mirror of
https://github.com/RPCS3/glslang.git
synced 2025-02-17 09:27:48 +00:00
HLSL: Fix #754: recognize type casts in if-statements separately from declarations.
This commit is contained in:
parent
621c0e3d69
commit
057df2935a
@ -80,6 +80,16 @@ gl_FragCoord origin is upper left
|
||||
0:31 'ii' (temp float)
|
||||
0:32 Pre-Increment (temp int)
|
||||
0:32 'ii' (temp int)
|
||||
0:33 Test condition and select (temp void)
|
||||
0:33 Condition
|
||||
0:33 Compare Equal (temp bool)
|
||||
0:33 Convert int to float (temp float)
|
||||
0:33 'ii' (temp int)
|
||||
0:33 Constant:
|
||||
0:33 1.000000
|
||||
0:33 true case
|
||||
0:34 Pre-Increment (temp int)
|
||||
0:34 'ii' (temp int)
|
||||
0:2 Function Definition: PixelShaderFunction( (temp void)
|
||||
0:2 Function Parameters:
|
||||
0:? Sequence
|
||||
@ -179,6 +189,16 @@ gl_FragCoord origin is upper left
|
||||
0:31 'ii' (temp float)
|
||||
0:32 Pre-Increment (temp int)
|
||||
0:32 'ii' (temp int)
|
||||
0:33 Test condition and select (temp void)
|
||||
0:33 Condition
|
||||
0:33 Compare Equal (temp bool)
|
||||
0:33 Convert int to float (temp float)
|
||||
0:33 'ii' (temp int)
|
||||
0:33 Constant:
|
||||
0:33 1.000000
|
||||
0:33 true case
|
||||
0:34 Pre-Increment (temp int)
|
||||
0:34 'ii' (temp int)
|
||||
0:2 Function Definition: PixelShaderFunction( (temp void)
|
||||
0:2 Function Parameters:
|
||||
0:? Sequence
|
||||
@ -195,24 +215,24 @@ gl_FragCoord origin is upper left
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 94
|
||||
// Id's are bound by 101
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 87 90
|
||||
EntryPoint Fragment 4 "PixelShaderFunction" 94 97
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Name 4 "PixelShaderFunction"
|
||||
Name 11 "@PixelShaderFunction(vf4;"
|
||||
Name 10 "input"
|
||||
Name 68 "ii"
|
||||
Name 80 "ii"
|
||||
Name 85 "input"
|
||||
Name 87 "input"
|
||||
Name 90 "@entryPointOutput"
|
||||
Name 91 "param"
|
||||
Decorate 87(input) Location 0
|
||||
Decorate 90(@entryPointOutput) Location 0
|
||||
Name 92 "input"
|
||||
Name 94 "input"
|
||||
Name 97 "@entryPointOutput"
|
||||
Name 98 "param"
|
||||
Decorate 94(input) Location 0
|
||||
Decorate 97(@entryPointOutput) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@ -228,20 +248,20 @@ gl_FragCoord origin is upper left
|
||||
78: TypeInt 32 1
|
||||
79: TypePointer Function 78(int)
|
||||
82: 78(int) Constant 1
|
||||
86: TypePointer Input 7(fvec4)
|
||||
87(input): 86(ptr) Variable Input
|
||||
89: TypePointer Output 7(fvec4)
|
||||
90(@entryPointOutput): 89(ptr) Variable Output
|
||||
93: TypePointer Input 7(fvec4)
|
||||
94(input): 93(ptr) Variable Input
|
||||
96: TypePointer Output 7(fvec4)
|
||||
97(@entryPointOutput): 96(ptr) Variable Output
|
||||
4(PixelShaderFunction): 2 Function None 3
|
||||
5: Label
|
||||
85(input): 8(ptr) Variable Function
|
||||
91(param): 8(ptr) Variable Function
|
||||
88: 7(fvec4) Load 87(input)
|
||||
Store 85(input) 88
|
||||
92: 7(fvec4) Load 85(input)
|
||||
Store 91(param) 92
|
||||
93: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 91(param)
|
||||
Store 90(@entryPointOutput) 93
|
||||
92(input): 8(ptr) Variable Function
|
||||
98(param): 8(ptr) Variable Function
|
||||
95: 7(fvec4) Load 94(input)
|
||||
Store 92(input) 95
|
||||
99: 7(fvec4) Load 92(input)
|
||||
Store 98(param) 99
|
||||
100: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 98(param)
|
||||
Store 97(@entryPointOutput) 100
|
||||
Return
|
||||
FunctionEnd
|
||||
11(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9
|
||||
@ -329,6 +349,17 @@ gl_FragCoord origin is upper left
|
||||
81: 78(int) Load 80(ii)
|
||||
83: 78(int) IAdd 81 82
|
||||
Store 80(ii) 83
|
||||
84: 7(fvec4) Undef
|
||||
ReturnValue 84
|
||||
84: 78(int) Load 80(ii)
|
||||
85: 6(float) ConvertSToF 84
|
||||
86: 15(bool) FOrdEqual 85 76
|
||||
SelectionMerge 88 None
|
||||
BranchConditional 86 87 88
|
||||
87: Label
|
||||
89: 78(int) Load 80(ii)
|
||||
90: 78(int) IAdd 89 82
|
||||
Store 80(ii) 90
|
||||
Branch 88
|
||||
88: Label
|
||||
91: 7(fvec4) Undef
|
||||
ReturnValue 91
|
||||
FunctionEnd
|
||||
|
@ -30,4 +30,6 @@ float4 PixelShaderFunction(float4 input) : COLOR0
|
||||
if (float ii = input.z)
|
||||
++ii;
|
||||
++ii;
|
||||
if (float(ii) == 1.0)
|
||||
++ii;
|
||||
}
|
||||
|
@ -2,5 +2,5 @@
|
||||
// For the version, it uses the latest git tag followed by the number of commits.
|
||||
// For the date, it uses the current date (when then script is run).
|
||||
|
||||
#define GLSLANG_REVISION "Overload400-PrecQual.1878"
|
||||
#define GLSLANG_REVISION "Overload400-PrecQual.1881"
|
||||
#define GLSLANG_DATE "06-Mar-2017"
|
||||
|
@ -469,6 +469,12 @@ bool HlslGrammar::acceptControlDeclaration(TIntermNode*& node)
|
||||
if (! acceptFullySpecifiedType(type))
|
||||
return false;
|
||||
|
||||
// filter out type casts
|
||||
if (peekTokenClass(EHTokLeftParen)) {
|
||||
recedeToken();
|
||||
return false;
|
||||
}
|
||||
|
||||
// identifier
|
||||
HlslToken idToken;
|
||||
if (! acceptIdentifier(idToken)) {
|
||||
@ -3259,7 +3265,7 @@ void HlslGrammar::acceptArraySpecifier(TArraySizes*& arraySizes)
|
||||
TSourceLoc loc = token.loc;
|
||||
TIntermTyped* sizeExpr = nullptr;
|
||||
|
||||
// Array sizing expression is optional. If ommitted, array will be later sized by initializer list.
|
||||
// Array sizing expression is optional. If omitted, array will be later sized by initializer list.
|
||||
const bool hasArraySize = acceptAssignmentExpression(sizeExpr);
|
||||
|
||||
if (! acceptTokenClass(EHTokRightBracket)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user