From e97f609ca7bc7f287db2ca8ac3cece90d95ff75d Mon Sep 17 00:00:00 2001 From: firestar99 Date: Mon, 28 Jul 2025 13:04:46 +0200 Subject: [PATCH 1/5] wgsl: add `spirv-unknown-naga-wgsl` target, transpiling with naga 27 --- Cargo.lock | 2 + crates/rustc_codegen_spirv/Cargo.toml | 2 + crates/rustc_codegen_spirv/src/lib.rs | 1 + crates/rustc_codegen_spirv/src/link.rs | 5 ++ .../rustc_codegen_spirv/src/naga_transpile.rs | 79 +++++++++++++++++++ crates/rustc_codegen_spirv/src/target.rs | 77 ++++++++++++++++++ 6 files changed, 166 insertions(+) create mode 100644 crates/rustc_codegen_spirv/src/naga_transpile.rs diff --git a/Cargo.lock b/Cargo.lock index e0b1ed7a7bc..dcf75636f70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2731,6 +2731,7 @@ dependencies = [ "lazy_static", "libc", "log", + "naga", "object 0.37.3", "pretty_assertions", "regex", @@ -2743,6 +2744,7 @@ dependencies = [ "spirt", "spirv-std-types", "spirv-tools", + "strum", "termcolor", "thorin-dwp", "tracing", diff --git a/crates/rustc_codegen_spirv/Cargo.toml b/crates/rustc_codegen_spirv/Cargo.toml index ed72fbd2800..1d8ae642f0b 100644 --- a/crates/rustc_codegen_spirv/Cargo.toml +++ b/crates/rustc_codegen_spirv/Cargo.toml @@ -61,6 +61,8 @@ itertools = "0.14.0" tracing.workspace = true tracing-subscriber.workspace = true tracing-tree = "0.4.0" +naga = { version = "27.0.3", features = ["spv-in", "wgsl-out"] } +strum = { version = "0.27.2", features = ["derive"] } [dev-dependencies] pretty_assertions = "1.0" diff --git a/crates/rustc_codegen_spirv/src/lib.rs b/crates/rustc_codegen_spirv/src/lib.rs index 66c85ea7d1a..bbd88021324 100644 --- a/crates/rustc_codegen_spirv/src/lib.rs +++ b/crates/rustc_codegen_spirv/src/lib.rs @@ -127,6 +127,7 @@ mod custom_decorations; mod custom_insts; mod link; mod linker; +mod naga_transpile; mod spirv_type; mod spirv_type_constraints; mod symbols; diff --git a/crates/rustc_codegen_spirv/src/link.rs b/crates/rustc_codegen_spirv/src/link.rs index 300fb1d19d1..eea98a5bc77 100644 --- a/crates/rustc_codegen_spirv/src/link.rs +++ b/crates/rustc_codegen_spirv/src/link.rs @@ -2,6 +2,7 @@ use crate::maybe_pqp_cg_ssa as rustc_codegen_ssa; use crate::codegen_cx::{CodegenArgs, SpirvMetadata}; +use crate::naga_transpile::should_transpile; use crate::target::{SpirvTarget, SpirvTargetVariant}; use crate::{SpirvCodegenBackend, SpirvModuleBuffer, linker}; use ar::{Archive, GnuBuilder, Header}; @@ -323,6 +324,10 @@ fn post_link_single_module( drop(save_modules_timer); } + + if let Some(transpile) = should_transpile(sess) { + transpile(sess, cg_args, &spv_binary, out_filename).ok(); + } } fn do_spirv_opt( diff --git a/crates/rustc_codegen_spirv/src/naga_transpile.rs b/crates/rustc_codegen_spirv/src/naga_transpile.rs new file mode 100644 index 00000000000..8960524624b --- /dev/null +++ b/crates/rustc_codegen_spirv/src/naga_transpile.rs @@ -0,0 +1,79 @@ +use crate::codegen_cx::CodegenArgs; +use crate::target::{NagaTarget, SpirvTarget}; +use rustc_session::Session; +use rustc_span::ErrorGuaranteed; +use std::path::Path; + +pub type NagaTranspile = fn( + sess: &Session, + cg_args: &CodegenArgs, + spv_binary: &[u32], + out_filename: &Path, +) -> Result<(), ErrorGuaranteed>; + +pub fn should_transpile(sess: &Session) -> Option { + let target = SpirvTarget::parse_target(sess.opts.target_triple.tuple()) + .expect("parsing should fail earlier"); + match target { + SpirvTarget::Naga(NagaTarget::NAGA_WGSL) => Some(transpile::wgsl_transpile), + _ => None, + } +} + +mod transpile { + use crate::codegen_cx::CodegenArgs; + use naga::error::ShaderError; + use naga::valid::Capabilities; + use rustc_session::Session; + use rustc_span::ErrorGuaranteed; + use std::path::Path; + + pub fn wgsl_transpile( + sess: &Session, + _cg_args: &CodegenArgs, + spv_binary: &[u32], + out_filename: &Path, + ) -> Result<(), ErrorGuaranteed> { + // these should be params via spirv-builder + let opts = naga::front::spv::Options::default(); + let capabilities = Capabilities::default(); + let writer_flags = naga::back::wgsl::WriterFlags::empty(); + + let module = naga::front::spv::parse_u8_slice(bytemuck::cast_slice(spv_binary), &opts) + .map_err(|err| { + sess.dcx().err(format!( + "Naga failed to parse spv: \n{}", + ShaderError { + source: String::new(), + label: None, + inner: Box::new(err), + } + )) + })?; + let mut validator = + naga::valid::Validator::new(naga::valid::ValidationFlags::default(), capabilities); + let info = validator.validate(&module).map_err(|err| { + sess.dcx().err(format!( + "Naga validation failed: \n{}", + ShaderError { + source: String::new(), + label: None, + inner: Box::new(err), + } + )) + })?; + + let wgsl_dst = out_filename.with_extension("wgsl"); + let wgsl = naga::back::wgsl::write_string(&module, &info, writer_flags).map_err(|err| { + sess.dcx() + .err(format!("Naga failed to write wgsl : \n{err}")) + })?; + + std::fs::write(&wgsl_dst, wgsl).map_err(|err| { + sess.dcx() + .err(format!("failed to write wgsl to file: {err}")) + })?; + + Ok(()) + } +} diff --git a/crates/rustc_codegen_spirv/src/target.rs b/crates/rustc_codegen_spirv/src/target.rs index 69def2137d0..332757a80ef 100644 --- a/crates/rustc_codegen_spirv/src/target.rs +++ b/crates/rustc_codegen_spirv/src/target.rs @@ -5,11 +5,16 @@ use std::cmp::Ordering; use std::fmt::{Debug, Display, Formatter}; use std::ops::{Deref, DerefMut}; use std::str::FromStr; +use strum::{Display, EnumString, IntoStaticStr}; #[derive(Clone, Eq, PartialEq)] pub enum TargetError { + /// If during parsing a target variant returns `UnknownTarget`, further variants will attempt to parse the string. + /// Returning another error means that you have recognized the target but something else is invalid, and we should + /// abort the parsing with your error. UnknownTarget(String), InvalidTargetVersion(SpirvTarget), + InvalidNagaVariant(String), } impl Display for TargetError { @@ -21,6 +26,9 @@ impl Display for TargetError { TargetError::InvalidTargetVersion(target) => { write!(f, "Invalid version in target `{}`", target.env()) } + TargetError::InvalidNagaVariant(target) => { + write!(f, "Unknown naga out variant `{target}`") + } } } } @@ -439,6 +447,63 @@ impl Display for OpenGLTarget { } } +/// A naga target +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +pub struct NagaTarget { + pub out: NagaOut, +} + +#[derive(Copy, Clone, Debug, Eq, PartialEq, IntoStaticStr, Display, EnumString)] +#[allow(clippy::upper_case_acronyms)] +pub enum NagaOut { + #[strum(to_string = "wgsl")] + WGSL, +} + +impl NagaTarget { + pub const NAGA_WGSL: Self = NagaTarget::new(NagaOut::WGSL); + pub const ALL_NAGA_TARGETS: &'static [Self] = &[Self::NAGA_WGSL]; + /// emit spirv like naga targets were this target + pub const EMIT_SPIRV_LIKE: SpirvTarget = SpirvTarget::VULKAN_1_3; + + pub const fn new(out: NagaOut) -> Self { + Self { out } + } +} + +impl SpirvTargetVariant for NagaTarget { + fn validate(&self) -> Result<(), TargetError> { + Ok(()) + } + + fn to_spirv_tools(&self) -> spirv_tools::TargetEnv { + Self::EMIT_SPIRV_LIKE.to_spirv_tools() + } + + fn spirv_version(&self) -> SpirvVersion { + Self::EMIT_SPIRV_LIKE.spirv_version() + } +} + +impl FromStr for NagaTarget { + type Err = TargetError; + + fn from_str(s: &str) -> Result { + let s = s + .strip_prefix("naga-") + .ok_or_else(|| TargetError::UnknownTarget(s.to_owned()))?; + Ok(Self::new(FromStr::from_str(s).map_err(|_e| { + TargetError::InvalidNagaVariant(s.to_owned()) + })?)) + } +} + +impl Display for NagaTarget { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "naga-{}", self.out) + } +} + /// A rust-gpu target #[derive(Copy, Clone, Debug, Eq, PartialEq)] #[non_exhaustive] @@ -446,6 +511,7 @@ pub enum SpirvTarget { Universal(UniversalTarget), Vulkan(VulkanTarget), OpenGL(OpenGLTarget), + Naga(NagaTarget), } impl SpirvTarget { @@ -467,12 +533,15 @@ impl SpirvTarget { pub const OPENGL_4_2: Self = Self::OpenGL(OpenGLTarget::OPENGL_4_2); pub const OPENGL_4_3: Self = Self::OpenGL(OpenGLTarget::OPENGL_4_3); pub const OPENGL_4_5: Self = Self::OpenGL(OpenGLTarget::OPENGL_4_5); + pub const NAGA_WGSL: Self = Self::Naga(NagaTarget::NAGA_WGSL); + #[allow(clippy::match_same_arms)] pub const fn memory_model(&self) -> MemoryModel { match self { SpirvTarget::Universal(_) => MemoryModel::Simple, SpirvTarget::Vulkan(_) => MemoryModel::Vulkan, SpirvTarget::OpenGL(_) => MemoryModel::GLSL450, + SpirvTarget::Naga(_) => MemoryModel::Vulkan, } } } @@ -483,6 +552,7 @@ impl SpirvTargetVariant for SpirvTarget { SpirvTarget::Universal(t) => t.validate(), SpirvTarget::Vulkan(t) => t.validate(), SpirvTarget::OpenGL(t) => t.validate(), + SpirvTarget::Naga(t) => t.validate(), } } @@ -491,6 +561,7 @@ impl SpirvTargetVariant for SpirvTarget { SpirvTarget::Universal(t) => t.to_spirv_tools(), SpirvTarget::Vulkan(t) => t.to_spirv_tools(), SpirvTarget::OpenGL(t) => t.to_spirv_tools(), + SpirvTarget::Naga(t) => t.to_spirv_tools(), } } @@ -499,6 +570,7 @@ impl SpirvTargetVariant for SpirvTarget { SpirvTarget::Universal(t) => t.spirv_version(), SpirvTarget::Vulkan(t) => t.spirv_version(), SpirvTarget::OpenGL(t) => t.spirv_version(), + SpirvTarget::Naga(t) => t.spirv_version(), } } } @@ -513,6 +585,9 @@ impl SpirvTarget { if matches!(result, Err(TargetError::UnknownTarget(..))) { result = OpenGLTarget::from_str(s).map(Self::OpenGL); } + if matches!(result, Err(TargetError::UnknownTarget(..))) { + result = NagaTarget::from_str(s).map(Self::Naga); + } result } @@ -533,6 +608,7 @@ impl SpirvTarget { SpirvTarget::Universal(t) => t.to_string(), SpirvTarget::Vulkan(t) => t.to_string(), SpirvTarget::OpenGL(t) => t.to_string(), + SpirvTarget::Naga(t) => t.to_string(), } } @@ -555,6 +631,7 @@ impl SpirvTarget { .iter() .map(|t| Self::OpenGL(*t)), ) + .chain(NagaTarget::ALL_NAGA_TARGETS.iter().map(|t| Self::Naga(*t))) } } From 712f2b16e7b7dc1da07ca68dd4383f3a40b7d05c Mon Sep 17 00:00:00 2001 From: firestar99 Date: Mon, 16 Jun 2025 10:03:25 +0200 Subject: [PATCH 2/5] wgsl: hide naga behind feature --- crates/rustc_codegen_spirv/Cargo.toml | 3 ++- crates/rustc_codegen_spirv/src/link.rs | 2 +- .../rustc_codegen_spirv/src/naga_transpile.rs | 20 ++++++++++++++----- tests/compiletests/Cargo.toml | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/crates/rustc_codegen_spirv/Cargo.toml b/crates/rustc_codegen_spirv/Cargo.toml index 1d8ae642f0b..aaaed94a7ff 100644 --- a/crates/rustc_codegen_spirv/Cargo.toml +++ b/crates/rustc_codegen_spirv/Cargo.toml @@ -29,6 +29,7 @@ use-compiled-tools = ["spirv-tools/use-compiled-tools"] # and will likely produce compile errors when built against a different toolchain. # Enable this feature to be able to experiment with other versions. skip-toolchain-check = [] +naga = ["dep:naga"] [dependencies] # HACK(eddyb) these only exist to unify features across dependency trees, @@ -61,7 +62,7 @@ itertools = "0.14.0" tracing.workspace = true tracing-subscriber.workspace = true tracing-tree = "0.4.0" -naga = { version = "27.0.3", features = ["spv-in", "wgsl-out"] } +naga = { version = "27.0.3", features = ["spv-in", "wgsl-out"], optional = true } strum = { version = "0.27.2", features = ["derive"] } [dev-dependencies] diff --git a/crates/rustc_codegen_spirv/src/link.rs b/crates/rustc_codegen_spirv/src/link.rs index eea98a5bc77..fa6608f4bb4 100644 --- a/crates/rustc_codegen_spirv/src/link.rs +++ b/crates/rustc_codegen_spirv/src/link.rs @@ -325,7 +325,7 @@ fn post_link_single_module( drop(save_modules_timer); } - if let Some(transpile) = should_transpile(sess) { + if let Ok(Some(transpile)) = should_transpile(sess) { transpile(sess, cg_args, &spv_binary, out_filename).ok(); } } diff --git a/crates/rustc_codegen_spirv/src/naga_transpile.rs b/crates/rustc_codegen_spirv/src/naga_transpile.rs index 8960524624b..0f2235cb45e 100644 --- a/crates/rustc_codegen_spirv/src/naga_transpile.rs +++ b/crates/rustc_codegen_spirv/src/naga_transpile.rs @@ -11,15 +11,25 @@ pub type NagaTranspile = fn( out_filename: &Path, ) -> Result<(), ErrorGuaranteed>; -pub fn should_transpile(sess: &Session) -> Option { +pub fn should_transpile(sess: &Session) -> Result, ErrorGuaranteed> { let target = SpirvTarget::parse_target(sess.opts.target_triple.tuple()) .expect("parsing should fail earlier"); - match target { - SpirvTarget::Naga(NagaTarget::NAGA_WGSL) => Some(transpile::wgsl_transpile), - _ => None, - } + let result: Result, ()> = match target { + #[cfg(feature = "naga")] + SpirvTarget::Naga(NagaTarget::NAGA_WGSL) => Ok(Some(transpile::wgsl_transpile)), + #[cfg(not(feature = "naga"))] + SpirvTarget::Naga(NagaTarget::NAGA_WGSL) => Err(()), + _ => Ok(None), + }; + result.map_err(|_e| { + sess.dcx().err(format!( + "Target `{}` requires feature \"naga\" on rustc_codegen_spirv", + target.target() + )) + }) } +#[cfg(feature = "naga")] mod transpile { use crate::codegen_cx::CodegenArgs; use naga::error::ShaderError; diff --git a/tests/compiletests/Cargo.toml b/tests/compiletests/Cargo.toml index 8b88c9211b0..644473a6471 100644 --- a/tests/compiletests/Cargo.toml +++ b/tests/compiletests/Cargo.toml @@ -15,7 +15,7 @@ use-compiled-tools = ["rustc_codegen_spirv/use-compiled-tools"] [dependencies] compiletest = { version = "0.11.2", package = "compiletest_rs" } -rustc_codegen_spirv = { workspace = true } +rustc_codegen_spirv = { workspace = true, features = ["naga"] } rustc_codegen_spirv-types = { workspace = true } clap = { version = "4", features = ["derive"] } itertools = "0.14.0" From 0c931341ddca3d9735ab56dee7406b5d6aafb1a9 Mon Sep 17 00:00:00 2001 From: Firestar99 Date: Thu, 3 Jul 2025 18:07:11 +0200 Subject: [PATCH 3/5] wgsl: enable naga feature by default, cargo-gpu can't handle it --- crates/rustc_codegen_spirv/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/rustc_codegen_spirv/Cargo.toml b/crates/rustc_codegen_spirv/Cargo.toml index aaaed94a7ff..7cd9eaf1fbe 100644 --- a/crates/rustc_codegen_spirv/Cargo.toml +++ b/crates/rustc_codegen_spirv/Cargo.toml @@ -20,10 +20,10 @@ crate-type = ["dylib"] default = ["use-compiled-tools"] # If enabled, uses spirv-tools binaries installed in PATH, instead of # compiling and linking the spirv-tools C++ code -use-installed-tools = ["spirv-tools/use-installed-tools"] +use-installed-tools = ["spirv-tools/use-installed-tools", "naga"] # If enabled will compile and link the C++ code for the spirv tools, the compiled # version is preferred if both this and `use-installed-tools` are enabled -use-compiled-tools = ["spirv-tools/use-compiled-tools"] +use-compiled-tools = ["spirv-tools/use-compiled-tools", "naga"] # If enabled, this will not check whether the current rustc version is set to the # appropriate channel. rustc_cogeden_spirv requires a specific nightly version, # and will likely produce compile errors when built against a different toolchain. From c01cdf6e64275a44635382e04250409281e516a1 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Sat, 30 Aug 2025 12:03:35 +0200 Subject: [PATCH 4/5] wgsl: ignore naga targets in compile tests with unsupported extensions or instructions --- .../ui/arch/all_memory_barrier.rs | 1 + ...convert_u_to_acceleration_structure_khr.rs | 1 + tests/compiletests/ui/arch/debug_printf.rs | 1 + .../ui/arch/demote_to_helper_invocation.rs | 1 + .../ui/arch/emit_stream_vertex.rs | 1 + tests/compiletests/ui/arch/emit_vertex.rs | 1 + tests/compiletests/ui/arch/end_primitive.rs | 1 + .../ui/arch/end_stream_primitive.rs | 1 + .../compiletests/ui/arch/execute_callable.rs | 1 + .../ui/arch/ignore_intersection_khr.rs | 1 + tests/compiletests/ui/arch/memory_barrier.rs | 1 + .../ray_query_confirm_intersection_khr.rs | 1 + ...query_get_intersection_barycentrics_khr.rs | 1 + ..._intersection_candidate_aabb_opaque_khr.rs | 1 + ...y_query_get_intersection_front_face_khr.rs | 1 + ...ery_get_intersection_geometry_index_khr.rs | 1 + ..._intersection_instance_custom_index_khr.rs | 1 + ..._query_get_intersection_instance_id_khr.rs | 1 + ...t_intersection_object_ray_direction_khr.rs | 1 + ..._get_intersection_object_ray_origin_khr.rs | 1 + ...ry_get_intersection_object_to_world_khr.rs | 1 + ...ry_get_intersection_primitive_index_khr.rs | 1 + ..._shader_binding_table_record_offset_khr.rs | 1 + .../arch/ray_query_get_intersection_t_khr.rs | 1 + .../ray_query_get_intersection_type_khr.rs | 1 + .../ui/arch/ray_query_get_ray_flags_khr.rs | 1 + .../ui/arch/ray_query_get_ray_t_min_khr.rs | 1 + .../ray_query_get_world_ray_direction_khr.rs | 1 + .../ray_query_get_world_ray_origin_khr.rs | 1 + .../ui/arch/ray_query_initialize_khr.rs | 1 + .../ui/arch/ray_query_terminate_khr.rs | 1 + tests/compiletests/ui/arch/read_clock_khr.rs | 1 + .../ui/arch/report_intersection_khr.rs | 1 + .../compiletests/ui/arch/terminate_ray_khr.rs | 1 + tests/compiletests/ui/arch/trace_ray_khr.rs | 1 + .../ui/arch/workgroup_memory_barrier.rs | 1 + tests/compiletests/ui/dis/asm.rs | 1 + tests/compiletests/ui/dis/asm.stderr | 2 +- tests/compiletests/ui/dis/asm_op_decorate.rs | 1 + .../ui/dis/complex_image_sample_inst.rs | 1 + .../ui/dis/complex_image_sample_inst.stderr | 6 +- .../ui/dis/non-writable-storage_buffer.rs | 1 + .../ui/dis/panic_builtin_bounds_check.rs | 2 + .../ui/dis/panic_builtin_bounds_check.stderr | 14 ++-- .../ui/dis/panic_sequential_many.rs | 2 + .../ui/dis/panic_sequential_many.stderr | 76 +++++++++---------- .../compiletests/ui/image/query/query_lod.rs | 1 + .../ui/image/query/rect_image_query_size.rs | 1 + .../sampled_image_rect_query_size_lod_err.rs | 1 + .../ui/lang/asm/infer-access-chain-array.rs | 1 + .../compiletests/ui/spirv-attr/bool-inputs.rs | 1 + tests/compiletests/ui/spirv-attr/invariant.rs | 5 +- .../compiletests/ui/spirv-attr/matrix-type.rs | 1 + .../storage_class/runtime_descriptor_array.rs | 1 + .../runtime_descriptor_array_error.rs | 1 + .../runtime_descriptor_array_error.stderr | 4 +- .../typed_buffer_descriptor_array.rs | 1 + .../typed_buffer_descriptor_array_slice.rs | 1 + tests/compiletests/ui/target_features_err.rs | 1 + 59 files changed, 110 insertions(+), 52 deletions(-) diff --git a/tests/compiletests/ui/arch/all_memory_barrier.rs b/tests/compiletests/ui/arch/all_memory_barrier.rs index b3f6d2f374a..adfe7ab836d 100644 --- a/tests/compiletests/ui/arch/all_memory_barrier.rs +++ b/tests/compiletests/ui/arch/all_memory_barrier.rs @@ -1,6 +1,7 @@ // build-pass // compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model // compile-flags: -C llvm-args=--disassemble-fn=all_memory_barrier::all_memory_barrier +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/convert_u_to_acceleration_structure_khr.rs b/tests/compiletests/ui/arch/convert_u_to_acceleration_structure_khr.rs index 1a38c779801..9df46fc5e0d 100644 --- a/tests/compiletests/ui/arch/convert_u_to_acceleration_structure_khr.rs +++ b/tests/compiletests/ui/arch/convert_u_to_acceleration_structure_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+Int64,+RayTracingKHR,+ext:SPV_KHR_ray_tracing +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/debug_printf.rs b/tests/compiletests/ui/arch/debug_printf.rs index e396b2f5384..3b5022e430d 100644 --- a/tests/compiletests/ui/arch/debug_printf.rs +++ b/tests/compiletests/ui/arch/debug_printf.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+ext:SPV_KHR_non_semantic_info +// ignore-naga use spirv_std::spirv; use spirv_std::{ diff --git a/tests/compiletests/ui/arch/demote_to_helper_invocation.rs b/tests/compiletests/ui/arch/demote_to_helper_invocation.rs index 862b1f4a6b8..18405b103e0 100644 --- a/tests/compiletests/ui/arch/demote_to_helper_invocation.rs +++ b/tests/compiletests/ui/arch/demote_to_helper_invocation.rs @@ -1,6 +1,7 @@ // build-pass // // compile-flags: -C target-feature=+DemoteToHelperInvocationEXT,+ext:SPV_EXT_demote_to_helper_invocation +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/emit_stream_vertex.rs b/tests/compiletests/ui/arch/emit_stream_vertex.rs index 8f25b102d67..c2872736a81 100644 --- a/tests/compiletests/ui/arch/emit_stream_vertex.rs +++ b/tests/compiletests/ui/arch/emit_stream_vertex.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -C target-feature=+Int64,+Geometry,+GeometryStreams +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/emit_vertex.rs b/tests/compiletests/ui/arch/emit_vertex.rs index c8fa3fe7814..3005d98f503 100644 --- a/tests/compiletests/ui/arch/emit_vertex.rs +++ b/tests/compiletests/ui/arch/emit_vertex.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+Geometry +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/end_primitive.rs b/tests/compiletests/ui/arch/end_primitive.rs index 0749ecd1e21..eba55624d51 100644 --- a/tests/compiletests/ui/arch/end_primitive.rs +++ b/tests/compiletests/ui/arch/end_primitive.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+Geometry +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/end_stream_primitive.rs b/tests/compiletests/ui/arch/end_stream_primitive.rs index 96959840222..93d4422b5a2 100644 --- a/tests/compiletests/ui/arch/end_stream_primitive.rs +++ b/tests/compiletests/ui/arch/end_stream_primitive.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -C target-feature=+Int64,+Geometry,+GeometryStreams +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/execute_callable.rs b/tests/compiletests/ui/arch/execute_callable.rs index 41375a5153d..79810e9bc88 100644 --- a/tests/compiletests/ui/arch/execute_callable.rs +++ b/tests/compiletests/ui/arch/execute_callable.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/ignore_intersection_khr.rs b/tests/compiletests/ui/arch/ignore_intersection_khr.rs index c7c68f7fb19..c80960de48d 100644 --- a/tests/compiletests/ui/arch/ignore_intersection_khr.rs +++ b/tests/compiletests/ui/arch/ignore_intersection_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/memory_barrier.rs b/tests/compiletests/ui/arch/memory_barrier.rs index 3c6033b910f..39310f1f047 100644 --- a/tests/compiletests/ui/arch/memory_barrier.rs +++ b/tests/compiletests/ui/arch/memory_barrier.rs @@ -1,4 +1,5 @@ // build-pass +// ignore-naga #![feature(adt_const_params)] #![allow(incomplete_features)] diff --git a/tests/compiletests/ui/arch/ray_query_confirm_intersection_khr.rs b/tests/compiletests/ui/arch/ray_query_confirm_intersection_khr.rs index d75c69878c4..c2e2ced4d56 100644 --- a/tests/compiletests/ui/arch/ray_query_confirm_intersection_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_confirm_intersection_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_barycentrics_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_barycentrics_khr.rs index 4e859c6fea3..74edf650406 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_barycentrics_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_barycentrics_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_candidate_aabb_opaque_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_candidate_aabb_opaque_khr.rs index 87376f005cd..19c625f4664 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_candidate_aabb_opaque_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_candidate_aabb_opaque_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_front_face_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_front_face_khr.rs index ba6006988ee..bda1a59dca3 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_front_face_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_front_face_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_geometry_index_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_geometry_index_khr.rs index 69323141d3b..e453362bc77 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_geometry_index_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_geometry_index_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_instance_custom_index_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_instance_custom_index_khr.rs index 2dfc5bb17e6..7ac735a1a37 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_instance_custom_index_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_instance_custom_index_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_instance_id_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_instance_id_khr.rs index 20b413deec2..e3c0c37ef70 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_instance_id_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_instance_id_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_object_ray_direction_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_object_ray_direction_khr.rs index 177490b1b2a..abdca7fe7ad 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_object_ray_direction_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_object_ray_direction_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_object_ray_origin_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_object_ray_origin_khr.rs index a0ea175b89e..aaeabddd401 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_object_ray_origin_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_object_ray_origin_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_object_to_world_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_object_to_world_khr.rs index 20b8fc5b2f5..b7a0996625a 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_object_to_world_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_object_to_world_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::matrix::Matrix4x3; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_primitive_index_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_primitive_index_khr.rs index a4f9ab84cc2..bc8d8b7925a 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_primitive_index_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_primitive_index_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_shader_binding_table_record_offset_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_shader_binding_table_record_offset_khr.rs index 159c4aa16d5..3e58521e56e 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_shader_binding_table_record_offset_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_shader_binding_table_record_offset_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_t_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_t_khr.rs index 39cd3dde591..054542fdd51 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_t_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_t_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_intersection_type_khr.rs b/tests/compiletests/ui/arch/ray_query_get_intersection_type_khr.rs index 39b848003e1..93be2c779c7 100644 --- a/tests/compiletests/ui/arch/ray_query_get_intersection_type_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_intersection_type_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_ray_flags_khr.rs b/tests/compiletests/ui/arch/ray_query_get_ray_flags_khr.rs index 816e808b93d..737bfb300c3 100644 --- a/tests/compiletests/ui/arch/ray_query_get_ray_flags_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_ray_flags_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_ray_t_min_khr.rs b/tests/compiletests/ui/arch/ray_query_get_ray_t_min_khr.rs index b5c0d82c3f4..c23234890f0 100644 --- a/tests/compiletests/ui/arch/ray_query_get_ray_t_min_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_ray_t_min_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_world_ray_direction_khr.rs b/tests/compiletests/ui/arch/ray_query_get_world_ray_direction_khr.rs index 1f579e38b53..7e3d567fee2 100644 --- a/tests/compiletests/ui/arch/ray_query_get_world_ray_direction_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_world_ray_direction_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_get_world_ray_origin_khr.rs b/tests/compiletests/ui/arch/ray_query_get_world_ray_origin_khr.rs index f56a47e67b1..efd80dbf7be 100644 --- a/tests/compiletests/ui/arch/ray_query_get_world_ray_origin_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_get_world_ray_origin_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_initialize_khr.rs b/tests/compiletests/ui/arch/ray_query_initialize_khr.rs index ac2e5f0fab5..75893656d1f 100644 --- a/tests/compiletests/ui/arch/ray_query_initialize_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_initialize_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayTracingKHR,+RayQueryKHR,+ext:SPV_KHR_ray_tracing,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/ray_query_terminate_khr.rs b/tests/compiletests/ui/arch/ray_query_terminate_khr.rs index 02c5b4fde65..a1b53aa6772 100644 --- a/tests/compiletests/ui/arch/ray_query_terminate_khr.rs +++ b/tests/compiletests/ui/arch/ray_query_terminate_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayQueryKHR,+ext:SPV_KHR_ray_query +// ignore-naga use glam::Vec3; use spirv_std::ray_tracing::{AccelerationStructure, RayFlags, RayQuery}; diff --git a/tests/compiletests/ui/arch/read_clock_khr.rs b/tests/compiletests/ui/arch/read_clock_khr.rs index 5222d57fa85..485a0cb031c 100644 --- a/tests/compiletests/ui/arch/read_clock_khr.rs +++ b/tests/compiletests/ui/arch/read_clock_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+Int64,+ShaderClockKHR,+ext:SPV_KHR_shader_clock +// ignore-naga use glam::UVec2; use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/report_intersection_khr.rs b/tests/compiletests/ui/arch/report_intersection_khr.rs index a7d3cca8c81..cc0ab9be116 100644 --- a/tests/compiletests/ui/arch/report_intersection_khr.rs +++ b/tests/compiletests/ui/arch/report_intersection_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/terminate_ray_khr.rs b/tests/compiletests/ui/arch/terminate_ray_khr.rs index 5d986dfa1c3..e9be85b18a3 100644 --- a/tests/compiletests/ui/arch/terminate_ray_khr.rs +++ b/tests/compiletests/ui/arch/terminate_ray_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/trace_ray_khr.rs b/tests/compiletests/ui/arch/trace_ray_khr.rs index f210a65c984..496ada41eb1 100644 --- a/tests/compiletests/ui/arch/trace_ray_khr.rs +++ b/tests/compiletests/ui/arch/trace_ray_khr.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/arch/workgroup_memory_barrier.rs b/tests/compiletests/ui/arch/workgroup_memory_barrier.rs index 1a4b6de6685..ae2f216798d 100644 --- a/tests/compiletests/ui/arch/workgroup_memory_barrier.rs +++ b/tests/compiletests/ui/arch/workgroup_memory_barrier.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -C llvm-args=--disassemble-fn=workgroup_memory_barrier::workgroup_memory_barrier +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/dis/asm.rs b/tests/compiletests/ui/dis/asm.rs index 1e2a5a6f010..941f2a35228 100644 --- a/tests/compiletests/ui/dis/asm.rs +++ b/tests/compiletests/ui/dis/asm.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -C llvm-args=--disassemble-fn=asm::asm +// ignore-naga use core::arch::asm; use spirv_std::spirv; diff --git a/tests/compiletests/ui/dis/asm.stderr b/tests/compiletests/ui/dis/asm.stderr index 0bf5d9ebac7..41101daaf40 100644 --- a/tests/compiletests/ui/dis/asm.stderr +++ b/tests/compiletests/ui/dis/asm.stderr @@ -1,6 +1,6 @@ %1 = OpFunction %2 None %3 %4 = OpLabel -OpLine %5 13 13 +OpLine %5 14 13 OpMemoryBarrier %6 %7 OpNoLine OpReturn diff --git a/tests/compiletests/ui/dis/asm_op_decorate.rs b/tests/compiletests/ui/dis/asm_op_decorate.rs index d279beaee54..9836f461acc 100644 --- a/tests/compiletests/ui/dis/asm_op_decorate.rs +++ b/tests/compiletests/ui/dis/asm_op_decorate.rs @@ -20,6 +20,7 @@ // ignore-spv1.4 // ignore-spv1.5 // ignore-spv1.6 +// ignore-naga use core::arch::asm; use spirv_std::spirv; diff --git a/tests/compiletests/ui/dis/complex_image_sample_inst.rs b/tests/compiletests/ui/dis/complex_image_sample_inst.rs index 73b4dd2254e..867cc3093ca 100644 --- a/tests/compiletests/ui/dis/complex_image_sample_inst.rs +++ b/tests/compiletests/ui/dis/complex_image_sample_inst.rs @@ -1,6 +1,7 @@ // build-pass // compile-flags: -Ctarget-feature=+RuntimeDescriptorArray,+ext:SPV_EXT_descriptor_indexing // compile-flags: -C llvm-args=--disassemble-fn=complex_image_sample_inst::sample_proj_lod +// ignore-naga use core::arch::asm; use spirv_std::spirv; diff --git a/tests/compiletests/ui/dis/complex_image_sample_inst.stderr b/tests/compiletests/ui/dis/complex_image_sample_inst.stderr index b99b63a736b..bc73b0b216a 100644 --- a/tests/compiletests/ui/dis/complex_image_sample_inst.stderr +++ b/tests/compiletests/ui/dis/complex_image_sample_inst.stderr @@ -9,11 +9,11 @@ %13 = OpCompositeExtract %10 %7 0 %14 = OpCompositeExtract %10 %7 1 %15 = OpCompositeConstruct %6 %13 %14 -OpLine %16 29 13 -%17 = OpAccessChain %18 %19 %20 OpLine %16 30 13 +%17 = OpAccessChain %18 %19 %20 +OpLine %16 31 13 %21 = OpLoad %22 %17 -OpLine %16 34 13 +OpLine %16 35 13 %23 = OpImageSampleProjExplicitLod %2 %21 %4 Grad %12 %15 OpNoLine OpReturnValue %23 diff --git a/tests/compiletests/ui/dis/non-writable-storage_buffer.rs b/tests/compiletests/ui/dis/non-writable-storage_buffer.rs index 32e2d05a9bc..f13aa759818 100644 --- a/tests/compiletests/ui/dis/non-writable-storage_buffer.rs +++ b/tests/compiletests/ui/dis/non-writable-storage_buffer.rs @@ -21,6 +21,7 @@ // ignore-spv1.4 // ignore-spv1.5 // ignore-spv1.6 +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/dis/panic_builtin_bounds_check.rs b/tests/compiletests/ui/dis/panic_builtin_bounds_check.rs index 832a15174ca..e13f5a4a3ee 100644 --- a/tests/compiletests/ui/dis/panic_builtin_bounds_check.rs +++ b/tests/compiletests/ui/dis/panic_builtin_bounds_check.rs @@ -17,6 +17,8 @@ // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // FIXME(eddyb) handle this one in the test runner. // normalize-stderr-test "\S*/lib/rustlib/" -> "$$SYSROOT/lib/rustlib/" +// +// ignore-naga // HACK(eddyb) `compiletest` handles `ui\dis\`, but not `ui\\dis\\`, on Windows. // normalize-stderr-test "ui/dis/" -> "$$DIR/" diff --git a/tests/compiletests/ui/dis/panic_builtin_bounds_check.stderr b/tests/compiletests/ui/dis/panic_builtin_bounds_check.stderr index 2a6a8e7746e..1f72dc59fef 100644 --- a/tests/compiletests/ui/dis/panic_builtin_bounds_check.stderr +++ b/tests/compiletests/ui/dis/panic_builtin_bounds_check.stderr @@ -4,7 +4,7 @@ OpExtension "SPV_KHR_non_semantic_info" OpMemoryModel Logical Simple OpEntryPoint Fragment %2 "main" OpExecutionMode %2 OriginUpperLeft -%3 = OpString "/n[Rust panicked at $DIR/panic_builtin_bounds_check.rs:27:5]/n index out of bounds: the len is %u but the index is %u/n in main()/n" +%3 = OpString "/n[Rust panicked at $DIR/panic_builtin_bounds_check.rs:29:5]/n index out of bounds: the len is %u but the index is %u/n in main()/n" %4 = OpString "$DIR/panic_builtin_bounds_check.rs" OpDecorate %5 ArrayStride 4 %6 = OpTypeVoid @@ -23,18 +23,18 @@ OpDecorate %5 ArrayStride 4 %18 = OpTypePointer Function %8 %2 = OpFunction %6 None %7 %19 = OpLabel -OpLine %4 32 4 +OpLine %4 34 4 %20 = OpVariable %11 Function -OpLine %4 32 23 +OpLine %4 34 23 %21 = OpCompositeConstruct %5 %12 %13 %14 %15 -OpLine %4 32 4 +OpLine %4 34 4 %22 = OpCompositeExtract %8 %21 0 %23 = OpCompositeExtract %8 %21 1 %24 = OpCompositeExtract %8 %21 2 %25 = OpCompositeExtract %8 %21 3 %26 = OpCompositeConstruct %10 %22 %23 %24 %25 OpStore %20 %26 -OpLine %4 27 4 +OpLine %4 29 4 %27 = OpULessThan %16 %17 %9 OpNoLine OpSelectionMerge %28 None @@ -42,12 +42,12 @@ OpBranchConditional %27 %29 %30 %29 = OpLabel OpBranch %28 %30 = OpLabel -OpLine %4 27 4 +OpLine %4 29 4 %31 = OpExtInst %6 %1 1 %3 %9 %17 OpNoLine OpReturn %28 = OpLabel -OpLine %4 27 4 +OpLine %4 29 4 %32 = OpIAdd %8 %12 %17 %33 = OpInBoundsAccessChain %18 %20 %32 %34 = OpLoad %8 %33 diff --git a/tests/compiletests/ui/dis/panic_sequential_many.rs b/tests/compiletests/ui/dis/panic_sequential_many.rs index c64641e0efc..a7c10989882 100644 --- a/tests/compiletests/ui/dis/panic_sequential_many.rs +++ b/tests/compiletests/ui/dis/panic_sequential_many.rs @@ -18,6 +18,8 @@ // normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple" // FIXME(eddyb) handle this one in the test runner. // normalize-stderr-test "\S*/lib/rustlib/" -> "$$SYSROOT/lib/rustlib/" +// +// ignore-naga // HACK(eddyb) `compiletest` handles `ui\dis\`, but not `ui\\dis\\`, on Windows. // normalize-stderr-test "ui/dis/" -> "$$DIR/" diff --git a/tests/compiletests/ui/dis/panic_sequential_many.stderr b/tests/compiletests/ui/dis/panic_sequential_many.stderr index 21cd242d7c3..9c2786d34cc 100644 --- a/tests/compiletests/ui/dis/panic_sequential_many.stderr +++ b/tests/compiletests/ui/dis/panic_sequential_many.stderr @@ -4,7 +4,7 @@ OpExtension "SPV_KHR_non_semantic_info" OpMemoryModel Logical Simple OpEntryPoint Fragment %2 "main" %3 %4 %5 OpExecutionMode %2 OriginUpperLeft -%6 = OpString "/n[Rust panicked at $DIR/panic_sequential_many.rs:31:10]/n attempt to divide by zero/n in main()/n" +%6 = OpString "/n[Rust panicked at $DIR/panic_sequential_many.rs:33:10]/n attempt to divide by zero/n in main()/n" %7 = OpString "$DIR/panic_sequential_many.rs" OpName %3 "x" OpName %4 "y" @@ -26,248 +26,248 @@ OpDecorate %5 Location 0 %5 = OpVariable %10 Output %2 = OpFunction %11 None %12 %15 = OpLabel -OpLine %7 28 12 +OpLine %7 30 12 %16 = OpLoad %8 %3 -OpLine %7 28 35 +OpLine %7 30 35 %17 = OpLoad %8 %4 -OpLine %7 31 9 +OpLine %7 33 9 %18 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %19 None OpBranchConditional %18 %20 %21 %20 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %22 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %21 = OpLabel OpBranch %19 %19 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %23 = OpUDiv %8 %16 %17 %24 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %25 None OpBranchConditional %24 %26 %27 %26 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %28 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %27 = OpLabel OpBranch %25 %25 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %29 = OpUDiv %8 %23 %17 %30 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %31 None OpBranchConditional %30 %32 %33 %32 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %34 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %33 = OpLabel OpBranch %31 %31 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %35 = OpUDiv %8 %29 %17 %36 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %37 None OpBranchConditional %36 %38 %39 %38 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %40 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %39 = OpLabel OpBranch %37 %37 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %41 = OpUDiv %8 %35 %17 %42 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %43 None OpBranchConditional %42 %44 %45 %44 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %46 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %45 = OpLabel OpBranch %43 %43 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %47 = OpUDiv %8 %41 %17 %48 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %49 None OpBranchConditional %48 %50 %51 %50 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %52 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %51 = OpLabel OpBranch %49 %49 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %53 = OpUDiv %8 %47 %17 %54 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %55 None OpBranchConditional %54 %56 %57 %56 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %58 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %57 = OpLabel OpBranch %55 %55 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %59 = OpUDiv %8 %53 %17 %60 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %61 None OpBranchConditional %60 %62 %63 %62 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %64 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %63 = OpLabel OpBranch %61 %61 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %65 = OpUDiv %8 %59 %17 %66 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %67 None OpBranchConditional %66 %68 %69 %68 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %70 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %69 = OpLabel OpBranch %67 %67 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %71 = OpUDiv %8 %65 %17 %72 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %73 None OpBranchConditional %72 %74 %75 %74 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %76 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %75 = OpLabel OpBranch %73 %73 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %77 = OpUDiv %8 %71 %17 %78 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %79 None OpBranchConditional %78 %80 %81 %80 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %82 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %81 = OpLabel OpBranch %79 %79 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %83 = OpUDiv %8 %77 %17 %84 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %85 None OpBranchConditional %84 %86 %87 %86 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %88 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %87 = OpLabel OpBranch %85 %85 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %89 = OpUDiv %8 %83 %17 %90 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %91 None OpBranchConditional %90 %92 %93 %92 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %94 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %93 = OpLabel OpBranch %91 %91 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %95 = OpUDiv %8 %89 %17 %96 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %97 None OpBranchConditional %96 %98 %99 %98 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %100 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %99 = OpLabel OpBranch %97 %97 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %101 = OpUDiv %8 %95 %17 %102 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %103 None OpBranchConditional %102 %104 %105 %104 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %106 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %105 = OpLabel OpBranch %103 %103 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %107 = OpUDiv %8 %101 %17 %108 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %109 None OpBranchConditional %108 %110 %111 %110 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %112 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %111 = OpLabel OpBranch %109 %109 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %113 = OpUDiv %8 %107 %17 %114 = OpIEqual %13 %17 %14 OpNoLine OpSelectionMerge %115 None OpBranchConditional %114 %116 %117 %116 = OpLabel -OpLine %7 31 9 +OpLine %7 33 9 %118 = OpExtInst %11 %1 1 %6 OpNoLine OpReturn %117 = OpLabel OpBranch %115 %115 = OpLabel -OpLine %7 31 4 +OpLine %7 33 4 %119 = OpUDiv %8 %113 %17 OpStore %5 %119 OpNoLine diff --git a/tests/compiletests/ui/image/query/query_lod.rs b/tests/compiletests/ui/image/query/query_lod.rs index 4d764d05145..f5b68e8d072 100644 --- a/tests/compiletests/ui/image/query/query_lod.rs +++ b/tests/compiletests/ui/image/query/query_lod.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -C target-feature=+ImageQuery +// ignore-naga use spirv_std::spirv; use spirv_std::{Image, Sampler, arch}; diff --git a/tests/compiletests/ui/image/query/rect_image_query_size.rs b/tests/compiletests/ui/image/query/rect_image_query_size.rs index 3182412157c..38e8f5ac062 100644 --- a/tests/compiletests/ui/image/query/rect_image_query_size.rs +++ b/tests/compiletests/ui/image/query/rect_image_query_size.rs @@ -6,6 +6,7 @@ // ignore-vulkan1.2 // ignore-vulkan1.3 // ignore-vulkan1.4 +// ignore-naga use spirv_std::spirv; use spirv_std::{Image, arch}; diff --git a/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.rs b/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.rs index c12a9d8863d..338e5f35471 100644 --- a/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.rs +++ b/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.rs @@ -8,6 +8,7 @@ // ignore-vulkan1.2 // ignore-vulkan1.3 // ignore-vulkan1.4 +// ignore-naga use spirv_std::{Image, arch, image::SampledImage, spirv}; diff --git a/tests/compiletests/ui/lang/asm/infer-access-chain-array.rs b/tests/compiletests/ui/lang/asm/infer-access-chain-array.rs index cd3649989a3..981afc414c5 100644 --- a/tests/compiletests/ui/lang/asm/infer-access-chain-array.rs +++ b/tests/compiletests/ui/lang/asm/infer-access-chain-array.rs @@ -2,6 +2,7 @@ // when used to index arrays. // build-pass +// ignore-naga use core::arch::asm; use glam::Vec4; diff --git a/tests/compiletests/ui/spirv-attr/bool-inputs.rs b/tests/compiletests/ui/spirv-attr/bool-inputs.rs index c0d74df93b5..9aaba163d62 100644 --- a/tests/compiletests/ui/spirv-attr/bool-inputs.rs +++ b/tests/compiletests/ui/spirv-attr/bool-inputs.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+FragmentFullyCoveredEXT,+ext:SPV_EXT_fragment_fully_covered +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/spirv-attr/invariant.rs b/tests/compiletests/ui/spirv-attr/invariant.rs index 37e7a698ec1..027e951eaa3 100644 --- a/tests/compiletests/ui/spirv-attr/invariant.rs +++ b/tests/compiletests/ui/spirv-attr/invariant.rs @@ -1,7 +1,10 @@ // Tests that the invariant attribute works // build-pass +use spirv_std::glam::Vec4; use spirv_std::spirv; #[spirv(vertex)] -pub fn main(#[spirv(invariant)] output: &mut f32) {} +pub fn main(#[spirv(invariant)] output: &mut f32, #[spirv(position)] pos: &mut Vec4) { + *pos = Vec4::ZERO; +} diff --git a/tests/compiletests/ui/spirv-attr/matrix-type.rs b/tests/compiletests/ui/spirv-attr/matrix-type.rs index ef8ca603493..a1c87cfca8a 100644 --- a/tests/compiletests/ui/spirv-attr/matrix-type.rs +++ b/tests/compiletests/ui/spirv-attr/matrix-type.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -Ctarget-feature=+RayTracingKHR,+ext:SPV_KHR_ray_tracing +// ignore-naga use spirv_std::spirv; diff --git a/tests/compiletests/ui/storage_class/runtime_descriptor_array.rs b/tests/compiletests/ui/storage_class/runtime_descriptor_array.rs index 0596b567253..3e4e432a402 100644 --- a/tests/compiletests/ui/storage_class/runtime_descriptor_array.rs +++ b/tests/compiletests/ui/storage_class/runtime_descriptor_array.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -C target-feature=+RuntimeDescriptorArray,+ext:SPV_EXT_descriptor_indexing +// ignore-naga use spirv_std::spirv; use spirv_std::{Image, RuntimeArray, Sampler}; diff --git a/tests/compiletests/ui/storage_class/runtime_descriptor_array_error.rs b/tests/compiletests/ui/storage_class/runtime_descriptor_array_error.rs index 5ccefec3de8..23cf386f8c3 100644 --- a/tests/compiletests/ui/storage_class/runtime_descriptor_array_error.rs +++ b/tests/compiletests/ui/storage_class/runtime_descriptor_array_error.rs @@ -1,4 +1,5 @@ // build-fail +// ignore-naga use spirv_std::{Image, RuntimeArray, spirv}; diff --git a/tests/compiletests/ui/storage_class/runtime_descriptor_array_error.stderr b/tests/compiletests/ui/storage_class/runtime_descriptor_array_error.stderr index d46fcdc9a8f..94b9f92fc50 100644 --- a/tests/compiletests/ui/storage_class/runtime_descriptor_array_error.stderr +++ b/tests/compiletests/ui/storage_class/runtime_descriptor_array_error.stderr @@ -1,11 +1,11 @@ error: descriptor indexing must use &RuntimeArray, not &[T] - --> $DIR/runtime_descriptor_array_error.rs:7:52 + --> $DIR/runtime_descriptor_array_error.rs:8:52 | LL | #[spirv(descriptor_set = 0, binding = 0)] one: &[Image!(2D, type=f32, sampled)], | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use &[T] instead of &RuntimeArray - --> $DIR/runtime_descriptor_array_error.rs:8:61 + --> $DIR/runtime_descriptor_array_error.rs:9:61 | LL | #[spirv(uniform, descriptor_set = 0, binding = 0)] two: &RuntimeArray, | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/compiletests/ui/storage_class/typed_buffer_descriptor_array.rs b/tests/compiletests/ui/storage_class/typed_buffer_descriptor_array.rs index 1383707dec5..71a493c38fb 100644 --- a/tests/compiletests/ui/storage_class/typed_buffer_descriptor_array.rs +++ b/tests/compiletests/ui/storage_class/typed_buffer_descriptor_array.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -C target-feature=+RuntimeDescriptorArray,+ext:SPV_EXT_descriptor_indexing +// ignore-naga use glam::Vec4; use spirv_std::spirv; diff --git a/tests/compiletests/ui/storage_class/typed_buffer_descriptor_array_slice.rs b/tests/compiletests/ui/storage_class/typed_buffer_descriptor_array_slice.rs index 9e62e997068..6eea70f3b84 100644 --- a/tests/compiletests/ui/storage_class/typed_buffer_descriptor_array_slice.rs +++ b/tests/compiletests/ui/storage_class/typed_buffer_descriptor_array_slice.rs @@ -1,5 +1,6 @@ // build-pass // compile-flags: -C target-feature=+RuntimeDescriptorArray,+ext:SPV_EXT_descriptor_indexing +// ignore-naga use glam::Vec4; use spirv_std::spirv; diff --git a/tests/compiletests/ui/target_features_err.rs b/tests/compiletests/ui/target_features_err.rs index f6def31c4f4..b06674d9cd0 100644 --- a/tests/compiletests/ui/target_features_err.rs +++ b/tests/compiletests/ui/target_features_err.rs @@ -1,5 +1,6 @@ // build-fail // compile-flags: -Ctarget-feature=+rayTracingKHR,+ext:SPV_KHR_ray_tracing +// ignore-naga use spirv_std::spirv; From 842df37dd655cce0749c59b8d1e06aace2098dcd Mon Sep 17 00:00:00 2001 From: firestar99 Date: Tue, 1 Jul 2025 19:57:45 +0200 Subject: [PATCH 5/5] wgsl ci: add experimental wgsl compiletest to ci --- .github/workflows/ci.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 83b0f02b7c7..45613fd603f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -126,7 +126,14 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest, windows-latest, macOS-latest ] + target_env: [ "vulkan1.1,vulkan1.2,vulkan1.3,vulkan1.4,spv1.3,spv1.4" ] + experimental: [ false ] + include: + - os: ubuntu-24.04 + target_env: naga-wgsl + experimental: true runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} steps: - uses: actions/checkout@v4 - name: Install Vulkan SDK @@ -141,7 +148,7 @@ jobs: - name: cargo fetch --locked run: cargo fetch --locked --target $TARGET - name: compiletest - run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env vulkan1.1,vulkan1.2,vulkan1.3,vulkan1.4,spv1.3,spv1.4 + run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env ${{ matrix.target_env }} difftest: name: Difftest