mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-14 12:29:30 -07:00
A pipeline is now an object with a build method and a run method. The build method returns the last step's outputs object.
This commit is contained in:
@@ -116,6 +116,14 @@ const makePass = (loaded, build, run) => ({
|
||||
run: run ?? (() => {}),
|
||||
});
|
||||
|
||||
const makePipeline = (context, steps) => steps.filter((f) => f != null).map((f) => f(context));
|
||||
const makePipeline = async (context, steps) => {
|
||||
steps = steps.filter((f) => f != null).map((f) => f(context));
|
||||
await Promise.all(steps.map(step => step.loaded));
|
||||
return {
|
||||
steps,
|
||||
build: (canvasSize) => steps.reduce((outputs, step) => step.build(canvasSize, outputs), null),
|
||||
run: (encoder) => steps.forEach((step) => step.run(encoder))
|
||||
};
|
||||
}
|
||||
|
||||
export { getCanvasSize, makeRenderTarget, makeComputeTarget, make1DTexture, loadTexture, loadShader, makeUniformBuffer, makePass, makePipeline, makeBindGroup };
|
||||
|
||||
Reference in New Issue
Block a user