From a7c8b6867c495ff145f34772b105ede882340a68 Mon Sep 17 00:00:00 2001 From: Greggman Date: Mon, 12 Aug 2024 09:38:51 -0700 Subject: [PATCH] rename `cubeTexture` to `imageTexture` (#439) and add a few comments about buffer0 and buffer1 --- sample/imageBlur/main.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sample/imageBlur/main.ts b/sample/imageBlur/main.ts index d661dfc6..6cdebac1 100644 --- a/sample/imageBlur/main.ts +++ b/sample/imageBlur/main.ts @@ -65,7 +65,7 @@ const response = await fetch('../../assets/img/Di-3d.png'); const imageBitmap = await createImageBitmap(await response.blob()); const [srcWidth, srcHeight] = [imageBitmap.width, imageBitmap.height]; -const cubeTexture = device.createTexture({ +const imageTexture = device.createTexture({ size: [srcWidth, srcHeight, 1], format: 'rgba8unorm', usage: @@ -75,7 +75,7 @@ const cubeTexture = device.createTexture({ }); device.queue.copyExternalImageToTexture( { source: imageBitmap }, - { texture: cubeTexture }, + { texture: imageTexture }, [imageBitmap.width, imageBitmap.height] ); @@ -93,6 +93,7 @@ const textures = [0, 1].map(() => { }); }); +// A buffer with 0 in it. Binding this buffer is used to set `flip` to 0 const buffer0 = (() => { const buffer = device.createBuffer({ size: 4, @@ -104,6 +105,7 @@ const buffer0 = (() => { return buffer; })(); +// A buffer with 1 in it. Binding this buffer is used to set `flip` to 1 const buffer1 = (() => { const buffer = device.createBuffer({ size: 4, @@ -141,7 +143,7 @@ const computeBindGroup0 = device.createBindGroup({ entries: [ { binding: 1, - resource: cubeTexture.createView(), + resource: imageTexture.createView(), }, { binding: 2,