HLSL: Fix a grammar error related to constructors in parenthetical expressions
This commit is contained in:
129
Test/baseResults/hlsl.constructexpr.frag.out
Normal file
129
Test/baseResults/hlsl.constructexpr.frag.out
Normal file
@@ -0,0 +1,129 @@
|
||||
hlsl.constructexpr.frag
|
||||
Shader version: 450
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:18 Function Definition: main( (global structure{temp 4-component vector of float color})
|
||||
0:4 Function Parameters:
|
||||
0:? Sequence
|
||||
0:6 Constant:
|
||||
0:6 3 (const int)
|
||||
0:7 Constant:
|
||||
0:7 4 (const int)
|
||||
0:8 Constant:
|
||||
0:8 5 (const int)
|
||||
0:9 Constant:
|
||||
0:9 6 (const int)
|
||||
0:10 Constant:
|
||||
0:10 7 (const int)
|
||||
0:11 Constant:
|
||||
0:11 8 (const int)
|
||||
0:12 Comma (temp 2-component vector of float)
|
||||
0:? Constant:
|
||||
0:? 9.000000
|
||||
0:? 10.000000
|
||||
0:? Constant:
|
||||
0:? 11.000000
|
||||
0:? 12.000000
|
||||
0:15 move second child to first child (temp 4-component vector of float)
|
||||
0:15 color: direct index for structure (temp 4-component vector of float)
|
||||
0:15 'ps_output' (temp structure{temp 4-component vector of float color})
|
||||
0:15 Constant:
|
||||
0:15 0 (const int)
|
||||
0:15 Constant:
|
||||
0:15 1.000000
|
||||
0:15 1.000000
|
||||
0:15 1.000000
|
||||
0:15 1.000000
|
||||
0:16 Branch: Return with expression
|
||||
0:16 'ps_output' (temp structure{temp 4-component vector of float color})
|
||||
0:? Linker Objects
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
||||
|
||||
Shader version: 450
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:18 Function Definition: main( (global structure{temp 4-component vector of float color})
|
||||
0:4 Function Parameters:
|
||||
0:? Sequence
|
||||
0:6 Constant:
|
||||
0:6 3 (const int)
|
||||
0:7 Constant:
|
||||
0:7 4 (const int)
|
||||
0:8 Constant:
|
||||
0:8 5 (const int)
|
||||
0:9 Constant:
|
||||
0:9 6 (const int)
|
||||
0:10 Constant:
|
||||
0:10 7 (const int)
|
||||
0:11 Constant:
|
||||
0:11 8 (const int)
|
||||
0:12 Comma (temp 2-component vector of float)
|
||||
0:? Constant:
|
||||
0:? 9.000000
|
||||
0:? 10.000000
|
||||
0:? Constant:
|
||||
0:? 11.000000
|
||||
0:? 12.000000
|
||||
0:15 move second child to first child (temp 4-component vector of float)
|
||||
0:15 color: direct index for structure (temp 4-component vector of float)
|
||||
0:15 'ps_output' (temp structure{temp 4-component vector of float color})
|
||||
0:15 Constant:
|
||||
0:15 0 (const int)
|
||||
0:15 Constant:
|
||||
0:15 1.000000
|
||||
0:15 1.000000
|
||||
0:15 1.000000
|
||||
0:15 1.000000
|
||||
0:16 Branch: Return with expression
|
||||
0:16 'ps_output' (temp structure{temp 4-component vector of float color})
|
||||
0:? Linker Objects
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 32
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main"
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source HLSL 450
|
||||
Name 4 "main"
|
||||
Name 22 "PS_OUTPUT"
|
||||
MemberName 22(PS_OUTPUT) 0 "color"
|
||||
Name 24 "ps_output"
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeInt 32 1
|
||||
7: 6(int) Constant 3
|
||||
8: 6(int) Constant 4
|
||||
9: 6(int) Constant 5
|
||||
10: 6(int) Constant 6
|
||||
11: 6(int) Constant 7
|
||||
12: 6(int) Constant 8
|
||||
13: TypeFloat 32
|
||||
14: TypeVector 13(float) 2
|
||||
15: 13(float) Constant 1091567616
|
||||
16: 13(float) Constant 1092616192
|
||||
17: 14(fvec2) ConstantComposite 15 16
|
||||
18: 13(float) Constant 1093664768
|
||||
19: 13(float) Constant 1094713344
|
||||
20: 14(fvec2) ConstantComposite 18 19
|
||||
21: TypeVector 13(float) 4
|
||||
22(PS_OUTPUT): TypeStruct 21(fvec4)
|
||||
23: TypePointer Function 22(PS_OUTPUT)
|
||||
25: 6(int) Constant 0
|
||||
26: 13(float) Constant 1065353216
|
||||
27: 21(fvec4) ConstantComposite 26 26 26 26
|
||||
28: TypePointer Function 21(fvec4)
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
24(ps_output): 23(ptr) Variable Function
|
||||
29: 28(ptr) AccessChain 24(ps_output) 25
|
||||
Store 29 27
|
||||
30:22(PS_OUTPUT) Load 24(ps_output)
|
||||
ReturnValue 30
|
||||
FunctionEnd
|
||||
17
Test/hlsl.constructexpr.frag
Normal file
17
Test/hlsl.constructexpr.frag
Normal file
@@ -0,0 +1,17 @@
|
||||
struct PS_OUTPUT { float4 color : SV_Target0; };
|
||||
|
||||
PS_OUTPUT main()
|
||||
{
|
||||
// Evaluates to a sequence: 3, 4, 5, 6, 7, 8, and a float2(9,10), float2(11,12) sequence
|
||||
(int(3));
|
||||
(int(3) + int(1));
|
||||
(int(3) + int(1) + int(1));
|
||||
(((int(6))));
|
||||
(int(7.0));
|
||||
((int((2)) ? 8 : 8));
|
||||
(float2(9, 10), float2(11, 12));
|
||||
|
||||
PS_OUTPUT ps_output;
|
||||
ps_output.color = 1.0;
|
||||
return ps_output;
|
||||
}
|
||||
23
Test/hlsl.init2.frag
Normal file
23
Test/hlsl.init2.frag
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
void Test1()
|
||||
{
|
||||
struct mystruct { float2 a; };
|
||||
mystruct test1 = {
|
||||
{ 1, 2, }, // test trailing commas
|
||||
};
|
||||
|
||||
mystruct test2 = {
|
||||
{ { 1, 2, } }, // test unneeded levels
|
||||
};
|
||||
|
||||
float test3 = { 1 } ; // test scalar initialization
|
||||
}
|
||||
|
||||
struct PS_OUTPUT { float4 color : SV_Target0; };
|
||||
|
||||
PS_OUTPUT main()
|
||||
{
|
||||
PS_OUTPUT ps_output;
|
||||
ps_output.color = 1.0;
|
||||
return ps_output;
|
||||
}
|
||||
Reference in New Issue
Block a user