Adding some more comments. Destructuring the context object in the pass modules. A little code cleanup in bloomPass. Changing the endPass sampler to be cheaper.

This commit is contained in:
Rezmason
2021-11-15 01:05:05 -08:00
parent 1b61e304a5
commit b26155d20e
10 changed files with 38 additions and 40 deletions

View File

@@ -1,14 +1,12 @@
import { loadShader, makeBindGroup, makePass } from "./utils.js";
// Eventually, WebGPU will allow the output of the final pass in the pipeline to be copied to the canvas texture.
// Until then, this render pass does the job.
const numVerticesPerQuad = 2 * 3;
export default (context) => {
const { config, device, canvasFormat, canvasContext } = context;
const linearSampler = device.createSampler({
magFilter: "linear",
minFilter: "linear",
});
export default ({ device, canvasFormat, canvasContext }) => {
const nearestSampler = device.createSampler();
const renderPassConfig = {
colorAttachments: [
@@ -46,7 +44,7 @@ export default (context) => {
})();
const build = (size, inputs) => {
renderBindGroup = makeBindGroup(device, renderPipeline, 0, [linearSampler, inputs.primary.createView()]);
renderBindGroup = makeBindGroup(device, renderPipeline, 0, [nearestSampler, inputs.primary.createView()]);
return null;
};