mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-17 05:49:30 -07:00
Moved the makePyramid and resizePyramid methods from the regl solution's util module to bloomPass.
Adding the canvas context's preferred format to the shared pass context (named "canvasFormat"). Added a placeholder bloomPass, which the existing passes now receive input from.
This commit is contained in:
@@ -2,7 +2,7 @@ import { structs } from "/lib/gpu-buffer.js";
|
||||
import { getCanvasSize, makeUniformBuffer, makePipeline } from "./utils.js";
|
||||
|
||||
import makeRain from "./rainPass.js";
|
||||
// import makeBloomPass from "./bloomPass.js";
|
||||
import makeBloomPass from "./bloomPass.js";
|
||||
import makePalettePass from "./palettePass.js";
|
||||
import makeStripePass from "./stripePass.js";
|
||||
import makeImagePass from "./imagePass.js";
|
||||
@@ -25,13 +25,13 @@ export default async (canvas, config) => {
|
||||
const adapter = await navigator.gpu.requestAdapter();
|
||||
const device = await adapter.requestDevice();
|
||||
const canvasContext = canvas.getContext("webgpu");
|
||||
const presentationFormat = canvasContext.getPreferredFormat(adapter);
|
||||
const canvasFormat = canvasContext.getPreferredFormat(adapter);
|
||||
|
||||
// console.table(device.limits);
|
||||
|
||||
const canvasConfig = {
|
||||
device,
|
||||
format: presentationFormat,
|
||||
format: canvasFormat,
|
||||
size: [NaN, NaN],
|
||||
usage:
|
||||
// GPUTextureUsage.STORAGE_BINDING |
|
||||
@@ -47,10 +47,11 @@ export default async (canvas, config) => {
|
||||
device,
|
||||
canvasContext,
|
||||
timeBuffer,
|
||||
canvasFormat,
|
||||
};
|
||||
|
||||
const effectName = config.effect in effects ? config.effect : "plain";
|
||||
const pipeline = makePipeline(context, [makeRain, /*makeBloomPass,*/ effects[effectName]]);
|
||||
const pipeline = makePipeline(context, [makeRain, makeBloomPass, effects[effectName]]);
|
||||
|
||||
await Promise.all(pipeline.map((step) => step.ready));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user