Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
057df293
Commit
057df293
authored
Mar 06, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Fix #754: recognize type casts in if-statements separately from declarations.
parent
621c0e3d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
24 deletions
+63
-24
hlsl.if.frag.out
Test/baseResults/hlsl.if.frag.out
+53
-22
hlsl.if.frag
Test/hlsl.if.frag
+2
-0
revision.h
glslang/Include/revision.h
+1
-1
hlslGrammar.cpp
hlsl/hlslGrammar.cpp
+7
-1
No files found.
Test/baseResults/hlsl.if.frag.out
View file @
057df293
...
@@ -80,6 +80,16 @@ gl_FragCoord origin is upper left
...
@@ -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
...
@@ -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
...
@@ -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 9
0
"@entryPointOutput"
Name 9
7
"@entryPointOutput"
Name 9
1
"param"
Name 9
8
"param"
Decorate
87
(input) Location 0
Decorate
94
(input) Location 0
Decorate 9
0
(@entryPointOutput) Location 0
Decorate 9
7
(@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
...
@@ -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)
9
0(@entryPointOutput): 89
(ptr) Variable Output
9
7(@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
9
1
(param): 8(ptr) Variable Function
9
8
(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
9
2: 7(fvec4) Load 85
(input)
9
9: 7(fvec4) Load 92
(input)
Store 9
1(param) 92
Store 9
8(param) 99
93: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 91
(param)
100: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 98
(param)
Store 9
0(@entryPointOutput) 93
Store 9
7(@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
...
@@ -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
Test/hlsl.if.frag
View file @
057df293
...
@@ -30,4 +30,6 @@ float4 PixelShaderFunction(float4 input) : COLOR0
...
@@ -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
;
}
}
glslang/Include/revision.h
View file @
057df293
...
@@ -2,5 +2,5 @@
...
@@ -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.18
78
"
#define GLSLANG_REVISION "Overload400-PrecQual.18
81
"
#define GLSLANG_DATE "06-Mar-2017"
#define GLSLANG_DATE "06-Mar-2017"
hlsl/hlslGrammar.cpp
View file @
057df293
...
@@ -469,6 +469,12 @@ bool HlslGrammar::acceptControlDeclaration(TIntermNode*& node)
...
@@ -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)
...
@@ -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 om
m
itted, 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
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment