Skip to content

Commit

Permalink
rename cubeTexture to imageTexture
Browse files Browse the repository at this point in the history
and add a few comments about buffer0 and buffer1
  • Loading branch information
greggman committed Aug 7, 2024
1 parent 9be56e7 commit 97336bb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sample/imageBlur/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -75,7 +75,7 @@ const cubeTexture = device.createTexture({
});
device.queue.copyExternalImageToTexture(
{ source: imageBitmap },
{ texture: cubeTexture },
{ texture: imageTexture },
[imageBitmap.width, imageBitmap.height]
);

Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -141,7 +143,7 @@ const computeBindGroup0 = device.createBindGroup({
entries: [
{
binding: 1,
resource: cubeTexture.createView(),
resource: imageTexture.createView(),
},
{
binding: 2,
Expand Down

0 comments on commit 97336bb

Please sign in to comment.