feat(shader)!: make ProgrammableStage::entry_point optional

This commit is contained in:
Erich Gubler 2024-01-29 21:41:55 -05:00
parent 4af1991569
commit e216566e48
52 changed files with 152 additions and 130 deletions

View File

@ -236,7 +236,7 @@ impl ComputepassState {
label: Some("Compute Pipeline"), label: Some("Compute Pipeline"),
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &sm, module: &sm,
entry_point: "cs_main", entry_point: Some("cs_main"),
compilation_options: wgpu::PipelineCompilationOptions::default(), compilation_options: wgpu::PipelineCompilationOptions::default(),
cache: None, cache: None,
}); });
@ -331,7 +331,7 @@ impl ComputepassState {
label: Some("Compute Pipeline bindless"), label: Some("Compute Pipeline bindless"),
layout: Some(&bindless_pipeline_layout), layout: Some(&bindless_pipeline_layout),
module: &bindless_sm, module: &bindless_sm,
entry_point: "cs_main", entry_point: Some("cs_main"),
compilation_options: wgpu::PipelineCompilationOptions::default(), compilation_options: wgpu::PipelineCompilationOptions::default(),
cache: None, cache: None,
}); });

View File

@ -182,7 +182,7 @@ impl RenderpassState {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &sm, module: &sm,
entry_point: "vs_main", entry_point: Some("vs_main"),
buffers: &vertex_buffer_layouts, buffers: &vertex_buffer_layouts,
compilation_options: wgpu::PipelineCompilationOptions::default(), compilation_options: wgpu::PipelineCompilationOptions::default(),
}, },
@ -199,7 +199,7 @@ impl RenderpassState {
multisample: wgpu::MultisampleState::default(), multisample: wgpu::MultisampleState::default(),
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &sm, module: &sm,
entry_point: "fs_main", entry_point: Some("fs_main"),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8UnormSrgb, format: wgpu::TextureFormat::Rgba8UnormSrgb,
blend: None, blend: None,
@ -280,7 +280,7 @@ impl RenderpassState {
layout: Some(&bindless_pipeline_layout), layout: Some(&bindless_pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &bindless_shader_module, module: &bindless_shader_module,
entry_point: "vs_main", entry_point: Some("vs_main"),
buffers: &vertex_buffer_layouts, buffers: &vertex_buffer_layouts,
compilation_options: wgpu::PipelineCompilationOptions::default(), compilation_options: wgpu::PipelineCompilationOptions::default(),
}, },
@ -297,7 +297,7 @@ impl RenderpassState {
multisample: wgpu::MultisampleState::default(), multisample: wgpu::MultisampleState::default(),
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &bindless_shader_module, module: &bindless_shader_module,
entry_point: "fs_main", entry_point: Some("fs_main"),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8UnormSrgb, format: wgpu::TextureFormat::Rgba8UnormSrgb,
blend: None, blend: None,

View File

@ -131,7 +131,7 @@ impl crate::framework::Example for Example {
layout: Some(&render_pipeline_layout), layout: Some(&render_pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &draw_shader, module: &draw_shader,
entry_point: "main_vs", entry_point: Some("main_vs"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[ buffers: &[
wgpu::VertexBufferLayout { wgpu::VertexBufferLayout {
@ -148,7 +148,7 @@ impl crate::framework::Example for Example {
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &draw_shader, module: &draw_shader,
entry_point: "main_fs", entry_point: Some("main_fs"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),
@ -165,7 +165,7 @@ impl crate::framework::Example for Example {
label: Some("Compute pipeline"), label: Some("Compute pipeline"),
layout: Some(&compute_pipeline_layout), layout: Some(&compute_pipeline_layout),
module: &compute_shader, module: &compute_shader,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -202,13 +202,13 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: config.view_formats[0], format: config.view_formats[0],

View File

@ -96,13 +96,13 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout_empty), layout: Some(&pipeline_layout_empty),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader_triangle_and_lines, module: &shader_triangle_and_lines,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader_triangle_and_lines, module: &shader_triangle_and_lines,
entry_point: "fs_main_red", entry_point: Some("fs_main_red"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(RENDER_TARGET_FORMAT.into())], targets: &[Some(RENDER_TARGET_FORMAT.into())],
}), }),
@ -122,13 +122,13 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout_empty), layout: Some(&pipeline_layout_empty),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader_triangle_and_lines, module: &shader_triangle_and_lines,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader_triangle_and_lines, module: &shader_triangle_and_lines,
entry_point: "fs_main_blue", entry_point: Some("fs_main_blue"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(RENDER_TARGET_FORMAT.into())], targets: &[Some(RENDER_TARGET_FORMAT.into())],
}), }),
@ -149,13 +149,13 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout_empty), layout: Some(&pipeline_layout_empty),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader_triangle_and_lines, module: &shader_triangle_and_lines,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader_triangle_and_lines, module: &shader_triangle_and_lines,
entry_point: "fs_main_white", entry_point: Some("fs_main_white"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),
@ -213,13 +213,13 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),

