mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-17 05:49:30 -07:00
Created a pass-through post processing compute pass. The other post-processing passes will be changed over to this kind of thing.
makePassFBO has now been split into makeRenderTarget and makeComputeTarget.
This commit is contained in:
@@ -27,13 +27,20 @@ const loadTexture = async (device, url) => {
|
||||
return texture;
|
||||
};
|
||||
|
||||
const makePassFBO = (device, width, height, format = "bgra8unorm") =>
|
||||
const makeRenderTarget = (device, width, height, format) =>
|
||||
device.createTexture({
|
||||
size: [width, height, 1],
|
||||
format,
|
||||
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT,
|
||||
});
|
||||
|
||||
const makeComputeTarget = (device, width, height) =>
|
||||
device.createTexture({
|
||||
size: [width, height, 1],
|
||||
format: "rgba8unorm",
|
||||
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC | GPUTextureUsage.COPY_DST | GPUTextureUsage.STORAGE_BINDING,
|
||||
});
|
||||
|
||||
const loadShader = async (device, url) => {
|
||||
const response = await fetch(url);
|
||||
const code = await response.text();
|
||||
@@ -90,4 +97,4 @@ const makePass = (getOutputs, ready, setSize, 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, loadShader, makeUniformBuffer, makePass, makePipeline, makeBindGroup };
|
||||
export { getCanvasSize, makeRenderTarget, makeComputeTarget, make1DTexture, loadTexture, loadShader, makeUniformBuffer, makePass, makePipeline, makeBindGroup };
|
||||
|
||||
Reference in New Issue
Block a user