Sitelet https://github.com/gpuweb/gpuweb/issues/2043
Skip to content

Dealing with holes in the pipeline layout. #2043

Description

@Kangz

Let's say that for some reason I would like to create a pipeline that only uses bind groups 0 and 2. This could happen for example if I choose BG 1 to be for the fragment data and BG 2 for vertex data, and want to render without an FS. (but many other reasons).

Because GPUPipelineLayoutDescriptor.bindGroupLayout is non-sparse, right now to create the pipeline I need to do the following:

const bgl0 = device.createBindGroupLayout(...);
const bgl2 = device.createBindGroupLayout(...);

const layout = device.createPipelineLayout({
    bindGroupLayouts: [
        bgl0,
        device.createBindGroupLayout({entries: []}), // This is the important part
        bgl2,
    ],
});
const pipeline = ...;

But then to draw with this pipeline I need to set an empty GPUBindGroup at group index 1 to satisfy "validate encoder bindgroups". This is an annoying to just "unset" a bindgroup.

I'd like to suggest that we allow either GPUPipelineLayoutDescriptor.bindGroupLayout to be sparse, or during validation, treat the empty bindgrouplayout the same way as requiring no bind groups.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiWebGPU APIapi resolvedResolved - waiting for a change to the API specification

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions