diff --git a/deno_webgpu/shader.rs b/deno_webgpu/shader.rs index fc30e66b719..f7cce242818 100644 --- a/deno_webgpu/shader.rs +++ b/deno_webgpu/shader.rs @@ -44,7 +44,6 @@ pub fn op_webgpu_create_shader_module( let descriptor = wgpu_core::pipeline::ShaderModuleDescriptor { label: Some(label), shader_bound_checks: wgpu_types::ShaderBoundChecks::default(), - debug: false, }; gfx_put!(device => instance.device_create_shader_module( diff --git a/examples/boids/src/main.rs b/examples/boids/src/main.rs index 46ac0bb0a8a..75d42273d35 100644 --- a/examples/boids/src/main.rs +++ b/examples/boids/src/main.rs @@ -46,12 +46,10 @@ impl wgpu_example::framework::Example for Example { let compute_shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("compute.wgsl"))), - debug: false, }); let draw_shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("draw.wgsl"))), - debug: false, }); // buffer for simulation parameters uniform diff --git a/examples/bunnymark/src/main.rs b/examples/bunnymark/src/main.rs index 84699e56ad5..baebe40fd76 100644 --- a/examples/bunnymark/src/main.rs +++ b/examples/bunnymark/src/main.rs @@ -48,7 +48,6 @@ impl wgpu_example::framework::Example for Example { source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!( "../../../wgpu-hal/examples/halmark/shader.wgsl" ))), - debug: false, }); let global_bind_group_layout = diff --git a/examples/conservative-raster/src/main.rs b/examples/conservative-raster/src/main.rs index 67c3a6d147f..9be7a061035 100644 --- a/examples/conservative-raster/src/main.rs +++ b/examples/conservative-raster/src/main.rs @@ -88,7 +88,6 @@ impl wgpu_example::framework::Example for Example { source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!( "triangle_and_lines.wgsl" ))), - debug: false, }); let pipeline_triangle_conservative = @@ -198,7 +197,6 @@ impl wgpu_example::framework::Example for Example { let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("upscale.wgsl"))), - debug: false, }); ( device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { diff --git a/examples/cube/src/main.rs b/examples/cube/src/main.rs index 3329440fd94..33a1260d463 100644 --- a/examples/cube/src/main.rs +++ b/examples/cube/src/main.rs @@ -241,7 +241,6 @@ impl wgpu_example::framework::Example for Example { let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), - debug: false, }); let vertex_buffers = [wgpu::VertexBufferLayout { diff --git a/examples/hello-compute/src/main.rs b/examples/hello-compute/src/main.rs index 732683a9a88..c7d09c6a4ae 100644 --- a/examples/hello-compute/src/main.rs +++ b/examples/hello-compute/src/main.rs @@ -68,7 +68,6 @@ async fn execute_gpu_inner( let cs_module = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), - debug: false, }); // Gets the size in bytes of the buffer. diff --git a/examples/hello-triangle/src/main.rs b/examples/hello-triangle/src/main.rs index 55c0e1de037..ebb8f6b736c 100644 --- a/examples/hello-triangle/src/main.rs +++ b/examples/hello-triangle/src/main.rs @@ -40,7 +40,6 @@ async fn run(event_loop: EventLoop<()>, window: Window) { let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), - debug: false, }); let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { diff --git a/examples/mipmap/src/main.rs b/examples/mipmap/src/main.rs index 24c0674701f..f6c1c66edd6 100644 --- a/examples/mipmap/src/main.rs +++ b/examples/mipmap/src/main.rs @@ -85,7 +85,6 @@ impl Example { let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("blit.wgsl"))), - debug: false, }); let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { @@ -283,7 +282,6 @@ impl wgpu_example::framework::Example for Example { let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("draw.wgsl"))), - debug: false, }); let draw_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { diff --git a/examples/msaa-line/src/main.rs b/examples/msaa-line/src/main.rs index 940ec66a54c..ac71d4c091d 100644 --- a/examples/msaa-line/src/main.rs +++ b/examples/msaa-line/src/main.rs @@ -154,7 +154,6 @@ impl wgpu_example::framework::Example for Example { let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), - debug: false, }); let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { diff --git a/examples/shadow/src/main.rs b/examples/shadow/src/main.rs index d57f402523c..2492dad9ba7 100644 --- a/examples/shadow/src/main.rs +++ b/examples/shadow/src/main.rs @@ -451,7 +451,6 @@ impl wgpu_example::framework::Example for Example { let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), - debug: false, }); let shadow_pass = { diff --git a/examples/skybox/src/main.rs b/examples/skybox/src/main.rs index 383fcbd2902..bfc0e909dc4 100644 --- a/examples/skybox/src/main.rs +++ b/examples/skybox/src/main.rs @@ -171,7 +171,6 @@ impl wgpu_example::framework::Example for Example { let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), - debug: false, }); let camera = Camera { diff --git a/examples/stencil-triangles/src/main.rs b/examples/stencil-triangles/src/main.rs index 5ff934b682d..3e51d2d0af2 100644 --- a/examples/stencil-triangles/src/main.rs +++ b/examples/stencil-triangles/src/main.rs @@ -56,7 +56,6 @@ impl wgpu_example::framework::Example for Example { let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), - debug: false, }); let vertex_buffers = [wgpu::VertexBufferLayout { diff --git a/examples/timestamp-queries/src/main.rs b/examples/timestamp-queries/src/main.rs index 22ab8a351aa..d3e2676ad82 100644 --- a/examples/timestamp-queries/src/main.rs +++ b/examples/timestamp-queries/src/main.rs @@ -237,7 +237,6 @@ fn submit_render_and_compute_pass_with_queries( let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl(std::borrow::Cow::Borrowed(include_str!("shader.wgsl"))), - debug: false, }); encoder.write_timestamp(&queries.set, queries.next_unused_query); diff --git a/examples/water/src/main.rs b/examples/water/src/main.rs index 593015b6460..7f31b2b5940 100644 --- a/examples/water/src/main.rs +++ b/examples/water/src/main.rs @@ -496,12 +496,10 @@ impl wgpu_example::framework::Example for Example { let terrain_module = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: Some("terrain"), source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("terrain.wgsl"))), - debug: false, }); let water_module = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: Some("water"), source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("water.wgsl"))), - debug: false, }); // Create the render pipelines. These describe how the data will flow through the GPU, and what diff --git a/player/tests/data/bind-group.ron b/player/tests/data/bind-group.ron index 30da133d52e..3cab418e994 100644 --- a/player/tests/data/bind-group.ron +++ b/player/tests/data/bind-group.ron @@ -11,8 +11,7 @@ id: Id(0, 1, Empty), desc: ( label: None, - flags: (bits: 3), - debug: false, + flags: (bits: 3) ), data: "empty.wgsl", ), diff --git a/player/tests/data/pipeline-statistics-query.ron b/player/tests/data/pipeline-statistics-query.ron index e549f3e578c..999c333a302 100644 --- a/player/tests/data/pipeline-statistics-query.ron +++ b/player/tests/data/pipeline-statistics-query.ron @@ -19,7 +19,6 @@ desc: ( label: None, flags: (bits: 3), - debug: false, ), data: "empty.wgsl", ), diff --git a/player/tests/data/quad.ron b/player/tests/data/quad.ron index 64d8bb36b7d..563ba24b846 100644 --- a/player/tests/data/quad.ron +++ b/player/tests/data/quad.ron @@ -14,7 +14,6 @@ desc: ( label: None, flags: (bits: 3), - debug: false, ), data: "quad.wgsl", ), diff --git a/player/tests/data/zero-init-buffer.ron b/player/tests/data/zero-init-buffer.ron index 048bd25b1b7..b93f65c736f 100644 --- a/player/tests/data/zero-init-buffer.ron +++ b/player/tests/data/zero-init-buffer.ron @@ -79,7 +79,6 @@ desc: ( label: None, flags: (bits: 3), - debug: false, ), data: "zero-init-buffer-for-binding.wgsl", ), diff --git a/player/tests/data/zero-init-texture-binding.ron b/player/tests/data/zero-init-texture-binding.ron index e4c2c8a4d81..1f8ce14435c 100644 --- a/player/tests/data/zero-init-texture-binding.ron +++ b/player/tests/data/zero-init-texture-binding.ron @@ -124,7 +124,7 @@ desc: ( label: None, flags: (bits: 3), - debug: false, + ), data: "zero-init-texture-binding.wgsl", ), diff --git a/tests/src/image.rs b/tests/src/image.rs index 7bc7dde96ae..0e3ea9ea8e5 100644 --- a/tests/src/image.rs +++ b/tests/src/image.rs @@ -360,7 +360,6 @@ fn copy_via_compute( let sm = device.create_shader_module(ShaderModuleDescriptor { label: Some("shader copy_texture_to_buffer.wgsl"), source: ShaderSource::Wgsl(Cow::Borrowed(&processed_source)), - debug: false, }); let pipeline_copy = device.create_compute_pipeline(&ComputePipelineDescriptor { diff --git a/tests/tests/occlusion_query/mod.rs b/tests/tests/occlusion_query/mod.rs index 2c3822e4ec6..7a7f3fa9a23 100644 --- a/tests/tests/occlusion_query/mod.rs +++ b/tests/tests/occlusion_query/mod.rs @@ -28,7 +28,6 @@ static OCCLUSION_QUERY: GpuTestConfiguration = GpuTestConfiguration::new() .create_shader_module(wgpu::ShaderModuleDescriptor { label: Some("Shader module"), source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), - debug: false, }); let pipeline = ctx .device diff --git a/tests/tests/shader/mod.rs b/tests/tests/shader/mod.rs index f5ba320b06d..a8ca9a27bb2 100644 --- a/tests/tests/shader/mod.rs +++ b/tests/tests/shader/mod.rs @@ -288,7 +288,6 @@ fn shader_input_output_test( let sm = ctx.device.create_shader_module(ShaderModuleDescriptor { label: Some(&format!("shader {test_name}")), source: ShaderSource::Wgsl(Cow::Borrowed(&processed)), - debug: false, }); let pipeline = ctx diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 5039433fc6d..73a7480d82b 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -34,7 +34,7 @@ use hal::{CommandEncoder as _, Device as _}; use parking_lot::{Mutex, MutexGuard}; use smallvec::SmallVec; use thiserror::Error; -use wgt::{TextureFormat, TextureSampleType, TextureViewDimension}; +use wgt::{InstanceFlags, TextureFormat, TextureSampleType, TextureViewDimension}; use std::{borrow::Cow, iter, num::NonZeroU32}; @@ -1317,7 +1317,7 @@ impl Device { .contains(wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES), ); - let debug_source = if desc.debug { + let debug_source = if self.instance_flags.contains(InstanceFlags::DEBUG) { Some(hal::DebugSource { file_name: Cow::Owned( desc.label @@ -1339,17 +1339,14 @@ impl Device { inner: Box::new(inner), }) })?; - let interface = validation::Interface::new(&module, &info, self.limits.clone()); + let interface = + validation::Interface::new(&module, &info, self.limits.clone(), self.features); let hal_shader = hal::ShaderInput::Naga(hal::NagaShader { module, info, debug_source, }); - let interface = - validation::Interface::new(&module, &info, self.limits.clone(), self.features); - let hal_shader = hal::ShaderInput::Naga(hal::NagaShader { module, info }); - let hal_desc = hal::ShaderModuleDescriptor { label: desc.label.to_hal(self.instance_flags), runtime_checks: desc.shader_bound_checks.runtime_checks(), diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index 8849a9db5c2..1b04d8d5fec 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -36,8 +36,7 @@ pub enum ShaderModuleSource<'a> { pub struct ShaderModuleDescriptor<'a> { pub label: Label<'a>, #[cfg_attr(feature = "serde", serde(default))] - pub shader_bound_checks: wgt::ShaderBoundChecks, - pub debug: bool, + pub shader_bound_checks: wgt::ShaderBoundChecks } #[derive(Debug)] diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index 12209e888e4..d88b48ef735 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -745,7 +745,7 @@ impl super::Device { if let Some(ref debug) = naga_shader.debug_source { temp_options.debug_info = Some(naga::back::spv::DebugInfo { source_code: &debug.source_code, - file_name: &debug.file_name, + file_name: debug.file_name.as_ref().as_ref(), }) } @@ -1529,7 +1529,7 @@ impl crate::Device for super::Device { .as_ref() .map(|d| naga::back::spv::DebugInfo { source_code: d.source_code.as_ref(), - file_name: d.file_name.as_ref(), + file_name: d.file_name.as_ref().as_ref(), }); if !desc.runtime_checks { naga_options.bounds_check_policies = naga::proc::BoundsCheckPolicies { diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index 3d509999538..bfdd1909abc 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -895,7 +895,6 @@ impl crate::Context for Context { let descriptor = wgc::pipeline::ShaderModuleDescriptor { label: desc.label.map(Borrowed), shader_bound_checks, - debug: desc.debug, }; let source = match desc.source { #[cfg(feature = "spirv")] @@ -959,7 +958,6 @@ impl crate::Context for Context { // Doesn't matter the value since spirv shaders aren't mutated to include // runtime checks shader_bound_checks: unsafe { wgt::ShaderBoundChecks::unchecked() }, - debug: false, }; let (id, error) = wgc::gfx_select!( device => global.device_create_shader_module_spirv(*device, &descriptor, Borrowed(&desc.source), ()) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 1b1a8a50770..4c499254d36 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -568,8 +568,6 @@ pub struct ShaderModuleDescriptor<'a> { pub label: Label<'a>, /// Source code for the shader. pub source: ShaderSource<'a>, - /// Generate debug symbols, only available in spv-out - pub debug: bool, } static_assertions::assert_impl_all!(ShaderModuleDescriptor: Send, Sync); diff --git a/wgpu/src/macros.rs b/wgpu/src/macros.rs index 2bc91386960..fc3560e01c3 100644 --- a/wgpu/src/macros.rs +++ b/wgpu/src/macros.rs @@ -81,20 +81,13 @@ macro_rules! include_spirv_raw { /// Macro to load a WGSL module statically. #[macro_export] macro_rules! include_wgsl { - ($name:tt) => {{ - // log::info!("including '{}'", $name); - $crate::ShaderModuleDescriptor { - label: Some($name), - source: $crate::ShaderSource::Wgsl(include_str!($name).into()), - debug: false, - } - }}; - ($name:tt, $debug:tt) => {{ - // log::info!("including '{}', '{}'", $name, $debug); - $crate::ShaderModuleDescriptor { - label: Some($name), - source: $crate::ShaderSource::Wgsl(include_str!($name).into()), - debug: $debug, + ($($token:tt)*) => { + { + //log::info!("including '{}'", $($token)*); + $crate::ShaderModuleDescriptor { + label: Some($($token)*), + source: $crate::ShaderSource::Wgsl(include_str!($($token)*).into()), + } } - }}; + }; }