Skip to content

Commit 0b37696

Browse files
committed
derivative: fix missing safety doc
1 parent dd3ed28 commit 0b37696

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Diff for: crates/spirv-std/src/arch/derivative.rs

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ macro_rules! deriv_fn {
1919
}
2020

2121
/// Types that can be derived by partial derivatives
22+
///
23+
/// # Safety
24+
/// Result Type must be a scalar or vector of floating-point type using the IEEE 754 encoding. The component width must be 32 bits.
2225
pub unsafe trait Derivative: Sealed + Default {
2326
/// Result is the partial derivative of `Self` with respect to the window x coordinate. Uses local differencing
2427
/// based on the value of `Self`. Same result as either [`Self::dfdx_fine`] or [`Self::dfdx_coarse`] on `Self`. Selection of which

Diff for: tests/ui/arch/derivative.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
%1 = OpFunction %2 None %3
22
%4 = OpLabel
3-
OpLine %5 34 8
3+
OpLine %5 37 8
44
%6 = OpDPdx %7 %8
5-
OpLine %5 76 8
5+
OpLine %5 79 8
66
%9 = OpDPdy %7 %8
7-
OpLine %5 116 8
7+
OpLine %5 119 8
88
%10 = OpFwidth %7 %8
99
OpNoLine
1010
OpReturn

Diff for: tests/ui/arch/derivative_control.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
%1 = OpFunction %2 None %3
22
%4 = OpLabel
3-
OpLine %5 47 8
3+
OpLine %5 50 8
44
%6 = OpDPdxFine %7 %8
5-
OpLine %5 89 8
5+
OpLine %5 92 8
66
%9 = OpDPdyFine %7 %8
7-
OpLine %5 128 8
7+
OpLine %5 131 8
88
%10 = OpFwidthFine %7 %8
9-
OpLine %5 62 8
9+
OpLine %5 65 8
1010
%11 = OpDPdxCoarse %7 %8
11-
OpLine %5 104 8
11+
OpLine %5 107 8
1212
%12 = OpDPdyCoarse %7 %8
13-
OpLine %5 140 8
13+
OpLine %5 143 8
1414
%13 = OpFwidthCoarse %7 %8
1515
OpNoLine
1616
OpReturn

0 commit comments

Comments
 (0)