From df7c66be49822d650f8956662b16db49bae31d09 Mon Sep 17 00:00:00 2001 From: DarrelFW321 <60972474+DarrelFW321@users.noreply.github.com> Date: Thu, 3 Apr 2025 19:54:02 -0400 Subject: Add sparse texture Load intrinsic for SPIRV (#6702) * Implement sparse texture Load intrinsics for SPIRV * changed test name from TEST_load to TEST_sparse --------- Co-authored-by: Darren Wihandi <65404740+fairywreath@users.noreply.github.com> --- .../partial-resident-texture-combined.slang | 23 ++++++++++++++++++++++ .../texture/partial-resident-texture.slang | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/hlsl-intrinsic/texture/partial-resident-texture-combined.slang b/tests/hlsl-intrinsic/texture/partial-resident-texture-combined.slang index 21b16eba8..3deddb504 100644 --- a/tests/hlsl-intrinsic/texture/partial-resident-texture-combined.slang +++ b/tests/hlsl-intrinsic/texture/partial-resident-texture-combined.slang @@ -37,6 +37,9 @@ Sampler1DArray st1DArray_f32v4; //TEST_INPUT: TextureSampler2D(size=4, content = one, arrayLength=2):name st2DArray_f32v4 Sampler2DArray st2DArray_f32v4; +//TEST_INPUT: TextureSampler2D(size=4, content = one):name st2DMS_f32v4 + Sampler2DMS st2DMS_f32v4; + // // Combined depth texture samplers. // @@ -177,6 +180,25 @@ bool TEST_sampler( ; } +bool TEST_sparse( + Sampler2D s2D, + Sampler2DMS s2DMS) + where T : ITexelElement, IArithmetic + { + typealias TN = T; + constexpr const int2 offset = int2(0, 0); + uint status; + + int sampleIndex = 0; + int2 iuv = int2(1, 1); + int3 iuvs = int3(iuv, sampleIndex); + + return true + && (status = getNotMapped(), all(TN(T(1)) == s2D.Load(iuvs, offset, status))) && CheckAccessFullyMapped(status) + && (status = getNotMapped(), all(TN(T(1)) == s2DMS.Load(iuv, sampleIndex, offset, status))) && CheckAccessFullyMapped(status) + ; + } + [numthreads(4, 1, 1)] void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) { @@ -198,6 +220,7 @@ void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) st2DArray_f32v4, ) && TEST_combinedDepth() + && TEST_sparse(st2D_f32v4, st2DMS_f32v4) ; //CHK:1 diff --git a/tests/hlsl-intrinsic/texture/partial-resident-texture.slang b/tests/hlsl-intrinsic/texture/partial-resident-texture.slang index ee2c21225..edf67ddc1 100644 --- a/tests/hlsl-intrinsic/texture/partial-resident-texture.slang +++ b/tests/hlsl-intrinsic/texture/partial-resident-texture.slang @@ -235,10 +235,10 @@ bool TEST_load( int3 iuvs = int3(iuv, sampleIndex); return true - // 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) + // SPIRV does not support sparse buffer loads. +#if !defined(VK) && (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) -- cgit v1.2.3