summaryrefslogtreecommitdiffstats
path: root/tests/glsl
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2025-05-07 00:46:42 -0500
committerGitHub <noreply@github.com>2025-05-06 22:46:42 -0700
commitccdb2e39da37753961f3694d0f90e676bf859006 (patch)
treee4dd8cea8e54083283c7728df8654fa5ad4516b2 /tests/glsl
parent90ecf185a742efffc7e1fcf399961289b3e00d08 (diff)
bitcast require the input has same width with result type (#7018)
bitcast requires the input has same width with result type, this PR ensures that we always lower the bitcast IR instruction satisfies this requirement. Close #7017.
Diffstat (limited to 'tests/glsl')
-rw-r--r--tests/glsl/interger_pack.slang47
1 files changed, 44 insertions, 3 deletions
diff --git a/tests/glsl/interger_pack.slang b/tests/glsl/interger_pack.slang
index 7bf414c4d..cf2c49f9c 100644
--- a/tests/glsl/interger_pack.slang
+++ b/tests/glsl/interger_pack.slang
@@ -3,8 +3,26 @@
#version 450
-//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
-layout(scalar) buffer MyBlockName2
+//TEST_INPUT:ubuffer(data=[0xA802 0x1349 0xC2 0x91 0xB2 0x72], stride=4):out,name=inputBuffer
+layout(scalar) buffer MyBlock1
+{
+ uint32_t a;
+ uint32_t b;
+
+ uint32_t c;
+ uint32_t d;
+ uint32_t e;
+ uint32_t f;
+} inputBuffer;
+// BUF: A802
+// BUF-NEXT: 1349
+// BUF-NEXT: C2
+// BUF-NEXT: 91
+// BUF-NEXT: B2
+// BUF-NEXT: 72
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
+layout(scalar) buffer MyBlock2
{
uvec4 a;
ivec4 b;
@@ -20,6 +38,12 @@ layout(scalar) buffer MyBlockName2
uint32_t i;
int32_t j;
+
+ uint32_t k;
+ int32_t l;
+
+ uint32_t m;
+ uint32_t n;
} outputBuffer;
layout(local_size_x = 1) in;
@@ -27,7 +51,7 @@ void computeMain()
{
uint32_t a = 0xF2845678;
outputBuffer.a = unpack8(a);
- // BUF: 78
+ // BUF-NEXT: 78
// BUF-NEXT: 56
// BUF-NEXT: 84
// BUF-NEXT: F2
@@ -74,4 +98,21 @@ void computeMain()
i8vec4 j = {0x82, 0x56, 0x12, 0x80};
outputBuffer.j = pack32(j);
// BUF-NEXT: 80125682
+
+ // Note: Below tests are mainly to verify that we don't emit invalid spirv code
+ u16vec2 k = {inputBuffer.a, inputBuffer.b};
+ outputBuffer.k = pack32(k);
+ // BUF-NEXT: 1349A802
+
+ i16vec2 l = {inputBuffer.a, inputBuffer.b};
+ outputBuffer.l = pack32(l);
+ // BUF-NEXT: 1349A802
+
+ u8vec4 m = {inputBuffer.c, inputBuffer.d, inputBuffer.e, inputBuffer.f};
+ outputBuffer.m = pack32(m);
+ // BUF-NEXT: 72B291C2
+
+ u8vec4 n = {inputBuffer.c, inputBuffer.d, inputBuffer.e, inputBuffer.f};
+ outputBuffer.n = pack32(n);
+ // BUF-NEXT: 72B291C2
}