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
64076ed7
Commit
64076ed7
authored
Jul 28, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLSL: Fix binary-expression associativity and termination issue.
parent
fea226ba
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
133 additions
and
70 deletions
+133
-70
hlsl.array.frag.out
Test/baseResults/hlsl.array.frag.out
+32
-32
hlsl.assoc.frag.out
Test/baseResults/hlsl.assoc.frag.out
+5
-5
hlsl.buffer.frag.out
Test/baseResults/hlsl.buffer.frag.out
+17
-17
hlsl.conditional.frag.out
Test/baseResults/hlsl.conditional.frag.out
+8
-8
hlsl.precedence.frag.out
Test/baseResults/hlsl.precedence.frag.out
+68
-2
hlsl.precedence.frag
Test/hlsl.precedence.frag
+1
-1
revision.h
glslang/Include/revision.h
+1
-1
hlslGrammar.cpp
hlsl/hlslGrammar.cpp
+1
-4
No files found.
Test/baseResults/hlsl.array.frag.out
View file @
64076ed7
...
...
@@ -11,6 +11,9 @@ gl_FragCoord origin is upper left
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 direct index (temp 4-component vector of float)
0:10 'a' (global 4-element array of 4-component vector of float)
0:10 Constant:
...
...
@@ -18,7 +21,6 @@ gl_FragCoord origin is upper left
0:10 indirect index (temp 4-component vector of float)
0:10 'a' (global 4-element array of 4-component vector of float)
0:10 'i' (in int)
0:10 add (temp 4-component vector of float)
0:10 direct index (temp 4-component vector of float)
0:10 'input' (in 3-element array of 4-component vector of float)
0:10 Constant:
...
...
@@ -26,8 +28,6 @@ gl_FragCoord origin is upper left
0:10 indirect index (temp 4-component vector of float)
0:10 'input' (in 3-element array of 4-component vector of float)
0:10 'i' (in int)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 direct index (temp 4-component vector of float)
0:10 'b' (temp 10-element array of 4-component vector of float)
0:10 Constant:
...
...
@@ -63,6 +63,9 @@ gl_FragCoord origin is upper left
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 direct index (temp 4-component vector of float)
0:10 'a' (global 4-element array of 4-component vector of float)
0:10 Constant:
...
...
@@ -70,7 +73,6 @@ gl_FragCoord origin is upper left
0:10 indirect index (temp 4-component vector of float)
0:10 'a' (global 4-element array of 4-component vector of float)
0:10 'i' (in int)
0:10 add (temp 4-component vector of float)
0:10 direct index (temp 4-component vector of float)
0:10 'input' (in 3-element array of 4-component vector of float)
0:10 Constant:
...
...
@@ -78,8 +80,6 @@ gl_FragCoord origin is upper left
0:10 indirect index (temp 4-component vector of float)
0:10 'input' (in 3-element array of 4-component vector of float)
0:10 'i' (in int)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 direct index (temp 4-component vector of float)
0:10 'b' (temp 10-element array of 4-component vector of float)
0:10 Constant:
...
...
@@ -114,9 +114,9 @@ gl_FragCoord origin is upper left
Name 19 "i"
Name 27 "input"
Name 40 "b"
Name 5
1
""
MemberName 5
1
0 "m"
Name 5
5
"s"
Name 5
2
""
MemberName 5
2
0 "m"
Name 5
6
"s"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
...
...
@@ -142,14 +142,14 @@ gl_FragCoord origin is upper left
39: TypePointer Function 38
41: 13(int) Constant 5
42: TypePointer Function 7(fvec4)
49
: 8(int) Constant 7
5
0: TypeArray 7(fvec4) 49
5
1: TypeStruct 50
5
2
: 8(int) Constant 11
5
3: TypeArray 51(struct) 52
5
4: TypePointer Private 53
5
5(s): 54
(ptr) Variable Private
5
7
: 13(int) Constant 0
50
: 8(int) Constant 7
5
1: TypeArray 7(fvec4) 50
5
2: TypeStruct 51
5
3
: 8(int) Constant 11
5
4: TypeArray 52(struct) 53
5
5: TypePointer Private 54
5
6(s): 55
(ptr) Variable Private
5
8
: 13(int) Constant 0
4(PixelShaderFunction): 2 Function None 3
5: Label
40(b): 39(ptr) Variable Function
...
...
@@ -161,22 +161,22 @@ gl_FragCoord origin is upper left
23: 7(fvec4) FAdd 17 22
30: 29(ptr) AccessChain 27(input) 28
31: 7(fvec4) Load 30
32:
13(int) Load 19(i)
33:
29(ptr) AccessChain 27(input) 32
34:
7(fvec4) Load
33
35: 7(fvec4)
FAdd 31
34
36: 7(fvec4) FAdd
23
35
32:
7(fvec4) FAdd 23 31
33:
13(int) Load 19(i)
34:
29(ptr) AccessChain 27(input)
33
35: 7(fvec4)
Load
34
36: 7(fvec4) FAdd
32
35
43: 42(ptr) AccessChain 40(b) 41
44: 7(fvec4) Load 43
45:
13(int) Load 19(i)
46:
42(ptr) AccessChain 40(b) 45
47:
7(fvec4) Load
46
48: 7(fvec4)
FAdd 44
47
56: 13(int) Load 19(i)
5
8
: 13(int) Load 19(i)
59: 1
5(ptr) AccessChain 55(s) 56 57 58
60:
7(fvec4) Load
59
61: 7(fvec4)
FAdd 48
60
62: 7(fvec4) FAdd
36
61
45:
7(fvec4) FAdd 36 44
46:
13(int) Load 19(i)
47:
42(ptr) AccessChain 40(b)
46
48: 7(fvec4)
Load
47
49: 7(fvec4) FAdd 45 48
5
7
: 13(int) Load 19(i)
59: 1
3(int) Load 19(i)
60:
15(ptr) AccessChain 56(s) 57 58
59
61: 7(fvec4)
Load
60
62: 7(fvec4) FAdd
49
61
ReturnValue 62
FunctionEnd
Test/baseResults/hlsl.assoc.frag.out
View file @
64076ed7
...
...
@@ -23,9 +23,9 @@ gl_FragCoord origin is upper left
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 'a1' (in 4-component vector of float)
0:10 'a2' (in 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 'a3' (in 4-component vector of float)
0:10 'a4' (in 4-component vector of float)
0:10 'a5' (in 4-component vector of float)
...
...
@@ -59,9 +59,9 @@ gl_FragCoord origin is upper left
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 'a1' (in 4-component vector of float)
0:10 'a2' (in 4-component vector of float)
0:10 add (temp 4-component vector of float)
0:10 'a3' (in 4-component vector of float)
0:10 'a4' (in 4-component vector of float)
0:10 'a5' (in 4-component vector of float)
...
...
@@ -104,9 +104,9 @@ gl_FragCoord origin is upper left
16: 7(fvec4) Load 10(a2)
17: 7(fvec4) FAdd 15 16
18: 7(fvec4) Load 11(a3)
19: 7(fvec4)
Load 12(a4)
20: 7(fvec4)
FAdd 18 19
21: 7(fvec4) FAdd 1
7
20
19: 7(fvec4)
FAdd 17 18
20: 7(fvec4)
Load 12(a4)
21: 7(fvec4) FAdd 1
9
20
22: 7(fvec4) Load 13(a5)
23: 7(fvec4) FAdd 21 22
ReturnValue 23
...
...
Test/baseResults/hlsl.buffer.frag.out
View file @
64076ed7
...
...
@@ -10,12 +10,12 @@ gl_FragCoord origin is upper left
0:21 add (temp 4-component vector of float)
0:21 add (temp 4-component vector of float)
0:21 add (temp 4-component vector of float)
0:21 add (temp 4-component vector of float)
0:21 'input' (in 4-component vector of float)
0:21 v1: direct index for structure (layout(column_major std140 ) uniform 4-component vector of float)
0:21 'anon@0' (layout(column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v1})
0:21 Constant:
0:21 0 (const uint)
0:21 add (temp 4-component vector of float)
0:21 v2: direct index for structure (layout(column_major std430 ) buffer 4-component vector of float)
0:21 'anon@1' (layout(column_major std430 ) buffer block{layout(column_major std430 ) buffer 4-component vector of float v2})
0:21 Constant:
...
...
@@ -49,12 +49,12 @@ gl_FragCoord origin is upper left
0:21 add (temp 4-component vector of float)
0:21 add (temp 4-component vector of float)
0:21 add (temp 4-component vector of float)
0:21 add (temp 4-component vector of float)
0:21 'input' (in 4-component vector of float)
0:21 v1: direct index for structure (layout(column_major std140 ) uniform 4-component vector of float)
0:21 'anon@0' (layout(column_major std140 ) uniform block{layout(column_major std140 ) uniform 4-component vector of float v1})
0:21 Constant:
0:21 0 (const uint)
0:21 add (temp 4-component vector of float)
0:21 v2: direct index for structure (layout(column_major std430 ) buffer 4-component vector of float)
0:21 'anon@1' (layout(column_major std430 ) buffer block{layout(column_major std430 ) buffer 4-component vector of float v2})
0:21 Constant:
...
...
@@ -91,10 +91,10 @@ gl_FragCoord origin is upper left
Name 20 ""
MemberName 20 0 "v2"
Name 22 ""
Name 2
5
""
MemberName 2
5
0 "v3"
MemberName 2
5
1 "i3"
Name 2
7
""
Name 2
6
""
MemberName 2
6
0 "v3"
MemberName 2
6
1 "i3"
Name 2
8
""
Name 32 ""
MemberName 32 0 "v4"
MemberName 32 1 "i4"
...
...
@@ -105,10 +105,10 @@ gl_FragCoord origin is upper left
MemberDecorate 20 0 Offset 0
Decorate 20 BufferBlock
Decorate 22 DescriptorSet 0
MemberDecorate 2
5
0 Offset 0
MemberDecorate 2
5
1 Offset 16
Decorate 2
5
Block
Decorate 2
7
DescriptorSet 0
MemberDecorate 2
6
0 Offset 0
MemberDecorate 2
6
1 Offset 16
Decorate 2
6
Block
Decorate 2
8
DescriptorSet 0
MemberDecorate 32 0 Offset 0
MemberDecorate 32 1 Offset 16
Decorate 32 BufferBlock
...
...
@@ -128,9 +128,9 @@ gl_FragCoord origin is upper left
20: TypeStruct 7(fvec4)
21: TypePointer Uniform 20(struct)
22: 21(ptr) Variable Uniform
2
5
: TypeStruct 7(fvec4) 14(int)
2
6: TypePointer Uniform 25
(struct)
2
7: 26
(ptr) Variable Uniform
2
6
: TypeStruct 7(fvec4) 14(int)
2
7: TypePointer Uniform 26
(struct)
2
8: 27
(ptr) Variable Uniform
32: TypeStruct 7(fvec4) 14(int)
33: TypePointer Uniform 32(struct)
34: 33(ptr) Variable Uniform
...
...
@@ -142,10 +142,10 @@ gl_FragCoord origin is upper left
19: 7(fvec4) FAdd 10 18
23: 16(ptr) AccessChain 22 15
24: 7(fvec4) Load 23
2
8: 16(ptr) AccessChain 27 15
29:
7(fvec4) Load 28
30: 7(fvec4)
FAdd 24
29
31: 7(fvec4) FAdd
19
30
2
5: 7(fvec4) FAdd 19 24
29:
16(ptr) AccessChain 28 15
30: 7(fvec4)
Load
29
31: 7(fvec4) FAdd
25
30
35: 16(ptr) AccessChain 34 15
36: 7(fvec4) Load 35
37: 7(fvec4) FAdd 31 36
...
...
Test/baseResults/hlsl.conditional.frag.out
View file @
64076ed7
...
...
@@ -29,6 +29,7 @@ gl_FragCoord origin is upper left
0:7 Sequence
0:7 move second child to first child (temp 4-component vector of float)
0:7 'ret' (temp 4-component vector of float)
0:9 add (temp 4-component vector of float)
0:8 add (temp 4-component vector of float)
0:7 add (temp 4-component vector of float)
0:7 vector-scale (temp 4-component vector of float)
...
...
@@ -39,7 +40,6 @@ gl_FragCoord origin is upper left
0:8 Convert int to float (temp float)
0:8 'b' (temp int)
0:8 'input' (in 4-component vector of float)
0:9 add (temp 4-component vector of float)
0:9 vector-scale (temp 4-component vector of float)
0:9 Convert int to float (temp float)
0:9 'c' (temp int)
...
...
@@ -141,6 +141,7 @@ gl_FragCoord origin is upper left
0:7 Sequence
0:7 move second child to first child (temp 4-component vector of float)
0:7 'ret' (temp 4-component vector of float)
0:9 add (temp 4-component vector of float)
0:8 add (temp 4-component vector of float)
0:7 add (temp 4-component vector of float)
0:7 vector-scale (temp 4-component vector of float)
...
...
@@ -151,7 +152,6 @@ gl_FragCoord origin is upper left
0:8 Convert int to float (temp float)
0:8 'b' (temp int)
0:8 'input' (in 4-component vector of float)
0:9 add (temp 4-component vector of float)
0:9 vector-scale (temp 4-component vector of float)
0:9 Convert int to float (temp float)
0:9 'c' (temp int)
...
...
@@ -287,12 +287,12 @@ gl_FragCoord origin is upper left
31: 15(float) ConvertSToF 30
32: 16(fvec4) Load 22(input)
33: 16(fvec4) VectorTimesScalar 32 31
34:
6(int) Load 14(d)
35:
15(float) ConvertSToF 34
36: 1
6(fvec4) Load 22(input)
37: 16(fvec4)
VectorTimesScalar 36 35
38: 16(fvec4)
FAdd 33 37
39: 16(fvec4) FAdd
29
38
34:
16(fvec4) FAdd 29 33
35:
6(int) Load 14(d)
36: 1
5(float) ConvertSToF 35
37: 16(fvec4)
Load 22(input)
38: 16(fvec4)
VectorTimesScalar 37 36
39: 16(fvec4) FAdd
34
38
Store 18(ret) 39
42: 6(int) Load 10(b)
SelectionMerge 44 None
...
...
Test/baseResults/hlsl.precedence.frag.out
View file @
64076ed7
...
...
@@ -12,11 +12,36 @@ gl_FragCoord origin is upper left
0:8 Branch: Return with expression
0:8 add (temp 4-component vector of float)
0:8 add (temp 4-component vector of float)
0:8 add (temp 4-component vector of float)
0:8 'a1' (in 4-component vector of float)
0:8 component-wise multiply (temp 4-component vector of float)
0:8 'a2' (in 4-component vector of float)
0:8 'a3' (in 4-component vector of float)
0:8 'a4' (in 4-component vector of float)
0:? Construct vec4 (temp 4-component vector of float)
0:8 component-wise multiply (temp 3-component vector of float)
0:8 vector swizzle (temp 3-component vector of float)
0:8 'a1' (in 4-component vector of float)
0:8 Sequence
0:8 Constant:
0:8 0 (const int)
0:8 Constant:
0:8 1 (const int)
0:8 Constant:
0:8 2 (const int)
0:8 vector swizzle (temp 3-component vector of float)
0:8 'a2' (in 4-component vector of float)
0:8 Sequence
0:8 Constant:
0:8 0 (const int)
0:8 Constant:
0:8 1 (const int)
0:8 Constant:
0:8 2 (const int)
0:8 direct index (temp float)
0:8 'a3' (in 4-component vector of float)
0:8 Constant:
0:8 3 (const int)
0:? Linker Objects
...
...
@@ -36,16 +61,41 @@ gl_FragCoord origin is upper left
0:8 Branch: Return with expression
0:8 add (temp 4-component vector of float)
0:8 add (temp 4-component vector of float)
0:8 add (temp 4-component vector of float)
0:8 'a1' (in 4-component vector of float)
0:8 component-wise multiply (temp 4-component vector of float)
0:8 'a2' (in 4-component vector of float)
0:8 'a3' (in 4-component vector of float)
0:8 'a4' (in 4-component vector of float)
0:? Construct vec4 (temp 4-component vector of float)
0:8 component-wise multiply (temp 3-component vector of float)
0:8 vector swizzle (temp 3-component vector of float)
0:8 'a1' (in 4-component vector of float)
0:8 Sequence
0:8 Constant:
0:8 0 (const int)
0:8 Constant:
0:8 1 (const int)
0:8 Constant:
0:8 2 (const int)
0:8 vector swizzle (temp 3-component vector of float)
0:8 'a2' (in 4-component vector of float)
0:8 Sequence
0:8 Constant:
0:8 0 (const int)
0:8 Constant:
0:8 1 (const int)
0:8 Constant:
0:8 2 (const int)
0:8 direct index (temp float)
0:8 'a3' (in 4-component vector of float)
0:8 Constant:
0:8 3 (const int)
0:? Linker Objects
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by
21
// Id's are bound by
37
Capability Shader
1: ExtInstImport "GLSL.std.450"
...
...
@@ -67,6 +117,10 @@ gl_FragCoord origin is upper left
11(a2): 8(ptr) Variable Input
13(a3): 8(ptr) Variable Input
17(a4): 8(ptr) Variable Input
20: TypeVector 6(float) 3
26: TypeInt 32 0
27: 26(int) Constant 3
28: TypePointer Input 6(float)
4(PixelShaderFunction): 2 Function None 3
5: Label
10: 7(fvec4) Load 9(a1)
...
...
@@ -76,5 +130,17 @@ gl_FragCoord origin is upper left
16: 7(fvec4) FAdd 10 15
18: 7(fvec4) Load 17(a4)
19: 7(fvec4) FAdd 16 18
ReturnValue 19
21: 7(fvec4) Load 9(a1)
22: 20(fvec3) VectorShuffle 21 21 0 1 2
23: 7(fvec4) Load 11(a2)
24: 20(fvec3) VectorShuffle 23 23 0 1 2
25: 20(fvec3) FMul 22 24
29: 28(ptr) AccessChain 13(a3) 27
30: 6(float) Load 29
31: 6(float) CompositeExtract 25 0
32: 6(float) CompositeExtract 25 1
33: 6(float) CompositeExtract 25 2
34: 7(fvec4) CompositeConstruct 31 32 33 30
35: 7(fvec4) FAdd 19 34
ReturnValue 35
FunctionEnd
Test/hlsl.precedence.frag
View file @
64076ed7
...
...
@@ -5,5 +5,5 @@ float4 PixelShaderFunction(
float4
a4
)
:
COLOR0
{
return
a1
+
a2
*
a3
+
a4
;
return
a1
+
a2
*
a3
+
a4
+
float4
(
a1
.
rgb
*
a2
.
rgb
,
a3
.
a
)
;
}
glslang/Include/revision.h
View file @
64076ed7
...
...
@@ -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 "SPIRV99.136
1
"
#define GLSLANG_REVISION "SPIRV99.136
2
"
#define GLSLANG_DATE "28-Jul-2016"
hlsl/hlslGrammar.cpp
View file @
64076ed7
...
...
@@ -1675,12 +1675,12 @@ bool HlslGrammar::acceptBinaryExpression(TIntermTyped*& node, PrecedenceLevel pr
if
(
!
acceptBinaryExpression
(
node
,
(
PrecedenceLevel
)(
precedenceLevel
+
1
)))
return
false
;
do
{
TOperator
op
=
HlslOpMap
::
binary
(
peek
());
PrecedenceLevel
tokenLevel
=
HlslOpMap
::
precedenceLevel
(
op
);
if
(
tokenLevel
<
precedenceLevel
)
return
true
;
do
{
// ... op
TSourceLoc
loc
=
token
.
loc
;
advanceToken
();
...
...
@@ -1697,9 +1697,6 @@ bool HlslGrammar::acceptBinaryExpression(TIntermTyped*& node, PrecedenceLevel pr
parseContext
.
error
(
loc
,
"Could not perform requested binary operation"
,
""
,
""
);
return
false
;
}
if
(
!
peekTokenClass
(
EHTokComma
))
return
true
;
}
while
(
true
);
}
...
...
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