View File

@ -243,13 +243,13 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &vertex_buffers, buffers: &vertex_buffers,
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),
@ -272,13 +272,13 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &vertex_buffers, buffers: &vertex_buffers,
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_wire", entry_point: Some("fs_wire"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: config.view_formats[0], format: config.view_formats[0],

View File

@ -109,7 +109,7 @@ async fn execute_gpu_inner(
label: None, label: None,
layout: None, layout: None,
module: &cs_module, module: &cs_module,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -103,7 +103,7 @@ async fn execute(
label: None, label: None,
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &shaders_module, module: &shaders_module,
entry_point: "patient_main", entry_point: Some("patient_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });
@ -111,7 +111,7 @@ async fn execute(
label: None, label: None,
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &shaders_module, module: &shaders_module,
entry_point: "hasty_main", entry_point: Some("hasty_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -59,13 +59,13 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
buffers: &[], buffers: &[],
compilation_options: Default::default(), compilation_options: Default::default(),
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(swapchain_format.into())], targets: &[Some(swapchain_format.into())],
}), }),

View File

@ -110,7 +110,7 @@ async fn run() {
label: None, label: None,
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &shader, module: &shader,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -92,13 +92,13 @@ impl Example {
layout: None, layout: None,
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(TEXTURE_FORMAT.into())], targets: &[Some(TEXTURE_FORMAT.into())],
}), }),
@ -292,13 +292,13 @@ impl crate::framework::Example for Example {
layout: None, layout: None,
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),

View File

@ -53,7 +53,7 @@ impl Example {
layout: Some(pipeline_layout), layout: Some(pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: shader, module: shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[wgpu::VertexBufferLayout { buffers: &[wgpu::VertexBufferLayout {
array_stride: std::mem::size_of::<Vertex>() as wgpu::BufferAddress, array_stride: std::mem::size_of::<Vertex>() as wgpu::BufferAddress,
@ -63,7 +63,7 @@ impl Example {
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: shader, module: shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),

View File

@ -59,13 +59,13 @@ async fn run(_path: Option<String>) {
layout: None, layout: None,
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgpu::TextureFormat::Rgba8UnormSrgb.into())], targets: &[Some(wgpu::TextureFormat::Rgba8UnormSrgb.into())],
}), }),

View File

@ -245,7 +245,7 @@ impl WgpuContext {
label: None, label: None,
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &shader, module: &shader,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -499,7 +499,7 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_bake", entry_point: Some("vs_bake"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[vb_desc.clone()], buffers: &[vb_desc.clone()],
}, },
@ -633,17 +633,17 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[vb_desc], buffers: &[vb_desc],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: if supports_storage_resources { entry_point: Some(if supports_storage_resources {
"fs_main" "fs_main"
} else { } else {
"fs_main_without_storage" "fs_main_without_storage"
}, }),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),

View File

