summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/slang/hlsl.meta.slang14
-rw-r--r--tests/spirv/sampler-shadow.slang13
2 files changed, 27 insertions, 0 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index 412d5b6a0..31500f028 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -4052,6 +4052,20 @@ ${{{{
}
}}}}
+// Declare Sampler*Shadow type aliases.
+${{{{
+ for (int shape = 0; shape < 4; shape++)
+ for (int isArray = 0; isArray<=1; isArray++)
+ {
+}}}}
+/// Represents a handle to a $(shapeTypeNames[shape]) combined texture-sampler for shadow comparison.
+/// @param format The storage format of the texture.
+/// @see Please refer to `_Texture` for more information about texture types.
+/// @category texture_types
+typealias Sampler$(shapeTypeNames[shape])$(arrayPostFix[isArray])Shadow<int format=0> = _Texture<float, __Shape$(shapeTypeNames[shape]), $(isArray), 0, 0, 0, 1, 1, format>;
+${{{{
+ }
+}}}}
// Atomic intrinsic insts.
diff --git a/tests/spirv/sampler-shadow.slang b/tests/spirv/sampler-shadow.slang
new file mode 100644
index 000000000..89bdbc405
--- /dev/null
+++ b/tests/spirv/sampler-shadow.slang
@@ -0,0 +1,13 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+// CHECK: OpImageSampleDrefExplicitLod
+
+Sampler2DShadow ss;
+
+RWStructuredBuffer<float> output;
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ output[0] = ss.SampleCmpLevelZero(float2(0.0), 0.5);
+} \ No newline at end of file