diff --git a/crates/rustc_codegen_spirv/src/builder/byte_addressable_buffer.rs b/crates/rustc_codegen_spirv/src/builder/byte_addressable_buffer.rs index 76260a7765..4704f903a8 100644 --- a/crates/rustc_codegen_spirv/src/builder/byte_addressable_buffer.rs +++ b/crates/rustc_codegen_spirv/src/builder/byte_addressable_buffer.rs @@ -4,7 +4,8 @@ use crate::maybe_pqp_cg_ssa as rustc_codegen_ssa; use super::Builder; use crate::builder_spirv::{SpirvValue, SpirvValueExt, SpirvValueKind}; use crate::spirv_type::SpirvType; -use rspirv::spirv::Word; +use rspirv::spirv::{Decoration, Word}; +use rustc_codegen_spirv_types::Capability; use rustc_codegen_ssa::traits::BuilderMethods; use rustc_errors::ErrorGuaranteed; use rustc_span::DUMMY_SP; @@ -41,11 +42,20 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { }; let u32_ty = SpirvType::Integer(32, false).def(DUMMY_SP, self); let u32_ptr = self.type_ptr_to(u32_ty); + let array = array.def(self); + let actual_index = actual_index.def(self); let ptr = self .emit() - .in_bounds_access_chain(u32_ptr, None, array.def(self), [actual_index.def(self)]) + .in_bounds_access_chain(u32_ptr, None, array, [actual_index]) .unwrap() .with_type(u32_ptr); + if self.builder.has_capability(Capability::ShaderNonUniform) { + // apply NonUniform to the operation and the index + self.emit() + .decorate(ptr.def(self), Decoration::NonUniform, []); + self.emit() + .decorate(actual_index, Decoration::NonUniform, []); + } self.load(u32_ty, ptr, Align::ONE) } @@ -233,11 +243,20 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { }; let u32_ty = SpirvType::Integer(32, false).def(DUMMY_SP, self); let u32_ptr = self.type_ptr_to(u32_ty); + let array = array.def(self); + let actual_index = actual_index.def(self); let ptr = self .emit() - .in_bounds_access_chain(u32_ptr, None, array.def(self), [actual_index.def(self)]) + .in_bounds_access_chain(u32_ptr, None, array, [actual_index]) .unwrap() .with_type(u32_ptr); + if self.builder.has_capability(Capability::ShaderNonUniform) { + // apply NonUniform to the operation and the index + self.emit() + .decorate(ptr.def(self), Decoration::NonUniform, []); + self.emit() + .decorate(actual_index, Decoration::NonUniform, []); + } self.store(value, ptr, Align::ONE); Ok(()) } diff --git a/crates/rustc_codegen_spirv/src/linker/mod.rs b/crates/rustc_codegen_spirv/src/linker/mod.rs index fa69dc8e7f..6b5d7919b1 100644 --- a/crates/rustc_codegen_spirv/src/linker/mod.rs +++ b/crates/rustc_codegen_spirv/src/linker/mod.rs @@ -472,6 +472,11 @@ pub fn link( duplicates::remove_duplicate_debuginfo(&mut output); } + { + let _timer = sess.timer("link_remove_non_uniform"); + simple_passes::remove_non_uniform_decorations(sess, &mut output)?; + } + // NOTE(eddyb) SPIR-T pipeline is entirely limited to this block. { let (spv_words, module_or_err, lower_from_spv_timer) = diff --git a/crates/rustc_codegen_spirv/src/linker/simple_passes.rs b/crates/rustc_codegen_spirv/src/linker/simple_passes.rs index d0e7854895..9dfeadad35 100644 --- a/crates/rustc_codegen_spirv/src/linker/simple_passes.rs +++ b/crates/rustc_codegen_spirv/src/linker/simple_passes.rs @@ -1,6 +1,7 @@ use super::{Result, get_name, get_names}; use rspirv::dr::{Block, Function, Module}; -use rspirv::spirv::{ExecutionModel, Op, Word}; +use rspirv::spirv::{Decoration, ExecutionModel, Op, Word}; +use rustc_codegen_spirv_types::Capability; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_session::Session; use std::iter::once; @@ -264,3 +265,19 @@ pub fn check_fragment_insts(sess: &Session, module: &Module) -> Result<()> { } } } + +/// Remove all [`Decoration::NonUniform`] if this module does *not* have [`Capability::ShaderNonUniform`]. +/// This allows image asm to always declare `NonUniform` and not worry about conditional compilation. +pub fn remove_non_uniform_decorations(_sess: &Session, module: &mut Module) -> Result<()> { + let has_shader_non_uniform_capability = module.capabilities.iter().any(|inst| { + inst.class.opcode == Op::Capability + && inst.operands[0].unwrap_capability() == Capability::ShaderNonUniform + }); + if !has_shader_non_uniform_capability { + module.annotations.retain(|inst| { + !(inst.class.opcode == Op::Decorate + && inst.operands[1].unwrap_decoration() == Decoration::NonUniform) + }); + } + Ok(()) +} diff --git a/crates/spirv-std/src/image.rs b/crates/spirv-std/src/image.rs index 59814a03d1..77af83b5c6 100644 --- a/crates/spirv-std/src/image.rs +++ b/crates/spirv-std/src/image.rs @@ -149,6 +149,8 @@ impl< let mut result = SampledType::Vec4::default(); unsafe { asm! { + "OpDecorate %image NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%coordinate = OpLoad _ {coordinate}", "%result = OpImageFetch typeof*{result} %image %coordinate", @@ -200,6 +202,10 @@ impl< let mut result = SampledType::Vec4::default(); unsafe { asm! { + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%typeSampledImage = OpTypeSampledImage typeof*{this}", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", @@ -230,6 +236,10 @@ impl< unsafe { let mut result = SampledType::Vec4::default(); asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%typeSampledImage = OpTypeSampledImage typeof*{1}", "%image = OpLoad typeof*{1} {1}", "%sampler = OpLoad typeof*{2} {2}", @@ -262,6 +272,10 @@ impl< let mut result = SampledType::Vec4::default(); asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%typeSampledImage = OpTypeSampledImage typeof*{1}", "%image = OpLoad typeof*{1} {1}", "%sampler = OpLoad typeof*{2} {2}", @@ -295,6 +309,10 @@ impl< let mut result = SampledType::Vec4::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%coordinate = OpLoad _ {coordinate}", @@ -328,6 +346,10 @@ impl< let mut result = SampledType::Vec4::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%coordinate = OpLoad _ {coordinate}", @@ -362,6 +384,10 @@ impl< let mut result = Default::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%coordinate = OpLoad _ {coordinate}", @@ -395,6 +421,10 @@ impl< let mut result = Default::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%coordinate = OpLoad _ {coordinate}", @@ -432,6 +462,10 @@ impl< let mut result = Default::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%coordinate = OpLoad _ {coordinate}", @@ -487,6 +521,10 @@ impl< unsafe { let mut result = SampledType::Vec4::default(); asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%project_coordinate = OpLoad _ {project_coordinate}", @@ -517,6 +555,10 @@ impl< let mut result = Default::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%project_coordinate = OpLoad _ {project_coordinate}", @@ -550,6 +592,10 @@ impl< let mut result = Default::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%project_coordinate = OpLoad _ {project_coordinate}", @@ -584,6 +630,10 @@ impl< let mut result = Default::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%project_coordinate = OpLoad _ {project_coordinate}", @@ -617,6 +667,10 @@ impl< let mut result = Default::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%coordinate = OpLoad _ {coordinate}", @@ -654,6 +708,10 @@ impl< let mut result = Default::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%coordinate = OpLoad _ {coordinate}", @@ -710,6 +768,8 @@ impl< unsafe { asm! { + "OpDecorate %image NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%coordinate = OpLoad _ {coordinate}", "%result = OpImageRead typeof*{result} %image %coordinate", @@ -733,14 +793,17 @@ impl< ) where I: Integer, { - asm! { - "%image = OpLoad _ {this}", - "%coordinate = OpLoad _ {coordinate}", - "%texels = OpLoad _ {texels}", - "OpImageWrite %image %coordinate %texels", - this = in(reg) self, - coordinate = in(reg) &coordinate, - texels = in(reg) &texels, + unsafe { + asm! { + "OpDecorate %image NonUniform", + "%image = OpLoad _ {this}", + "%coordinate = OpLoad _ {coordinate}", + "%texels = OpLoad _ {texels}", + "OpImageWrite %image %coordinate %texels", + this = in(reg) self, + coordinate = in(reg) &coordinate, + texels = in(reg) &texels, + } } } } @@ -779,6 +842,8 @@ impl< unsafe { asm! { + "OpDecorate %image NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%coordinate = OpLoad _ {coordinate}", "%result = OpImageRead typeof*{result} %image %coordinate", @@ -802,14 +867,17 @@ impl< ) where I: Integer, { - asm! { - "%image = OpLoad _ {this}", - "%coordinate = OpLoad _ {coordinate}", - "%texels = OpLoad _ {texels}", - "OpImageWrite %image %coordinate %texels", - this = in(reg) self, - coordinate = in(reg) &coordinate, - texels = in(reg) &texels, + unsafe { + asm! { + "OpDecorate %image NonUniform", + "%image = OpLoad _ {this}", + "%coordinate = OpLoad _ {coordinate}", + "%texels = OpLoad _ {texels}", + "OpImageWrite %image %coordinate %texels", + this = in(reg) self, + coordinate = in(reg) &coordinate, + texels = in(reg) &texels, + } } } } @@ -848,13 +916,15 @@ impl< unsafe { asm! { - "%image = OpLoad _ {this}", - "%coordinate = OpLoad _ {coordinate}", - "%result = OpImageRead typeof*{result} %image %coordinate", - "OpStore {result} %result", - this = in(reg) self, - coordinate = in(reg) &coordinate, - result = in(reg) &mut result, + "OpDecorate %image NonUniform", + "OpDecorate %result NonUniform", + "%image = OpLoad _ {this}", + "%coordinate = OpLoad _ {coordinate}", + "%result = OpImageRead typeof*{result} %image %coordinate", + "OpStore {result} %result", + this = in(reg) self, + coordinate = in(reg) &coordinate, + result = in(reg) &mut result, } } @@ -880,13 +950,16 @@ impl< where Self: HasQueryLevels, { - let result: u32; + let mut result = Default::default(); unsafe { asm! { + "OpDecorate %image NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", - "{result} = OpImageQueryLevels typeof{result} %image", + "%result = OpImageQueryLevels typeof*{result} %image", + "OpStore {result} %result", this = in(reg) self, - result = out(reg) result, + result = in(reg) &mut result, } } result @@ -914,6 +987,10 @@ impl< let mut result = Default::default(); unsafe { asm! { + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%typeSampledImage = OpTypeSampledImage typeof*{this}", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", @@ -940,6 +1017,8 @@ impl< let mut result: Size = Default::default(); unsafe { asm! { + "OpDecorate %image NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%result = OpImageQuerySize typeof*{result} %image", "OpStore {result} %result", @@ -984,6 +1063,8 @@ impl< let mut result: Size = Default::default(); unsafe { asm! { + "OpDecorate %image NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%result = OpImageQuerySizeLod typeof*{result} %image {lod}", "OpStore {result} %result", @@ -1019,13 +1100,16 @@ impl< #[crate::macros::gpu_only] #[doc(alias = "OpImageQuerySamples")] pub fn query_samples(&self) -> u32 { - let result: u32; + let mut result = Default::default(); unsafe { asm! { + "OpDecorate %image NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", - "{result} = OpImageQuerySamples typeof{result} %image", + "%result = OpImageQuerySamples typeof*{result} %image", + "OpStore {result} %result", this = in(reg) self, - result = out(reg) result, + result = in(reg) &mut result, } } result @@ -1079,6 +1163,8 @@ impl< let mut result = SampledType::Vec4::default(); unsafe { asm!( + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%sampledImage = OpLoad typeof*{1} {1}", "%coord = OpLoad typeof*{2} {2}", "%result = OpImageSampleImplicitLod typeof*{0} %sampledImage %coord", @@ -1104,6 +1190,8 @@ impl< let mut result = SampledType::Vec4::default(); unsafe { asm!( + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%sampledImage = OpLoad typeof*{1} {1}", "%coord = OpLoad typeof*{2} {2}", "%lod = OpLoad typeof*{3} {3}", @@ -1326,6 +1414,8 @@ impl< let mut result = SampledType::Vec4::default(); unsafe { asm! { + "OpDecorate %image NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%coordinate = OpLoad _ {coordinate}", "%result = OpImageFetch typeof*{result} %image %coordinate $PARAMS", @@ -1356,6 +1446,10 @@ impl< let mut result = SampledType::Vec4::default(); unsafe { asm! { + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%typeSampledImage = OpTypeSampledImage typeof*{this}", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", @@ -1387,6 +1481,10 @@ impl< unsafe { let mut result = SampledType::Vec4::default(); asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%typeSampledImage = OpTypeSampledImage typeof*{this}", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", @@ -1419,6 +1517,10 @@ impl< let mut result = Default::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%coordinate = OpLoad _ {coordinate}", @@ -1451,6 +1553,10 @@ impl< unsafe { let mut result = SampledType::Vec4::default(); asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%project_coordinate = OpLoad _ {project_coordinate}", @@ -1482,6 +1588,10 @@ impl< let mut result = Default::default(); unsafe { asm!( + "OpDecorate %image NonUniform", + "OpDecorate %sampler NonUniform", + "OpDecorate %sampledImage NonUniform", + "OpDecorate %result NonUniform", "%image = OpLoad _ {this}", "%sampler = OpLoad _ {sampler}", "%project_coordinate = OpLoad _ {project_coordinate}", diff --git a/crates/spirv-std/src/runtime_array.rs b/crates/spirv-std/src/runtime_array.rs index 5d5df01dfb..f94c166994 100644 --- a/crates/spirv-std/src/runtime_array.rs +++ b/crates/spirv-std/src/runtime_array.rs @@ -31,15 +31,18 @@ impl RuntimeArray { #[spirv_std_macros::gpu_only] pub unsafe fn index(&self, index: usize) -> &T { // FIXME(eddyb) `let mut result = T::default()` uses (for `asm!`), with this. - let mut result_slot = core::mem::MaybeUninit::uninit(); + let mut result = core::mem::MaybeUninit::uninit(); asm! { - "%result = OpAccessChain _ {arr} {index}", - "OpStore {result_slot} %result", - arr = in(reg) self, - index = in(reg) index, - result_slot = in(reg) result_slot.as_mut_ptr(), + "OpDecorate %index NonUniform", + "OpDecorate %result NonUniform", + "%index = OpLoad _ {index}", + "%result = OpAccessChain typeof*{result} {this} %index", + "OpStore {result} %result", + result = in(reg) result.as_mut_ptr(), + this = in(reg) self, + index = in(reg) &index, } - result_slot.assume_init() + result.assume_init() } /// Index the array, returning a mutable reference to an element. Unfortunately, because the @@ -52,14 +55,17 @@ impl RuntimeArray { #[spirv_std_macros::gpu_only] pub unsafe fn index_mut(&mut self, index: usize) -> &mut T { // FIXME(eddyb) `let mut result = T::default()` uses (for `asm!`), with this. - let mut result_slot = core::mem::MaybeUninit::uninit(); + let mut result = core::mem::MaybeUninit::uninit(); asm! { - "%result = OpAccessChain _ {arr} {index}", - "OpStore {result_slot} %result", - arr = in(reg) self, - index = in(reg) index, - result_slot = in(reg) result_slot.as_mut_ptr(), + "OpDecorate %index NonUniform", + "OpDecorate %result NonUniform", + "%index = OpLoad _ {index}", + "%result = OpAccessChain typeof*{result} {this} %index", + "OpStore {result} %result", + result = in(reg) result.as_mut_ptr(), + this = in(reg) self, + index = in(reg) &index, } - result_slot.assume_init() + result.assume_init() } } diff --git a/tests/compiletests/src/main.rs b/tests/compiletests/src/main.rs index c2947bd35d..ffb42b0577 100644 --- a/tests/compiletests/src/main.rs +++ b/tests/compiletests/src/main.rs @@ -14,7 +14,7 @@ struct Opt { bless: bool, /// The environment to compile to the SPIR-V tests. - #[arg(long, default_value = "spv1.3")] + #[arg(long, default_value = "vulkan1.2")] target_env: String, /// Only run tests that match these filters. diff --git a/tests/compiletests/ui/dis/non_uniform_load.rs b/tests/compiletests/ui/dis/non_uniform_load.rs new file mode 100644 index 0000000000..aaba9d10f5 --- /dev/null +++ b/tests/compiletests/ui/dis/non_uniform_load.rs @@ -0,0 +1,29 @@ +// build-pass +// compile-flags: -Ctarget-feature=+ShaderNonUniform,+ext:SPV_EXT_descriptor_indexing +// compile-flags: -C llvm-args=--disassemble +// normalize-stderr-test "OpSource .*\n" -> "" + +use spirv_std::{ByteAddressableBuffer, RuntimeArray, TypedBuffer, spirv}; + +pub struct BigStruct { + a: u32, + b: u32, + c: u32, + d: u32, + e: u32, + f: u32, +} + +#[spirv(fragment)] +pub fn main( + #[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buf: &RuntimeArray< + TypedBuffer<[u32]>, + >, + #[spirv(flat)] index_in: u32, + out: &mut BigStruct, +) { + unsafe { + let buf = ByteAddressableBuffer::from_slice(buf.index(index_in as usize)); + *out = buf.load(5); + } +} diff --git a/tests/compiletests/ui/dis/non_uniform_load.stderr b/tests/compiletests/ui/dis/non_uniform_load.stderr new file mode 100644 index 0000000000..219b706c1f --- /dev/null +++ b/tests/compiletests/ui/dis/non_uniform_load.stderr @@ -0,0 +1,150 @@ +; SPIR-V +; Version: 1.3 +; Generator: rspirv +; Bound: 69 +OpCapability Shader +OpCapability Float64 +OpCapability Int64 +OpCapability Int16 +OpCapability Int8 +OpCapability ShaderClockKHR +OpCapability ShaderNonUniform +OpExtension "SPV_EXT_descriptor_indexing" +OpExtension "SPV_KHR_shader_clock" +OpMemoryModel Logical Simple +OpEntryPoint Fragment %1 "main" %2 %3 +OpExecutionMode %1 OriginUpperLeft +%4 = OpString "/home/firestar99/workspace/frameworks/rust-gpu/crates/spirv-std/src/byte_addressable_buffer.rs" +%5 = OpString "/home/firestar99/workspace/frameworks/rust-gpu/crates/spirv-std/src/runtime_array.rs" +%6 = OpString "/home/firestar99/workspace/frameworks/rust-gpu/crates/spirv-std/src/typed_buffer.rs" +%7 = OpString "$DIR/non_uniform_load.rs" +OpName %8 "BigStruct" +OpMemberName %8 0 "a" +OpMemberName %8 1 "b" +OpMemberName %8 2 "c" +OpMemberName %8 3 "d" +OpMemberName %8 4 "e" +OpMemberName %8 5 "f" +OpName %2 "index_in" +OpName %9 "buf" +OpName %3 "out" +OpMemberDecorate %8 0 Offset 0 +OpMemberDecorate %8 1 Offset 4 +OpMemberDecorate %8 2 Offset 8 +OpMemberDecorate %8 3 Offset 12 +OpMemberDecorate %8 4 Offset 16 +OpMemberDecorate %8 5 Offset 20 +OpDecorate %2 Flat +OpDecorate %2 Location 0 +OpDecorate %10 ArrayStride 4 +OpDecorate %11 Block +OpMemberDecorate %11 0 Offset 0 +OpDecorate %9 NonWritable +OpDecorate %9 Binding 0 +OpDecorate %9 DescriptorSet 0 +OpDecorate %3 Location 0 +OpDecorate %12 NonUniform +OpDecorate %13 NonUniform +OpDecorate %14 NonUniform +OpDecorate %15 NonUniform +OpDecorate %16 NonUniform +OpDecorate %17 NonUniform +OpDecorate %18 NonUniform +OpDecorate %19 NonUniform +OpDecorate %20 NonUniform +OpDecorate %21 NonUniform +OpDecorate %22 NonUniform +OpDecorate %23 NonUniform +OpDecorate %24 NonUniform +%25 = OpTypeInt 32 0 +%26 = OpTypePointer Input %25 +%8 = OpTypeStruct %25 %25 %25 %25 %25 %25 +%27 = OpTypePointer Output %8 +%28 = OpTypeVoid +%29 = OpTypeFunction %28 +%2 = OpVariable %26 Input +%10 = OpTypeRuntimeArray %25 +%11 = OpTypeStruct %10 +%30 = OpTypePointer StorageBuffer %11 +%31 = OpTypeRuntimeArray %11 +%32 = OpTypePointer StorageBuffer %31 +%9 = OpVariable %32 StorageBuffer +%33 = OpTypePointer StorageBuffer %10 +%34 = OpConstant %25 0 +%35 = OpTypeBool +%36 = OpConstant %25 4 +%37 = OpConstant %25 5 +%38 = OpConstant %25 24 +%39 = OpConstant %25 2 +%40 = OpTypePointer StorageBuffer %25 +%41 = OpConstant %25 1 +%42 = OpConstant %25 3 +%3 = OpVariable %27 Output +%1 = OpFunction %28 None %29 +%43 = OpLabel +OpLine %7 22 4 +%44 = OpLoad %25 %2 +OpLine %5 35 8 +%12 = OpAccessChain %30 %9 %44 +OpLine %6 69 12 +%45 = OpAccessChain %33 %12 %34 +%46 = OpArrayLength %25 %12 0 +OpLine %4 70 7 +%47 = OpIEqual %35 %36 %34 +OpNoLine +OpSelectionMerge %48 None +OpBranchConditional %47 %49 %50 +%49 = OpLabel +OpReturn +%50 = OpLabel +OpBranch %48 +%48 = OpLabel +OpLine %4 70 7 +%51 = OpUMod %25 %37 %36 +%52 = OpIEqual %35 %51 %34 +OpNoLine +OpSelectionMerge %53 None +OpBranchConditional %52 %54 %55 +%54 = OpLabel +OpBranch %53 +%55 = OpLabel +OpReturn +%53 = OpLabel +OpLine %4 74 14 +%56 = OpIMul %25 %46 %36 +OpLine %4 75 7 +%57 = OpIAdd %25 %37 %38 +%58 = OpUGreaterThan %35 %57 %56 +OpNoLine +OpSelectionMerge %59 None +OpBranchConditional %58 %60 %61 +%60 = OpLabel +OpReturn +%61 = OpLabel +OpBranch %59 +%59 = OpLabel +OpLine %4 97 8 +%13 = OpShiftRightLogical %25 %37 %39 +%14 = OpInBoundsAccessChain %40 %45 %13 +%62 = OpLoad %25 %14 +%15 = OpIAdd %25 %13 %41 +%16 = OpInBoundsAccessChain %40 %45 %15 +%63 = OpLoad %25 %16 +%17 = OpIAdd %25 %13 %39 +%18 = OpInBoundsAccessChain %40 %45 %17 +%64 = OpLoad %25 %18 +%19 = OpIAdd %25 %13 %42 +%20 = OpInBoundsAccessChain %40 %45 %19 +%65 = OpLoad %25 %20 +%21 = OpIAdd %25 %13 %36 +%22 = OpInBoundsAccessChain %40 %45 %21 +%66 = OpLoad %25 %22 +%23 = OpIAdd %25 %13 %37 +%24 = OpInBoundsAccessChain %40 %45 %23 +%67 = OpLoad %25 %24 +%68 = OpCompositeConstruct %8 %62 %63 %64 %65 %66 %67 +OpLine %7 27 8 +OpStore %3 %68 +OpNoLine +OpReturn +OpFunctionEnd diff --git a/tests/compiletests/ui/dis/non_uniform_load_mut.rs b/tests/compiletests/ui/dis/non_uniform_load_mut.rs new file mode 100644 index 0000000000..2f0921b4c0 --- /dev/null +++ b/tests/compiletests/ui/dis/non_uniform_load_mut.rs @@ -0,0 +1,29 @@ +// build-pass +// compile-flags: -Ctarget-feature=+ShaderNonUniform,+ext:SPV_EXT_descriptor_indexing +// compile-flags: -C llvm-args=--disassemble +// normalize-stderr-test "OpSource .*\n" -> "" + +use spirv_std::{ByteAddressableBuffer, RuntimeArray, TypedBuffer, spirv}; + +pub struct BigStruct { + a: u32, + b: u32, + c: u32, + d: u32, + e: u32, + f: u32, +} + +#[spirv(fragment)] +pub fn load_mut( + #[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buf: &mut RuntimeArray< + TypedBuffer<[u32]>, + >, + #[spirv(flat)] index_in: u32, + out: &mut BigStruct, +) { + unsafe { + let buf = ByteAddressableBuffer::from_mut_slice(buf.index_mut(index_in as usize)); + *out = buf.load(5); + } +} diff --git a/tests/compiletests/ui/dis/non_uniform_load_mut.stderr b/tests/compiletests/ui/dis/non_uniform_load_mut.stderr new file mode 100644 index 0000000000..9bcc9119b2 --- /dev/null +++ b/tests/compiletests/ui/dis/non_uniform_load_mut.stderr @@ -0,0 +1,149 @@ +; SPIR-V +; Version: 1.3 +; Generator: rspirv +; Bound: 69 +OpCapability Shader +OpCapability Float64 +OpCapability Int64 +OpCapability Int16 +OpCapability Int8 +OpCapability ShaderClockKHR +OpCapability ShaderNonUniform +OpExtension "SPV_EXT_descriptor_indexing" +OpExtension "SPV_KHR_shader_clock" +OpMemoryModel Logical Simple +OpEntryPoint Fragment %1 "load_mut" %2 %3 +OpExecutionMode %1 OriginUpperLeft +%4 = OpString "/home/firestar99/workspace/frameworks/rust-gpu/crates/spirv-std/src/byte_addressable_buffer.rs" +%5 = OpString "/home/firestar99/workspace/frameworks/rust-gpu/crates/spirv-std/src/runtime_array.rs" +%6 = OpString "/home/firestar99/workspace/frameworks/rust-gpu/crates/spirv-std/src/typed_buffer.rs" +%7 = OpString "$DIR/non_uniform_load_mut.rs" +OpName %8 "BigStruct" +OpMemberName %8 0 "a" +OpMemberName %8 1 "b" +OpMemberName %8 2 "c" +OpMemberName %8 3 "d" +OpMemberName %8 4 "e" +OpMemberName %8 5 "f" +OpName %2 "index_in" +OpName %9 "buf" +OpName %3 "out" +OpMemberDecorate %8 0 Offset 0 +OpMemberDecorate %8 1 Offset 4 +OpMemberDecorate %8 2 Offset 8 +OpMemberDecorate %8 3 Offset 12 +OpMemberDecorate %8 4 Offset 16 +OpMemberDecorate %8 5 Offset 20 +OpDecorate %2 Flat +OpDecorate %2 Location 0 +OpDecorate %10 ArrayStride 4 +OpDecorate %11 Block +OpMemberDecorate %11 0 Offset 0 +OpDecorate %9 Binding 0 +OpDecorate %9 DescriptorSet 0 +OpDecorate %3 Location 0 +OpDecorate %12 NonUniform +OpDecorate %13 NonUniform +OpDecorate %14 NonUniform +OpDecorate %15 NonUniform +OpDecorate %16 NonUniform +OpDecorate %17 NonUniform +OpDecorate %18 NonUniform +OpDecorate %19 NonUniform +OpDecorate %20 NonUniform +OpDecorate %21 NonUniform +OpDecorate %22 NonUniform +OpDecorate %23 NonUniform +OpDecorate %24 NonUniform +%25 = OpTypeInt 32 0 +%26 = OpTypePointer Input %25 +%8 = OpTypeStruct %25 %25 %25 %25 %25 %25 +%27 = OpTypePointer Output %8 +%28 = OpTypeVoid +%29 = OpTypeFunction %28 +%2 = OpVariable %26 Input +%10 = OpTypeRuntimeArray %25 +%11 = OpTypeStruct %10 +%30 = OpTypePointer StorageBuffer %11 +%31 = OpTypeRuntimeArray %11 +%32 = OpTypePointer StorageBuffer %31 +%9 = OpVariable %32 StorageBuffer +%33 = OpTypePointer StorageBuffer %10 +%34 = OpConstant %25 0 +%35 = OpTypeBool +%36 = OpConstant %25 4 +%37 = OpConstant %25 5 +%38 = OpConstant %25 24 +%39 = OpConstant %25 2 +%40 = OpTypePointer StorageBuffer %25 +%41 = OpConstant %25 1 +%42 = OpConstant %25 3 +%3 = OpVariable %27 Output +%1 = OpFunction %28 None %29 +%43 = OpLabel +OpLine %7 22 4 +%44 = OpLoad %25 %2 +OpLine %5 59 8 +%12 = OpAccessChain %30 %9 %44 +OpLine %6 89 12 +%45 = OpAccessChain %33 %12 %34 +%46 = OpArrayLength %25 %12 0 +OpLine %4 70 7 +%47 = OpIEqual %35 %36 %34 +OpNoLine +OpSelectionMerge %48 None +OpBranchConditional %47 %49 %50 +%49 = OpLabel +OpReturn +%50 = OpLabel +OpBranch %48 +%48 = OpLabel +OpLine %4 70 7 +%51 = OpUMod %25 %37 %36 +%52 = OpIEqual %35 %51 %34 +OpNoLine +OpSelectionMerge %53 None +OpBranchConditional %52 %54 %55 +%54 = OpLabel +OpBranch %53 +%55 = OpLabel +OpReturn +%53 = OpLabel +OpLine %4 74 14 +%56 = OpIMul %25 %46 %36 +OpLine %4 75 7 +%57 = OpIAdd %25 %37 %38 +%58 = OpUGreaterThan %35 %57 %56 +OpNoLine +OpSelectionMerge %59 None +OpBranchConditional %58 %60 %61 +%60 = OpLabel +OpReturn +%61 = OpLabel +OpBranch %59 +%59 = OpLabel +OpLine %4 97 8 +%13 = OpShiftRightLogical %25 %37 %39 +%14 = OpInBoundsAccessChain %40 %45 %13 +%62 = OpLoad %25 %14 +%15 = OpIAdd %25 %13 %41 +%16 = OpInBoundsAccessChain %40 %45 %15 +%63 = OpLoad %25 %16 +%17 = OpIAdd %25 %13 %39 +%18 = OpInBoundsAccessChain %40 %45 %17 +%64 = OpLoad %25 %18 +%19 = OpIAdd %25 %13 %42 +%20 = OpInBoundsAccessChain %40 %45 %19 +%65 = OpLoad %25 %20 +%21 = OpIAdd %25 %13 %36 +%22 = OpInBoundsAccessChain %40 %45 %21 +%66 = OpLoad %25 %22 +%23 = OpIAdd %25 %13 %37 +%24 = OpInBoundsAccessChain %40 %45 %23 +%67 = OpLoad %25 %24 +%68 = OpCompositeConstruct %8 %62 %63 %64 %65 %66 %67 +OpLine %7 27 8 +OpStore %3 %68 +OpNoLine +OpReturn +OpFunctionEnd diff --git a/tests/compiletests/ui/dis/non_uniform_store.rs b/tests/compiletests/ui/dis/non_uniform_store.rs new file mode 100644 index 0000000000..87c80fbb32 --- /dev/null +++ b/tests/compiletests/ui/dis/non_uniform_store.rs @@ -0,0 +1,29 @@ +// build-pass +// compile-flags: -Ctarget-feature=+ShaderNonUniform,+ext:SPV_EXT_descriptor_indexing +// compile-flags: -C llvm-args=--disassemble +// normalize-stderr-test "OpSource .*\n" -> "" + +use spirv_std::{ByteAddressableBuffer, RuntimeArray, TypedBuffer, spirv}; + +pub struct BigStruct { + a: u32, + b: u32, + c: u32, + d: u32, + e: u32, + f: u32, +} + +#[spirv(fragment)] +pub fn store( + #[spirv(descriptor_set = 0, binding = 0, storage_buffer)] buf: &mut RuntimeArray< + TypedBuffer<[u32]>, + >, + #[spirv(flat)] index_in: u32, + #[spirv(flat)] val: BigStruct, +) { + unsafe { + let mut buf = ByteAddressableBuffer::from_mut_slice(buf.index_mut(index_in as usize)); + buf.store(5, val); + } +} diff --git a/tests/compiletests/ui/dis/non_uniform_store.stderr b/tests/compiletests/ui/dis/non_uniform_store.stderr new file mode 100644 index 0000000000..550714cbdc --- /dev/null +++ b/tests/compiletests/ui/dis/non_uniform_store.stderr @@ -0,0 +1,155 @@ +; SPIR-V +; Version: 1.3 +; Generator: rspirv +; Bound: 69 +OpCapability Shader +OpCapability Float64 +OpCapability Int64 +OpCapability Int16 +OpCapability Int8 +OpCapability ShaderClockKHR +OpCapability ShaderNonUniform +OpExtension "SPV_EXT_descriptor_indexing" +OpExtension "SPV_KHR_shader_clock" +OpMemoryModel Logical Simple +OpEntryPoint Fragment %1 "store" %2 %3 +OpExecutionMode %1 OriginUpperLeft +%4 = OpString "/home/firestar99/workspace/frameworks/rust-gpu/crates/spirv-std/src/byte_addressable_buffer.rs" +%5 = OpString "/home/firestar99/workspace/frameworks/rust-gpu/crates/spirv-std/src/runtime_array.rs" +%6 = OpString "/home/firestar99/workspace/frameworks/rust-gpu/crates/spirv-std/src/typed_buffer.rs" +%7 = OpString "$DIR/non_uniform_store.rs" +OpName %8 "BigStruct" +OpMemberName %8 0 "a" +OpMemberName %8 1 "b" +OpMemberName %8 2 "c" +OpMemberName %8 3 "d" +OpMemberName %8 4 "e" +OpMemberName %8 5 "f" +OpName %2 "index_in" +OpName %3 "val" +OpName %9 "buf" +OpMemberDecorate %8 0 Offset 0 +OpMemberDecorate %8 1 Offset 4 +OpMemberDecorate %8 2 Offset 8 +OpMemberDecorate %8 3 Offset 12 +OpMemberDecorate %8 4 Offset 16 +OpMemberDecorate %8 5 Offset 20 +OpDecorate %2 Flat +OpDecorate %2 Location 0 +OpDecorate %3 Flat +OpDecorate %3 Location 1 +OpDecorate %10 ArrayStride 4 +OpDecorate %11 Block +OpMemberDecorate %11 0 Offset 0 +OpDecorate %9 Binding 0 +OpDecorate %9 DescriptorSet 0 +OpDecorate %12 NonUniform +OpDecorate %13 NonUniform +OpDecorate %14 NonUniform +OpDecorate %15 NonUniform +OpDecorate %16 NonUniform +OpDecorate %17 NonUniform +OpDecorate %18 NonUniform +OpDecorate %19 NonUniform +OpDecorate %20 NonUniform +OpDecorate %21 NonUniform +OpDecorate %22 NonUniform +OpDecorate %23 NonUniform +OpDecorate %24 NonUniform +%25 = OpTypeInt 32 0 +%26 = OpTypePointer Input %25 +%8 = OpTypeStruct %25 %25 %25 %25 %25 %25 +%27 = OpTypePointer Input %8 +%28 = OpTypeVoid +%29 = OpTypeFunction %28 +%2 = OpVariable %26 Input +%3 = OpVariable %27 Input +%10 = OpTypeRuntimeArray %25 +%11 = OpTypeStruct %10 +%30 = OpTypePointer StorageBuffer %11 +%31 = OpTypeRuntimeArray %11 +%32 = OpTypePointer StorageBuffer %31 +%9 = OpVariable %32 StorageBuffer +%33 = OpTypePointer StorageBuffer %10 +%34 = OpConstant %25 0 +%35 = OpTypeBool +%36 = OpConstant %25 4 +%37 = OpConstant %25 5 +%38 = OpConstant %25 24 +%39 = OpConstant %25 2 +%40 = OpTypePointer StorageBuffer %25 +%41 = OpConstant %25 1 +%42 = OpConstant %25 3 +%1 = OpFunction %28 None %29 +%43 = OpLabel +OpLine %7 22 4 +%44 = OpLoad %25 %2 +OpLine %7 23 4 +%45 = OpLoad %8 %3 +OpLine %5 59 8 +%12 = OpAccessChain %30 %9 %44 +OpLine %6 89 12 +%46 = OpAccessChain %33 %12 %34 +%47 = OpArrayLength %25 %12 0 +OpLine %4 70 7 +%48 = OpIEqual %35 %36 %34 +OpNoLine +OpSelectionMerge %49 None +OpBranchConditional %48 %50 %51 +%50 = OpLabel +OpReturn +%51 = OpLabel +OpBranch %49 +%49 = OpLabel +OpLine %4 70 7 +%52 = OpUMod %25 %37 %36 +%53 = OpIEqual %35 %52 %34 +OpNoLine +OpSelectionMerge %54 None +OpBranchConditional %53 %55 %56 +%55 = OpLabel +OpBranch %54 +%56 = OpLabel +OpReturn +%54 = OpLabel +OpLine %4 74 14 +%57 = OpIMul %25 %47 %36 +OpLine %4 75 7 +%58 = OpIAdd %25 %37 %38 +%59 = OpUGreaterThan %35 %58 %57 +OpNoLine +OpSelectionMerge %60 None +OpBranchConditional %59 %61 %62 +%61 = OpLabel +OpReturn +%62 = OpLabel +OpBranch %60 +%60 = OpLabel +OpLine %4 150 8 +%13 = OpShiftRightLogical %25 %37 %39 +%63 = OpCompositeExtract %25 %45 0 +%14 = OpInBoundsAccessChain %40 %46 %13 +OpStore %14 %63 +%64 = OpCompositeExtract %25 %45 1 +%15 = OpIAdd %25 %13 %41 +%16 = OpInBoundsAccessChain %40 %46 %15 +OpStore %16 %64 +%65 = OpCompositeExtract %25 %45 2 +%17 = OpIAdd %25 %13 %39 +%18 = OpInBoundsAccessChain %40 %46 %17 +OpStore %18 %65 +%66 = OpCompositeExtract %25 %45 3 +%19 = OpIAdd %25 %13 %42 +%20 = OpInBoundsAccessChain %40 %46 %19 +OpStore %20 %66 +%67 = OpCompositeExtract %25 %45 4 +%21 = OpIAdd %25 %13 %36 +%22 = OpInBoundsAccessChain %40 %46 %21 +OpStore %22 %67 +%68 = OpCompositeExtract %25 %45 5 +%23 = OpIAdd %25 %13 %37 +%24 = OpInBoundsAccessChain %40 %46 %23 +OpStore %24 %68 +OpNoLine +OpReturn +OpFunctionEnd diff --git a/tests/compiletests/ui/image/gather_err.stderr b/tests/compiletests/ui/image/gather_err.stderr index f3d2f4cfe0..550fdfd018 100644 --- a/tests/compiletests/ui/image/gather_err.stderr +++ b/tests/compiletests/ui/image/gather_err.stderr @@ -9,12 +9,12 @@ error[E0277]: the trait bound `Image: HasGather` is no Image Image note: required by a bound in `Image::::gather` - --> $SPIRV_STD_SRC/image.rs:197:15 + --> $SPIRV_STD_SRC/image.rs:199:15 | -190 | pub fn gather( +192 | pub fn gather( | ------ required by a bound in this associated function ... -197 | Self: HasGather, +199 | Self: HasGather, | ^^^^^^^^^ required by this bound in `Image::::gather` error[E0277]: the trait bound `Image: HasGather` is not satisfied @@ -28,12 +28,12 @@ error[E0277]: the trait bound `Image: HasGather` is no Image Image note: required by a bound in `Image::::gather` - --> $SPIRV_STD_SRC/image.rs:197:15 + --> $SPIRV_STD_SRC/image.rs:199:15 | -190 | pub fn gather( +192 | pub fn gather( | ------ required by a bound in this associated function ... -197 | Self: HasGather, +199 | Self: HasGather, | ^^^^^^^^^ required by this bound in `Image::::gather` error: aborting due to 2 previous errors diff --git a/tests/compiletests/ui/image/query/query_levels_err.stderr b/tests/compiletests/ui/image/query/query_levels_err.stderr index 2f03a3f426..c49926bd05 100644 --- a/tests/compiletests/ui/image/query/query_levels_err.stderr +++ b/tests/compiletests/ui/image/query/query_levels_err.stderr @@ -10,12 +10,12 @@ error[E0277]: the trait bound `Image: HasQueryLevels` Image Image note: required by a bound in `Image::::query_levels` - --> $SPIRV_STD_SRC/image.rs:881:15 + --> $SPIRV_STD_SRC/image.rs:951:15 | -879 | pub fn query_levels(&self) -> u32 +949 | pub fn query_levels(&self) -> u32 | ------------ required by a bound in this associated function -880 | where -881 | Self: HasQueryLevels, +950 | where +951 | Self: HasQueryLevels, | ^^^^^^^^^^^^^^ required by this bound in `Image::::query_levels` error: aborting due to 1 previous error diff --git a/tests/compiletests/ui/image/query/query_lod_err.stderr b/tests/compiletests/ui/image/query/query_lod_err.stderr index 0b6a9a052c..e985e690b5 100644 --- a/tests/compiletests/ui/image/query/query_lod_err.stderr +++ b/tests/compiletests/ui/image/query/query_lod_err.stderr @@ -10,12 +10,12 @@ error[E0277]: the trait bound `Image: HasQueryLevels` Image Image note: required by a bound in `Image::::query_lod` - --> $SPIRV_STD_SRC/image.rs:907:15 + --> $SPIRV_STD_SRC/image.rs:980:15 | -901 | pub fn query_lod( +974 | pub fn query_lod( | --------- required by a bound in this associated function ... -907 | Self: HasQueryLevels, +980 | Self: HasQueryLevels, | ^^^^^^^^^^^^^^ required by this bound in `Image::::query_lod` error: aborting due to 1 previous error diff --git a/tests/compiletests/ui/image/query/query_size_err.stderr b/tests/compiletests/ui/image/query/query_size_err.stderr index 4c3dca3c39..c94971162e 100644 --- a/tests/compiletests/ui/image/query/query_size_err.stderr +++ b/tests/compiletests/ui/image/query/query_size_err.stderr @@ -1,27 +1,27 @@ error[E0277]: the trait bound `Image: HasQuerySize` is not satisfied - --> $DIR/query_size_err.rs:12:21 - | -12 | *output = image.query_size(); - | ^^^^^^^^^^ the trait `HasQuerySize` is not implemented for `Image` - | - = help: the following other types implement trait `HasQuerySize`: - Image - Image - Image - Image - Image - Image - Image - Image - and 6 others + --> $DIR/query_size_err.rs:12:21 + | +12 | *output = image.query_size(); + | ^^^^^^^^^^ the trait `HasQuerySize` is not implemented for `Image` + | + = help: the following other types implement trait `HasQuerySize`: + Image + Image + Image + Image + Image + Image + Image + Image + and 6 others note: required by a bound in `Image::::query_size` - --> $SPIRV_STD_SRC/image.rs:938:15 - | -936 | pub fn query_size + Default>(&self) -> Size - | ---------- required by a bound in this associated function -937 | where -938 | Self: HasQuerySize, - | ^^^^^^^^^^^^ required by this bound in `Image::::query_size` + --> $SPIRV_STD_SRC/image.rs:1015:15 + | +1013 | pub fn query_size + Default>(&self) -> Size + | ---------- required by a bound in this associated function +1014 | where +1015 | Self: HasQuerySize, + | ^^^^^^^^^^^^ required by this bound in `Image::::query_size` error: aborting due to 1 previous error diff --git a/tests/compiletests/ui/image/query/query_size_lod_err.stderr b/tests/compiletests/ui/image/query/query_size_lod_err.stderr index 1b097f3f9c..bbad070b0a 100644 --- a/tests/compiletests/ui/image/query/query_size_lod_err.stderr +++ b/tests/compiletests/ui/image/query/query_size_lod_err.stderr @@ -1,22 +1,22 @@ error[E0277]: the trait bound `Image: HasQuerySizeLod` is not satisfied - --> $DIR/query_size_lod_err.rs:12:21 - | -12 | *output = image.query_size_lod(0); - | ^^^^^^^^^^^^^^ the trait `HasQuerySizeLod` is not implemented for `Image` - | - = help: the following other types implement trait `HasQuerySizeLod`: - Image - Image - Image - Image + --> $DIR/query_size_lod_err.rs:12:21 + | +12 | *output = image.query_size_lod(0); + | ^^^^^^^^^^^^^^ the trait `HasQuerySizeLod` is not implemented for `Image` + | + = help: the following other types implement trait `HasQuerySizeLod`: + Image + Image + Image + Image note: required by a bound in `Image::::query_size_lod` - --> $SPIRV_STD_SRC/image.rs:982:15 - | -977 | pub fn query_size_lod + Default>( - | -------------- required by a bound in this associated function + --> $SPIRV_STD_SRC/image.rs:1061:15 + | +1056 | pub fn query_size_lod + Default>( + | -------------- required by a bound in this associated function ... -982 | Self: HasQuerySizeLod, - | ^^^^^^^^^^^^^^^ required by this bound in `Image::::query_size_lod` +1061 | Self: HasQuerySizeLod, + | ^^^^^^^^^^^^^^^ required by this bound in `Image::::query_size_lod` error: aborting due to 1 previous error diff --git a/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.stderr b/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.stderr index e4000bd415..9403b250ee 100644 --- a/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.stderr +++ b/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.stderr @@ -10,12 +10,12 @@ error[E0277]: the trait bound `Image: HasQuerySizeLod` Image Image note: required by a bound in `SampledImage::>::query_size_lod` - --> /image.rs:1138:12 + --> /image.rs:1226:12 | -1124 | pub fn query_size_lod + Default>( +1212 | pub fn query_size_lod + Default>( | -------------- required by a bound in this associated function ... -1138 | >: HasQuerySizeLod, +1226 | >: HasQuerySizeLod, | ^^^^^^^^^^^^^^^ required by this bound in `SampledImage::>::query_size_lod` error: aborting due to 1 previous error