Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPURenderBundleEncoder.setIndexBuffer size parameter defaults to 0 #24288

Open
0f-0b opened this issue Jun 20, 2024 · 1 comment
Open

GPURenderBundleEncoder.setIndexBuffer size parameter defaults to 0 #24288

0f-0b opened this issue Jun 20, 2024 · 1 comment

Comments

@0f-0b
Copy link
Contributor

0f-0b commented Jun 20, 2024

const adapter = await navigator.gpu.requestAdapter();
if (!adapter) {
  throw "no adapter";
}
const device = await adapter.requestDevice();
const buffer = device.createBuffer({ size: 2, usage: GPUBufferUsage.INDEX });
const encoder = device.createRenderBundleEncoder({ colorFormats: [] });
encoder.setIndexBuffer(buffer, "uint16");
$ deno run --unstable-webgpu a.ts
error: Uncaught (in promise) TypeError: size must be larger than 0
encoder.setIndexBuffer(buffer, "uint16");
        ^
    at GPURenderBundleEncoder.setIndexBuffer (ext:deno_webgpu/01_webgpu.js:4943:5)
    at …/a.ts:8:9
$ deno --version
deno 1.44.4+6ab1433 (canary, aarch64-apple-darwin)
v8 12.6.228.9
typescript 5.4.5
@Hajime-san
Copy link
Contributor

I found some diff between deno's implementation and current spec around this issue.

GPURenderCommandsMixin

GPURenderCommandsMixin defines rendering commands common to GPURenderPassEncoder and GPURenderBundleEncoder.

GPURenderCommandsMixin assumes the presence of GPUObjectBase, GPUCommandsMixin, and GPUBindingCommandsMixin members on the same object. It must only be included by interfaces which also include those mixins.

GPUDebugCommandsMixin

GPUDebugCommandsMixin is also common to GPURenderPassEncoder and GPUComputePassEncoder

GPUBindingCommandsMixin

The setBindGroup() method has two overloads, and the bindGroup argument to be nullable.

upstream wgpu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants