Skip to content

Commit

Permalink
Add Matrix overload for exp10() core lib function (#5620)
Browse files Browse the repository at this point in the history
Fixes #5579
  • Loading branch information
bprb authored Nov 20, 2024
1 parent 54ec755 commit 4f6b928
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
12 changes: 12 additions & 0 deletions source/slang/hlsl.meta.slang
Original file line number Diff line number Diff line change
Expand Up @@ -8245,6 +8245,18 @@ vector<T,N> exp10(vector<T,N> x)
}
}

__generic<T : __BuiltinFloatingPointType, let N : int, let M : int>
[__readNone]
[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl, sm_4_0_version)]
matrix<T,N,M> exp10(matrix<T,N,M> x)
{
__target_switch
{
default:
MATRIX_MAP_UNARY(T, N, M, exp10, x);
}
}


/// Convert 16-bit float stored in low bits of integer
/// @category conversion Conversion functions
Expand Down
1 change: 1 addition & 0 deletions tests/hlsl-intrinsic/matrix-double.slang
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void test1(inout FloatMatrix ft, inout FloatMatrix f, int idx)

ft += exp2(f);
ft += exp(f);
ft += exp10(f);

ft += frac(f * makeFloatMatrix(3));
ft += ceil(f * makeFloatMatrix(5) - makeFloatMatrix(3));
Expand Down
8 changes: 4 additions & 4 deletions tests/hlsl-intrinsic/matrix-double.slang.expected.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: double
-363.570686
-128.281824
134.883405
383.294965
-359.422651
-120.905458
148.000645
406.621082
1 change: 1 addition & 0 deletions tests/hlsl-intrinsic/matrix-float.slang
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)

ft += exp2(f);
ft += exp(f);
ft += exp10(f);

ft += frac(f * makeFloatMatrix(3));
ft += ceil(f * makeFloatMatrix(5) - makeFloatMatrix(3));
Expand Down
8 changes: 4 additions & 4 deletions tests/hlsl-intrinsic/matrix-float.slang.expected.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type: float
-916.058716
-315.978027
358.120331
1035.545532
-905.656372
-297.479736
391.015503
1094.042358

0 comments on commit 4f6b928

Please sign in to comment.