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:31 'ii' (temp float)
|
||||||
0:32 Pre-Increment (temp int)
|
0:32 Pre-Increment (temp int)
|
||||||
0:32 'ii' (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 Definition: PixelShaderFunction( (temp void)
|
||||||
0:2 Function Parameters:
|
0:2 Function Parameters:
|
||||||
0:? Sequence
|
0:? Sequence
|
||||||
@ -179,6 +189,16 @@ gl_FragCoord origin is upper left
|
|||||||
0:31 'ii' (temp float)
|
0:31 'ii' (temp float)
|
||||||
0:32 Pre-Increment (temp int)
|
0:32 Pre-Increment (temp int)
|
||||||
0:32 'ii' (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 Definition: PixelShaderFunction( (temp void)
|
||||||
0:2 Function Parameters:
|
0:2 Function Parameters:
|
||||||
0:? Sequence
|
0:? Sequence
|
||||||
@ -195,24 +215,24 @@ gl_FragCoord origin is upper left
|
|||||||
|
|
||||||
// Module Version 10000
|
// Module Version 10000
|
||||||
// Generated by (magic number): 80001
|
// Generated by (magic number): 80001
|
||||||
// Id's are bound by 94
|
// Id's are bound by 101
|
||||||
|
|
||||||
Capability Shader
|
Capability Shader
|
||||||
1: ExtInstImport "GLSL.std.450"
|
1: ExtInstImport "GLSL.std.450"
|
||||||
MemoryModel Logical GLSL450
|
MemoryModel Logical GLSL450
|
||||||
EntryPoint Fragment 4 "PixelShaderFunction" 87 90
|
EntryPoint Fragment 4 "PixelShaderFunction" 94 97
|
||||||
ExecutionMode 4 OriginUpperLeft
|
ExecutionMode 4 OriginUpperLeft
|
||||||
Name 4 "PixelShaderFunction"
|
Name 4 "PixelShaderFunction"
|
||||||
Name 11 "@PixelShaderFunction(vf4;"
|
Name 11 "@PixelShaderFunction(vf4;"
|
||||||
Name 10 "input"
|
Name 10 "input"
|
||||||
Name 68 "ii"
|
Name 68 "ii"
|
||||||
Name 80 "ii"
|
Name 80 "ii"
|
||||||
Name 85 "input"
|
Name 92 "input"
|
||||||
Name 87 "input"
|
Name 94 "input"
|
||||||
Name 90 "@entryPointOutput"
|
Name 97 "@entryPointOutput"
|
||||||
Name 91 "param"
|
Name 98 "param"
|
||||||
Decorate 87(input) Location 0
|
Decorate 94(input) Location 0
|
||||||
Decorate 90(@entryPointOutput) Location 0
|
Decorate 97(@entryPointOutput) Location 0
|
||||||
2: TypeVoid
|
2: TypeVoid
|
||||||
3: TypeFunction 2
|
3: TypeFunction 2
|
||||||
6: TypeFloat 32
|
6: TypeFloat 32
|
||||||
@ -228,20 +248,20 @@ gl_FragCoord origin is upper left
|
|||||||
78: TypeInt 32 1
|
78: TypeInt 32 1
|
||||||
79: TypePointer Function 78(int)
|
79: TypePointer Function 78(int)
|
||||||
82: 78(int) Constant 1
|
82: 78(int) Constant 1
|
||||||
86: TypePointer Input 7(fvec4)
|
93: TypePointer Input 7(fvec4)
|
||||||
87(input): 86(ptr) Variable Input
|
94(input): 93(ptr) Variable Input
|
||||||
89: TypePointer Output 7(fvec4)
|
96: TypePointer Output 7(fvec4)
|
||||||
90(@entryPointOutput): 89(ptr) Variable Output
|
97(@entryPointOutput): 96(ptr) Variable Output
|
||||||
4(PixelShaderFunction): 2 Function None 3
|
4(PixelShaderFunction): 2 Function None 3
|
||||||
5: Label
|
5: Label
|
||||||
85(input): 8(ptr) Variable Function
|
92(input): 8(ptr) Variable Function
|
||||||
91(param): 8(ptr) Variable Function
|
98(param): 8(ptr) Variable Function
|
||||||
88: 7(fvec4) Load 87(input)
|
95: 7(fvec4) Load 94(input)
|
||||||
Store 85(input) 88
|
Store 92(input) 95
|
||||||
92: 7(fvec4) Load 85(input)
|
99: 7(fvec4) Load 92(input)
|
||||||
Store 91(param) 92
|
Store 98(param) 99
|
||||||
93: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 91(param)
|
100: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 98(param)
|
||||||
Store 90(@entryPointOutput) 93
|
Store 97(@entryPointOutput) 100
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
11(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9
|
11(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9
|
||||||
@ -329,6 +349,17 @@ gl_FragCoord origin is upper left
|
|||||||
81: 78(int) Load 80(ii)
|
81: 78(int) Load 80(ii)
|
||||||
83: 78(int) IAdd 81 82
|
83: 78(int) IAdd 81 82
|
||||||
Store 80(ii) 83
|
Store 80(ii) 83
|
||||||
84: 7(fvec4) Undef
|
84: 78(int) Load 80(ii)
|
||||||
ReturnValue 84
|
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
|
FunctionEnd
|
||||||
|
@ -30,4 +30,6 @@ float4 PixelShaderFunction(float4 input) : COLOR0
|
|||||||
if (float ii = input.z)
|
if (float ii = input.z)
|
||||||
++ii;
|
++ii;
|
||||||
++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 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).
|
// 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"
|
#define GLSLANG_DATE "06-Mar-2017"
|
||||||
|
@ -469,6 +469,12 @@ bool HlslGrammar::acceptControlDeclaration(TIntermNode*& node)
|
|||||||
if (! acceptFullySpecifiedType(type))
|
if (! acceptFullySpecifiedType(type))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// filter out type casts
|
||||||
|
if (peekTokenClass(EHTokLeftParen)) {
|
||||||
|
recedeToken();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// identifier
|
// identifier
|
||||||
HlslToken idToken;
|
HlslToken idToken;
|
||||||
if (! acceptIdentifier(idToken)) {
|
if (! acceptIdentifier(idToken)) {
|
||||||
@ -3259,7 +3265,7 @@ void HlslGrammar::acceptArraySpecifier(TArraySizes*& arraySizes)
|
|||||||
TSourceLoc loc = token.loc;
|
TSourceLoc loc = token.loc;
|
||||||
TIntermTyped* sizeExpr = nullptr;
|
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);
|
const bool hasArraySize = acceptAssignmentExpression(sizeExpr);
|
||||||
|
|
||||||
if (! acceptTokenClass(EHTokRightBracket)) {
|
if (! acceptTokenClass(EHTokRightBracket)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user