Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@types/showdown": "^2.0.6",
"@types/stats.js": "^0.17.3",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@webgpu/types": "^0.1.53",
"@webgpu/types": "^0.1.61",
"chokidar": "^4.0.3",
"eslint": "^8.57.1",
"eslint-config-prettier": "^8.10.0",
Expand Down
24 changes: 6 additions & 18 deletions sample/a-buffer/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,21 +448,15 @@ const configure = () => {
entries: [
{
binding: 0,
resource: {
buffer: uniformBuffer,
},
resource: uniformBuffer,
},
{
binding: 1,
resource: {
buffer: headsBuffer,
},
resource: headsBuffer,
},
{
binding: 2,
resource: {
buffer: linkedListBuffer,
},
resource: linkedListBuffer,
},
{
binding: 3,
Expand All @@ -484,21 +478,15 @@ const configure = () => {
entries: [
{
binding: 0,
resource: {
buffer: uniformBuffer,
},
resource: uniformBuffer,
},
{
binding: 1,
resource: {
buffer: headsBuffer,
},
resource: headsBuffer,
},
{
binding: 2,
resource: {
buffer: linkedListBuffer,
},
resource: linkedListBuffer,
},
{
binding: 3,
Expand Down
8 changes: 4 additions & 4 deletions sample/blending/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const srcBindGroupUnpremultipliedAlpha = device.createBindGroup({
entries: [
{ binding: 0, resource: sampler },
{ binding: 1, resource: srcTextureUnpremultipliedAlpha.createView() },
{ binding: 2, resource: { buffer: srcUniform.buffer } },
{ binding: 2, resource: srcUniform.buffer },
],
});

Expand All @@ -203,7 +203,7 @@ const dstBindGroupUnpremultipliedAlpha = device.createBindGroup({
entries: [
{ binding: 0, resource: sampler },
{ binding: 1, resource: dstTextureUnpremultipliedAlpha.createView() },
{ binding: 2, resource: { buffer: dstUniform.buffer } },
{ binding: 2, resource: dstUniform.buffer },
],
});

Expand All @@ -212,7 +212,7 @@ const srcBindGroupPremultipliedAlpha = device.createBindGroup({
entries: [
{ binding: 0, resource: sampler },
{ binding: 1, resource: srcTexturePremultipliedAlpha.createView() },
{ binding: 2, resource: { buffer: srcUniform.buffer } },
{ binding: 2, resource: srcUniform.buffer },
],
});

Expand All @@ -221,7 +221,7 @@ const dstBindGroupPremultipliedAlpha = device.createBindGroup({
entries: [
{ binding: 0, resource: sampler },
{ binding: 1, resource: dstTexturePremultipliedAlpha.createView() },
{ binding: 2, resource: { buffer: dstUniform.buffer } },
{ binding: 2, resource: dstUniform.buffer },
],
});

Expand Down
17 changes: 3 additions & 14 deletions sample/cameras/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,9 @@ const sampler = device.createSampler({
const uniformBindGroup = device.createBindGroup({
layout: pipeline.getBindGroupLayout(0),
entries: [
{
binding: 0,
resource: {
buffer: uniformBuffer,
},
},
{
binding: 1,
resource: sampler,
},
{
binding: 2,
resource: cubeTexture.createView(),
},
{ binding: 0, resource: uniformBuffer },
{ binding: 1, resource: sampler },
{ binding: 2, resource: cubeTexture.createView() },
],
});

Expand Down
25 changes: 3 additions & 22 deletions sample/computeBoids/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,28 +228,9 @@ for (let i = 0; i < 2; ++i) {
particleBindGroups[i] = device.createBindGroup({
layout: computePipeline.getBindGroupLayout(0),
entries: [
{
binding: 0,
resource: {
buffer: simParamBuffer,
},
},
{
binding: 1,
resource: {
buffer: particleBuffers[i],
offset: 0,
size: initialParticleData.byteLength,
},
},
{
binding: 2,
resource: {
buffer: particleBuffers[(i + 1) % 2],
offset: 0,
size: initialParticleData.byteLength,
},
},
{ binding: 0, resource: simParamBuffer },
{ binding: 1, resource: particleBuffers[i] },
{ binding: 2, resource: particleBuffers[(i + 1) % 2] },
],
});
}
Expand Down
12 changes: 2 additions & 10 deletions sample/cornell/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,12 @@ export default class Common {
{
// common_uniforms
binding: 0,
resource: {
buffer: this.uniformBuffer,
offset: 0,
size: this.uniformBuffer.size,
},
resource: this.uniformBuffer,
},
{
// quads
binding: 1,
resource: {
buffer: quads,
offset: 0,
size: quads.size,
},
resource: quads,
},
],
});
Expand Down
10 changes: 2 additions & 8 deletions sample/cornell/radiosity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ export default class Radiosity {
{
// accumulation buffer
binding: 0,
resource: {
buffer: this.accumulationBuffer,
size: this.accumulationBuffer.size,
},
resource: this.accumulationBuffer,
},
{
// lightmap
Expand All @@ -124,10 +121,7 @@ export default class Radiosity {
{
// radiosity_uniforms
binding: 2,
resource: {
buffer: this.uniformBuffer,
size: this.uniformBuffer.size,
},
resource: this.uniformBuffer,
},
],
});
Expand Down
6 changes: 1 addition & 5 deletions sample/cubemap/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,7 @@ const uniformBindGroup = device.createBindGroup({
entries: [
{
binding: 0,
resource: {
buffer: uniformBuffer,
offset: 0,
size: uniformBufferSize,
},
resource: uniformBuffer,
},
{
binding: 1,
Expand Down
53 changes: 11 additions & 42 deletions sample/deferredRendering/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,36 +334,17 @@ const cameraUniformBuffer = device.createBuffer({
const sceneUniformBindGroup = device.createBindGroup({
layout: writeGBuffersPipeline.getBindGroupLayout(0),
entries: [
{
binding: 0,
resource: {
buffer: modelUniformBuffer,
},
},
{
binding: 1,
resource: {
buffer: cameraUniformBuffer,
},
},
{ binding: 0, resource: modelUniformBuffer },
{ binding: 1, resource: cameraUniformBuffer },
],
});

const gBufferTexturesBindGroup = device.createBindGroup({
layout: gBufferTexturesBindGroupLayout,
entries: [
{
binding: 0,
resource: gBufferTextureViews[0],
},
{
binding: 1,
resource: gBufferTextureViews[1],
},
{
binding: 2,
resource: gBufferTextureViews[2],
},
{ binding: 0, resource: gBufferTextureViews[0] },
{ binding: 1, resource: gBufferTextureViews[1] },
{ binding: 2, resource: gBufferTextureViews[2] },
],
});

Expand Down Expand Up @@ -431,21 +412,15 @@ const lightsBufferBindGroup = device.createBindGroup({
entries: [
{
binding: 0,
resource: {
buffer: lightsBuffer,
},
resource: lightsBuffer,
},
{
binding: 1,
resource: {
buffer: configUniformBuffer,
},
resource: configUniformBuffer,
},
{
binding: 2,
resource: {
buffer: cameraUniformBuffer,
},
resource: cameraUniformBuffer,
},
],
});
Expand All @@ -454,21 +429,15 @@ const lightsBufferComputeBindGroup = device.createBindGroup({
entries: [
{
binding: 0,
resource: {
buffer: lightsBuffer,
},
resource: lightsBuffer,
},
{
binding: 1,
resource: {
buffer: configUniformBuffer,
},
resource: configUniformBuffer,
},
{
binding: 2,
resource: {
buffer: lightExtentBuffer,
},
resource: lightExtentBuffer,
},
],
});
Expand Down
17 changes: 3 additions & 14 deletions sample/fractalCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,9 @@ const sampler = device.createSampler({
const uniformBindGroup = device.createBindGroup({
layout: pipeline.getBindGroupLayout(0),
entries: [
{
binding: 0,
resource: {
buffer: uniformBuffer,
},
},
{
binding: 1,
resource: sampler,
},
{
binding: 2,
resource: cubeTexture.createView(),
},
{ binding: 0, resource: uniformBuffer },
{ binding: 1, resource: sampler },
{ binding: 2, resource: cubeTexture.createView() },
],
});

Expand Down
18 changes: 7 additions & 11 deletions sample/gameOfLife/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,18 @@ function resetGameData() {
const bindGroup0 = device.createBindGroup({
layout: bindGroupLayoutCompute,
entries: [
{ binding: 0, resource: { buffer: sizeBuffer } },
{ binding: 1, resource: { buffer: buffer0 } },
{ binding: 2, resource: { buffer: buffer1 } },
{ binding: 0, resource: sizeBuffer },
{ binding: 1, resource: buffer0 },
{ binding: 2, resource: buffer1 },
],
});

const bindGroup1 = device.createBindGroup({
layout: bindGroupLayoutCompute,
entries: [
{ binding: 0, resource: { buffer: sizeBuffer } },
{ binding: 1, resource: { buffer: buffer1 } },
{ binding: 2, resource: { buffer: buffer0 } },
{ binding: 0, resource: sizeBuffer },
{ binding: 1, resource: buffer1 },
{ binding: 2, resource: buffer0 },
],
});

Expand Down Expand Up @@ -210,11 +210,7 @@ function resetGameData() {
entries: [
{
binding: 0,
resource: {
buffer: sizeBuffer,
offset: 0,
size: 2 * Uint32Array.BYTES_PER_ELEMENT,
},
resource: sizeBuffer,
},
],
});
Expand Down
2 changes: 1 addition & 1 deletion sample/generateMipmap/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ const objects = textures.map(({ texture, viewDimension }) => {
const bindGroup = device.createBindGroup({
layout: pipeline.getBindGroupLayout(0),
entries: [
{ binding: 0, resource: { buffer: uniformBuffer } },
{ binding: 0, resource: uniformBuffer },
{ binding: 1, resource: sampler },
{
binding: 2,
Expand Down
Loading