@ -198,13 +198,13 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_sky", entry_point: Some("vs_sky"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_sky", entry_point: Some("fs_sky"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),
@ -228,7 +228,7 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_entity", entry_point: Some("vs_entity"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[wgpu::VertexBufferLayout { buffers: &[wgpu::VertexBufferLayout {
array_stride: std::mem::size_of::<Vertex>() as wgpu::BufferAddress, array_stride: std::mem::size_of::<Vertex>() as wgpu::BufferAddress,
@ -238,7 +238,7 @@ impl crate::framework::Example for Example {
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_entity", entry_point: Some("fs_entity"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),

View File

@ -130,13 +130,13 @@ impl<const SRGB: bool> crate::framework::Example for Example<SRGB> {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &vertex_buffers, buffers: &vertex_buffers,
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: config.view_formats[0], format: config.view_formats[0],

View File

@ -73,13 +73,13 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &vertex_buffers, buffers: &vertex_buffers,
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: config.view_formats[0], format: config.view_formats[0],
@ -114,13 +114,13 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &vertex_buffers, buffers: &vertex_buffers,
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),

View File

@ -100,7 +100,7 @@ async fn run(_path: Option<String>) {
label: None, label: None,
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &shader, module: &shader,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -320,7 +320,7 @@ impl crate::framework::Example for Example {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &base_shader_module, module: &base_shader_module,
entry_point: "vert_main", entry_point: Some("vert_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[wgpu::VertexBufferLayout { buffers: &[wgpu::VertexBufferLayout {
array_stride: vertex_size as wgpu::BufferAddress, array_stride: vertex_size as wgpu::BufferAddress,
@ -330,7 +330,7 @@ impl crate::framework::Example for Example {
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: fragment_shader_module, module: fragment_shader_module,
entry_point: fragment_entry_point, entry_point: Some(fragment_entry_point),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),

View File

@ -298,7 +298,7 @@ fn compute_pass(
label: None, label: None,
layout: None, layout: None,
module, module,
entry_point: "main_cs", entry_point: Some("main_cs"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });
@ -354,13 +354,13 @@ fn render_pass(
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module, module,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module, module,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(format.into())], targets: &[Some(format.into())],
}), }),

View File

@ -179,13 +179,13 @@ impl WgpuContext {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(swapchain_format.into())], targets: &[Some(swapchain_format.into())],
}), }),

View File

