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

undefined cannot be accepted as a member of GPUPipelineLayoutDescriptor.bindGroupLayouts #162

Open
Jiawei-Shao opened this issue Dec 6, 2024 · 1 comment

Comments

@Jiawei-Shao
Copy link
Contributor

Now in dist/index.d.ts GPUPipelineLayoutDescriptor is defined as below, which means the member of bindGroupLayouts in GPUPipelineLayoutDescriptor can not be undefined:

interface GPUPipelineLayoutDescriptor
  extends GPUObjectDescriptorBase {
  /**
   * A list of optional {@link GPUBindGroupLayout}s the pipeline will use. Each element corresponds
   * to a @group attribute in the {@link GPUShaderModule}, with the `N`th element corresponding
   * with `@group(N)`.
   */
  bindGroupLayouts: Iterable<GPUBindGroupLayout | null>;
}

While according to WebGPU SPEC, undefined is valid as a member of bindGroupLayouts in GPUPipelineLayoutDescriptor:

dictionary GPUPipelineLayoutDescriptor
         : GPUObjectDescriptorBase {
    required sequence<GPUBindGroupLayout?> bindGroupLayouts;
};

Does it mean the definition of GPUPipelineLayoutDescriptor in dist/index.d.ts doesn't follow the WebGPU SPEC?

@kainino0x
Copy link
Collaborator

You're correct, WebIDL T? should be translated as T | null | undefined.

It would be best to fix this in the generator, but if that's difficult we can fix it in dist/index.d.ts and add a note in https://github.com/gpuweb/types/blob/main/README.md#intentional-differences-between-generator-output-and-final-result

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