diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-05-16 13:42:59 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-16 10:42:59 -0700 |
| commit | 8683b85c0494db99feb08b6efcdc26dfe006729f (patch) | |
| tree | 6822d8fabc336409b286c854617fd525bd90fcf2 /tests/compute/byte-address-buffer.slang | |
| parent | 9dfd5244ad2953753535e82acd05e72e5ab2bc5f (diff) | |
Fix HLSL ByteAddressBuffer Load* parameter integer type (#7117)
* Fix HLSL ByteAddressBuffer Load* parameter integer type
* Fix tests
* Fix load with alignment function signature clash
* Fix LoadAligned tests
Diffstat (limited to 'tests/compute/byte-address-buffer.slang')
| -rw-r--r-- | tests/compute/byte-address-buffer.slang | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/compute/byte-address-buffer.slang b/tests/compute/byte-address-buffer.slang index 65356ec22..3bf811945 100644 --- a/tests/compute/byte-address-buffer.slang +++ b/tests/compute/byte-address-buffer.slang @@ -5,6 +5,8 @@ //TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj //TEST(compute):COMPARE_COMPUTE_EX:-d3d12 -compute -shaderobj +//TEST:SIMPLE(filecheck=SPV):-target spirv -entry computeMain -stage compute -emit-spirv-directly + // Confirm cross-compilation of `(RW)ByteAddressBuffer` // // TODO: I'm only using `RWByteAddressBuffer` for now because I don't @@ -16,26 +18,31 @@ RWByteAddressBuffer inputBuffer; //TEST_INPUT:ubuffer(data=[0 0 0 0]):out,name=outputBuffer RWByteAddressBuffer outputBuffer; -void test(int val) +// Make sure arithmetic ops are properly performed on unsigned types. +// SPV-NOT: OpSDiv +// SPV: OpUDiv + +void test(uint val) { uint tmp = val; - tmp = inputBuffer.Load(int(tmp * 4)); + tmp = inputBuffer.Load(uint(tmp * 4)); - uint2 pair = inputBuffer.Load2(int(tmp * 4)); + uint2 pair = inputBuffer.Load2(uint(tmp * 4)); tmp = (pair.x + pair.y) & 0xF; - uint4 quad = inputBuffer.Load4(int(tmp * 4)); + uint4 quad = inputBuffer.Load4(uint(tmp * 4)); tmp = (quad.x + quad.y + quad.z + quad.w) & 0xF; outputBuffer.Store(val*4, tmp); } [numthreads(4, 1, 1)] +[shader("compute")] void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { uint tid = dispatchThreadID.x; - int val = int(tid); + uint val = uint(tid); test(val); } |
