summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-03-01 01:46:09 -0500
committerGitHub <noreply@github.com>2025-02-28 22:46:09 -0800
commit700c38ae7c16a49de7f720ae3b1940df5b2b4b33 (patch)
tree96e338255d830cee5b65fc5e881c4d04bebbd168 /tests
parentbca772ca02bbe9c0f1201c7ae177a10ccff84958 (diff)
Implement sparse texture Sample* intrinsics for SPIRV (#6377)
* implement sparse residency samples for spirv * udpate test * separate tests to non-combined and combined sampler * remove expected failure * add expected failure for dx12 combined sampler test * remove expected failure * fix submodule merge * add back dx12 test failure --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/expected-failure-github.txt1
-rw-r--r--tests/hlsl-intrinsic/texture/partial-resident-texture-combined.slang205
-rw-r--r--tests/hlsl-intrinsic/texture/partial-resident-texture.slang264
3 files changed, 448 insertions, 22 deletions
diff --git a/tests/expected-failure-github.txt b/tests/expected-failure-github.txt
index 10897b31e..c36e142f6 100644
--- a/tests/expected-failure-github.txt
+++ b/tests/expected-failure-github.txt
@@ -13,3 +13,4 @@ tests/compute/interface-shader-param.slang.5 syn (wgpu)
tests/language-feature/shader-params/interface-shader-param-ordinary.slang.4 syn (wgpu)
tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables.slang.8 (mtl)
tests/glsl-intrinsic/shader-subgroup/shader-subgroup-builtin-variables-2.slang.3 (mtl)
+tests/hlsl-intrinsic/texture/partial-resident-texture-combined.slang (dx12)
diff --git a/tests/hlsl-intrinsic/texture/partial-resident-texture-combined.slang b/tests/hlsl-intrinsic/texture/partial-resident-texture-combined.slang
new file mode 100644
index 000000000..21b16eba8
--- /dev/null
+++ b/tests/hlsl-intrinsic/texture/partial-resident-texture-combined.slang
@@ -0,0 +1,205 @@
+// TODO: There are issues running tests combined texture samplers in DX12.
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -shaderobj -output-using-type -use-dxil -profile cs_6_7 -dx12
+
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-vk -compute -shaderobj -output-using-type -emit-spirv-directly -render-feature hardware-device -xslang -DVK
+
+//TEST_INPUT: ubuffer(data=[2], stride=4):out,name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+//TEST_INPUT:ubuffer(data=[1 1 1 1]):name=iBuf
+RWByteAddressBuffer iBuf;
+
+//
+// Combined texture samplers.
+//
+
+//TEST_INPUT: TextureSampler1D(size=4, content = one):name st1D_f32v3
+Sampler1D<float3> st1D_f32v3;
+//TEST_INPUT: TextureSampler2D(size=4, content = one):name st2D_f32v3
+Sampler2D<float3> st2D_f32v3;
+//TEST_INPUT: TextureSampler3D(size=4, content = one):name st3D_f32v3
+Sampler3D<float3> st3D_f32v3;
+
+//TEST_INPUT: TextureSampler1D(size=4, content = one, arrayLength=2):name st1DArray_f32v3
+Sampler1DArray<float3> st1DArray_f32v3;
+//TEST_INPUT: TextureSampler2D(size=4, content = one, arrayLength=2):name st2DArray_f32v3
+Sampler2DArray<float3> st2DArray_f32v3;
+
+//TEST_INPUT: TextureSampler1D(size=4, content = one):name st1D_f32v4
+Sampler1D<float4> st1D_f32v4;
+//TEST_INPUT: TextureSampler2D(size=4, content = one):name st2D_f32v4
+Sampler2D<float4> st2D_f32v4;
+//TEST_INPUT: TextureSampler3D(size=4, content = one):name st3D_f32v4
+Sampler3D<float4> st3D_f32v4;
+
+//TEST_INPUT: TextureSampler1D(size=4, content = one, arrayLength=2):name st1DArray_f32v4
+Sampler1DArray<float4> st1DArray_f32v4;
+//TEST_INPUT: TextureSampler2D(size=4, content = one, arrayLength=2):name st2DArray_f32v4
+Sampler2DArray<float4> st2DArray_f32v4;
+
+//
+// Combined depth texture samplers.
+//
+
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
+typealias CombinedDepth2d = _Texture<
+ T,
+ __Shape2D,
+ 0, // isArray
+ 0, // isMS
+ sampleCount,
+ 0, // access
+ 1, // isShadow
+ 1, // isCombined
+ format
+>;
+
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
+typealias CombinedDepth2d_array = _Texture<
+ T,
+ __Shape2D,
+ 1, // isArray
+ 0, // isMS
+ sampleCount,
+ 0, // access
+ 1, // isShadow
+ 1, // isCombined
+ format
+>;
+
+
+//TEST_INPUT: TextureSampler2D(size=4, content = zero):name cd2D
+CombinedDepth2d<float> cd2D;
+//TEST_INPUT: TextureSampler2D(size=4, content = zero, arrayLength=2):name cd2DArray
+CombinedDepth2d_array<float> cd2DArray;
+
+uint getNotMapped()
+{
+ // We want to return a status uint that causes `CheckAccessFullyMapped` to return false.
+ // These are just educated guesses - actual implementation differ between platforms and drivers.
+#if defined(VK)
+ return 0xFFFFFFFFU;
+#else
+ return 0;
+#endif
+}
+
+bool TEST_combinedDepth()
+{
+ float u = 0.0;
+ int offset = 0;
+ float clamp = 0.0;
+ float slice = 0.0;
+ float level = 0.0;
+ float compareValue = 0.0;
+
+ uint status;
+
+ return true
+ // =================
+ // float SampleCmp()
+ // =================
+ && (status = getNotMapped(), all(0.0 == cd2D.SampleCmp(float2(u), compareValue, int2(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(0.0 == cd2DArray.SampleCmp(float3(u, u, slice), compareValue, int2(offset), clamp, status))) && CheckAccessFullyMapped(status)
+
+ // ==========================
+ // float SampleCmpLevelZero()
+ // ==========================
+ && (status = getNotMapped(), all(0.0 == cd2D.SampleCmpLevelZero(float2(u), compareValue, int2(offset), status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(0.0 == cd2DArray.SampleCmpLevelZero(float3(u, u, slice), compareValue, int2(offset), status))) && CheckAccessFullyMapped(status)
+
+ // ======================
+ // float SampleCmpLevel()
+ // ======================
+ && (status = getNotMapped(), all(0.0 == cd2D.SampleCmpLevel(float2(u), compareValue, level, int2(offset), status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(0.0 == cd2DArray.SampleCmpLevel(float3(u, u, slice), compareValue, level, int2(offset), status))) && CheckAccessFullyMapped(status)
+ ;
+}
+
+bool TEST_sampler<T>(
+ Sampler1D<T> t1D,
+ Sampler2D<T> t2D,
+ Sampler3D<T> t3D,
+ Sampler1DArray<T> t1DArray,
+ Sampler2DArray<T> t2DArray,
+) where T : ITexelElement, IArithmetic
+{
+ typealias TN = T;
+
+ float u = 0.0;
+ int offset = 0;
+ float clamp = 0.0;
+ float slice = 0.0;
+ float bias = 0.0;
+ float grad = 0.0;
+ float level = 0.0;
+ constexpr const float ddx = 0.0f;
+ constexpr const float ddy = 0.0f;
+
+ uint status;
+
+ return true
+ // ==========
+ // T Sample()
+ // ==========
+ && (status = getNotMapped(), all(TN(T(1)) == t1D.Sample(u, offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2D.Sample(float2(u), int2(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t3D.Sample(float3(u), int3(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t1DArray.Sample(float2(u, slice), offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2DArray.Sample(float3(u, u, slice), offset, clamp, status))) && CheckAccessFullyMapped(status)
+
+ // ==============
+ // T SampleBias()
+ // ==============
+ && (status = getNotMapped(), all(TN(T(1)) == t1D.SampleBias(u, bias, offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2D.SampleBias(float2(u), bias, int2(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t3D.SampleBias(float3(u), bias, int3(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t1DArray.SampleBias(float2(u, slice), bias, offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2DArray.SampleBias(float3(u, u, slice), bias, offset, clamp, status))) && CheckAccessFullyMapped(status)
+
+ // ==============
+ // T SampleGrad()
+ // ==============
+ && (status = getNotMapped(), all(TN(T(1)) == t1D.SampleGrad(u, ddx, ddy, offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2D.SampleGrad(float2(u), ddx, ddy, int2(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t3D.SampleGrad(float3(u), ddx, ddy, int3(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t1DArray.SampleGrad(float2(u, slice), ddx, ddy, offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2DArray.SampleGrad(float3(u, u, slice), ddx, ddy, offset, clamp, status))) && CheckAccessFullyMapped(status)
+
+ // ==============
+ // T SampleLevel()
+ // ==============
+ && (status = getNotMapped(), all(TN(T(1)) == t1D.SampleLevel(u, level, offset, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2D.SampleLevel(float2(u), level, int2(offset), status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t3D.SampleLevel(float3(u), level, int3(offset), status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t1DArray.SampleLevel(float2(u, slice), level, offset, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2DArray.SampleLevel(float3(u, u, slice), level, offset, status))) && CheckAccessFullyMapped(status)
+ ;
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
+{
+ bool result = true
+ // Make sure CheckAccessFullyMapped can return false
+ && (!CheckAccessFullyMapped(getNotMapped()))
+ && TEST_sampler(
+ st1D_f32v3,
+ st2D_f32v3,
+ st3D_f32v3,
+ st1DArray_f32v3,
+ st2DArray_f32v3,
+ )
+ && TEST_sampler(
+ st1D_f32v4,
+ st2D_f32v4,
+ st3D_f32v4,
+ st1DArray_f32v4,
+ st2DArray_f32v4,
+ )
+ && TEST_combinedDepth()
+ ;
+
+ //CHK:1
+ outputBuffer[0] = int(result);
+}
diff --git a/tests/hlsl-intrinsic/texture/partial-resident-texture.slang b/tests/hlsl-intrinsic/texture/partial-resident-texture.slang
index ba7e31835..ee2c21225 100644
--- a/tests/hlsl-intrinsic/texture/partial-resident-texture.slang
+++ b/tests/hlsl-intrinsic/texture/partial-resident-texture.slang
@@ -1,21 +1,224 @@
-//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -shaderobj -output-using-type -use-dxil -profile cs_6_6 -dx12
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -shaderobj -output-using-type -use-dxil -profile cs_6_7 -dx12
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-vk -compute -shaderobj -output-using-type -emit-spirv-directly -render-feature hardware-device -xslang -DVK
//TEST_INPUT: ubuffer(data=[2], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;
-//TEST_INPUT: Texture2D(size=4, content = one):name t2D_f32
-Texture2D<float4> t2D_f32;
-
-//TEST_INPUT: Texture2D(size=4, content = one):name t2DMS_f32
-Texture2DMS<float4> t2DMS_f32;
-
//TEST_INPUT:ubuffer(data=[1 1 1 1]):name=iBuf
RWByteAddressBuffer iBuf;
//TEST_INPUT: Sampler:name samplerState
SamplerState samplerState;
+//TEST_INPUT: Sampler:name samplerCmpState
+SamplerComparisonState samplerCmpState;
+
+//
+// Textures.
+//
+
+//TEST_INPUT: Texture1D(size=4, content = one):name t1D_f32v3
+Texture1D<float3> t1D_f32v3;
+//TEST_INPUT: Texture2D(size=4, content = one):name t2D_f32v3
+Texture2D<float3> t2D_f32v3;
+//TEST_INPUT: Texture3D(size=4, content = one):name t3D_f32v3
+Texture3D<float3> t3D_f32v3;
+//TEST_INPUT: TextureCube(size=4, content = one):name tCube_f32v3
+TextureCube<float3> tCube_f32v3;
+//TEST_INPUT: Texture1D(size=4, content = one, arrayLength=2):name t1DArray_f32v3
+Texture1DArray<float3> t1DArray_f32v3;
+//TEST_INPUT: Texture2D(size=4, content = one, arrayLength=2):name t2DArray_f32v3
+Texture2DArray<float3> t2DArray_f32v3;
+//TEST_INPUT: TextureCube(size=4, content = one, arrayLength=2):name tCubeArray_f32v3
+TextureCubeArray<float3> tCubeArray_f32v3;
+
+//TEST_INPUT: Texture1D(size=4, content = one):name t1D_f32v4
+Texture1D<float4> t1D_f32v4;
+//TEST_INPUT: Texture2D(size=4, content = one):name t2D_f32v4
+Texture2D<float4> t2D_f32v4;
+//TEST_INPUT: Texture3D(size=4, content = one):name t3D_f32v4
+Texture3D<float4> t3D_f32v4;
+//TEST_INPUT: TextureCube(size=4, content = one):name tCube_f32v4
+TextureCube<float4> tCube_f32v4;
+
+//TEST_INPUT: Texture1D(size=4, content = one, arrayLength=2):name t1DArray_f32v4
+Texture1DArray<float4> t1DArray_f32v4;
+//TEST_INPUT: Texture2D(size=4, content = one, arrayLength=2):name t2DArray_f32v4
+Texture2DArray<float4> t2DArray_f32v4;
+//TEST_INPUT: TextureCube(size=4, content = one, arrayLength=2):name tCubeArray_f32v4
+TextureCubeArray<float4> tCubeArray_f32v4;
+
+//TEST_INPUT: Texture2D(size=4, content = one):name t2DMS_f32v4
+Texture2DMS<float4> t2DMS_f32v4;
+
+//
+// Depth textures.
+//
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
+typealias depth2d = _Texture<
+ T,
+ __Shape2D,
+ 0, // isArray
+ 0, // isMS
+ sampleCount,
+ 0, // access
+ 1, // isShadow
+ 0, // isCombined
+ format
+>;
+
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
+typealias depth2d_array = _Texture<
+ T,
+ __Shape2D,
+ 1, // isArray
+ 0, // isMS
+ sampleCount,
+ 0, // access
+ 1, // isShadow
+ 0, // isCombined
+ format
+>;
+
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
+typealias depthcube = _Texture<
+ T,
+ __ShapeCube,
+ 0, // isArray
+ 0, // isMS
+ sampleCount,
+ 0, // access
+ 1, // isShadow
+ 0, // isCombined
+ format
+>;
+
+__generic<T : ITexelElement, let sampleCount:int=0, let format:int=0>
+typealias depthcube_array = _Texture<
+ T,
+ __ShapeCube,
+ 1, // isArray
+ 0, // isMS
+ sampleCount,
+ 0, // access
+ 1, // isShadow
+ 0, // isCombined
+ format
+>;
+
+//TEST_INPUT: Texture2D(size=4, content = zero):name d2D
+depth2d<float> d2D;
+//TEST_INPUT: Texture2D(size=4, content = zero, arrayLength=2):name d2DArray
+depth2d_array<float> d2DArray;
+
+uint getNotMapped()
+{
+ // We want to return a status uint that causes `CheckAccessFullyMapped` to return false.
+ // These are just educated guesses - actual implementation differ between platforms and drivers.
+#if defined(VK)
+ return 0xFFFFFFFFU;
+#else
+ return 0;
+#endif
+}
+
+bool TEST_depthTexture()
+{
+ float u = 0.0;
+ int offset = 0;
+ float clamp = 0.0;
+ float slice = 0.0;
+ float level = 0.0;
+ float compareValue = 0.0;
+
+ uint status;
+
+ return true
+ // =================
+ // float SampleCmp()
+ // =================
+ && (status = getNotMapped(), all(0.0 == d2D.SampleCmp(samplerCmpState, float2(u), compareValue, int2(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(0.0 == d2DArray.SampleCmp(samplerCmpState, float3(u, u, slice), compareValue, int2(offset), clamp, status))) && CheckAccessFullyMapped(status)
+
+ // ==========================
+ // float SampleCmpLevelZero()
+ // ==========================
+ && (status = getNotMapped(), all(0.0 == d2D.SampleCmpLevelZero(samplerCmpState, float2(u), compareValue, int2(offset), status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(0.0 == d2DArray.SampleCmpLevelZero(samplerCmpState, float3(u, u, slice), compareValue, int2(offset), status))) && CheckAccessFullyMapped(status)
+
+ // ======================
+ // float SampleCmpLevel()
+ // ======================
+ && (status = getNotMapped(), all(0.0 == d2D.SampleCmpLevel(samplerCmpState, float2(u), compareValue, level, int2(offset), status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(0.0 == d2DArray.SampleCmpLevel(samplerCmpState, float3(u, u, slice), compareValue, level, int2(offset), status))) && CheckAccessFullyMapped(status)
+ ;
+}
+
bool TEST_texture<T>(
+ Texture1D<T> t1D,
+ Texture2D<T> t2D,
+ Texture3D<T> t3D,
+ TextureCube<T> tCube,
+ Texture1DArray<T> t1DArray,
+ Texture2DArray<T> t2DArray,
+ TextureCubeArray<T> tCubeArray,
+ )
+ where T : ITexelElement, IArithmetic
+{
+ typealias TN = T;
+
+ float u = 0.0;
+ int offset = 0;
+ float clamp = 0.0;
+ float slice = 0.0;
+ float bias = 0.0;
+ float grad = 0.0;
+ float level = 0.0;
+ constexpr const float ddx = 0.0f;
+ constexpr const float ddy = 0.0f;
+
+ uint status;
+
+ return true
+ // ==========
+ // T Sample()
+ // ==========
+ && (status = getNotMapped(), all(TN(T(1)) == t1D.Sample(samplerState, u, offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2D.Sample(samplerState, float2(u), int2(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t3D.Sample(samplerState, float3(u), int3(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t1DArray.Sample(samplerState, float2(u, slice), offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2DArray.Sample(samplerState, float3(u, u, slice), offset, clamp, status))) && CheckAccessFullyMapped(status)
+
+ // ==============
+ // T SampleBias()
+ // ==============
+ && (status = getNotMapped(), all(TN(T(1)) == t1D.SampleBias(samplerState, u, bias, offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2D.SampleBias(samplerState, float2(u), bias, int2(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t3D.SampleBias(samplerState, float3(u), bias, int3(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t1DArray.SampleBias(samplerState, float2(u, slice), bias, offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2DArray.SampleBias(samplerState, float3(u, u, slice), bias, offset, clamp, status))) && CheckAccessFullyMapped(status)
+
+ // ==============
+ // T SampleGrad()
+ // ==============
+ && (status = getNotMapped(), all(TN(T(1)) == t1D.SampleGrad(samplerState, u, ddx, ddy, offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2D.SampleGrad(samplerState, float2(u), ddx, ddy, int2(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t3D.SampleGrad(samplerState, float3(u), ddx, ddy, int3(offset), clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t1DArray.SampleGrad(samplerState, float2(u, slice), ddx, ddy, offset, clamp, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2DArray.SampleGrad(samplerState, float3(u, u, slice), ddx, ddy, offset, clamp, status))) && CheckAccessFullyMapped(status)
+
+ // ==============
+ // T SampleLevel()
+ // ==============
+ && (status = getNotMapped(), all(TN(T(1)) == t1D.SampleLevel(samplerState, u, level, offset, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2D.SampleLevel(samplerState, float2(u), level, int2(offset), status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t3D.SampleLevel(samplerState, float3(u), level, int3(offset), status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t1DArray.SampleLevel(samplerState, float2(u, slice), level, offset, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2DArray.SampleLevel(samplerState, float3(u, u, slice), level, offset, status))) && CheckAccessFullyMapped(status)
+ ;
+}
+
+bool TEST_load<T>(
Texture2D<T> t2D,
Texture2DMS<T> t2DMS)
where T : ITexelElement, IArithmetic
@@ -32,20 +235,16 @@ bool TEST_texture<T>(
int3 iuvs = int3(iuv, sampleIndex);
return true
- // Make sure CheckAccessFullyMapped can return false
- && (status = 0, !CheckAccessFullyMapped(status))
-
- // Sample
- && (status = 0, all(TN(T(1)) == t2D.Sample(samplerState, uv, offset, clamp, status))) && CheckAccessFullyMapped(status)
-
- // Load
- && (status = 0, all(TN(T(1)) == t2DMS.Load(iuv, sampleIndex, offset, status))) && CheckAccessFullyMapped(status)
- && (status = 0, all(TN(T(1)) == t2D.Load(iuvs, offset, status))) && CheckAccessFullyMapped(status)
- && (status = 0, 2 == outputBuffer.Load(0, status)) && CheckAccessFullyMapped(status)
- && (status = 0, 1 == iBuf.Load(0, status)) && CheckAccessFullyMapped(status)
- && (status = 0, all(int2(1) == iBuf.Load2(0, status))) && CheckAccessFullyMapped(status)
- && (status = 0, all(int3(1) == iBuf.Load3(0, status))) && CheckAccessFullyMapped(status)
- && (status = 0, all(int4(1) == iBuf.Load4(0, status))) && CheckAccessFullyMapped(status)
+ // Currently not supported by Slang on VK.
+#if !defined(VK)
+ && (status = getNotMapped(), all(TN(T(1)) == t2DMS.Load(iuv, sampleIndex, offset, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(TN(T(1)) == t2D.Load(iuvs, offset, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), 2 == outputBuffer.Load(0, status)) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), 1 == iBuf.Load(0, status)) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(int2(1) == iBuf.Load2(0, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(int3(1) == iBuf.Load3(0, status))) && CheckAccessFullyMapped(status)
+ && (status = getNotMapped(), all(int4(1) == iBuf.Load4(0, status))) && CheckAccessFullyMapped(status)
+#endif
;
}
@@ -53,7 +252,28 @@ bool TEST_texture<T>(
void computeMain(int3 dispatchThreadID: SV_DispatchThreadID)
{
bool result = true
- && TEST_texture(t2D_f32, t2DMS_f32)
+ // Make sure CheckAccessFullyMapped can return false
+ && (!CheckAccessFullyMapped(getNotMapped()))
+ && TEST_texture(
+ t1D_f32v3,
+ t2D_f32v3,
+ t3D_f32v3,
+ tCube_f32v3,
+ t1DArray_f32v3,
+ t2DArray_f32v3,
+ tCubeArray_f32v3,
+ )
+ && TEST_texture(
+ t1D_f32v4,
+ t2D_f32v4,
+ t3D_f32v4,
+ tCube_f32v4,
+ t1DArray_f32v4,
+ t2DArray_f32v4,
+ tCubeArray_f32v4,
+ )
+ && TEST_depthTexture()
+ && TEST_load(t2D_f32v4, t2DMS_f32v4)
;
//CHK:1