diff options
| author | Sami Kiminki (NVIDIA) <235843927+skiminki-nv@users.noreply.github.com> | 2025-10-10 19:39:13 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-10 16:39:13 +0000 |
| commit | 5c672cef1f6ac6b5cd6cd71bd47489b7b7331adb (patch) | |
| tree | 7511c0bca54c2ddda7d1101a795cb19dd588bc04 /source | |
| parent | cd50974490b82dd7e0f9ac0dd5ce9c17e390ff1f (diff) | |
8503 wgsl depth texture (#8645)
Add built-in type aliases for DepthTexture* and unify Sampler*Shadow
Add the following type aliases:
- DepthTexture1D, DepthTexture1DArray
- DepthTexture2D, DepthTexture2DArray
- DepthTexture2DMS, DepthTexture2DMSArray
- DepthTexture3D
- DepthTextureCube, DepthTextureCubeArray
These match with the type aliases for non-depth textures.
Also, unify the Sampler*Shadow type aliases with DepthTexture*
ones. This adds the following:
- Sampler2DMSShadow
- Sampler2DMSArrayShadow
and removes the Sampler3DArrayShadow type alias. As a side-effect, the
descriptions of Sampler*ArrayShadow type aliases are fixed
("texture-sampler for shadow" ==> "texture-sampler array for shadow").
Update the slang tests to use the newly introduced type aliases instead
of
the custom type aliases that use _Texture<> directly.
Add DepthTexture testing in
hlsl-intrinsic/texture/texture-intrinsics. Do this by extracting the
test logic of computeMain() in a separate function and parametrize it
for non-depth/depth texture types. This adds basic coverage for the
following types:
- DepthTexture1D
- DepthTexture2D
- DepthTexture3D
- DepthTextureCube
- DepthTexture1DArray
- DepthTexture2DArray
- DepthTextureCubeArray
Issue #6166
Issue #8503
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/hlsl.meta.slang | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang index 26c2a43cb..86e77c650 100644 --- a/source/slang/hlsl.meta.slang +++ b/source/slang/hlsl.meta.slang @@ -4753,17 +4753,35 @@ ${{{{ } }}}} -// Declare Sampler*Shadow type aliases. +// Declare DepthTexture* and Sampler*Shadow type aliases. ${{{{ for (int shape = 0; shape < 4; shape++) - for (int isArray = 0; isArray<=1; isArray++) + for (int isArray : { 0, 1 }) + for (int isMS : { 0, 1 }) { + if (isMS) + { + // Only DepthTexture2DMS and Sampler2DMSShadow. + if (shape != kCoreModule_ShapeIndex2D) + continue; + } + + // No 3D Array. + if (shape == kCoreModule_ShapeIndex3D && isArray == 1) + continue; }}}} -/// Represents a handle to a $(shapeTypeNames[shape]) combined texture-sampler for shadow comparison. +/// Represents a handle to a$(isMS?" multisampled": "") $(shapeTypeNames[shape]) depth texture$(isArray?" array":""). /// @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>; +typealias DepthTexture$(shapeTypeNames[shape])$(msPostFix[isMS])$(arrayPostFix[isArray])<int format=0> = _Texture<float, __Shape$(shapeTypeNames[shape]), $(isArray), $(isMS), 0, 0, 1, 0, format>; + +/// Represents a handle to a$(isMS?" multisampled": "") $(shapeTypeNames[shape]) combined texture-sampler$(isArray?" array":"") 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])$(msPostFix[isMS])$(arrayPostFix[isArray])Shadow<int format=0> = _Texture<float, __Shape$(shapeTypeNames[shape]), $(isArray), $(isMS), 0, 0, 1, 1, format>; + ${{{{ } }}}} |
