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
b92ce60f
Commit
b92ce60f
authored
Apr 07, 2018
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GLSL/SPV: Fix #1310: don't create unnecessary integer matrices.
parent
88a6a181
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
118 additions
and
2 deletions
+118
-2
spv.vecMatConstruct.frag.out
Test/baseResults/spv.vecMatConstruct.frag.out
+87
-0
spv.vecMatConstruct.frag
Test/spv.vecMatConstruct.frag
+14
-0
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+16
-2
Spv.FromFile.cpp
gtests/Spv.FromFile.cpp
+1
-0
No files found.
Test/baseResults/spv.vecMatConstruct.frag.out
0 → 100755
View file @
b92ce60f
spv.vecMatConstruct.frag
// Module Version 10000
// Generated by (magic number): 80006
// Id's are bound by 62
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
Name 9 "v2"
Name 13 "m"
Name 19 "v3"
Name 27 "v4"
Name 37 "iv2"
Name 45 "iv3"
Name 54 "iv4"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 2
8: TypePointer Function 7(fvec2)
10: TypeVector 6(float) 3
11: TypeMatrix 10(fvec3) 4
12: TypePointer Function 11
18: TypePointer Function 10(fvec3)
25: TypeVector 6(float) 4
26: TypePointer Function 25(fvec4)
34: TypeInt 32 1
35: TypeVector 34(int) 2
36: TypePointer Function 35(ivec2)
43: TypeVector 34(int) 3
44: TypePointer Function 43(ivec3)
52: TypeVector 34(int) 4
53: TypePointer Function 52(ivec4)
4(main): 2 Function None 3
5: Label
9(v2): 8(ptr) Variable Function
13(m): 12(ptr) Variable Function
19(v3): 18(ptr) Variable Function
27(v4): 26(ptr) Variable Function
37(iv2): 36(ptr) Variable Function
45(iv3): 44(ptr) Variable Function
54(iv4): 53(ptr) Variable Function
14: 11 Load 13(m)
15: 6(float) CompositeExtract 14 0 0
16: 6(float) CompositeExtract 14 0 1
17: 7(fvec2) CompositeConstruct 15 16
Store 9(v2) 17
20: 11 Load 13(m)
21: 6(float) CompositeExtract 20 0 0
22: 6(float) CompositeExtract 20 0 1
23: 6(float) CompositeExtract 20 0 2
24: 10(fvec3) CompositeConstruct 21 22 23
Store 19(v3) 24
28: 11 Load 13(m)
29: 6(float) CompositeExtract 28 0 0
30: 6(float) CompositeExtract 28 0 1
31: 6(float) CompositeExtract 28 0 2
32: 6(float) CompositeExtract 28 1 0
33: 25(fvec4) CompositeConstruct 29 30 31 32
Store 27(v4) 33
38: 11 Load 13(m)
39: 6(float) CompositeExtract 38 0 0
40: 6(float) CompositeExtract 38 0 1
41: 7(fvec2) CompositeConstruct 39 40
42: 35(ivec2) ConvertFToS 41
Store 37(iv2) 42
46: 11 Load 13(m)
47: 6(float) CompositeExtract 46 0 0
48: 6(float) CompositeExtract 46 0 1
49: 6(float) CompositeExtract 46 0 2
50: 10(fvec3) CompositeConstruct 47 48 49
51: 43(ivec3) ConvertFToS 50
Store 45(iv3) 51
55: 11 Load 13(m)
56: 6(float) CompositeExtract 55 0 0
57: 6(float) CompositeExtract 55 0 1
58: 6(float) CompositeExtract 55 0 2
59: 6(float) CompositeExtract 55 1 0
60: 25(fvec4) CompositeConstruct 56 57 58 59
61: 52(ivec4) ConvertFToS 60
Store 54(iv4) 61
Return
FunctionEnd
Test/spv.vecMatConstruct.frag
0 → 100644
View file @
b92ce60f
#version 450
void
main
()
{
mat4x3
m
;
vec2
v2
=
vec2
(
m
);
vec3
v3
=
vec3
(
m
);
vec4
v4
=
vec4
(
m
);
ivec2
iv2
=
ivec2
(
m
);
ivec3
iv3
=
ivec3
(
m
);
ivec4
iv4
=
ivec4
(
m
);
}
glslang/MachineIndependent/ParseHelper.cpp
View file @
b92ce60f
...
@@ -5771,8 +5771,22 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode*
...
@@ -5771,8 +5771,22 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode*
//
//
// Returns nullptr for an error or the constructed node.
// Returns nullptr for an error or the constructed node.
//
//
TIntermTyped
*
TParseContext
::
constructBuiltIn
(
const
TType
&
type
,
TOperator
op
,
TIntermTyped
*
node
,
const
TSourceLoc
&
loc
,
bool
subset
)
TIntermTyped
*
TParseContext
::
constructBuiltIn
(
const
TType
&
type
,
TOperator
op
,
TIntermTyped
*
node
,
const
TSourceLoc
&
loc
,
{
bool
subset
)
{
// If we are changing a matrix in both domain of basic type and to a non matrix,
// do the shape change first (by default, below, basic type is changed before shape).
// This avoids requesting a matrix of a new type that is going to be discarded anyway.
// TODO: This could be generalized to more type combinations, but that would require
// more extensive testing and full algorithm rework. For now, the need to do two changes makes
// the recursive call work, and avoids the most aggregious case of creating integer matrices.
if
(
node
->
getType
().
isMatrix
()
&&
(
type
.
isScalar
()
||
type
.
isVector
())
&&
type
.
isFloatingDomain
()
!=
node
->
getType
().
isFloatingDomain
())
{
TType
transitionType
(
node
->
getBasicType
(),
glslang
::
EvqTemporary
,
type
.
getVectorSize
(),
0
,
0
,
node
->
isVector
());
TOperator
transitionOp
=
intermediate
.
mapTypeToConstructorOp
(
transitionType
);
node
=
constructBuiltIn
(
transitionType
,
transitionOp
,
node
,
loc
,
false
);
}
TIntermTyped
*
newNode
;
TIntermTyped
*
newNode
;
TOperator
basicOp
;
TOperator
basicOp
;
...
...
gtests/Spv.FromFile.cpp
View file @
b92ce60f
...
@@ -322,6 +322,7 @@ INSTANTIATE_TEST_CASE_P(
...
@@ -322,6 +322,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.variableArrayIndex.frag"
,
"spv.variableArrayIndex.frag"
,
"spv.varyingArray.frag"
,
"spv.varyingArray.frag"
,
"spv.varyingArrayIndirect.frag"
,
"spv.varyingArrayIndirect.frag"
,
"spv.vecMatConstruct.frag"
,
"spv.voidFunction.frag"
,
"spv.voidFunction.frag"
,
"spv.whileLoop.frag"
,
"spv.whileLoop.frag"
,
"spv.AofA.frag"
,
"spv.AofA.frag"
,
...
...
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