mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-25 08:14:12 +00:00
tests: remove not_spirt
test variants.
This commit is contained in:
parent
174692bd8d
commit
6b49cb1d51
@ -125,16 +125,25 @@ impl Runner {
|
||||
.join(" ")
|
||||
}
|
||||
|
||||
for (env, spirt) in self
|
||||
struct Variation {
|
||||
name: &'static str,
|
||||
extra_flags: &'static str,
|
||||
}
|
||||
const VARIATIONS: &[Variation] = &[Variation {
|
||||
name: "spirt",
|
||||
extra_flags: "",
|
||||
}];
|
||||
|
||||
for (env, variation) in self
|
||||
.opt
|
||||
.environments()
|
||||
.flat_map(|env| [(env, false), (env, true)])
|
||||
.flat_map(|env| VARIATIONS.iter().map(move |variation| (env, variation)))
|
||||
{
|
||||
// HACK(eddyb) in order to allow *some* tests to have separate output
|
||||
// with the SPIR-T support enabled (via `--spirt`), while keeping
|
||||
// *most* of the tests unchanged, we take advantage of "stage IDs",
|
||||
// in different testing variations (i.e. experimental features), while
|
||||
// keeping *most* of the tests unchanged, we make use of "stage IDs",
|
||||
// which offer `// only-S` and `// ignore-S` for any stage ID `S`.
|
||||
let stage_id = if spirt { "spirt" } else { "not_spirt" };
|
||||
let stage_id = variation.name;
|
||||
|
||||
let target = format!("{TARGET_PREFIX}{env}");
|
||||
let libs = build_deps(&self.deps_target_dir, &self.codegen_backend_path, &target);
|
||||
@ -150,9 +159,7 @@ impl Runner {
|
||||
.join(DepKind::ProcMacro.target_dir_suffix(&target)),
|
||||
],
|
||||
);
|
||||
if !spirt {
|
||||
flags += " -Cllvm-args=--no-spirt";
|
||||
}
|
||||
flags += variation.extra_flags;
|
||||
|
||||
let config = compiletest::Config {
|
||||
stage_id: stage_id.to_string(),
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %8 11 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %9 11 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %8 11 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %9 11 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %8 10 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=workgroup_memory_barrier::workgroup_memory_barrier
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %8 10 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=workgroup_memory_barrier_with_group_sync::workgroup_memory_barrier_with_group_sync
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %7 10 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=add_two_ints::add_two_ints
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %5 18 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=asm::asm
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %7 20 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=asm_add_two_ints::add_two_ints
|
||||
|
@ -1,50 +0,0 @@
|
||||
// HACK(eddyb) duplicate of asm_op_decorate.spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-not_spirt
|
||||
#![crate_name = "asm_op_decorate"]
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C target-feature=+RuntimeDescriptorArray,+ext:SPV_EXT_descriptor_indexing
|
||||
// compile-flags: -C llvm-args=--disassemble-globals
|
||||
// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> ""
|
||||
// normalize-stderr-test "OpSource .*\n" -> ""
|
||||
// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> ""
|
||||
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"
|
||||
|
||||
// FIXME(eddyb) this should use revisions to track both the `vulkan1.2` output
|
||||
// and the pre-`vulkan1.2` output, but per-revisions `{only,ignore}-*` directives
|
||||
// are not supported in `compiletest-rs`.
|
||||
// ignore-vulkan1.2
|
||||
|
||||
use core::arch::asm;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn add_decorate() {
|
||||
unsafe {
|
||||
let offset = 1u32;
|
||||
asm!(
|
||||
"OpDecorate %image_2d_var DescriptorSet 0",
|
||||
"OpDecorate %image_2d_var Binding 0",
|
||||
"%uint = OpTypeInt 32 0",
|
||||
"%float = OpTypeFloat 32",
|
||||
"%uint_0 = OpConstant %uint 0",
|
||||
"%image_2d = OpTypeImage %float Dim2D 0 0 0 1 Unknown",
|
||||
"%sampled_image_2d = OpTypeSampledImage %image_2d",
|
||||
"%image_array = OpTypeRuntimeArray %sampled_image_2d",
|
||||
// NOTE(eddyb) `Generic` is used here because it's the placeholder
|
||||
// for storage class inference - both of the two `OpTypePointer`
|
||||
// types below should end up inferring to `UniformConstant`.
|
||||
"%ptr_image_array = OpTypePointer Generic %image_array",
|
||||
"%image_2d_var = OpVariable %ptr_image_array UniformConstant",
|
||||
"%ptr_sampled_image_2d = OpTypePointer Generic %sampled_image_2d",
|
||||
"", // ^^ type preamble
|
||||
"%offset = OpLoad _ {0}",
|
||||
"%24 = OpAccessChain %ptr_sampled_image_2d %image_2d_var %offset",
|
||||
"%25 = OpLoad %sampled_image_2d %24",
|
||||
in(reg) &offset,
|
||||
);
|
||||
}
|
||||
}
|
||||
#[spirv(fragment)]
|
||||
pub fn main() {
|
||||
add_decorate();
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
OpCapability Float64
|
||||
OpCapability Int16
|
||||
OpCapability Int64
|
||||
OpCapability Int8
|
||||
OpCapability RuntimeDescriptorArray
|
||||
OpCapability ShaderClockKHR
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_EXT_descriptor_indexing"
|
||||
OpExtension "SPV_KHR_shader_clock"
|
||||
OpMemoryModel Logical Simple
|
||||
OpEntryPoint Fragment %1 "main"
|
||||
OpExecutionMode %1 OriginUpperLeft
|
||||
%2 = OpString "$OPSTRING_FILENAME/asm_op_decorate.not_spirt.rs"
|
||||
OpName %3 "asm_op_decorate::add_decorate"
|
||||
OpName %4 "asm_op_decorate::main"
|
||||
OpDecorate %5 ArrayStride 4
|
||||
OpDecorate %6 DescriptorSet 0
|
||||
OpDecorate %6 Binding 0
|
||||
%7 = OpTypeVoid
|
||||
%8 = OpTypeFunction %7
|
||||
%9 = OpTypeInt 32 0
|
||||
%10 = OpConstant %9 1
|
||||
%11 = OpTypeFloat 32
|
||||
%12 = OpTypeImage %11 2D 0 0 0 1 Unknown
|
||||
%13 = OpTypeSampledImage %12
|
||||
%5 = OpTypeRuntimeArray %13
|
||||
%14 = OpTypePointer UniformConstant %5
|
||||
%6 = OpVariable %14 UniformConstant
|
||||
%15 = OpTypePointer UniformConstant %13
|
@ -1,5 +1,5 @@
|
||||
// HACK(eddyb) duplicate of asm_op_decorate.not_spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-spirt
|
||||
|
||||
|
||||
#![crate_name = "asm_op_decorate"]
|
||||
|
||||
// build-pass
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %12 60 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -Ctarget-feature=+RuntimeDescriptorArray,+ext:SPV_EXT_descriptor_indexing
|
||||
|
@ -1,15 +0,0 @@
|
||||
// HACK(eddyb) duplicate of custom_entry_point.spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-not_spirt
|
||||
#![crate_name = "custom_entry_point"]
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-globals
|
||||
// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> ""
|
||||
// normalize-stderr-test "OpSource .*\n" -> ""
|
||||
// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> ""
|
||||
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"
|
||||
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment(entry_point_name = "hello_world"))]
|
||||
pub fn main() {}
|
@ -1,14 +0,0 @@
|
||||
OpCapability Float64
|
||||
OpCapability Int16
|
||||
OpCapability Int64
|
||||
OpCapability Int8
|
||||
OpCapability ShaderClockKHR
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_shader_clock"
|
||||
OpMemoryModel Logical Simple
|
||||
OpEntryPoint Fragment %1 "hello_world"
|
||||
OpExecutionMode %1 OriginUpperLeft
|
||||
%2 = OpString "$OPSTRING_FILENAME/custom_entry_point.not_spirt.rs"
|
||||
OpName %3 "custom_entry_point::main"
|
||||
%4 = OpTypeVoid
|
||||
%5 = OpTypeFunction %4
|
@ -1,5 +1,5 @@
|
||||
// HACK(eddyb) duplicate of custom_entry_point.not_spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-spirt
|
||||
|
||||
|
||||
#![crate_name = "custom_entry_point"]
|
||||
|
||||
// build-pass
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %5 18 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// This is a similar setup to the `issue-731` test, but instead of "just" the
|
||||
// missing copy out of the global (`Input`) `OpVariable`, small enough types
|
||||
|
@ -1,24 +0,0 @@
|
||||
// HACK(eddyb) duplicate of generic-fn-op-name.spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-not_spirt
|
||||
#![crate_name = "generic_fn_op_name"]
|
||||
//
|
||||
// Test that generic functions' `OpName` correctly include generic arguments.
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-globals
|
||||
// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> ""
|
||||
// normalize-stderr-test "OpSource .*\n" -> ""
|
||||
// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> ""
|
||||
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"
|
||||
#![feature(adt_const_params)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
use spirv_std::image::Dimensionality;
|
||||
use spirv_std::spirv;
|
||||
|
||||
fn generic<T, const DIM: Dimensionality>() {}
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main() {
|
||||
generic::<f32, { Dimensionality::TwoD }>();
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
OpCapability Float64
|
||||
OpCapability Int16
|
||||
OpCapability Int64
|
||||
OpCapability Int8
|
||||
OpCapability ShaderClockKHR
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_shader_clock"
|
||||
OpMemoryModel Logical Simple
|
||||
OpEntryPoint Fragment %1 "main"
|
||||
OpExecutionMode %1 OriginUpperLeft
|
||||
%2 = OpString "$OPSTRING_FILENAME/generic-fn-op-name.not_spirt.rs"
|
||||
OpName %3 "generic_fn_op_name::generic::<f32, {spirv_std_types::image_params::Dimensionality::TwoD}>"
|
||||
OpName %4 "generic_fn_op_name::main"
|
||||
%5 = OpTypeVoid
|
||||
%6 = OpTypeFunction %5
|
@ -1,5 +1,5 @@
|
||||
// HACK(eddyb) duplicate of generic-fn-op-name.not_spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-spirt
|
||||
|
||||
|
||||
#![crate_name = "generic_fn_op_name"]
|
||||
//
|
||||
// Test that generic functions' `OpName` correctly include generic arguments.
|
||||
|
@ -1,14 +0,0 @@
|
||||
// HACK(eddyb) duplicate of index_user_dst.spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-not_spirt
|
||||
#![crate_name = "index_user_dst"]
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-entry=main
|
||||
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] slice: &mut [f32]) {
|
||||
let float: f32 = slice[0];
|
||||
let _ = float;
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
%1 = OpFunction %2 None %3
|
||||
%4 = OpLabel
|
||||
OpLine %5 11 12
|
||||
%6 = OpAccessChain %7 %8 %9
|
||||
%10 = OpArrayLength %11 %8 0
|
||||
OpLine %5 12 21
|
||||
%12 = OpULessThan %13 %9 %10
|
||||
OpLine %5 12 21
|
||||
OpSelectionMerge %14 None
|
||||
OpBranchConditional %12 %15 %16
|
||||
%15 = OpLabel
|
||||
OpLine %5 12 21
|
||||
%17 = OpInBoundsAccessChain %18 %6 %9
|
||||
%19 = OpLoad %20 %17
|
||||
OpLine %5 14 1
|
||||
OpReturn
|
||||
%16 = OpLabel
|
||||
OpLine %5 12 21
|
||||
OpBranch %21
|
||||
%21 = OpLabel
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
%23 = OpPhi %13 %24 %21 %24 %25
|
||||
OpLoopMerge %26 %25 None
|
||||
OpBranchConditional %23 %27 %26
|
||||
%27 = OpLabel
|
||||
OpBranch %25
|
||||
%25 = OpLabel
|
||||
OpBranch %22
|
||||
%26 = OpLabel
|
||||
OpUnreachable
|
||||
%14 = OpLabel
|
||||
OpUnreachable
|
||||
OpFunctionEnd
|
@ -1,5 +1,5 @@
|
||||
// HACK(eddyb) duplicate of index_user_dst.not_spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-spirt
|
||||
|
||||
|
||||
#![crate_name = "index_user_dst"]
|
||||
|
||||
// build-pass
|
||||
|
@ -1,27 +0,0 @@
|
||||
// HACK(eddyb) duplicate of issue-373.spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-not_spirt
|
||||
#![crate_name = "issue_373"]
|
||||
|
||||
// Test that returning a single-scalar-field `#[repr(C)] struct` doesn't generate
|
||||
// unsupported pointer casts (the problem was the use of `PassMode::Cast`, through
|
||||
// the default Rust ABI adjustments, that we now override through query hooks).
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-entry=main
|
||||
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct S {
|
||||
x: f32,
|
||||
}
|
||||
|
||||
fn f() -> S {
|
||||
S { x: 2.0 }
|
||||
}
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(out: &mut f32) {
|
||||
*out = f().x;
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
%1 = OpFunction %2 None %3
|
||||
%4 = OpLabel
|
||||
OpLine %5 26 11
|
||||
%6 = OpFunctionCall %7 %8
|
||||
OpLine %5 26 11
|
||||
%9 = OpCompositeExtract %10 %6 0
|
||||
OpLine %5 26 4
|
||||
OpStore %11 %9
|
||||
OpLine %5 27 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -1,5 +1,5 @@
|
||||
// HACK(eddyb) duplicate of issue-373.not_spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-spirt
|
||||
|
||||
|
||||
#![crate_name = "issue_373"]
|
||||
|
||||
// Test that returning a single-scalar-field `#[repr(C)] struct` doesn't generate
|
||||
|
@ -1,27 +0,0 @@
|
||||
// HACK(eddyb) duplicate of issue-723-output.spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-not_spirt
|
||||
#![crate_name = "issue_723_output"]
|
||||
|
||||
// Test that interface (global) `OpVariable`s mentioned by `OpEntryPoint` don't
|
||||
// have to be used by the shader, for storage class inference to succeed.
|
||||
|
||||
// NOTE(eddyb) this relies on two subtleties (in order to fail without the fix):
|
||||
// * disabling debuginfo (to prevent `%x.dbg.spill` stack slot generation)
|
||||
// * this could be alleviated in the future if we clean up how debuginfo
|
||||
// is handled in `rustc_codegen_ssa`, to not assume LLVM limitations
|
||||
// * it probably needs to stay like this, to ensure the parameter is unused
|
||||
// * `Output`s being handled with `&mut`, instead of by-value returns
|
||||
// * if this changes, this test will likely need >=1.4 SPIR-V, which supports
|
||||
// all interface `OpVariables` in `OpEntryPoint`, not just `Input`/`Output`
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C debuginfo=0 -C llvm-args=--disassemble-globals
|
||||
// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> ""
|
||||
// normalize-stderr-test "OpSource .*\n" -> ""
|
||||
// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> ""
|
||||
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"
|
||||
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(/* unused Output */ _: &mut glam::Vec4) {}
|
@ -1,19 +0,0 @@
|
||||
OpCapability Float64
|
||||
OpCapability Int16
|
||||
OpCapability Int64
|
||||
OpCapability Int8
|
||||
OpCapability ShaderClockKHR
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_shader_clock"
|
||||
OpMemoryModel Logical Simple
|
||||
OpEntryPoint Fragment %1 "main" %2
|
||||
OpExecutionMode %1 OriginUpperLeft
|
||||
%3 = OpString "$OPSTRING_FILENAME/issue-723-output.not_spirt.rs"
|
||||
OpName %4 "issue_723_output::main"
|
||||
OpDecorate %2 Location 0
|
||||
%5 = OpTypeVoid
|
||||
%6 = OpTypeFloat 32
|
||||
%7 = OpTypeVector %6 4
|
||||
%8 = OpTypePointer Output %7
|
||||
%9 = OpTypeFunction %5
|
||||
%2 = OpVariable %8 Output
|
@ -1,5 +1,5 @@
|
||||
// HACK(eddyb) duplicate of issue-723-output.not_spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-spirt
|
||||
|
||||
|
||||
#![crate_name = "issue_723_output"]
|
||||
|
||||
// Test that interface (global) `OpVariable`s mentioned by `OpEntryPoint` don't
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %5 16 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// Test that non-immediate (i.e. not one of scalar/scalar-pair/vector) inputs
|
||||
// get properly copied out of the global (`Input`) `OpVariable` and mutation is
|
||||
|
@ -1,34 +0,0 @@
|
||||
// HACK(eddyb) duplicate of non-writable-storage_buffer.spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-not_spirt
|
||||
#![crate_name = "non_writable_storage_buffer"]
|
||||
|
||||
// Tests that only `&T` (where `T: Freeze`) storage buffers get `NonWritable`.
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-globals
|
||||
// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> ""
|
||||
// normalize-stderr-test "OpSource .*\n" -> ""
|
||||
// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> ""
|
||||
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"
|
||||
|
||||
// FIXME(eddyb) this should use revisions to track both the `vulkan1.2` output
|
||||
// and the pre-`vulkan1.2` output, but per-revisions `{only,ignore}-*` directives
|
||||
// are not supported in `compiletest-rs`.
|
||||
// ignore-vulkan1.2
|
||||
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(
|
||||
#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] buf_imm: &u32,
|
||||
#[spirv(storage_buffer, descriptor_set = 0, binding = 1)] buf_mut: &mut u32,
|
||||
// FIXME(eddyb) use `AtomicU32` when methods on that work.
|
||||
#[spirv(storage_buffer, descriptor_set = 0, binding = 2)]
|
||||
buf_interior_mut: &core::cell::UnsafeCell<u32>,
|
||||
) {
|
||||
let x = *buf_imm;
|
||||
*buf_mut = x;
|
||||
unsafe {
|
||||
*buf_interior_mut.get() = x;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
OpCapability Float64
|
||||
OpCapability Int16
|
||||
OpCapability Int64
|
||||
OpCapability Int8
|
||||
OpCapability ShaderClockKHR
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_shader_clock"
|
||||
OpMemoryModel Logical Simple
|
||||
OpEntryPoint Fragment %1 "main"
|
||||
OpExecutionMode %1 OriginUpperLeft
|
||||
%2 = OpString "$OPSTRING_FILENAME/cell.rs"
|
||||
%3 = OpString "$OPSTRING_FILENAME/non-writable-storage_buffer.not_spirt.rs"
|
||||
OpName %4 "buf_imm"
|
||||
OpName %5 "buf_mut"
|
||||
OpName %6 "buf_interior_mut"
|
||||
OpDecorate %4 NonWritable
|
||||
OpDecorate %7 Block
|
||||
OpMemberDecorate %7 0 Offset 0
|
||||
OpDecorate %4 DescriptorSet 0
|
||||
OpDecorate %4 Binding 0
|
||||
OpDecorate %5 DescriptorSet 0
|
||||
OpDecorate %5 Binding 1
|
||||
OpDecorate %6 DescriptorSet 0
|
||||
OpDecorate %6 Binding 2
|
||||
%8 = OpTypeInt 32 0
|
||||
%9 = OpTypePointer StorageBuffer %8
|
||||
%10 = OpTypeVoid
|
||||
%11 = OpTypeFunction %10
|
||||
%7 = OpTypeStruct %8
|
||||
%12 = OpTypePointer StorageBuffer %7
|
||||
%13 = OpConstant %8 0
|
||||
%4 = OpVariable %12 StorageBuffer
|
||||
%5 = OpVariable %12 StorageBuffer
|
||||
%6 = OpVariable %12 StorageBuffer
|
@ -1,5 +1,5 @@
|
||||
// HACK(eddyb) duplicate of non-writable-storage_buffer.not_spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-spirt
|
||||
|
||||
|
||||
#![crate_name = "non_writable_storage_buffer"]
|
||||
|
||||
// Tests that only `&T` (where `T: Freeze`) storage buffers get `NonWritable`.
|
||||
|
@ -1,34 +0,0 @@
|
||||
// HACK(eddyb) duplicate of pass-mode-cast-struct.spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-not_spirt
|
||||
#![crate_name = "pass_mode_cast_struct"]
|
||||
|
||||
// Test that a small enough `struct` doesn't generate unsupported pointer casts.
|
||||
// (Just like `issue-373`, the problem was the use of `PassMode::Cast`, through
|
||||
// the default Rust ABI adjustments, that we now override through query hooks)
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-entry=main
|
||||
|
||||
use spirv_std::spirv;
|
||||
|
||||
struct Foo {
|
||||
a: u32,
|
||||
b: u8,
|
||||
c: u8,
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
fn unpack(data: u64) -> Self {
|
||||
Self {
|
||||
a: (data >> 16 & 0xffffff) as u32,
|
||||
b: (data & 0xff >> 8) as u8,
|
||||
c: (data & 0xff) as u8,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(#[spirv(flat)] in_packed: u64, out_sum: &mut u32) {
|
||||
let foo = Foo::unpack(in_packed);
|
||||
*out_sum = foo.a + (foo.b + foo.c) as u32;
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
%1 = OpFunction %2 None %3
|
||||
%4 = OpLabel
|
||||
OpLine %5 31 12
|
||||
%6 = OpLoad %7 %8
|
||||
OpLine %5 32 14
|
||||
%9 = OpFunctionCall %10 %11 %6
|
||||
OpLine %5 33 15
|
||||
%12 = OpCompositeExtract %13 %9 0
|
||||
OpLine %5 33 24
|
||||
%14 = OpCompositeExtract %15 %9 1
|
||||
OpLine %5 33 32
|
||||
%16 = OpCompositeExtract %15 %9 2
|
||||
OpLine %5 33 23
|
||||
%17 = OpIAdd %15 %14 %16
|
||||
OpLine %5 33 23
|
||||
%18 = OpUConvert %13 %17
|
||||
OpLine %5 33 4
|
||||
%19 = OpIAdd %13 %12 %18
|
||||
OpStore %20 %19
|
||||
OpLine %5 34 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -1,5 +1,5 @@
|
||||
// HACK(eddyb) duplicate of pass-mode-cast-struct.not_spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-spirt
|
||||
|
||||
|
||||
#![crate_name = "pass_mode_cast_struct"]
|
||||
|
||||
// Test that a small enough `struct` doesn't generate unsupported pointer casts.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %8 32 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// revisions: normal via_intrinsic
|
||||
//[normal] build-fail
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %11 10 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=ptr_read::copy_via_raw_ptr
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %11 10 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=ptr_read_method::copy_via_raw_ptr
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %8 10 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=ptr_write::copy_via_raw_ptr
|
||||
|
@ -1,4 +1,4 @@
|
||||
// normalize-stderr-not_spirt "OpLine %8 10 1" -> "OpNoLine"
|
||||
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-fn=ptr_write_method::copy_via_raw_ptr
|
||||
|
@ -3,9 +3,9 @@
|
||||
// we care more that the error messages do not regress too much.
|
||||
|
||||
// build-fail
|
||||
// normalize-stderr-not_spirt "36\[%36\]" -> "$$ID[%$$ID]"
|
||||
// normalize-stderr-spirt "38\[%38\]" -> "$$ID[%$$ID]"
|
||||
// normalize-stderr-test "(note: module `.*)\.(not_spirt|spirt)`" -> "$1.{not_spirt,spirt}`"
|
||||
|
||||
// normalize-stderr-test "38\[%38\]" -> "$$ID[%$$ID]"
|
||||
|
||||
|
||||
use spirv_std::spirv;
|
||||
|
||||
|
@ -5,7 +5,7 @@ warning: `#[inline(never)]` function `member_ref_arg_broken::h_newtyped` needs t
|
||||
error: error:0:0 - OpLoad Pointer <id> '$ID[%$ID]' is not a logical pointer.
|
||||
|
|
||||
= note: spirv-val failed
|
||||
= note: module `$TEST_BUILD_DIR/lang/core/ref/member_ref_arg-broken.{not_spirt,spirt}`
|
||||
= note: module `$TEST_BUILD_DIR/lang/core/ref/member_ref_arg-broken.spirt`
|
||||
|
||||
error: aborting due to previous error; 2 warnings emitted
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
// HACK(eddyb) duplicate of unwrap_or.spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-not_spirt
|
||||
#![crate_name = "unwrap_or"]
|
||||
|
||||
// unwrap_or generates some memory-bools (as u8). Test to make sure they're fused away.
|
||||
// OpINotEqual, as well as %bool, should not appear in the output.
|
||||
|
||||
// build-pass
|
||||
// compile-flags: -C llvm-args=--disassemble-entry=main
|
||||
|
||||
use spirv_std::spirv;
|
||||
|
||||
#[spirv(fragment)]
|
||||
pub fn main(out: &mut u32) {
|
||||
*out = None.unwrap_or(15);
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
%1 = OpFunction %2 None %3
|
||||
%4 = OpLabel
|
||||
OpLine %5 15 11
|
||||
%6 = OpCompositeInsert %7 %8 %9 0
|
||||
OpLine %5 15 11
|
||||
%10 = OpCompositeExtract %11 %6 1
|
||||
OpLine %12 967 14
|
||||
%13 = OpBitcast %14 %8
|
||||
OpLine %12 967 8
|
||||
%15 = OpIEqual %16 %13 %17
|
||||
OpSelectionMerge %18 None
|
||||
OpBranchConditional %15 %19 %20
|
||||
%19 = OpLabel
|
||||
OpLine %12 969 20
|
||||
OpBranch %18
|
||||
%20 = OpLabel
|
||||
OpLine %12 968 23
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
%21 = OpPhi %16 %22 %19 %23 %20
|
||||
%24 = OpPhi %11 %25 %19 %10 %20
|
||||
OpLine %12 971 4
|
||||
OpSelectionMerge %26 None
|
||||
OpBranchConditional %21 %27 %28
|
||||
%27 = OpLabel
|
||||
OpLine %12 971 4
|
||||
OpBranch %26
|
||||
%28 = OpLabel
|
||||
OpBranch %26
|
||||
%26 = OpLabel
|
||||
OpLine %5 15 4
|
||||
OpStore %29 %24
|
||||
OpLine %5 16 1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
@ -1,5 +1,5 @@
|
||||
// HACK(eddyb) duplicate of unwrap_or.not_spirt.rs because only-/ignore- do not work with revisions.
|
||||
// only-spirt
|
||||
|
||||
|
||||
#![crate_name = "unwrap_or"]
|
||||
|
||||
// unwrap_or generates some memory-bools (as u8). Test to make sure they're fused away.
|
||||
|
Loading…
Reference in New Issue
Block a user