tests/shader_runner: Parse hex blobs as a list of 32-bit integers.

This commit is contained in:
Henri Verbeet
2025-07-31 18:40:08 +02:00
parent 5dca0da2da
commit 243207701b
Notes: Henri Verbeet 2025-08-04 15:08:50 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1667
6 changed files with 115 additions and 107 deletions

View File

@@ -59,23 +59,23 @@ shader model < 5.1
% mov o0.xyzw, -|cb0[0].xyzw| % mov o0.xyzw, -|cb0[0].xyzw|
% ret % ret
44584243 86f9f3f1 b27b0db4 49b8d2de 09b1ffaf 01000000 78020000 05000000 43425844 f1f3f986 b40d7bb2 ded2b849 afffb109 00000001 00000278 00000005
34000000 48010000 58010000 8c010000 dc010000 52444546 0c010000 01000000 00000034 00000148 00000158 0000018c 000001dc 46454452 0000010c 00000001
68000000 01000000 3c000000 0005ffff 00010000 d8000000 52443131 3c000000 00000068 00000001 0000003c ffff0500 00000100 000000d8 31314452 0000003c
18000000 20000000 28000000 24000000 0c000000 00000000 5c000000 00000000 00000018 00000020 00000028 00000024 0000000c 00000000 0000005c 00000000
00000000 00000000 00000000 00000000 01000000 00000000 24476c6f 62616c73 00000000 00000000 00000000 00000000 00000001 00000000 6f6c4724 736c6162
00ababab 5c000000 01000000 80000000 10000000 00000000 00000000 a8000000 ababab00 0000005c 00000001 00000080 00000010 00000000 00000000 000000a8
00000000 10000000 02000000 b4000000 00000000 ffffffff 00000000 ffffffff 00000000 00000010 00000002 000000b4 00000000 ffffffff 00000000 ffffffff
00000000 7500666c 6f617434 00ababab 01000300 01000400 00000000 00000000 00000000 6c660075 3474616f ababab00 00030001 00040001 00000000 00000000
00000000 00000000 00000000 00000000 aa000000 4d696372 6f736f66 74202852 00000000 00000000 00000000 00000000 000000aa 7263694d 666f736f 52282074
2920484c 534c2053 68616465 7220436f 6d70696c 65722031 302e302e 31303031 4c482029 53204c53 65646168 6f432072 6c69706d 31207265 2e302e30 31303031
312e3136 33383400 4953474e 08000000 00000000 08000000 4f53474e 2c000000 36312e31 00343833 4e475349 00000008 00000000 00000008 4e47534f 0000002c
01000000 08000000 20000000 00000000 00000000 03000000 00000000 0f000000 00000001 00000008 00000020 00000000 00000000 00000003 00000000 0000000f
73765f74 61726765 7400abab 53484558 48000000 50000000 12000000 6a080001 745f7673 65677261 abab0074 58454853 00000048 00000050 00000012 0100086a
59000004 468e2000 00000000 01000000 65000003 f2201000 00000000 36000007 04000059 00208e46 00000000 00000001 03000065 001020f2 00000000 07000036
f2201000 00000000 468e2080 c1000000 00000000 00000000 3e000001 53544154 001020f2 00000000 80208e46 000000c1 00000000 00000000 0100003e 54415453
94000000 02000000 00000000 00000000 01000000 01000000 00000000 00000000 00000094 00000002 00000000 00000000 00000001 00000001 00000000 00000000
01000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

View File

@@ -27,12 +27,12 @@ shader model < 3.0
[pixel shader d3dbc-hex] [pixel shader d3dbc-hex]
% The same as above, but in bytecode format so we test the partial precision % The same as above, but in bytecode format so we test the partial precision
% destination modifier. % destination modifier.
0002ffff % ps_2_0 ffff0200 % ps_2_0
51000005 01000fa0 0000003f 00000000 00000000 00000000 % def c1, 0.5, 0, 0, 0 05000051 a00f0001 3f000000 00000000 00000000 00000000 % def c1, 0.5, 0, 0, 0
01000002 00000f80 0000e4a0 % mov r0, c0 02000001 800f0000 a0e40000 % mov r0, c0
02000003 00002f80 0000e480 010000a0 % add_pp r0, r0, c1.x 03000002 802f0000 80e40000 a0000001 % add_pp r0, r0, c1.x
01000002 00082f80 0000e480 % mov_pp oC0, r0 02000001 802f0800 80e40000 % mov_pp oC0, r0
ffff0000 % end 0000ffff % end
[test] [test]
uniform 0 float4 1.0 2.0 3.0 4.0 uniform 0 float4 1.0 2.0 3.0 4.0

View File

