Unifying the interfaces of regl and webgpu makePass and makePipeline.

This commit is contained in:
Rezmason
2021-11-09 09:17:01 -08:00
parent 6586badf42
commit 87c2093281
14 changed files with 55 additions and 68 deletions

View File

@@ -4,7 +4,7 @@ import { loadImage, loadText, makePassFBO, makePass } from "./utils.js";
const defaultBGURL = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Flammarion_Colored.jpg/917px-Flammarion_Colored.jpg";
export default (regl, config, inputs) => {
export default ({ regl, config }, inputs) => {
const output = makePassFBO(regl, config.useHalfFloat);
const bgURL = "bgURL" in config ? config.bgURL : defaultBGURL;
const background = loadImage(regl, bgURL);
@@ -22,8 +22,8 @@ export default (regl, config, inputs) => {
{
primary: output,
},
() => render({ frag: imagePassFrag.text() }),
null,
[background.loaded, imagePassFrag.loaded]
Promise.all([background.loaded, imagePassFrag.loaded]),
(w, h) => output.resize(w, h),
() => render({ frag: imagePassFrag.text() })
);
};