From 5c672cef1f6ac6b5cd6cd71bd47489b7b7331adb Mon Sep 17 00:00:00 2001 From: "Sami Kiminki (NVIDIA)" <235843927+skiminki-nv@users.noreply.github.com> Date: Fri, 10 Oct 2025 19:39:13 +0300 Subject: 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 --- tests/metal/texture-sampler-less.slang | 61 +++------------------------------- tests/metal/texture.slang | 61 +++------------------------------- 2 files changed, 8 insertions(+), 114 deletions(-) (limited to 'tests/metal') diff --git a/tests/metal/texture-sampler-less.slang b/tests/metal/texture-sampler-less.slang index 6a7646e9a..80e5be3eb 100644 --- a/tests/metal/texture-sampler-less.slang +++ b/tests/metal/texture-sampler-less.slang @@ -28,63 +28,10 @@ Sampler1DArray t1DArray; Sampler2DArray t2DArray; SamplerCubeArray tCubeArray; -// Metal doc says "For depth texture types, T must be float." -__generic -typealias depth2d = _Texture< - T, - __Shape2D, - 0, // isArray - 0, // isMS - sampleCount, - 0, // access - 1, // isShadow - 1, // isCombined - format ->; - -__generic -typealias depth2d_array = _Texture< - T, - __Shape2D, - 1, // isArray - 0, // isMS - sampleCount, - 0, // access - 1, // isShadow - 1, // isCombined - format ->; - -__generic -typealias depthcube = _Texture< - T, - __ShapeCube, - 0, // isArray - 0, // isMS - sampleCount, - 0, // access - 1, // isShadow - 1, // isCombined - format ->; - -__generic -typealias depthcube_array = _Texture< - T, - __ShapeCube, - 1, // isArray - 0, // isMS - sampleCount, - 0, // access - 1, // isShadow - 1, // isCombined - format ->; - -depth2d d2D; -depthcube dCube; -depth2d_array d2DArray; -depthcube_array dCubeArray; +Sampler2DShadow d2D; +SamplerCubeShadow dCube; +Sampler2DArrayShadow d2DArray; +SamplerCubeArrayShadow dCubeArray; bool TEST_texture_float() { diff --git a/tests/metal/texture.slang b/tests/metal/texture.slang index c495bb3b3..831c3c43e 100644 --- a/tests/metal/texture.slang +++ b/tests/metal/texture.slang @@ -124,67 +124,14 @@ Texture2DArray t2DArray_u16; //TEST_INPUT: TextureCube(size=4, content = zero, arrayLength=2):name tCubeArray_u16 TextureCubeArray tCubeArray_u16; -// Metal doc says "For depth texture types, T must be float." -__generic -typealias depth2d = _Texture< - T, - __Shape2D, - 0, // isArray - 0, // isMS - sampleCount, - 0, // access - 1, // isShadow - 0, // isCombined - format ->; - -__generic -typealias depth2d_array = _Texture< - T, - __Shape2D, - 1, // isArray - 0, // isMS - sampleCount, - 0, // access - 1, // isShadow - 0, // isCombined - format ->; - -__generic -typealias depthcube = _Texture< - T, - __ShapeCube, - 0, // isArray - 0, // isMS - sampleCount, - 0, // access - 1, // isShadow - 0, // isCombined - format ->; - -__generic -typealias depthcube_array = _Texture< - T, - __ShapeCube, - 1, // isArray - 0, // isMS - sampleCount, - 0, // access - 1, // isShadow - 0, // isCombined - format ->; - //TEST_INPUT: Texture2D(size=4, format=D32Float, content = zero):name d2D -depth2d d2D; +DepthTexture2D d2D; //TEST_INPUT: TextureCube(size=4, format=D32Float, content = zero):name dCube -depthcube dCube; +DepthTextureCube dCube; //TEST_INPUT: Texture2D(size=4, format=D32Float, content = zero, arrayLength=2):name d2DArray -depth2d_array d2DArray; +DepthTexture2DArray d2DArray; //TEST_INPUT: TextureCube(size=4, format=D32Float, content = zero, arrayLength=2):name dCubeArray -depthcube_array dCubeArray; +DepthTextureCubeArray dCubeArray; //TEST_INPUT: Sampler(filteringMode=point):name samplerState SamplerState samplerState; -- cgit v1.2.3