@@ -172,21 +172,21 @@ shader model < 4.1
% mov o0.yz, l(0,10.000000,11.000000,0) % mov o0.yz, l(0,10.000000,11.000000,0)
% ret % ret
44584243 01be226d 9678d2b0 d0f833c5 63e17c6c 01000000 f0010000 05000000 43425844 6d22be01 b0d27896 c533f8d0 6c7ce163 00000001 000001f0 00000005
34000000 8c000000 e0000000 14010000 74010000 52444546 50000000 00000000 00000034 0000008c 000000e0 00000114 00000174 46454452 00000050 00000000
00000000 00000000 1c000000 0004ffff 00010000 1c000000 4d696372 6f736f66 00000000 00000000 0000001c ffff0400 00000100 0000001c 7263694d 666f736f
74202852 2920484c 534c2053 68616465 7220436f 6d70696c 65722031 302e302e 52282074 4c482029 53204c53 65646168 6f432072 6c69706d 31207265 2e302e30
31303031 312e3136 33383400 4953474e 4c000000 02000000 08000000 38000000 31303031 36312e31 00343833 4e475349 0000004c 00000002 00000008 00000038
00000000 01000000 03000000 00000000 0f000000 44000000 00000000 00000000 00000000 00000001 00000003 00000000 0000000f 00000044 00000000 00000000
03000000 01000000 0f090000 53565f50 6f736974 696f6e00 434f4c4f 5200abab 00000003 00000001 0000090f 505f5653 7469736f 006e6f69 4f4c4f43 abab0052
4f53474e 2c000000 01000000 08000000 20000000 00000000 00000000 03000000 4e47534f 0000002c 00000001 00000008 00000020 00000000 00000000 00000003
00000000 0f000000 53565f54 61726765 7400abab 53484452 58000000 40000000 00000000 0000000f 545f5653 65677261 abab0074 52444853 00000058 00000040
16000000 62100003 92101000 01000000 65000003 f2201000 00000000 36000005 00000016 03001062 00101092 00000001 03000065 001020f2 00000000 05000036
92201000 00000000 061c1000 01000000 36000008 62201000 00000000 02400000 00102092 00000000 00101c06 00000001 08000036 00102062 00000000 00004002
00000000 00002041 00003041 00000000 3e000001 53544154 74000000 03000000 00000000 41200000 41300000 00000000 0100003e 54415453 00000074 00000003
00000000 00000000 02000000 00000000 00000000 00000000 01000000 00000000 00000000 00000000 00000002 00000000 00000000 00000000 00000001 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000002 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[test] [test]

View File

@@ -38,16 +38,16 @@ shader model >= 4.0
shader model < 4.1 shader model < 4.1
[pixel shader dxbc-tpf-hex] [pixel shader dxbc-tpf-hex]
44584243 27142e5c db948785 3bc0e84e 973472c5 01000000 40010000 03000000 43425844 5c2e1427 858794db 4ee8c03b c5723497 00000001 00000140 00000003
2c000000 80000000 b4000000 4953474e 4c000000 02000000 08000000 38000000 0000002c 00000080 000000b4 4e475349 0000004c 00000002 00000008 00000038
00000000 00000000 01000000 00000000 01010000 3a000000 00000000 09000000 00000000 00000000 00000001 00000000 00000101 0000003a 00000000 00000009
01000000 00000000 02020000 41007376 5f697366 726f6e74 66616365 00ababab 00000001 00000000 00000202 76730041 6673695f 746e6f72 65636166 ababab00
4f53474e 2c000000 01000000 08000000 20000000 00000000 00000000 03000000 4e47534f 0000002c 00000001 00000008 00000020 00000000 00000000 00000003
00000000 0f000000 73765f74 61726765 7400abab 53484452 84000000 40000000 00000000 0000000f 745f7673 65677261 abab0074 52444853 00000084 00000040
21000000 62080003 12101000 00000000 63080004 22101000 00000000 09000000 00000021 03000862 00101012 00000000 04000863 00101022 00000000 00000009
65000003 f2201000 00000000 56000005 12201000 00000000 0a101000 00000000 03000065 001020f2 00000000 05000056 00102012 00000000 0010100a 00000000
01000007 22201000 00000000 1a101000 00000000 01400000 0000803f 36000008 07000001 00102022 00000000 0010101a 00000000 00004001 3f800000 08000036
c2201000 00000000 02400000 00000000 00000000 00000000 00000000 3e000001 001020c2 00000000 00004002 00000000 00000000 00000000 00000000 0100003e
[test] [test]
clear rtv 0 0.0 0.0 0.0 0.0 clear rtv 0 0.0 0.0 0.0 0.0

View File

