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.
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.bindGroupLayoutis non-sparse, right now to create the pipeline I need to do the following:But then to draw with this pipeline I need to set an empty
GPUBindGroupat 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.bindGroupLayoutto be sparse, or during validation, treat the empty bindgrouplayout the same way as requiring no bind groups.