yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeAdd `target_switch` and `intrinsic_asm` statement. (#3154)c787c4b82

master
1.4 KiB41 linesraw
1//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
2
3RWStructuredBuffer<float> buf;
4
5//
6// This test checks that we correctly diagnose trying to use the assignment and
7// typed assignment syntax with operands with no result type or id.
8//
9// By virtue of these tests being in the same file, we also check the error
10// recovery for the asm block parser.
11//
12int foo(const int constParam)
13{
14    // Doesn't have a result type
15    spirv_asm
16    {
17        %bar : %wrong = OpTypeInt 32 0
18        // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: cannot use this 'x : <type> = OpTypeInt...' syntax because OpTypeInt does not have a <result-type-id> operand
19
20    };
21
22    // Doesn't have a result value
23    spirv_asm
24    {
25        %foo = OpStore 1 2;
26        // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: cannot use this 'x = OpStore...' syntax because OpStore does not have a <result-id> operand
27    };
28
29    // garbage
30    spirv_asm
31    {
32        %foo =;
33        // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';'
34        %foo :;
35        // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';'
36        %foo : bar;
37        // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';', expected '='
38        %foo : bar =;
39        // CHECK: wrong-assignment-opcode.slang([[#@LINE-1]]): error {{.*}}: unexpected ';'
40    };
41}