@@ -230,48 +230,48 @@ tessellation-shader
% mov o[r0.x + 0].z, l(0) % mov o[r0.x + 0].z, l(0)
% ret % ret
44584243 3429d2d3 fb408d2b 2fd030cc 69cd5a0b 01000000 3c050000 06000000 43425844 d3d22934 2b8d40fb cc30d02f 0b5acd69 00000001 0000053c 00000006
38000000 b0000000 3c010000 c8010000 a8020000 a0040000 52444546 70000000 00000038 000000b0 0000013c 000001c8 000002a8 000004a0 46454452 00000070
00000000 00000000 00000000 3c000000 00055348 00010000 3c000000 52443131 00000000 00000000 00000000 0000003c 48530500 00000100 0000003c 31314452
3c000000 18000000 20000000 28000000 24000000 0c000000 00000000 4d696372 0000003c 00000018 00000020 00000028 00000024 0000000c 00000000 7263694d
6f736f66 74202852 2920484c 534c2053 68616465 7220436f 6d70696c 65722031 666f736f 52282074 4c482029 53204c53 65646168 6f432072 6c69706d 31207265
302e302e 31303031 312e3136 33383400 4953474e 84000000 04000000 08000000 2e302e30 31303031 36312e31 00343833 4e475349 00000084 00000004 00000008
68000000 00000000 01000000 03000000 00000000 0f0f0000 74000000 00000000 00000068 00000000 00000001 00000003 00000000 00000f0f 00000074 00000000
00000000 03000000 01000000 01010000 78000000 00000000 00000000 03000000 00000000 00000003 00000001 00000101 00000078 00000000 00000000 00000003
01000000 02020000 7e000000 00000000 00000000 03000000 01000000 04040000 00000001 00000202 0000007e 00000000 00000000 00000003 00000001 00000404
53565f50 6f736974 696f6e00 52454400 47524545 4e00424c 554500ab 4f53474e 505f5653 7469736f 006e6f69 00444552 45455247 4c42004e ab004555 4e47534f
84000000 04000000 08000000 68000000 00000000 01000000 03000000 00000000 00000084 00000004 00000008 00000068 00000000 00000001 00000003 00000000
0f000000 74000000 00000000 00000000 03000000 01000000 010e0000 78000000 0000000f 00000074 00000000 00000000 00000003 00000001 00000e01 00000078
00000000 00000000 03000000 01000000 020d0000 7e000000 00000000 00000000 00000000 00000000 00000003 00000001 00000d02 0000007e 00000000 00000000
03000000 01000000 040b0000 53565f50 6f736974 696f6e00 52454400 47524545 00000003 00000001 00000b04 505f5653 7469736f 006e6f69 00444552 45455247
4e00424c 554500ab 50435347 d8000000 07000000 08000000 b0000000 00000000 4c42004e ab004555 47534350 000000d8 00000007 00000008 000000b0 00000000
0d000000 03000000 00000000 010e0000 be000000 00000000 00000000 03000000 0000000d 00000003 00000000 00000e01 000000be 00000000 00000000 00000003
00000000 06090000 b0000000 01000000 0d000000 03000000 01000000 010e0000 00000000 00000906 000000b0 00000001 0000000d 00000003 00000001 00000e01
c0000000 00000000 00000000 03000000 01000000 020d0000 b0000000 02000000 000000c0 00000000 00000000 00000003 00000001 00000d02 000000b0 00000002
0d000000 03000000 02000000 010e0000 c2000000 00000000 00000000 03000000 0000000d 00000003 00000002 00000e01 000000c2 00000000 00000000 00000003
02000000 06090000 c4000000 00000000 0e000000 03000000 03000000 010e0000 00000002 00000906 000000c4 00000000 0000000e 00000003 00000003 00000e01
53565f54 65737346 6163746f 72005800 59005a00 53565f49 6e736964 65546573 545f5653 46737365 6f746361 00580072 005a0059 495f5653 6469736e 73655465
73466163 746f7200 53484558 f0010000 50000300 7c000000 71000001 93180001 63614673 00726f74 58454853 000001f0 00030050 0000007c 01000071 01001893
94180001 95100001 96080001 97180001 6a080001 73000001 99000002 03000000 01001894 01001095 01000896 01001897 0100086a 01000073 02000099 00000003
5f000002 00700100 67000004 12201000 00000000 11000000 67000004 12201000 0200005f 00017000 04000067 00102012 00000000 00000011 04000067 00102012
01000000 12000000 67000004 12201000 02000000 13000000 68000002 01000000 00000001 00000012 04000067 00102012 00000002 00000013 02000068 00000001
5b000004 12201000 00000000 03000000 36000004 12001000 00000000 0a700100 0400005b 00102012 00000000 00000003 04000036 00100012 00000000 0001700a
36000006 12209000 0a001000 00000000 01400000 0000803f 3e000001 73000001 06000036 00902012 0010000a 00000000 00004001 3f800000 0100003e 01000073
67000004 12201000 03000000 14000000 36000005 12201000 03000000 01400000 04000067 00102012 00000003 00000014 05000036 00102012 00000003 00004001
0000803f 3e000001 73000001 99000002 03000000 5f000002 00700100 65000003 3f800000 0100003e 01000073 02000099 00000003 0200005f 00017000 03000065
22201000 00000000 65000003 22201000 01000000 65000003 22201000 02000000 00102022 00000000 03000065 00102022 00000001 03000065 00102022 00000002
68000002 01000000 5b000004 22201000 00000000 03000000 36000004 12001000 02000068 00000001 0400005b 00102022 00000000 00000003 04000036 00100012
00000000 0a700100 36000006 22209000 0a001000 00000000 01400000 00000000 00000000 0001700a 06000036 00902022 0010000a 00000000 00004001 00000000
3e000001 73000001 99000002 02000000 5f000002 00700100 65000003 42201000 0100003e 01000073 02000099 00000002 0200005f 00017000 03000065 00102042
00000000 65000003 42201000 02000000 68000002 01000000 5b000004 42201000 00000000 03000065 00102042 00000002 02000068 00000001 0400005b 00102042
00000000 03000000 4f000006 12001000 00000000 0a700100 01400000 01000000 00000000 00000003 0600004f 00100012 00000000 0001700a 00004001 00000001
37000009 12001000 00000000 0a001000 00000000 01400000 00000000 01400000 09000037 00100012 00000000 0010000a 00000000 00004001 00000000 00004001
02000000 36000006 42209000 0a001000 00000000 01400000 00000000 3e000001 00000002 06000036 00902042 0010000a 00000000 00004001 00000000 0100003e
53544154 94000000 0c000000 01000000 00000000 04000000 00000000 00000000 54415453 00000094 0000000c 00000001 00000000 00000004 00000000 00000000
01000000 04000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000004 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 06000000 01000000 00000000 00000000 00000000 00000000 00000000 00000000 00000006 00000001 00000000
00000000 0a000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000000a 00000000 00000000 00000000 00000000 00000000 00000000
03000000 03000000 01000000 02000000 00000000 00000000 00000000 00000003 00000003 00000001 00000002 00000000 00000000 00000000
[domain shader] [domain shader]
struct data struct data

