mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 15:00:57 +01:00
Add support for gaps in bind group layouts & update relevant validation (#9034)
* [wgpu-core] add support for optional BG & BGL entries * [wgpu] allow gaps in bind group layouts And allow unbinding in the web backend. * adapt tests * add changelog entry * [wgpu] remove generic from `PipelineLayoutDescriptor`
This commit is contained in:
1 parent
aad2a00f4d
commit
e114d2f0a7
90 files changed
+567
-397
No files matched your search
+1
-1
@@ -346,7 +346,7 @@ fn copy_via_compute(
|
||||
|
||||
let pll = device.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ static BGRA8_UNORM_STORAGE: GpuTestConfiguration = GpuTestConfiguration::new()
|
||||
|
||||
let pl = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ async fn bgl_dedupe(ctx: TestingContext) {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl_1b],
|
||||
bind_group_layouts: &[Some(&bgl_1b)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
@@ -144,7 +144,7 @@ fn bgl_dedupe_with_dropped_user_handle(ctx: TestingContext) {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl_1],
|
||||
bind_group_layouts: &[Some(&bgl_1)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ fn multiple_bindings_with_differing_sizes(ctx: TestingContext) {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("pipeline_layout"),
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
bind_group_layouts: &[Some(&bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ async fn binding_array_buffers(
|
||||
.device
|
||||
.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
label: Some("Pipeline Layout"),
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
bind_group_layouts: &[Some(&bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ async fn binding_array_sampled_textures(ctx: TestingContext, partially_bound: bo
|
||||
.device
|
||||
.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
label: Some("Pipeline Layout"),
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
bind_group_layouts: &[Some(&bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ async fn binding_array_samplers(ctx: TestingContext, partially_bound: bool) {
|
||||
.device
|
||||
.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
label: Some("Pipeline Layout"),
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
bind_group_layouts: &[Some(&bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ async fn binding_array_storage_textures(ctx: TestingContext, partially_bound: bo
|
||||
.device
|
||||
.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
label: Some("Pipeline Layout"),
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
bind_group_layouts: &[Some(&bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ static MINIMUM_BUFFER_BINDING_SIZE_LAYOUT: GpuTestConfiguration = GpuTestConfigu
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
bind_group_layouts: &[Some(&bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
@@ -306,7 +306,7 @@ static MINIMUM_BUFFER_BINDING_SIZE_DISPATCH: GpuTestConfiguration = GpuTestConfi
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
bind_group_layouts: &[Some(&bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -322,7 +322,7 @@ fn resource_setup(ctx: &TestingContext) -> ResourceSetup {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("pipeline_layout"),
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -439,7 +439,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
|
||||
ctx.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&invalid_bind_group_layout],
|
||||
bind_group_layouts: &[Some(&invalid_bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ impl TestResources {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 4,
|
||||
});
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ async fn test_format(
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
bind_group_layouts: &[Some(&bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
let shader = ctx.device.create_shader_module(desc);
|
||||
|
||||
@@ -98,7 +98,7 @@ async fn partial_update_test(ctx: TestingContext) {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("pipeline_layout"),
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 32,
|
||||
});
|
||||
|
||||
@@ -267,9 +267,9 @@ async fn render_pass_test(ctx: &TestingContext, use_render_bundle: bool) {
|
||||
let render_pipeline_layout = ctx
|
||||
.device
|
||||
.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
label: None,
|
||||
bind_group_layouts: &[Some(&bind_group_layout)],
|
||||
immediate_size: 8 * size_of::<u32>() as u32,
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
let pipeline = ctx
|
||||
|
||||
@@ -91,7 +91,7 @@ async fn draw_test_with_reports(
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ impl TestResources {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
@@ -341,7 +341,7 @@ async fn d3d12_restrict_dynamic_buffers(ctx: TestingContext) {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -92,9 +92,9 @@ static COMPUTE_PIPELINE_DEFAULT_LAYOUT_BAD_BGL_INDEX: GpuTestConfiguration =
|
||||
cache: None,
|
||||
});
|
||||
|
||||
pipeline.get_bind_group_layout(0);
|
||||
pipeline.get_bind_group_layout(u32::MAX);
|
||||
},
|
||||
Some("Invalid group index 0"),
|
||||
Some("Bind group layout index 4294967295 is greater than the device's configured `max_bind_groups` limit"),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -178,9 +178,9 @@ static RENDER_PIPELINE_DEFAULT_LAYOUT_BAD_BGL_INDEX: GpuTestConfiguration =
|
||||
cache: None,
|
||||
});
|
||||
|
||||
pipeline.get_bind_group_layout(0);
|
||||
pipeline.get_bind_group_layout(u32::MAX);
|
||||
},
|
||||
Some("Invalid group index 0"),
|
||||
Some("Bind group layout index 4294967295 is greater than the device's configured `max_bind_groups` limit"),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ async fn pipeline_cache_test(ctx: TestingContext) {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("pipeline_layout"),
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ async fn multi_stage_data_binding_test(ctx: TestingContext) {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("pll"),
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 16,
|
||||
});
|
||||
|
||||
|
||||
@@ -463,7 +463,7 @@ fn resource_setup(ctx: &TestingContext) -> ResourceSetup {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("pipeline_layout"),
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -326,9 +326,9 @@ fn sampler_bind_group(ctx: TestingContext, group_type: GroupType) {
|
||||
}],
|
||||
});
|
||||
|
||||
let mut bgl_references: Vec<_> = bind_group_layouts.iter().collect();
|
||||
let mut bgl_references: Vec<_> = bind_group_layouts.iter().map(Some).collect();
|
||||
|
||||
bgl_references.push(&output_bgl);
|
||||
bgl_references.push(Some(&output_bgl));
|
||||
|
||||
let pipeline_layout = ctx
|
||||
.device
|
||||
|
||||
@@ -279,7 +279,7 @@ async fn shader_input_output_test(
|
||||
.device
|
||||
.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: match storage_type {
|
||||
InputStorageType::Immediate => MAX_BUFFER_SIZE as u32,
|
||||
_ => 0,
|
||||
|
||||
@@ -69,7 +69,7 @@ static ZERO_INIT_WORKGROUP_MEMORY: GpuTestConfiguration = GpuTestConfiguration::
|
||||
.device
|
||||
.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ static SUBGROUP_OPERATIONS: GpuTestConfiguration = GpuTestConfiguration::new()
|
||||
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("main"),
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
bind_group_layouts: &[Some(&bind_group_layout)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ async fn vertex_formats_common(ctx: TestingContext, tests: &[Test<'_>]) {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ async fn vertex_index_common(ctx: TestingContext) {
|
||||
.device
|
||||
.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bgl],
|
||||
bind_group_layouts: &[Some(&bgl)],
|
||||
immediate_size: 0,
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user