Skip to content

Commit 80f5532

Browse files
authored
Make read_clock_khr always available (#310)
* spirv-std: never disable `read_shader_clock()` intrinsics based on target features * compiletest: remove ShaderClockKHR from implied target features, naga does not support it * compiletest: remove useless env gates from `spec_constant-attr` * compiletest: write out the env it's testing
1 parent 598682c commit 80f5532

16 files changed

+3
-49
lines changed

crates/spirv-std/src/arch.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,6 @@ pub fn kill() -> ! {
147147
///
148148
/// See:
149149
/// <https://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/master/extensions/KHR/SPV_KHR_shader_clock.html>
150-
#[cfg(all(
151-
target_feature = "Int64",
152-
target_feature = "ShaderClockKHR",
153-
target_feature = "ext:SPV_KHR_shader_clock"
154-
))]
155150
#[spirv_std_macros::gpu_only]
156151
#[doc(alias = "OpReadClockKHR")]
157152
pub unsafe fn read_clock_khr<const SCOPE: u32>() -> u64 {
@@ -172,10 +167,6 @@ pub unsafe fn read_clock_khr<const SCOPE: u32>() -> u64 {
172167
/// capability. It returns a 'vector of two-components of 32-bit unsigned
173168
/// integer type with the first component containing the 32 least significant
174169
/// bits and the second component containing the 32 most significant bits.'
175-
#[cfg(all(
176-
target_feature = "ShaderClockKHR",
177-
target_feature = "ext:SPV_KHR_shader_clock"
178-
))]
179170
#[spirv_std_macros::gpu_only]
180171
#[doc(alias = "OpReadClockKHR")]
181172
pub unsafe fn read_clock_uvec2_khr<V: Vector<u32, 2>, const SCOPE: u32>() -> V {

tests/compiletests/src/main.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ impl Runner {
151151
format!("{}-{}", env, variation.name)
152152
};
153153

154+
println!("Testing env: {}\n", stage_id);
155+
154156
let target = format!("{SPIRV_TARGET_PREFIX}{env}");
155157
let libs = build_deps(&self.deps_target_dir, &self.codegen_backend_path, &target);
156158
let mut flags = test_rustc_flags(&self.codegen_backend_path, &libs, &[
@@ -342,15 +344,7 @@ struct TestDeps {
342344
/// The RUSTFLAGS passed to all SPIR-V builds.
343345
// FIXME(eddyb) expose most of these from `spirv-builder`.
344346
fn rust_flags(codegen_backend_path: &Path) -> String {
345-
let target_features = [
346-
"Int8",
347-
"Int16",
348-
"Int64",
349-
"Float64",
350-
// Only needed for `ui/arch/read_clock_khr.rs`.
351-
"ShaderClockKHR",
352-
"ext:SPV_KHR_shader_clock",
353-
];
347+
let target_features = ["Int8", "Int16", "Int64", "Float64"];
354348

355349
[
356350
&*format!("-Zcodegen-backend={}", codegen_backend_path.display()),

tests/compiletests/ui/dis/asm_op_decorate.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
OpCapability Shader
2-
OpCapability ShaderClockKHR
32
OpCapability RuntimeDescriptorArray
43
OpExtension "SPV_EXT_descriptor_indexing"
5-
OpExtension "SPV_KHR_shader_clock"
64
OpMemoryModel Logical Simple
75
OpEntryPoint Fragment %1 "main"
86
OpExecutionMode %1 OriginUpperLeft

tests/compiletests/ui/dis/const-float-cast-optimized.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
OpCapability Shader
22
OpCapability Float64
3-
OpCapability ShaderClockKHR
4-
OpExtension "SPV_KHR_shader_clock"
53
OpMemoryModel Logical Simple
64
OpEntryPoint Fragment %1 "main" %2
75
OpExecutionMode %1 OriginUpperLeft

tests/compiletests/ui/dis/const-float-cast.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
OpCapability Shader
22
OpCapability Float64
3-
OpCapability ShaderClockKHR
4-
OpExtension "SPV_KHR_shader_clock"
53
OpMemoryModel Logical Simple
64
OpEntryPoint Fragment %1 "main" %2
75
OpExecutionMode %1 OriginUpperLeft

tests/compiletests/ui/dis/const-from-cast.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
OpCapability Shader
2-
OpCapability ShaderClockKHR
3-
OpExtension "SPV_KHR_shader_clock"
42
OpMemoryModel Logical Simple
53
OpEntryPoint Fragment %1 "main" %2
64
OpExecutionMode %1 OriginUpperLeft

tests/compiletests/ui/dis/const-int-cast.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
OpCapability Shader
2-
OpCapability ShaderClockKHR
3-
OpExtension "SPV_KHR_shader_clock"
42
OpMemoryModel Logical Simple
53
OpEntryPoint Fragment %1 "main" %2
64
OpExecutionMode %1 OriginUpperLeft

tests/compiletests/ui/dis/const-narrowing-cast.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
OpCapability Shader
22
OpCapability Int8
3-
OpCapability ShaderClockKHR
4-
OpExtension "SPV_KHR_shader_clock"
53
OpMemoryModel Logical Simple
64
OpEntryPoint Fragment %1 "main" %2
75
OpExecutionMode %1 OriginUpperLeft

tests/compiletests/ui/dis/custom_entry_point.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
OpCapability Shader
2-
OpCapability ShaderClockKHR
3-
OpExtension "SPV_KHR_shader_clock"
42
OpMemoryModel Logical Simple
53
OpEntryPoint Fragment %1 "hello_world"
64
OpExecutionMode %1 OriginUpperLeft

tests/compiletests/ui/dis/generic-fn-op-name.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
OpCapability Shader
2-
OpCapability ShaderClockKHR
3-
OpExtension "SPV_KHR_shader_clock"
42
OpMemoryModel Logical Simple
53
OpEntryPoint Fragment %1 "main"
64
OpExecutionMode %1 OriginUpperLeft

tests/compiletests/ui/dis/issue-723-output.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
OpCapability Shader
2-
OpCapability ShaderClockKHR
3-
OpExtension "SPV_KHR_shader_clock"
42
OpMemoryModel Logical Simple
53
OpEntryPoint Fragment %1 "main" %2
64
OpExecutionMode %1 OriginUpperLeft

tests/compiletests/ui/dis/non-writable-storage_buffer.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
OpCapability Shader
2-
OpCapability ShaderClockKHR
3-
OpExtension "SPV_KHR_shader_clock"
42
OpMemoryModel Logical Simple
53
OpEntryPoint Fragment %1 "main"
64
OpExecutionMode %1 OriginUpperLeft

tests/compiletests/ui/dis/panic_builtin_bounds_check.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
OpCapability Shader
2-
OpCapability ShaderClockKHR
32
OpExtension "SPV_KHR_non_semantic_info"
4-
OpExtension "SPV_KHR_shader_clock"
53
%1 = OpExtInstImport "NonSemantic.DebugPrintf"
64
OpMemoryModel Logical Simple
75
OpEntryPoint Fragment %2 "main"

tests/compiletests/ui/dis/panic_sequential_many.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
OpCapability Shader
2-
OpCapability ShaderClockKHR
32
OpExtension "SPV_KHR_non_semantic_info"
4-
OpExtension "SPV_KHR_shader_clock"
53
%1 = OpExtInstImport "NonSemantic.DebugPrintf"
64
OpMemoryModel Logical Simple
75
OpEntryPoint Fragment %2 "main" %3 %4 %5

tests/compiletests/ui/dis/spec_constant-attr.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> ""
1010
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"
1111

12-
// FIXME(eddyb) this should use revisions to track both the `vulkan1.2` output
13-
// and the pre-`vulkan1.2` output, but per-revisions `{only,ignore}-*` directives
14-
// are not supported in `compiletest-rs`.
15-
// ignore-vulkan1.2
16-
1712
use spirv_std::spirv;
1813

1914
#[spirv(fragment)]

tests/compiletests/ui/dis/spec_constant-attr.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
OpCapability Shader
2-
OpCapability ShaderClockKHR
3-
OpExtension "SPV_KHR_shader_clock"
42
OpMemoryModel Logical Simple
53
OpEntryPoint Fragment %1 "main" %2
64
OpExecutionMode %1 OriginUpperLeft

0 commit comments

Comments
 (0)