@ -511,7 +511,7 @@ impl crate::framework::Example for Example {
// Vertex shader and input buffers // Vertex shader and input buffers
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &water_module, module: &water_module,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
// Layout of our vertices. This should match the structs // Layout of our vertices. This should match the structs
// which are uploaded to the GPU. This should also be // which are uploaded to the GPU. This should also be
@ -527,7 +527,7 @@ impl crate::framework::Example for Example {
// Fragment shader and output targets // Fragment shader and output targets
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &water_module, module: &water_module,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
// Describes how the colour will be interpolated // Describes how the colour will be interpolated
// and assigned to the output attachment. // and assigned to the output attachment.
@ -584,7 +584,7 @@ impl crate::framework::Example for Example {
layout: Some(&terrain_pipeline_layout), layout: Some(&terrain_pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &terrain_module, module: &terrain_module,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[wgpu::VertexBufferLayout { buffers: &[wgpu::VertexBufferLayout {
array_stride: terrain_vertex_size as wgpu::BufferAddress, array_stride: terrain_vertex_size as wgpu::BufferAddress,
@ -594,7 +594,7 @@ impl crate::framework::Example for Example {
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &terrain_module, module: &terrain_module,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(config.view_formats[0].into())], targets: &[Some(config.view_formats[0].into())],
}), }),

View File

@ -368,7 +368,7 @@ fn copy_via_compute(
label: Some("pipeline read"), label: Some("pipeline read"),
layout: Some(&pll), layout: Some(&pll),
module: &sm, module: &sm,
entry_point: "copy_texture_to_buffer", entry_point: Some("copy_texture_to_buffer"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -95,7 +95,7 @@ static BGRA8_UNORM_STORAGE: GpuTestConfiguration = GpuTestConfiguration::new()
let pipeline = device.create_compute_pipeline(&wgpu::ComputePipelineDescriptor { let pipeline = device.create_compute_pipeline(&wgpu::ComputePipelineDescriptor {
label: None, label: None,
layout: Some(&pl), layout: Some(&pl),
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
module: &module, module: &module,
cache: None, cache: None,

View File

@ -89,7 +89,7 @@ async fn bgl_dedupe(ctx: TestingContext) {
label: None, label: None,
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &module, module: &module,
entry_point: "no_resources", entry_point: Some("no_resources"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}; };
@ -219,7 +219,7 @@ fn bgl_dedupe_with_dropped_user_handle(ctx: TestingContext) {
label: None, label: None,
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &module, module: &module,
entry_point: "no_resources", entry_point: Some("no_resources"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });
@ -266,7 +266,7 @@ fn bgl_dedupe_derived(ctx: TestingContext) {
label: None, label: None,
layout: None, layout: None,
module: &module, module: &module,
entry_point: "resources", entry_point: Some("resources"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });
@ -338,7 +338,7 @@ fn separate_programs_have_incompatible_derived_bgls(ctx: TestingContext) {
label: None, label: None,
layout: None, layout: None,
module: &module, module: &module,
entry_point: "resources", entry_point: Some("resources"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}; };
@ -405,7 +405,7 @@ fn derived_bgls_incompatible_with_regular_bgls(ctx: TestingContext) {
label: None, label: None,
layout: None, layout: None,
module: &module, module: &module,
entry_point: "resources", entry_point: Some("resources"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -225,7 +225,7 @@ static MINIMUM_BUFFER_BINDING_SIZE_LAYOUT: GpuTestConfiguration = GpuTestConfigu
label: None, label: None,
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &shader_module, module: &shader_module,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });
@ -297,7 +297,7 @@ static MINIMUM_BUFFER_BINDING_SIZE_DISPATCH: GpuTestConfiguration = GpuTestConfi
label: None, label: None,
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &shader_module, module: &shader_module,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -317,7 +317,7 @@ fn resource_setup(ctx: &TestingContext) -> ResourceSetup {
label: Some("pipeline"), label: Some("pipeline"),
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &sm, module: &sm,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -533,7 +533,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
layout: None, layout: None,
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader_module, module: &shader_module,
entry_point: "", entry_point: Some(""),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
@ -557,7 +557,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
label: None, label: None,
layout: None, layout: None,
module: &shader_module, module: &shader_module,
entry_point: "", entry_point: None,
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });
@ -574,7 +574,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
label: None, label: None,
layout: None, layout: None,
module: &shader_module, module: &shader_module,
entry_point: "", entry_point: None,
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });
@ -823,7 +823,7 @@ static DIFFERENT_BGL_ORDER_BW_SHADER_AND_API: GpuTestConfiguration = GpuTestConf
.create_render_pipeline(&wgpu::RenderPipelineDescriptor { .create_render_pipeline(&wgpu::RenderPipelineDescriptor {
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &trivial_shaders_with_some_reversed_bindings, module: &trivial_shaders_with_some_reversed_bindings,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgt::ColorTargetState { targets: &[Some(wgt::ColorTargetState {
format: wgt::TextureFormat::Bgra8Unorm, format: wgt::TextureFormat::Bgra8Unorm,
@ -837,7 +837,7 @@ static DIFFERENT_BGL_ORDER_BW_SHADER_AND_API: GpuTestConfiguration = GpuTestConf
label: None, label: None,
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &trivial_shaders_with_some_reversed_bindings, module: &trivial_shaders_with_some_reversed_bindings,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },

View File

@ -96,7 +96,7 @@ async fn draw_test_with_reports(
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
buffers: &[], buffers: &[],
module: &shader, module: &shader,
entry_point: "vs_main_builtin", entry_point: Some("vs_main_builtin"),
compilation_options: Default::default(), compilation_options: Default::default(),
}, },
primitive: wgpu::PrimitiveState::default(), primitive: wgpu::PrimitiveState::default(),
@ -104,7 +104,7 @@ async fn draw_test_with_reports(
multisample: wgpu::MultisampleState::default(), multisample: wgpu::MultisampleState::default(),
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8Unorm, format: wgpu::TextureFormat::Rgba8Unorm,

View File

@ -23,13 +23,13 @@ static NV12_TEXTURE_CREATION_SAMPLING: GpuTestConfiguration = GpuTestConfigurati
layout: None, layout: None,
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(target_format.into())], targets: &[Some(target_format.into())],
}), }),

View File

@ -36,7 +36,7 @@ static OCCLUSION_QUERY: GpuTestConfiguration = GpuTestConfiguration::new()
layout: None, layout: None,
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },

View File

@ -68,7 +68,7 @@ static PARTIALLY_BOUNDED_ARRAY: GpuTestConfiguration = GpuTestConfiguration::new
label: None, label: None,
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &cs_module, module: &cs_module,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -29,7 +29,7 @@ static PIPELINE_DEFAULT_LAYOUT_BAD_MODULE: GpuTestConfiguration = GpuTestConfigu
label: Some("mandelbrot compute pipeline"), label: Some("mandelbrot compute pipeline"),
layout: None, layout: None,
module: &module, module: &module,
entry_point: "doesn't exist", entry_point: Some("doesn't exist"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });
@ -66,7 +66,7 @@ static NO_TARGETLESS_RENDER: GpuTestConfiguration = GpuTestConfiguration::new()
module: &ctx module: &ctx
.device .device
.create_shader_module(TRIVIAL_VERTEX_SHADER_DESC), .create_shader_module(TRIVIAL_VERTEX_SHADER_DESC),
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },

View File

@ -113,7 +113,7 @@ async fn pipeline_cache_test(ctx: TestingContext) {
label: Some("pipeline"), label: Some("pipeline"),
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &sm, module: &sm,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: Some(&first_cache), cache: Some(&first_cache),
}); });
@ -136,7 +136,7 @@ async fn pipeline_cache_test(ctx: TestingContext) {
label: Some("pipeline"), label: Some("pipeline"),
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &sm, module: &sm,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: Some(&second_cache), cache: Some(&second_cache),
}); });

