summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-11-12 21:01:47 -0800
committerGitHub <noreply@github.com>2024-11-12 21:01:47 -0800
commit0754abee603c1afa7803a444124acc9d268d2f0a (patch)
tree016bf4c03ff58595c62ec94e902137b1191e5960 /tests
parent567c7e09b6df36b535c4ffbccd6a3658d18e04c2 (diff)
Push buffer load to end of access chain. (#5544)
* Push buffer load to end of access chain. * Update test. * Fix. * Fix. * Fix. * Make more robust. * Fix.
Diffstat (limited to 'tests')
-rw-r--r--tests/spirv/sb-load-2.slang23
-rw-r--r--tests/spirv/sb-load.slang24
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/spirv/sb-load-2.slang b/tests/spirv/sb-load-2.slang
new file mode 100644
index 000000000..b4c10cb4a
--- /dev/null
+++ b/tests/spirv/sb-load-2.slang
@@ -0,0 +1,23 @@
+//TEST:SIMPLE(filecheck=CHECK): -target glsl -entry main -stage compute
+
+struct Test1
+{
+ float2x3 a; // 24B
+ float3x4 b; // 48B
+ float16_t3x2 c; // 12B
+ float16_t2x4 d; // 16B
+};
+
+StructuredBuffer<Test1> dp;
+RWStructuredBuffer<float4> outputBuffer;
+
+// CHECK-COUNT-2: unpackStorage
+// CHECK-NOT: unpackStorage
+[numthreads(4, 4, 1)]
+void main(uint3 GTid : SV_GroupThreadID,
+ uint GI : SV_GroupIndex)
+{
+ var tmp = dp[0];
+ var rs = tmp.a[0][0] + tmp.a[0][1];
+ outputBuffer[GI] = float4(rs);
+} \ No newline at end of file
diff --git a/tests/spirv/sb-load.slang b/tests/spirv/sb-load.slang
new file mode 100644
index 000000000..1b0df0be8
--- /dev/null
+++ b/tests/spirv/sb-load.slang
@@ -0,0 +1,24 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+
+#define FILL_PATTERN_DIMENSIONS_X 16
+#define FILL_PATTERN_DIMENSIONS_Y 16
+
+struct FillPatternBuffer
+{
+ float4 px[FILL_PATTERN_DIMENSIONS_Y][FILL_PATTERN_DIMENSIONS_X];
+};
+
+StructuredBuffer<FillPatternBuffer> dp;
+RWStructuredBuffer<float4> outputBuffer;
+
+// CHECK-NOT: OpCompositeConstruct
+
+[numthreads(4, 4, 1)]
+void main(uint3 GTid : SV_GroupThreadID,
+ uint GI : SV_GroupIndex)
+{
+ const uint ii = GTid.x;
+ const uint jj = GTid.y;
+ const float4 pmv = dp[0].px[ii][jj];
+ outputBuffer[GI] = pmv;
+} \ No newline at end of file