Driving more uniforms.read calls from the actual shaders.

This commit is contained in:
Rezmason
2021-11-08 03:01:46 -08:00
parent 61a3a6d783
commit 415ffa77ee
8 changed files with 31 additions and 27 deletions

View File

@@ -211,9 +211,13 @@ const makeGenerator = (layout, structLayouts) => {
const api = Object.freeze({
read: (wgsl) => {
if (typeof wgsl !== "string") {
throw new Error("Input is not a string.");
}
const structLayouts = parseStructLayoutsFromShader(wgsl);
return Object.fromEntries(Object.entries(structLayouts).map(([name, layout]) => [name, makeGenerator(layout, structLayouts)]));
},
byteSizeOf: (simpleType) => simpleTypes[simpleType][1] * BYTES_PER_ELEMENT,
});
export default api;