diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2025-02-19 22:17:30 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-19 22:17:30 -0800 |
| commit | 187ec444486ecf24d1baf897d179de4ee1b6b864 (patch) | |
| tree | fc22e12854f6b3f3aaa6bc1a58656499b836a085 /tests/gpu-feature/texture/query/footprint | |
| parent | 0460eb6a0b9e62c3145ab9c43d03751e19a49d8e (diff) | |
Support for dynamic array of textures access for Texture footprint. (#6392)
* Support for dynamic array of textures access for Texture footprint.
* Do a check for DXIL for dynamic array/footprint.
* format code (#40)
---------
Co-authored-by: jsmall-nvidia <jsmall@nvidia.com>
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/gpu-feature/texture/query/footprint')
| -rw-r--r-- | tests/gpu-feature/texture/query/footprint/nv-shader-texture-footprint-array.slang | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/gpu-feature/texture/query/footprint/nv-shader-texture-footprint-array.slang b/tests/gpu-feature/texture/query/footprint/nv-shader-texture-footprint-array.slang new file mode 100644 index 000000000..dc60cf263 --- /dev/null +++ b/tests/gpu-feature/texture/query/footprint/nv-shader-texture-footprint-array.slang @@ -0,0 +1,76 @@ +//DISABLE_TEST:SIMPLE:-target dxil-assembly -entry fragmentMain -profile sm_6_5 -stage fragment -DNV_SHADER_EXTN_SLOT=u0 + +//TEST:SIMPLE(filecheck=SPIRV):-target spirv-assembly -entry fragmentMain -stage fragment +//TEST:SIMPLE(filecheck=DXIL):-target dxil-assembly -entry fragmentMain -profile sm_6_5 -stage fragment -DNV_SHADER_EXTN_SLOT=u0 +//TEST:SIMPLE(filecheck=HLSL):-target hlsl -entry fragmentMain -stage fragment + +//DISABLED_TEST:SIMPLE:-target spirv-assembly -entry fragmentMain -stage fragment +//DISABLED_TEST:SIMPLE:-target dxil-assembly -entry fragmentMain -stage fragment +//DISABLED_TEST:SIMPLE:-target hlsl -entry fragmentMain -stage fragment + +uniform Texture2D textures[] : register(t2, space10); +uniform SamplerState sampler; +uniform RWStructuredBuffer<uint> outputBuffer; + +static Texture2D _getBindlessTexture2d(uint texIdx) +{ + return textures[NonUniformResourceIndex(texIdx)]; +} + +void accumulate(inout uint r, uint u) +{ + r = r ^ u; +} + +void accumulate(inout uint r, bool b) +{ + accumulate(r, uint(b)); +} + +void accumulate(inout uint r, uint2 u) +{ + accumulate(r, u.x); + accumulate(r, u.y); +} + +void accumulate(inout uint r, uint3 u) +{ + accumulate(r, u.x); + accumulate(r, u.y); + accumulate(r, u.z); +} + +void accumulate(inout uint r, TextureFootprint2D f) +{ + accumulate(r, f.anchor); + accumulate(r, f.offset); + accumulate(r, f.mask); + accumulate(r, f.lod); + accumulate(r, f.granularity); + accumulate(r, f.isSingleLevel); +} + +cbuffer Uniforms +{ + uniform float2 coords; + uniform uint granularity; +}; + +void fragmentMain( + float v : VARYING) +{ + uint index = uint(v); + uint r = 0; + + accumulate(r, _getBindlessTexture2d(index).queryFootprintCoarse(granularity, sampler, coords)); + +// SPIRV: Extension "SPV_NV_shader_image_footprint" +// SPIRV: ImageSampleFootprintNV + +// DXIL: struct struct.NvShaderExtnStruct + +// HLSL: NvFootprintCoarse + + outputBuffer[index] = r; +} + |