View File

@ -102,7 +102,7 @@ async fn partial_update_test(ctx: TestingContext) {
label: Some("pipeline"), label: Some("pipeline"),
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &sm, module: &sm,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -101,13 +101,13 @@ async fn multi_stage_data_binding_test(ctx: TestingContext) {
layout: Some(&pll), layout: Some(&pll),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &vs_sm, module: &vs_sm,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &fs_sm, module: &fs_sm,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8Unorm, format: wgpu::TextureFormat::Rgba8Unorm,

View File

@ -51,7 +51,7 @@ static PASS_RESET_VERTEX_BUFFER: GpuTestConfiguration =
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: VertexState { vertex: VertexState {
module: &module, module: &module,
entry_point: "double_buffer_vert", entry_point: Some("double_buffer_vert"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[ buffers: &[
VertexBufferLayout { VertexBufferLayout {
@ -71,7 +71,7 @@ static PASS_RESET_VERTEX_BUFFER: GpuTestConfiguration =
multisample: MultisampleState::default(), multisample: MultisampleState::default(),
fragment: Some(FragmentState { fragment: Some(FragmentState {
module: &module, module: &module,
entry_point: "double_buffer_frag", entry_point: Some("double_buffer_frag"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(ColorTargetState { targets: &[Some(ColorTargetState {
format: TextureFormat::Rgba8Unorm, format: TextureFormat::Rgba8Unorm,
@ -90,7 +90,7 @@ static PASS_RESET_VERTEX_BUFFER: GpuTestConfiguration =
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: VertexState { vertex: VertexState {
module: &module, module: &module,
entry_point: "single_buffer_vert", entry_point: Some("single_buffer_vert"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[VertexBufferLayout { buffers: &[VertexBufferLayout {
array_stride: 16, array_stride: 16,
@ -103,7 +103,7 @@ static PASS_RESET_VERTEX_BUFFER: GpuTestConfiguration =
multisample: MultisampleState::default(), multisample: MultisampleState::default(),
fragment: Some(FragmentState { fragment: Some(FragmentState {
module: &module, module: &module,
entry_point: "single_buffer_frag", entry_point: Some("single_buffer_frag"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(ColorTargetState { targets: &[Some(ColorTargetState {
format: TextureFormat::Rgba8Unorm, format: TextureFormat::Rgba8Unorm,

View File

@ -30,7 +30,7 @@ static ALLOW_INPUT_NOT_CONSUMED: GpuTestConfiguration =
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: VertexState { vertex: VertexState {
module: &module, module: &module,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
@ -39,7 +39,7 @@ static ALLOW_INPUT_NOT_CONSUMED: GpuTestConfiguration =
multisample: MultisampleState::default(), multisample: MultisampleState::default(),
fragment: Some(FragmentState { fragment: Some(FragmentState {
module: &module, module: &module,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(ColorTargetState { targets: &[Some(ColorTargetState {
format: TextureFormat::Rgba8Unorm, format: TextureFormat::Rgba8Unorm,

View File

@ -498,7 +498,7 @@ fn resource_setup(ctx: &TestingContext) -> ResourceSetup {
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &sm, module: &sm,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[wgpu::VertexBufferLayout { buffers: &[wgpu::VertexBufferLayout {
array_stride: 4, array_stride: 4,
@ -508,7 +508,7 @@ fn resource_setup(ctx: &TestingContext) -> ResourceSetup {
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &sm, module: &sm,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(target_format.into())], targets: &[Some(target_format.into())],
}), }),

View File

@ -43,7 +43,7 @@ async fn scissor_test_impl(
layout: None, layout: None,
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
@ -52,7 +52,7 @@ async fn scissor_test_impl(
multisample: wgpu::MultisampleState::default(), multisample: wgpu::MultisampleState::default(),
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8Unorm, format: wgpu::TextureFormat::Rgba8Unorm,

View File

@ -314,7 +314,7 @@ async fn shader_input_output_test(
label: Some(&format!("pipeline {test_name}")), label: Some(&format!("pipeline {test_name}")),
layout: Some(&pll), layout: Some(&pll),
module: &sm, module: &sm,
entry_point: "cs_main", entry_point: Some("cs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -79,7 +79,7 @@ static ZERO_INIT_WORKGROUP_MEMORY: GpuTestConfiguration = GpuTestConfiguration::
label: Some("pipeline read"), label: Some("pipeline read"),
layout: Some(&pll), layout: Some(&pll),
module: &sm, module: &sm,
entry_point: "read", entry_point: Some("read"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });
@ -90,7 +90,7 @@ static ZERO_INIT_WORKGROUP_MEMORY: GpuTestConfiguration = GpuTestConfiguration::
label: Some("pipeline write"), label: Some("pipeline write"),
layout: None, layout: None,
module: &sm, module: &sm,
entry_point: "write", entry_point: Some("write"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -121,7 +121,7 @@ async fn pulling_common(
layout: None, layout: None,
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: &shader, module: &shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[wgpu::VertexBufferLayout { buffers: &[wgpu::VertexBufferLayout {
array_stride: 8, array_stride: 8,
@ -138,7 +138,7 @@ async fn pulling_common(
multisample: wgpu::MultisampleState::default(), multisample: wgpu::MultisampleState::default(),
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8Unorm, format: wgpu::TextureFormat::Rgba8Unorm,

View File

@ -92,13 +92,14 @@ async fn reinterpret(
layout: None, layout: None,
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
module: shader, module: shader,
entry_point: "vs_main", entry_point: Some("vs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
buffers: &[], buffers: &[],
}, },
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: shader, module: shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(src_format.into())], targets: &[Some(src_format.into())],
}), }),

View File

@ -73,7 +73,7 @@ static SUBGROUP_OPERATIONS: GpuTestConfiguration = GpuTestConfiguration::new()
label: None, label: None,
layout: Some(&pipeline_layout), layout: Some(&pipeline_layout),
module: &cs_module, module: &cs_module,
entry_point: "main", entry_point: Some("main"),
compilation_options: Default::default(), compilation_options: Default::default(),
cache: None, cache: None,
}); });

View File

@ -250,7 +250,7 @@ async fn vertex_formats_common(ctx: TestingContext, tests: &[Test<'_>]) {
attributes: test.attributes, attributes: test.attributes,
}], }],
module: &shader, module: &shader,
entry_point: test.entry_point, entry_point: Some(test.entry_point),
compilation_options: Default::default(), compilation_options: Default::default(),
}, },
primitive: wgpu::PrimitiveState::default(), primitive: wgpu::PrimitiveState::default(),
@ -258,7 +258,7 @@ async fn vertex_formats_common(ctx: TestingContext, tests: &[Test<'_>]) {
multisample: wgpu::MultisampleState::default(), multisample: wgpu::MultisampleState::default(),
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fragment_main", entry_point: Some("fragment_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8Unorm, format: wgpu::TextureFormat::Rgba8Unorm,

View File

@ -259,7 +259,7 @@ async fn vertex_index_common(ctx: TestingContext) {
vertex: wgpu::VertexState { vertex: wgpu::VertexState {
buffers: &[], buffers: &[],
module: &shader, module: &shader,
entry_point: "vs_main_builtin", entry_point: Some("vs_main_builtin"),
compilation_options: Default::default(), compilation_options: Default::default(),
}, },
primitive: wgpu::PrimitiveState::default(), primitive: wgpu::PrimitiveState::default(),
@ -267,7 +267,7 @@ async fn vertex_index_common(ctx: TestingContext) {
multisample: wgpu::MultisampleState::default(), multisample: wgpu::MultisampleState::default(),
fragment: Some(wgpu::FragmentState { fragment: Some(wgpu::FragmentState {
module: &shader, module: &shader,
entry_point: "fs_main", entry_point: Some("fs_main"),
compilation_options: Default::default(), compilation_options: Default::default(),
targets: &[Some(wgpu::ColorTargetState { targets: &[Some(wgpu::ColorTargetState {
format: wgpu::TextureFormat::Rgba8Unorm, format: wgpu::TextureFormat::Rgba8Unorm,
@ -280,7 +280,7 @@ async fn vertex_index_common(ctx: TestingContext) {
}; };
let builtin_pipeline = ctx.device.create_render_pipeline(&pipeline_desc); let builtin_pipeline = ctx.device.create_render_pipeline(&pipeline_desc);
pipeline_desc.vertex.entry_point = "vs_main_buffers"; pipeline_desc.vertex.entry_point = Some("vs_main_buffers");
pipeline_desc.vertex.buffers = &[ pipeline_desc.vertex.buffers = &[
wgpu::VertexBufferLayout { wgpu::VertexBufferLayout {
array_stride: 4, array_stride: 4,

View File

@ -62,9 +62,14 @@ pub struct ComputePipelineDescriptor<'a> {
pub layout: Option<&'a PipelineLayout>, pub layout: Option<&'a PipelineLayout>,
/// The compiled shader module for this stage. /// The compiled shader module for this stage.
pub module: &'a ShaderModule, pub module: &'a ShaderModule,
/// The name of the entry point in the compiled shader. There must be a function with this name /// The name of the entry point in the compiled shader to use.
/// and no return value in the shader. ///
pub entry_point: &'a str, /// If [`Some`], there must be a compute shader entry point with this name in `module`.
/// Otherwise, expect exactly one compute shader entry point in `module`, which will be
/// selected.
// NOTE: keep phrasing in sync. with `FragmentState::entry_point`
// NOTE: keep phrasing in sync. with `VertexState::entry_point`
pub entry_point: Option<&'a str>,
/// Advanced options for when this pipeline is compiled /// Advanced options for when this pipeline is compiled
/// ///
/// This implements `Default`, and for most users can be set to `Default::default()` /// This implements `Default`, and for most users can be set to `Default::default()`

View File

@ -73,9 +73,14 @@ static_assertions::assert_impl_all!(VertexBufferLayout<'_>: Send, Sync);
pub struct VertexState<'a> { pub struct VertexState<'a> {
/// The compiled shader module for this stage. /// The compiled shader module for this stage.
pub module: &'a ShaderModule, pub module: &'a ShaderModule,
/// The name of the entry point in the compiled shader. There must be a function with this name /// The name of the entry point in the compiled shader to use.
/// in the shader. ///
pub entry_point: &'a str, /// If [`Some`], there must be a vertex-stage shader entry point with this name in `module`.
/// Otherwise, expect exactly one vertex-stage entry point in `module`, which will be
/// selected.
// NOTE: keep phrasing in sync. with `ComputePipelineDescriptor::entry_point`
// NOTE: keep phrasing in sync. with `FragmentState::entry_point`
pub entry_point: Option<&'a str>,
/// Advanced options for when this pipeline is compiled /// Advanced options for when this pipeline is compiled
/// ///
/// This implements `Default`, and for most users can be set to `Default::default()` /// This implements `Default`, and for most users can be set to `Default::default()`
@ -96,9 +101,14 @@ static_assertions::assert_impl_all!(VertexState<'_>: Send, Sync);
pub struct FragmentState<'a> { pub struct FragmentState<'a> {
/// The compiled shader module for this stage. /// The compiled shader module for this stage.
pub module: &'a ShaderModule, pub module: &'a ShaderModule,
/// The name of the entry point in the compiled shader. There must be a function with this name /// The name of the entry point in the compiled shader to use.
/// in the shader. ///
pub entry_point: &'a str, /// If [`Some`], there must be a `@fragment` shader entry point with this name in `module`.
/// Otherwise, expect exactly one fragment-stage entry point in `module`, which will be
/// selected.
// NOTE: keep phrasing in sync. with `ComputePipelineDescriptor::entry_point`
// NOTE: keep phrasing in sync. with `VertexState::entry_point`
pub entry_point: Option<&'a str>,
/// Advanced options for when this pipeline is compiled /// Advanced options for when this pipeline is compiled
/// ///
/// This implements `Default`, and for most users can be set to `Default::default()` /// This implements `Default`, and for most users can be set to `Default::default()`

View File

@ -1880,7 +1880,9 @@ impl crate::context::Context for ContextWebGpu {
&mapped_vertex_state, &mapped_vertex_state,
desc.vertex.compilation_options.constants, desc.vertex.compilation_options.constants,
); );
mapped_vertex_state.entry_point(desc.vertex.entry_point); if let Some(ep) = desc.vertex.entry_point {
mapped_vertex_state.entry_point(ep);
}
let buffers = desc let buffers = desc
.vertex .vertex
@ -1957,7 +1959,9 @@ impl crate::context::Context for ContextWebGpu {
let mut mapped_fragment_desc = let mut mapped_fragment_desc =
webgpu_sys::GpuFragmentState::new(&module.0.module, &targets); webgpu_sys::GpuFragmentState::new(&module.0.module, &targets);
insert_constants_map(&mapped_vertex_state, frag.compilation_options.constants); insert_constants_map(&mapped_vertex_state, frag.compilation_options.constants);
mapped_fragment_desc.entry_point(frag.entry_point); if let Some(ep) = frag.entry_point {
mapped_fragment_desc.entry_point(ep);
}
mapped_desc.fragment(&mapped_fragment_desc); mapped_desc.fragment(&mapped_fragment_desc);
} }
@ -1984,7 +1988,9 @@ impl crate::context::Context for ContextWebGpu {
let mut mapped_compute_stage = let mut mapped_compute_stage =
webgpu_sys::GpuProgrammableStage::new(&shader_module.0.module); webgpu_sys::GpuProgrammableStage::new(&shader_module.0.module);
insert_constants_map(&mapped_compute_stage, desc.compilation_options.constants); insert_constants_map(&mapped_compute_stage, desc.compilation_options.constants);
mapped_compute_stage.entry_point(desc.entry_point); if let Some(ep) = desc.entry_point {
mapped_compute_stage.entry_point(ep);
}
let auto_layout = wasm_bindgen::JsValue::from(webgpu_sys::GpuAutoLayoutMode::Auto); let auto_layout = wasm_bindgen::JsValue::from(webgpu_sys::GpuAutoLayoutMode::Auto);
let mut mapped_desc = webgpu_sys::GpuComputePipelineDescriptor::new( let mut mapped_desc = webgpu_sys::GpuComputePipelineDescriptor::new(
&match desc.layout { &match desc.layout {

View File

@ -1174,7 +1174,7 @@ impl crate::Context for ContextWgpuCore {
vertex: pipe::VertexState { vertex: pipe::VertexState {
stage: pipe::ProgrammableStageDescriptor { stage: pipe::ProgrammableStageDescriptor {
module: desc.vertex.module.id.into(), module: desc.vertex.module.id.into(),
entry_point: Some(Borrowed(desc.vertex.entry_point)), entry_point: desc.vertex.entry_point.map(Borrowed),
constants: Borrowed(desc.vertex.compilation_options.constants), constants: Borrowed(desc.vertex.compilation_options.constants),
zero_initialize_workgroup_memory: desc zero_initialize_workgroup_memory: desc
.vertex .vertex
@ -1189,7 +1189,7 @@ impl crate::Context for ContextWgpuCore {
fragment: desc.fragment.as_ref().map(|frag| pipe::FragmentState { fragment: desc.fragment.as_ref().map(|frag| pipe::FragmentState {
stage: pipe::ProgrammableStageDescriptor { stage: pipe::ProgrammableStageDescriptor {
module: frag.module.id.into(), module: frag.module.id.into(),
entry_point: Some(Borrowed(frag.entry_point)), entry_point: frag.entry_point.map(Borrowed),
constants: Borrowed(frag.compilation_options.constants), constants: Borrowed(frag.compilation_options.constants),
zero_initialize_workgroup_memory: frag zero_initialize_workgroup_memory: frag
.compilation_options .compilation_options
@ -1234,7 +1234,7 @@ impl crate::Context for ContextWgpuCore {
layout: desc.layout.map(|l| l.id.into()), layout: desc.layout.map(|l| l.id.into()),
stage: pipe::ProgrammableStageDescriptor { stage: pipe::ProgrammableStageDescriptor {
module: desc.module.id.into(), module: desc.module.id.into(),
entry_point: Some(Borrowed(desc.entry_point)), entry_point: desc.entry_point.map(Borrowed),
constants: Borrowed(desc.compilation_options.constants), constants: Borrowed(desc.compilation_options.constants),
zero_initialize_workgroup_memory: desc zero_initialize_workgroup_memory: desc
.compilation_options .compilation_options