Compare commits

...

1 Commits

Author SHA1 Message Date
molive d0b8b0d182 try passthrough 2026-10-08 19:50:40 +01:00
+44 -6
View File
@@ -1,3 +1,5 @@
const CREATE_SPV_PIPELINE: bool = false;
fn main() {
env_logger::init();
@@ -24,8 +26,13 @@ fn main() {
| wgpu::Features::STORAGE_RESOURCE_BINDING_ARRAY
| wgpu::Features::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING
| wgpu::Features::STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING
| wgpu::Features::PARTIALLY_BOUND_BINDING_ARRAY,
required_limits: wgpu::Limits::downlevel_defaults(),
| wgpu::Features::PARTIALLY_BOUND_BINDING_ARRAY
| wgpu::Features::PASSTHROUGH_SHADERS,
required_limits: wgpu::Limits {
max_binding_array_elements_per_shader_stage: 1000,
max_compute_invocations_per_workgroup: 512,
..wgpu::Limits::downlevel_defaults()
},
experimental_features: wgpu::ExperimentalFeatures::disabled(),
memory_hints: wgpu::MemoryHints::MemoryUsage,
trace: wgpu::Trace::Off,
@@ -36,8 +43,17 @@ fn main() {
let wgsl_module = device.create_shader_module(wgpu::include_wgsl!("shader.wgsl"));
log::logger().flush();
log::info!("Creating SPV passthrough module...");
let spv_ps_module =
unsafe { device.create_shader_module_passthrough(wgpu::include_spirv_raw!("shader.spv")) };
log::logger().flush();
log::info!("Creating SPV module...");
let spv_module = device.create_shader_module(wgpu::include_spirv!("shader.spv"));
let spv_module = if CREATE_SPV_PIPELINE {
Some(device.create_shader_module(wgpu::include_spirv!("shader.spv")))
} else {
None
};
log::logger().flush();
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
@@ -83,19 +99,41 @@ fn main() {
});
log::logger().flush();
log::info!("Creating SPV module...");
let spv_pipeline = device.create_compute_pipeline(&wgpu::ComputePipelineDescriptor {
log::info!("Creating SPV Passthrough pipeline...");
let spv_ps_pipeline = device.create_compute_pipeline(&wgpu::ComputePipelineDescriptor {
label: None,
layout: Some(&pipeline_layout),
module: &spv_module,
module: &spv_ps_module,
entry_point: Some("main"),
compilation_options: wgpu::PipelineCompilationOptions::default(),
cache: None,
});
log::logger().flush();
log::info!("Creating SPV pipeline...");
let spv_pipeline = if CREATE_SPV_PIPELINE {
Some(
device.create_compute_pipeline(&wgpu::ComputePipelineDescriptor {
label: None,
layout: Some(&pipeline_layout),
module: spv_module.as_ref().unwrap(),
entry_point: Some("main"),
compilation_options: wgpu::PipelineCompilationOptions::default(),
cache: None,
}),
)
} else {
None
};
log::logger().flush();
log::info!("WGSL module: {wgsl_module:?}");
log::info!("SPV module: {spv_module:?}");
log::info!("SPV ps module: {spv_ps_module:?}");
log::info!("WGSL pipeline: {wgsl_pipeline:?}");
log::info!("SPV pipeline: {spv_pipeline:?}");
log::info!("SPV ps pipeline: {spv_ps_pipeline:?}");
loop {}
}