diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2024-12-19 12:13:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-19 09:13:02 -0800 |
| commit | 237af82f7e9ed1dd5d97a981939fc23aec2008b3 (patch) | |
| tree | 4d89f5135837ede9e4bc49f3eff5f6f4350655c4 /tests | |
| parent | c6662b6e42d1e6e1ed2752846312074a06cd05e8 (diff) | |
Add HLSL texture sample with status intrinsics (#5901)
* Implement HLSL texture sample with status intrinsics
* fix test and cleanup
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/hlsl-intrinsic/texture/texture-intrinsics.slang | 60 |
1 files changed, 46 insertions, 14 deletions
diff --git a/tests/hlsl-intrinsic/texture/texture-intrinsics.slang b/tests/hlsl-intrinsic/texture/texture-intrinsics.slang index 8ae3b2fda..0543c71b2 100644 --- a/tests/hlsl-intrinsic/texture/texture-intrinsics.slang +++ b/tests/hlsl-intrinsic/texture/texture-intrinsics.slang @@ -43,11 +43,14 @@ void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) uint numLevels = 0, elements = 0; float fnumLevels = 0.0f, felements = 0.0f; + float clamp = 0.0f; + float bias = 0.0f; + uint status; /* <Template Type> Object.SampleLevel() - */ + */ val += t1D.SampleLevel(samplerState, u, 0); val += t2D.SampleLevel(samplerState, float2(u, u), 0); val += t3D.SampleLevel(samplerState, float3(u, u, u), 0); @@ -66,6 +69,16 @@ void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) val += t1DArray.SampleLevel(samplerState, float2(u, 0), 0, 1); val += t2DArray.SampleLevel(samplerState, float3(u, u, 0), 0, int2(1, 1)); + // Status variant +#if !defined(VK) + val += t1D.SampleLevel(samplerState, u, 0, 1, status); + val += t2D.SampleLevel(samplerState, float2(u, u), 0, int2(1, 1), status); + val += t3D.SampleLevel(samplerState, float3(u, u, u), 0, int3(1, 1, 1), status); + + val += t1DArray.SampleLevel(samplerState, float2(u, 0), 0, 1, status); + val += t2DArray.SampleLevel(samplerState, float3(u, u, 0), 0, int2(1, 1), status); +#endif + /* float Object.SampleCmpLevelZero() */ @@ -82,6 +95,15 @@ void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) val += t2D.SampleCmpLevelZero(shadowSampler, float2(u, u), 0, int2(0, 0)); // TextureCube does not have an offset version of this + // Status variant +#if !defined(VK) + val += t1D.SampleCmpLevelZero(shadowSampler, u, 0, 0, status); + val += t2D.SampleCmpLevelZero(shadowSampler, float2(u, u), 0, int2(0, 0), status); + + val += t1DArray.SampleCmpLevelZero(shadowSampler, float2(u, u), 0, 0, status); + val += t2DArray.SampleCmpLevelZero(shadowSampler, normalize(float3(u, 1 - u, u)), 0, int2(0, 0), status); +#endif + /* void Object.GetDimensions() */ @@ -306,22 +328,32 @@ void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) val += t1DArray.SampleGrad(samplerState, float2(0.0f, 0.0f), _ddx, _ddy, 0); val += t2DArray.SampleGrad(samplerState, float3(u, u, 0.0f), float2(_ddx, _ddx), float2(_ddy, _ddy), int2(0, 0)); + // Status variant +#if !defined(VK) + val += t1D.SampleGrad(samplerState, 0.0f, _ddx, _ddy, 0, clamp, status); + val += t2D.SampleGrad(samplerState, float2(u, u), float2(_ddx, _ddx), float2(_ddy, _ddy), int2(0, 0), clamp, status); + val += t3D.SampleGrad(samplerState, float3(u, u, u), float3(_ddx, _ddx, _ddx), float3(_ddy, _ddy, _ddy), int3(0, 0, 0), clamp, status); + + val += t1DArray.SampleGrad(samplerState, float2(0.0f, 0.0f), _ddx, _ddy, 0, clamp, status); + val += t2DArray.SampleGrad(samplerState, float3(u, u, 0.0f), float2(_ddx, _ddx), float2(_ddy, _ddy), int2(0, 0), clamp, status); +#endif + outputBuffer[idx] = val; } -// DX11: 313 -// DX11: 313 -// DX11: 313 -// DX11: 313 -// DX12: 340 -// DX12: 340 -// DX12: 340 -// DX12: 340 -// DX12CS6: 363 -// DX12CS6: 363 -// DX12CS6: 363 -// DX12CS6: 363 -// VK: 351 +// DX11: 327 +// DX11: 327 +// DX11: 327 +// DX11: 327 +// DX12: 354 +// DX12: 354 +// DX12: 354 +// DX12: 354 +// DX12CS6: 377 +// DX12CS6: 377 +// DX12CS6: 377 +// DX12CS6: 377 // VK: 351 // VK: 351 // VK: 351 +// VK: 351
\ No newline at end of file |
