summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-08-23 05:49:33 -0700
committerGitHub <noreply@github.com>2023-08-23 20:49:33 +0800
commit6437c38e0a3c2c1daf36cb5e543dc0b467fa4b15 (patch)
treec117b964ada397d9cac01ff4759bcd16d35c7e20 /tests
parentcdd5e6666f98903d61118ada5cba51424fd1577c (diff)
Lower all ByteAddressBuffer uses for SPIRV. (#3143)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/byte-address-buffer.slang2
-rw-r--r--tests/compute/unbounded-array-of-array-syntax.slang.glsl6
-rw-r--r--tests/cross-compile/array-of-buffers.slang.glsl11
-rw-r--r--tests/cross-compile/array-of-buffers.slang.hlsl9
-rw-r--r--tests/cross-compile/get-dimensions.slang17
-rw-r--r--tests/cross-compile/get-dimensions.slang.expected.txt2
-rw-r--r--tests/expected-failure.txt4
7 files changed, 25 insertions, 26 deletions
diff --git a/tests/compute/byte-address-buffer.slang b/tests/compute/byte-address-buffer.slang
index 9bba63a1f..715be850d 100644
--- a/tests/compute/byte-address-buffer.slang
+++ b/tests/compute/byte-address-buffer.slang
@@ -28,7 +28,7 @@ void test(int val)
uint4 quad = inputBuffer.Load4(int(tmp * 4));
tmp = (quad.x + quad.y + quad.z + quad.w) & 0xF;
- outputBuffer.Store(val * 4, tmp);
+ outputBuffer.Store(val*4, tmp);
}
[numthreads(4, 1, 1)]
diff --git a/tests/compute/unbounded-array-of-array-syntax.slang.glsl b/tests/compute/unbounded-array-of-array-syntax.slang.glsl
index 2ea90e4a6..f426bb55d 100644
--- a/tests/compute/unbounded-array-of-array-syntax.slang.glsl
+++ b/tests/compute/unbounded-array-of-array-syntax.slang.glsl
@@ -1,4 +1,3 @@
-//TEST_IGNORE_FILE:
#version 450
#extension GL_EXT_nonuniform_qualifier : require
layout(row_major) uniform;
@@ -15,9 +14,8 @@ void main()
int index_0 = int(gl_GlobalInvocationID.x);
int innerIndex_0 = index_0 & 3;
int _S1 = nonuniformEXT(index_0 >> 2);
- uint bufferCount_0;
- uint bufferStride_0;
- (bufferCount_0) = (g_aoa_0[_S1])._data.length(); (bufferStride_0) = 0;
+ uvec2 _S2 = uvec2(g_aoa_0[_S1]._data.length(), 0);
+ uint bufferCount_0 = _S2.x;
int innerIndex_1;
if(innerIndex_0 >= int(bufferCount_0))
{
diff --git a/tests/cross-compile/array-of-buffers.slang.glsl b/tests/cross-compile/array-of-buffers.slang.glsl
index fb1a4be2f..53a826a91 100644
--- a/tests/cross-compile/array-of-buffers.slang.glsl
+++ b/tests/cross-compile/array-of-buffers.slang.glsl
@@ -15,7 +15,6 @@ struct S_0
{
vec4 f_0;
};
-
layout(binding = 1)
layout(std140) uniform _S2
{
@@ -27,18 +26,14 @@ layout(std430, binding = 2) readonly buffer StructuredBuffer_S_t_0 {
layout(std430, binding = 3) buffer StructuredBuffer_float4_t_0 {
vec4 _data[];
} sb2_0[5];
-layout(std430, binding = 4) readonly buffer _S3
-{
+layout(std430, binding = 4) readonly buffer StructuredBuffer_uint_t_0 {
uint _data[];
} bb_0[6];
layout(location = 0)
-out vec4 _S4;
+out vec4 _S3;
void main()
{
-
- uint _S5 = ((bb_0[C_0.index_0])._data[(int(C_0.index_0 * 4U))/4]);
- _S4 = cb_0[C_0.index_0].f_0 + sb1_0[C_0.index_0]._data[C_0.index_0].f_0 + sb2_0[C_0.index_0]._data[C_0.index_0] + vec4(float(_S5));
+ _S3 = cb_0[C_0.index_0].f_0 + sb1_0[C_0.index_0]._data[C_0.index_0].f_0 + sb2_0[C_0.index_0]._data[C_0.index_0] + vec4(float(bb_0[C_0.index_0]._data[int(C_0.index_0 * 4U) / 4]));
return;
}
-
diff --git a/tests/cross-compile/array-of-buffers.slang.hlsl b/tests/cross-compile/array-of-buffers.slang.hlsl
index ca4b76bbe..a2c1c6302 100644
--- a/tests/cross-compile/array-of-buffers.slang.hlsl
+++ b/tests/cross-compile/array-of-buffers.slang.hlsl
@@ -13,7 +13,6 @@ cbuffer C_0 : register(b0)
{
SLANG_ParameterGroup_C_0 C_0;
}
-
struct S_0
{
float4 f_0;
@@ -26,9 +25,11 @@ StructuredBuffer<S_0 > sb1_0[int(4)] : register(t0);
RWStructuredBuffer<float4 > sb2_0[int(5)] : register(u0);
ByteAddressBuffer bb_0[int(6)] : register(t4);
-
float4 main() : SV_TARGET
{
- uint _S1 = bb_0[C_0.index_0].Load(int(C_0.index_0 * 4U));
- return cb_0[C_0.index_0].f_0 + sb1_0[C_0.index_0].Load(C_0.index_0).f_0 + sb2_0[C_0.index_0][C_0.index_0] + (float4)float(_S1);
+
+ float4 _S1 = cb_0[C_0.index_0].f_0 + sb1_0[C_0.index_0].Load(C_0.index_0).f_0 + sb2_0[C_0.index_0][C_0.index_0];
+ uint _S2 = bb_0[C_0.index_0].Load(int(C_0.index_0 * 4U));
+ return _S1 + (float4)float(_S2);
}
+
diff --git a/tests/cross-compile/get-dimensions.slang b/tests/cross-compile/get-dimensions.slang
index 65c2a1a70..27cbb18de 100644
--- a/tests/cross-compile/get-dimensions.slang
+++ b/tests/cross-compile/get-dimensions.slang
@@ -10,7 +10,7 @@ struct Thing
float b;
};
-//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer
+//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;
//TEST_INPUT:ubuffer(data=[7 2 9 53], stride=4):name buffer0
@@ -25,13 +25,16 @@ RWStructuredBuffer<float> buffer2;
//TEST_INPUT:ubuffer(data=[1 0 3 0 7 0], stride=8):name buffer3
RWStructuredBuffer<Thing> buffer3;
-[numthreads(4, 1, 1)]
+//TEST_INPUT:ubuffer(data=[1 0 3 0 7 6], stride=0):name buffer4
+RWByteAddressBuffer buffer4;
+
+[numthreads(5, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
int index = int(dispatchThreadID.x);
int last = -1;
- uint count, stride;
+ uint count = 0, stride = 0;
if (index == 0)
{
buffer0.GetDimensions(count, stride);
@@ -47,13 +50,17 @@ void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
buffer2.GetDimensions(count, stride);
last = int(buffer2.Load(int(count - 1)));
}
- else
+ else if (index == 3)
{
buffer3.GetDimensions(count, stride);
last = buffer3.Load(int(count - 1)).a;
}
-
+ else
+ {
+ buffer4.GetDimensions(count);
+ last = buffer4.Load(count - 4);
+ }
outputBuffer[index * 2] = int(count);
outputBuffer[index * 2 + 1] = last;
} \ No newline at end of file
diff --git a/tests/cross-compile/get-dimensions.slang.expected.txt b/tests/cross-compile/get-dimensions.slang.expected.txt
index b90b9551c..87709651c 100644
--- a/tests/cross-compile/get-dimensions.slang.expected.txt
+++ b/tests/cross-compile/get-dimensions.slang.expected.txt
@@ -6,3 +6,5 @@
0
3
7
+18
+6
diff --git a/tests/expected-failure.txt b/tests/expected-failure.txt
index effee0e2b..fcfea7c15 100644
--- a/tests/expected-failure.txt
+++ b/tests/expected-failure.txt
@@ -66,7 +66,6 @@ tests/bugs/vec-compare.slang.2 (vk)
tests/bugs/vec-init.slang.2 (vk)
tests/bugs/inlining/global-const-inline.slang.1 (vk)
tests/compute/buffer-layout.slang.2 (vk)
-tests/compute/byte-address-buffer.slang.2 (vk)
tests/compute/dynamic-dispatch-16.slang (vk)
tests/compute/dynamic-dispatch-17.slang (vk)
tests/compute/dynamic-dispatch-18.slang.2 (vk)
@@ -93,9 +92,7 @@ tests/compute/texture-sample-grad-offset-clamp.slang (vk)
tests/compute/texture-simple.slang.4 (vk)
tests/compute/texture-simpler.slang (vk)
tests/compute/vector-scalar-compare.slang.1 (vk)
-tests/cross-compile/get-dimensions.slang.1 (vk)
tests/cross-compile/glsl-bool-ops.slang.1 (vk)
-tests/hlsl/byte-buffer-load-std430.slang (vk)
tests/hlsl/glsl-matrix-layout.slang (vk)
tests/hlsl/packoffset.slang.1 (vk)
tests/hlsl-intrinsic/asfloat16.slang.3 (vk)
@@ -135,7 +132,6 @@ tests/hlsl-intrinsic/active-mask/switch.slang.3 (vk)
tests/hlsl-intrinsic/bit-cast/bit-cast-16-bit.slang.1 (vk)
tests/hlsl-intrinsic/byte-address-buffer/byte-address-16bit-vector.slang.2 (vk)
tests/hlsl-intrinsic/byte-address-buffer/byte-address-16bit.slang.2 (vk)
-tests/hlsl-intrinsic/byte-address-buffer/byte-address-struct.slang.3 (vk)
tests/hlsl-intrinsic/size-of/align-of-3.slang.3 (vk)
tests/hlsl-intrinsic/size-of/size-of-3.slang.3 (vk)
tests/hlsl-intrinsic/wave-mask/wave-active-product.slang.3 (vk)