From 88382ac7f3eda671c21dadb5b37bfd305369f750 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Fri, 28 Jun 2024 20:38:15 -0700 Subject: Implement CheckAccessFullyMapped (#4509) * Implement CheckAccessFullyMapped Closes #4438 Closes #4445 Closes #1712 Related to #4495 This commit implements "CheckAccessFullyMapped()" for HLSL target. All of other "status" variants for Sample/Load are limited to HLSL by the capability system, because they not properly implemented yet. --- .../texture/partial-resident-texture.slang | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/hlsl-intrinsic/texture/partial-resident-texture.slang (limited to 'tests') diff --git a/tests/hlsl-intrinsic/texture/partial-resident-texture.slang b/tests/hlsl-intrinsic/texture/partial-resident-texture.slang new file mode 100644 index 000000000..878ef02d3 --- /dev/null +++ b/tests/hlsl-intrinsic/texture/partial-resident-texture.slang @@ -0,0 +1,61 @@ +//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -shaderobj -output-using-type -use-dxil -profile cs_6_6 -dx12 + +//TEST_INPUT: ubuffer(data=[2], stride=4):out,name outputBuffer +RWStructuredBuffer outputBuffer; + +//TEST_INPUT: Texture2D(size=4, content = one):name t2D_f32 +Texture2D t2D_f32; + +//TEST_INPUT: Texture2D(size=4, content = one):name t2DMS_f32 +Texture2DMS t2DMS_f32; + +//TEST_INPUT:ubuffer(data=[1 1 1 1]):name=iBuf +RWByteAddressBuffer iBuf; + +//TEST_INPUT: Sampler:name samplerState +SamplerState samplerState; + +__generic +bool TEST_texture( + Texture2D> t2D, + Texture2DMS> t2DMS) +{ + typealias TN = vector; + constexpr const int2 offset = int2(0, 0); + uint status; + float clamp = 0; + + float2 uv = float2(0.5f, 0.5f); + + int sampleIndex = 0; + int2 iuv = int2(1, 1); + 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) + ; +} + +[numthreads(4, 1, 1)] +void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) +{ + bool result = true + && TEST_texture(t2D_f32, t2DMS_f32) + ; + + //CHK:1 + outputBuffer[0] = int(result); +} -- cgit v1.2.3