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
86a82bb9
Commit
86a82bb9
authored
Oct 04, 2017
by
John Kessenich
Committed by
GitHub
Oct 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1081 from xxxbxxx/for-upstream-1
HLSL: Fix crash when flattening both side of assignement simultaneously.
parents
24919659
a6085875
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
41 deletions
+68
-41
hlsl.flattenOpaqueInit.vert.out
Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out
+11
-11
hlsl.flattenOpaqueInit.vert.out
Test/baseResults/hlsl.flattenOpaqueInit.vert.out
+48
-24
hlsl.flattenOpaqueInit.vert
Test/hlsl.flattenOpaqueInit.vert
+3
-3
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+6
-3
No files found.
Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out
View file @
86a82bb9
...
@@ -2,12 +2,12 @@ hlsl.flattenOpaqueInit.vert
...
@@ -2,12 +2,12 @@ hlsl.flattenOpaqueInit.vert
WARNING: AST will form illegal SPIR-V; need to transform to legalize
WARNING: AST will form illegal SPIR-V; need to transform to legalize
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by 1
17
// Id's are bound by 1
25
Capability Shader
Capability Shader
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main"
78
EntryPoint Vertex 4 "main"
82
Source HLSL 500
Source HLSL 500
Name 4 "main"
Name 4 "main"
Name 17 "FxaaTex"
Name 17 "FxaaTex"
...
@@ -15,10 +15,10 @@ WARNING: AST will form illegal SPIR-V; need to transform to legalize
...
@@ -15,10 +15,10 @@ WARNING: AST will form illegal SPIR-V; need to transform to legalize
MemberName 17(FxaaTex) 1 "tex"
MemberName 17(FxaaTex) 1 "tex"
Name 38 "g_tInputTexture_sampler"
Name 38 "g_tInputTexture_sampler"
Name 42 "g_tInputTexture"
Name 42 "g_tInputTexture"
Name
78
"@entryPointOutput"
Name
82
"@entryPointOutput"
Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
Decorate 42(g_tInputTexture) DescriptorSet 0
Decorate 42(g_tInputTexture) DescriptorSet 0
Decorate
78
(@entryPointOutput) Location 0
Decorate
82
(@entryPointOutput) Location 0
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeSampler
6: TypeSampler
...
@@ -36,14 +36,14 @@ WARNING: AST will form illegal SPIR-V; need to transform to legalize
...
@@ -36,14 +36,14 @@ WARNING: AST will form illegal SPIR-V; need to transform to legalize
38(g_tInputTexture_sampler): 37(ptr) Variable UniformConstant
38(g_tInputTexture_sampler): 37(ptr) Variable UniformConstant
41: TypePointer UniformConstant 9
41: TypePointer UniformConstant 9
42(g_tInputTexture): 41(ptr) Variable UniformConstant
42(g_tInputTexture): 41(ptr) Variable UniformConstant
77
: TypePointer Output 11(fvec4)
81
: TypePointer Output 11(fvec4)
78(@entryPointOutput): 77
(ptr) Variable Output
82(@entryPointOutput): 81
(ptr) Variable Output
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
9
0
: 6 Load 38(g_tInputTexture_sampler)
9
6
: 6 Load 38(g_tInputTexture_sampler)
9
1
: 9 Load 42(g_tInputTexture)
9
7
: 9 Load 42(g_tInputTexture)
1
15: 26 SampledImage 91 90
1
23: 26 SampledImage 97 96
1
16: 11(fvec4) ImageSampleExplicitLod 115
31 Lod 32
1
24: 11(fvec4) ImageSampleExplicitLod 123
31 Lod 32
Store
78(@entryPointOutput) 116
Store
82(@entryPointOutput) 124
Return
Return
FunctionEnd
FunctionEnd
Test/baseResults/hlsl.flattenOpaqueInit.vert.out
View file @
86a82bb9
...
@@ -65,10 +65,18 @@ Shader version: 500
...
@@ -65,10 +65,18 @@ Shader version: 500
0:20 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:20 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:20 Constant:
0:20 Constant:
0:20 1 (const int)
0:20 1 (const int)
0:21 Branch: Return with expression
0:21 Sequence
0:21 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
0:21 Sequence
0:? 'tex1.smpl' ( temp sampler)
0:21 move second child to first child ( temp sampler)
0:? 'tex1.tex' ( temp texture2D)
0:? 'tex3.smpl' ( temp sampler)
0:? 'tex1.smpl' ( temp sampler)
0:21 move second child to first child ( temp texture2D)
0:? 'tex3.tex' ( temp texture2D)
0:? 'tex1.tex' ( temp texture2D)
0:22 Branch: Return with expression
0:22 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
0:? 'tex3.smpl' ( temp sampler)
0:? 'tex3.tex' ( temp texture2D)
0:18 Function Definition: main( ( temp void)
0:18 Function Definition: main( ( temp void)
0:18 Function Parameters:
0:18 Function Parameters:
0:? Sequence
0:? Sequence
...
@@ -149,10 +157,18 @@ Shader version: 500
...
@@ -149,10 +157,18 @@ Shader version: 500
0:20 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:20 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex})
0:20 Constant:
0:20 Constant:
0:20 1 (const int)
0:20 1 (const int)
0:21 Branch: Return with expression
0:21 Sequence
0:21 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
0:21 Sequence
0:? 'tex1.smpl' ( temp sampler)
0:21 move second child to first child ( temp sampler)
0:? 'tex1.tex' ( temp texture2D)
0:? 'tex3.smpl' ( temp sampler)
0:? 'tex1.smpl' ( temp sampler)
0:21 move second child to first child ( temp texture2D)
0:? 'tex3.tex' ( temp texture2D)
0:? 'tex1.tex' ( temp texture2D)
0:22 Branch: Return with expression
0:22 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
0:? 'tex3.smpl' ( temp sampler)
0:? 'tex3.tex' ( temp texture2D)
0:18 Function Definition: main( ( temp void)
0:18 Function Definition: main( ( temp void)
0:18 Function Parameters:
0:18 Function Parameters:
0:? Sequence
0:? Sequence
...
@@ -166,12 +182,12 @@ Shader version: 500
...
@@ -166,12 +182,12 @@ Shader version: 500
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by 8
0
// Id's are bound by 8
4
Capability Shader
Capability Shader
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main"
78
EntryPoint Vertex 4 "main"
82
Source HLSL 500
Source HLSL 500
Name 4 "main"
Name 4 "main"
Name 15 "lookUp(struct-FxaaTex-p1-t211;"
Name 15 "lookUp(struct-FxaaTex-p1-t211;"
...
@@ -193,12 +209,14 @@ Shader version: 500
...
@@ -193,12 +209,14 @@ Shader version: 500
Name 62 "flattenTemp"
Name 62 "flattenTemp"
Name 64 "tex2.smpl"
Name 64 "tex2.smpl"
Name 67 "tex2.tex"
Name 67 "tex2.tex"
Name 70 "param"
Name 70 "tex3.smpl"
Name 72 "param"
Name 72 "tex3.tex"
Name 78 "@entryPointOutput"
Name 74 "param"
Name 76 "param"
Name 82 "@entryPointOutput"
Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
Decorate 42(g_tInputTexture) DescriptorSet 0
Decorate 42(g_tInputTexture) DescriptorSet 0
Decorate
78
(@entryPointOutput) Location 0
Decorate
82
(@entryPointOutput) Location 0
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeSampler
6: TypeSampler
...
@@ -225,12 +243,12 @@ Shader version: 500
...
@@ -225,12 +243,12 @@ Shader version: 500
54: TypeInt 32 1
54: TypeInt 32 1
55: 54(int) Constant 0
55: 54(int) Constant 0
59: 54(int) Constant 1
59: 54(int) Constant 1
77
: TypePointer Output 11(fvec4)
81
: TypePointer Output 11(fvec4)
78(@entryPointOutput): 77
(ptr) Variable Output
82(@entryPointOutput): 81
(ptr) Variable Output
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
79
: 11(fvec4) FunctionCall 22(@main()
83
: 11(fvec4) FunctionCall 22(@main()
Store
78(@entryPointOutput) 79
Store
82(@entryPointOutput) 83
Return
Return
FunctionEnd
FunctionEnd
15(lookUp(struct-FxaaTex-p1-t211;): 11(fvec4) Function None 12
15(lookUp(struct-FxaaTex-p1-t211;): 11(fvec4) Function None 12
...
@@ -263,8 +281,10 @@ Shader version: 500
...
@@ -263,8 +281,10 @@ Shader version: 500
62(flattenTemp): 44(ptr) Variable Function
62(flattenTemp): 44(ptr) Variable Function
64(tex2.smpl): 7(ptr) Variable Function
64(tex2.smpl): 7(ptr) Variable Function
67(tex2.tex): 10(ptr) Variable Function
67(tex2.tex): 10(ptr) Variable Function
70(param): 7(ptr) Variable Function
70(tex3.smpl): 7(ptr) Variable Function
72(param): 10(ptr) Variable Function
72(tex3.tex): 10(ptr) Variable Function
74(param): 7(ptr) Variable Function
76(param): 10(ptr) Variable Function
50: 6 Load 38(g_tInputTexture_sampler)
50: 6 Load 38(g_tInputTexture_sampler)
51: 9 Load 42(g_tInputTexture)
51: 9 Load 42(g_tInputTexture)
52: 17(FxaaTex) CompositeConstruct 50 51
52: 17(FxaaTex) CompositeConstruct 50 51
...
@@ -284,9 +304,13 @@ Shader version: 500
...
@@ -284,9 +304,13 @@ Shader version: 500
69: 9 Load 68
69: 9 Load 68
Store 67(tex2.tex) 69
Store 67(tex2.tex) 69
71: 6 Load 53(tex1.smpl)
71: 6 Load 53(tex1.smpl)
Store 70(
param
) 71
Store 70(
tex3.smpl
) 71
73: 9 Load 58(tex1.tex)
73: 9 Load 58(tex1.tex)
Store 72(param) 73
Store 72(tex3.tex) 73
74: 11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 70(param) 72(param)
75: 6 Load 70(tex3.smpl)
ReturnValue 74
Store 74(param) 75
77: 9 Load 72(tex3.tex)
Store 76(param) 77
78: 11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 74(param) 76(param)
ReturnValue 78
FunctionEnd
FunctionEnd
Test/hlsl.flattenOpaqueInit.vert
View file @
86a82bb9
...
@@ -18,5 +18,6 @@ float4 main() : SV_TARGET0
...
@@ -18,5 +18,6 @@ float4 main() : SV_TARGET0
{
{
FxaaTex
tex1
=
{
g_tInputTexture_sampler
,
g_tInputTexture
};
FxaaTex
tex1
=
{
g_tInputTexture_sampler
,
g_tInputTexture
};
FxaaTex
tex2
=
fillOpaque
();
FxaaTex
tex2
=
fillOpaque
();
return
lookUp
(
tex1
);
FxaaTex
tex3
=
tex1
;
}
return
lookUp
(
tex3
);
\ No newline at end of file
}
hlsl/hlslParseHelper.cpp
View file @
86a82bb9
...
@@ -2595,7 +2595,8 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
...
@@ -2595,7 +2595,8 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
}
}
}
}
int
memberIdx
=
0
;
int
memberIdxLeft
=
0
;
int
memberIdxRight
=
0
;
// When dealing with split arrayed structures of built-ins, the arrayness is moved to the extracted built-in
// When dealing with split arrayed structures of built-ins, the arrayness is moved to the extracted built-in
// variables, which is awkward when copying between split and unsplit structures. This variable tracks
// variables, which is awkward when copying between split and unsplit structures. This variable tracks
...
@@ -2635,8 +2636,10 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
...
@@ -2635,8 +2636,10 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
subTree
->
setType
(
splitDerefType
);
subTree
->
setType
(
splitDerefType
);
}
}
}
else
if
(
flattened
&&
isFinalFlattening
(
derefType
))
{
}
else
if
(
flattened
&&
isFinalFlattening
(
derefType
))
{
const
TVector
<
TVariable
*>&
flatVariables
=
isLeft
?
*
leftVariables
:
*
rightVariables
;
if
(
isLeft
)
subTree
=
intermediate
.
addSymbol
(
*
flatVariables
[
memberIdx
++
]);
subTree
=
intermediate
.
addSymbol
(
*
(
*
leftVariables
)[
memberIdxLeft
++
]);
else
subTree
=
intermediate
.
addSymbol
(
*
(
*
rightVariables
)[
memberIdxRight
++
]);
}
else
{
}
else
{
// Index operator if it's an aggregate, else EOpNull
// Index operator if it's an aggregate, else EOpNull
const
TOperator
accessOp
=
node
->
getType
().
isArray
()
?
EOpIndexDirect
const
TOperator
accessOp
=
node
->
getType
().
isArray
()
?
EOpIndexDirect
...
...
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