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
8c21e0a2
Commit
8c21e0a2
authored
Mar 18, 2020
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #2132: constant matrix constructor from single non-scalar argument
parent
4b420b4f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
25 deletions
+84
-25
constFold.frag.out
Test/baseResults/constFold.frag.out
+67
-21
constFold.frag
Test/constFold.frag
+3
-0
parseConst.cpp
glslang/MachineIndependent/parseConst.cpp
+14
-4
No files found.
Test/baseResults/constFold.frag.out
View file @
8c21e0a2
...
...
@@ -260,27 +260,27 @@ ERROR: node is still EOpNull!
0:120 1.000000
0:120 Constant:
0:120 3 (const int)
0:12
6
Function Definition: foo3( ( global void)
0:12
6
Function Parameters:
0:1
28
Sequence
0:1
28
Sequence
0:1
28
move second child to first child ( temp 3X2 matrix of float)
0:1
28
'r32' ( temp 3X2 matrix of float)
0:1
28
Constant:
0:1
28
43.000000
0:1
28
64.000000
0:1
28
51.000000
0:1
28
76.000000
0:1
28
59.000000
0:1
28
88.000000
0:1
38
Function Definition: foo4( ( global void)
0:1
38
Function Parameters:
0:14
0
Sequence
0:14
0
Sequence
0:14
0
move second child to first child ( temp int)
0:14
0
'a' ( temp int)
0:14
0
Constant:
0:14
0
9 (const int)
0:12
9
Function Definition: foo3( ( global void)
0:12
9
Function Parameters:
0:1
31
Sequence
0:1
31
Sequence
0:1
31
move second child to first child ( temp 3X2 matrix of float)
0:1
31
'r32' ( temp 3X2 matrix of float)
0:1
31
Constant:
0:1
31
43.000000
0:1
31
64.000000
0:1
31
51.000000
0:1
31
76.000000
0:1
31
59.000000
0:1
31
88.000000
0:1
41
Function Definition: foo4( ( global void)
0:1
41
Function Parameters:
0:14
3
Sequence
0:14
3
Sequence
0:14
3
move second child to first child ( temp int)
0:14
3
'a' ( temp int)
0:14
3
Constant:
0:14
3
9 (const int)
0:? Linker Objects
0:? 'a' ( const int)
0:? 1 (const int)
...
...
@@ -367,6 +367,29 @@ ERROR: node is still EOpNull!
0:? 13.000000
0:? 14.000000
0:? 15.000000
0:? 'm22' ( const 2X2 matrix of float)
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:? 'mm34' ( const 3X4 matrix of float)
0:? 7.000000
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:? 7.000000
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:? 7.000000
0:? 0.000000
0:? 'mv4' ( const 4-component vector of float)
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:? 'a0' ( const 3-element array of structure{ global int i, global float f, global bool b})
0:? 3 (const int)
0:? 2.000000
...
...
@@ -635,6 +658,29 @@ ERROR: node is still EOpNull!
0:? 13.000000
0:? 14.000000
0:? 15.000000
0:? 'm22' ( const 2X2 matrix of float)
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:? 'mm34' ( const 3X4 matrix of float)
0:? 7.000000
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:? 7.000000
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:? 0.000000
0:? 7.000000
0:? 0.000000
0:? 'mv4' ( const 4-component vector of float)
0:? 1.000000
0:? 2.000000
0:? 3.000000
0:? 4.000000
0:? 'a0' ( const 3-element array of structure{ global int i, global float f, global bool b})
0:? 3 (const int)
0:? 2.000000
...
...
Test/constFold.frag
View file @
8c21e0a2
...
...
@@ -122,6 +122,9 @@ void foo2()
const
mat2
mm2
=
mat2
(
1
.
0
,
2
.
0
,
3
.
0
,
4
.
0
);
const
mat3x2
mm32
=
mat3x2
(
10
.
0
,
11
.
0
,
12
.
0
,
13
.
0
,
14
.
0
,
15
.
0
);
const
mat2
m22
=
mat2
(
vec4
(
1
.
0
,
2
.
0
,
3
.
0
,
4
.
0
));
const
mat3x4
mm34
=
mat3x4
(
7
.
0
);
const
vec4
mv4
=
vec4
(
m22
);
void
foo3
()
{
...
...
glslang/MachineIndependent/parseConst.cpp
View file @
8c21e0a2
...
...
@@ -165,17 +165,27 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
}
}
}
else
{
// matrix from vector
// matrix from vector
or scalar
int
count
=
0
;
const
int
startIndex
=
index
;
int
nodeComps
=
node
->
getType
().
computeNumComponents
();
for
(
int
i
=
startIndex
;
i
<
endIndex
;
i
++
)
{
if
(
i
>=
instanceSize
)
return
;
if
(
i
==
startIndex
||
(
i
-
startIndex
)
%
(
matrixRows
+
1
)
==
0
)
if
(
nodeComps
==
1
)
{
// If there is a single scalar parameter to a matrix
// constructor, it is used to initialize all the
// components on the matrixs diagonal, with the
// remaining components initialized to 0.0.
if
(
i
==
startIndex
||
(
i
-
startIndex
)
%
(
matrixRows
+
1
)
==
0
)
leftUnionArray
[
i
]
=
rightUnionArray
[
count
];
else
leftUnionArray
[
i
].
setDConst
(
0.0
);
}
else
{
// construct the matrix in column-major order, from
// the components provided, in order
leftUnionArray
[
i
]
=
rightUnionArray
[
count
];
else
leftUnionArray
[
i
].
setDConst
(
0.0
);
}
index
++
;
...
...
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