mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-14 12:29:30 -07:00
Fixing the names of shaders in the passes. The loadShader utility function now returns the code and the module, since I'm hoping to parse uniform buffer layouts from the code.
This commit is contained in:
@@ -35,10 +35,13 @@ const makePassFBO = (device, width, height, format = "rgba8unorm") =>
|
||||
// TODO: whittle these down
|
||||
});
|
||||
|
||||
const loadShaderModule = async (device, url) => {
|
||||
const loadShader = async (device, url) => {
|
||||
const response = await fetch(url);
|
||||
const code = await response.text();
|
||||
return device.createShaderModule({ code });
|
||||
return {
|
||||
code,
|
||||
module: device.createShaderModule({ code }),
|
||||
};
|
||||
};
|
||||
|
||||
const makeUniformBuffer = (device, structLayout, values = null) => {
|
||||
@@ -77,4 +80,4 @@ const makePass = (ready, setSize, getOutputs, execute) => ({
|
||||
const makePipeline = (context, steps) =>
|
||||
steps.filter((f) => f != null).reduce((pipeline, f, i) => [...pipeline, f(context, i == 0 ? null : pipeline[i - 1].getOutputs)], []);
|
||||
|
||||
export { getCanvasSize, makePassFBO, make1DTexture, loadTexture, loadShaderModule, makeUniformBuffer, makePass, makePipeline };
|
||||
export { getCanvasSize, makePassFBO, make1DTexture, loadTexture, loadShader, makeUniformBuffer, makePass, makePipeline };
|
||||
|
||||
Reference in New Issue
Block a user