mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-17 05:49:30 -07:00
Moved the WebGPU code off of "std140" and onto gpu-uniforms.
This commit is contained in:
@@ -44,14 +44,14 @@ const loadShader = async (device, url) => {
|
||||
};
|
||||
};
|
||||
|
||||
const makeUniformBuffer = (device, structLayout, values = null) => {
|
||||
const makeUniformBuffer = (device, uniforms, data = null) => {
|
||||
const buffer = device.createBuffer({
|
||||
size: structLayout.size,
|
||||
size: uniforms.minSize,
|
||||
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
|
||||
mappedAtCreation: values != null,
|
||||
mappedAtCreation: data != null,
|
||||
});
|
||||
if (values != null) {
|
||||
structLayout.build(values, buffer.getMappedRange());
|
||||
if (data != null) {
|
||||
uniforms.write(data, buffer.getMappedRange());
|
||||
buffer.unmap();
|
||||
}
|
||||
return buffer;
|
||||
|
||||
Reference in New Issue
Block a user