Skip to content

Commit 569dbc4

Browse files
committed
move mod: move arch::derivative and arch::demote_to_helper_invocation to fragment
1 parent 0fc84f8 commit 569dbc4

File tree

12 files changed

+29
-22
lines changed

12 files changed

+29
-22
lines changed

crates/spirv-std/src/arch.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@ use glam::UVec2;
1212

1313
mod atomics;
1414
mod barrier;
15-
mod demote_to_helper_invocation_ext;
16-
mod derivative;
1715

1816
pub use atomics::*;
1917
pub use barrier::*;
20-
pub use demote_to_helper_invocation_ext::*;
21-
pub use derivative::*;
2218

2319
/// Result is true if any component of `vector` is true, otherwise result is
2420
/// false.
@@ -124,18 +120,6 @@ pub unsafe fn vector_insert_dynamic<T: Scalar, V: Vector<T, N>, const N: usize>(
124120
}
125121
}
126122

127-
/// Fragment-shader discard. Equivalvent to `discard()` from GLSL
128-
///
129-
/// Ceases all further processing in any invocation that executes it: Only
130-
/// instructions these invocations executed before [kill] have observable side
131-
/// effects.
132-
#[spirv_std_macros::gpu_only]
133-
#[doc(alias = "OpKill", alias = "discard")]
134-
#[allow(clippy::empty_loop)]
135-
pub fn kill() -> ! {
136-
unsafe { asm!("OpKill", options(noreturn)) }
137-
}
138-
139123
/// Read from the shader clock with either the `Subgroup` or `Device` scope.
140124
///
141125
/// See:

crates/spirv-std/src/arch/demote_to_helper_invocation_ext.rs renamed to crates/spirv-std/src/fragment/demote_to_helper_invocation.rs

File renamed without changes.
File renamed without changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//! Intrinsics for fragment shaders
2+
3+
#[cfg(target_arch = "spirv")]
4+
use core::arch::asm;
5+
6+
mod demote_to_helper_invocation;
7+
mod derivative;
8+
9+
pub use demote_to_helper_invocation::*;
10+
pub use derivative::*;
11+
12+
/// Fragment-shader discard. Equivalent to `discard()` from GLSL
13+
///
14+
/// Ceases all further processing in any invocation that executes it: Only
15+
/// instructions these invocations executed before [kill] have observable side
16+
/// effects.
17+
#[spirv_std_macros::gpu_only]
18+
#[doc(alias = "OpKill", alias = "discard")]
19+
#[allow(clippy::empty_loop)]
20+
pub fn kill() -> ! {
21+
unsafe { asm!("OpKill", options(noreturn)) }
22+
}

crates/spirv-std/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ pub mod arch;
9595
pub mod byte_addressable_buffer;
9696
pub mod debug_printf;
9797
pub mod float;
98+
pub mod fragment;
9899
pub mod geometry;
99100
pub mod image;
100101
pub mod indirect_command;

tests/compiletests/ui/arch/demote_to_helper_invocation.rs renamed to tests/compiletests/ui/entry/fragment/demote_to_helper_invocation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ use spirv_std::spirv;
66

77
#[spirv(fragment)]
88
pub fn main() {
9-
unsafe { spirv_std::arch::demote_to_helper_invocation() };
10-
assert!(spirv_std::arch::is_helper_invocation());
9+
unsafe { spirv_std::fragment::demote_to_helper_invocation() };
10+
assert!(spirv_std::fragment::is_helper_invocation());
1111
}

tests/compiletests/ui/arch/derivative.rs renamed to tests/compiletests/ui/entry/fragment/derivative.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// build-pass
22
// compile-flags: -C llvm-args=--disassemble-fn=derivative::derivative
33

4-
use spirv_std::arch::Derivative;
4+
use spirv_std::fragment::Derivative;
55
use spirv_std::spirv;
66

77
#[spirv(fragment)]
File renamed without changes.

tests/compiletests/ui/arch/derivative_control.rs renamed to tests/compiletests/ui/entry/fragment/derivative_control.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// compile-flags: -C target-feature=+DerivativeControl
33
// compile-flags: -C llvm-args=--disassemble-fn=derivative_control::derivative
44

5-
use spirv_std::arch::Derivative;
5+
use spirv_std::fragment::Derivative;
66
use spirv_std::spirv;
77

88
#[spirv(fragment)]

tests/compiletests/ui/arch/derivative_control.stderr renamed to tests/compiletests/ui/entry/fragment/derivative_control.stderr

File renamed without changes.

0 commit comments

Comments
 (0)