Skip to content

Commit 2e7774a

Browse files
Add Sampler*Shadow type aliases. (#5789)
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
1 parent 0d5636c commit 2e7774a

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

source/slang/hlsl.meta.slang

+14
Original file line numberDiff line numberDiff line change
@@ -4052,6 +4052,20 @@ ${{{{
40524052
}
40534053
}}}}
40544054

4055+
// Declare Sampler*Shadow type aliases.
4056+
${{{{
4057+
for (int shape = 0; shape < 4; shape++)
4058+
for (int isArray = 0; isArray<=1; isArray++)
4059+
{
4060+
}}}}
4061+
/// Represents a handle to a $(shapeTypeNames[shape]) combined texture-sampler for shadow comparison.
4062+
/// @param format The storage format of the texture.
4063+
/// @see Please refer to `_Texture` for more information about texture types.
4064+
/// @category texture_types
4065+
typealias Sampler$(shapeTypeNames[shape])$(arrayPostFix[isArray])Shadow<int format=0> = _Texture<float, __Shape$(shapeTypeNames[shape]), $(isArray), 0, 0, 0, 1, 1, format>;
4066+
${{{{
4067+
}
4068+
}}}}
40554069

40564070
// Atomic intrinsic insts.
40574071

tests/spirv/sampler-shadow.slang

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//TEST:SIMPLE(filecheck=CHECK): -target spirv
2+
3+
// CHECK: OpImageSampleDrefExplicitLod
4+
5+
Sampler2DShadow ss;
6+
7+
RWStructuredBuffer<float> output;
8+
9+
[numthreads(1,1,1)]
10+
void computeMain()
11+
{
12+
output[0] = ss.SampleCmpLevelZero(float2(0.0), 0.5);
13+
}

0 commit comments

Comments
 (0)