View File

@@ -1726,9 +1726,8 @@ static HRESULT dxc_compiler_compile_shader(void *dxc_compiler, const char *profi
static ID3D10Blob *parse_hex(const char *source) static ID3D10Blob *parse_hex(const char *source)
{ {
size_t len = strlen(source), i, pos = 0; size_t len = strlen(source), i, pos = 0, nibble = 0;
unsigned char *ptr, value = 0; uint32_t *ptr, value = 0;
bool even = false;
ID3D10Blob *blob; ID3D10Blob *blob;
ptr = malloc(len / 2); ptr = malloc(len / 2);
@@ -1737,40 +1736,49 @@ static ID3D10Blob *parse_hex(const char *source)
{ {
char c = source[i]; char c = source[i];
if (nibble == 8)
{
ptr[pos++] = value;
nibble = 0;
value = 0;
}
if (isspace(c)) if (isspace(c))
{
if (nibble && nibble != 8)
fatal_error("Malformed hex literal.\n");
continue; continue;
}
if (c == '%') if (c == '%')
{ {
if (nibble && nibble != 8)
fatal_error("Malformed hex literal.\n");
while (source[i] != '\n') while (source[i] != '\n')
++i; ++i;
continue; continue;
} }
value <<= 4;
if ('0' <= c && c <= '9') if ('0' <= c && c <= '9')
value = 16 * value + (c - '0'); value |= (c - '0');
else if ('a' <= c && c <= 'f') else if ('a' <= c && c <= 'f')
value = 16 * value + (c - 'a' + 10); value |= (c - 'a' + 10);
else if ('A' <= c && c <= 'F') else if ('A' <= c && c <= 'F')
value = 16 * value + (c - 'A' + 10); value |= (c - 'A' + 10);
else else
fatal_error("Invalid hex character '%c'\n", c); fatal_error("Invalid hex character '%c'\n", c);
++nibble;
if (even)
{
ptr[pos++] = value;
value = 0;
}
even = !even;
} }
if (even) if (nibble == 8)
fatal_error("Odd number of hex characters.\n"); ptr[pos++] = value;
else if (nibble)
fatal_error("Malformed hex literal.\n");
D3DCreateBlob(pos, &blob); D3DCreateBlob(pos * sizeof(value), &blob);
if (pos) if (pos)
memcpy(ID3D10Blob_GetBufferPointer(blob), ptr, pos); memcpy(ID3D10Blob_GetBufferPointer(blob), ptr, pos * sizeof(value));
free(ptr); free(ptr);
return blob; return blob;