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
0c96db5a
Commit
0c96db5a
authored
May 06, 2016
by
qining
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a test for matrix, fix a variable name
parent
25262b3f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
9 deletions
+65
-9
precise.tesc.out
Test/baseResults/precise.tesc.out
+50
-2
precise.tesc
Test/precise.tesc
+7
-0
propagateNoContraction.cpp
glslang/MachineIndependent/propagateNoContraction.cpp
+8
-7
No files found.
Test/baseResults/precise.tesc.out
View file @
0c96db5a
...
...
@@ -357,8 +357,32 @@ vertices = -1
0:99 subtract (temp float)
0:99 'a' (temp float)
0:99 'b' (in float)
0:102 Function Definition: ma
in( (global void
)
0:102 Function Definition: ma
trix(mf23;mf32; (global 3X3 matrix of float
)
0:102 Function Parameters:
0:102 'a' (in 2X3 matrix of float)
0:102 'b' (in 3X2 matrix of float)
0:103 Sequence
0:103 Sequence
0:103 move second child to first child (temp 2X3 matrix of float)
0:103 'c' (noContraction temp 2X3 matrix of float)
0:103 Constant:
0:103 1.000000
0:103 2.000000
0:103 3.000000
0:103 4.000000
0:103 5.000000
0:103 6.000000
0:105 move second child to first child (temp 3X3 matrix of float)
0:105 'result' (noContraction temp 3X3 matrix of float)
0:105 matrix-multiply (noContraction temp 3X3 matrix of float)
0:105 add (noContraction temp 2X3 matrix of float)
0:105 'a' (noContraction in 2X3 matrix of float)
0:105 'c' (noContraction temp 2X3 matrix of float)
0:105 'b' (noContraction in 3X2 matrix of float)
0:106 Branch: Return with expression
0:106 'result' (noContraction temp 3X3 matrix of float)
0:109 Function Definition: main( (global void)
0:109 Function Parameters:
0:? Linker Objects
...
...
@@ -722,7 +746,31 @@ vertices = -1
0:99 subtract (temp float)
0:99 'a' (temp float)
0:99 'b' (in float)
0:102 Function Definition: ma
in( (global void
)
0:102 Function Definition: ma
trix(mf23;mf32; (global 3X3 matrix of float
)
0:102 Function Parameters:
0:102 'a' (in 2X3 matrix of float)
0:102 'b' (in 3X2 matrix of float)
0:103 Sequence
0:103 Sequence
0:103 move second child to first child (temp 2X3 matrix of float)
0:103 'c' (noContraction temp 2X3 matrix of float)
0:103 Constant:
0:103 1.000000
0:103 2.000000
0:103 3.000000
0:103 4.000000
0:103 5.000000
0:103 6.000000
0:105 move second child to first child (temp 3X3 matrix of float)
0:105 'result' (noContraction temp 3X3 matrix of float)
0:105 matrix-multiply (noContraction temp 3X3 matrix of float)
0:105 add (noContraction temp 2X3 matrix of float)
0:105 'a' (noContraction in 2X3 matrix of float)
0:105 'c' (noContraction temp 2X3 matrix of float)
0:105 'b' (noContraction in 3X2 matrix of float)
0:106 Branch: Return with expression
0:106 'result' (noContraction temp 3X3 matrix of float)
0:109 Function Definition: main( (global void)
0:109 Function Parameters:
0:? Linker Objects
Test/precise.tesc
View file @
0c96db5a
...
...
@@ -99,4 +99,11 @@ float precise_func_parameter(float b, precise out float c) {
return a - b; // Not noContraction
}
mat3 matrix (mat2x3 a, mat3x2 b) {
mat2x3 c = mat2x3(1.0, 2.0, 3.0, 4.0, 5.0, 6.0);
precise mat3 result;
result = (a + c) * b; // should be noContraction
return result;
}
void main(){}
glslang/MachineIndependent/propagateNoContraction.cpp
View file @
0c96db5a
...
...
@@ -61,7 +61,7 @@ using ObjectAccessChain = std::string;
// The delimiter used in the ObjectAccessChain string to separate symbol ID and
// different level of struct indices.
const
char
O
BJECT_ACCESSCHAIN_DELIMITER
=
'/'
;
const
char
O
bjectAccesschainDelimiter
=
'/'
;
// Mapping from Symbol IDs of symbol nodes, to their defining operation
// nodes.
...
...
@@ -169,6 +169,7 @@ bool isArithmeticOperation(glslang::TOperator op)
case
glslang
:
:
EOpVectorTimesMatrix
:
case
glslang
:
:
EOpMatrixTimesVector
:
case
glslang
:
:
EOpMatrixTimesScalar
:
case
glslang
:
:
EOpMatrixTimesMatrix
:
case
glslang
:
:
EOpDot
:
...
...
@@ -207,14 +208,14 @@ private:
// A helper function to get the front element from a given ObjectAccessChain
ObjectAccessChain
getFrontElement
(
const
ObjectAccessChain
&
chain
)
{
size_t
pos_delimiter
=
chain
.
find
(
O
BJECT_ACCESSCHAIN_DELIMITER
);
size_t
pos_delimiter
=
chain
.
find
(
O
bjectAccesschainDelimiter
);
return
pos_delimiter
==
std
::
string
::
npos
?
chain
:
chain
.
substr
(
0
,
pos_delimiter
);
}
// A helper function to get the accesschain starting from the second element.
ObjectAccessChain
subAccessChainFromSecondElement
(
const
ObjectAccessChain
&
chain
)
{
size_t
pos_delimiter
=
chain
.
find
(
O
BJECT_ACCESSCHAIN_DELIMITER
);
size_t
pos_delimiter
=
chain
.
find
(
O
bjectAccesschainDelimiter
);
return
pos_delimiter
==
std
::
string
::
npos
?
""
:
chain
.
substr
(
pos_delimiter
+
1
);
}
...
...
@@ -224,7 +225,7 @@ ObjectAccessChain getSubAccessChainAfterPrefix(const ObjectAccessChain& chain,
{
size_t
pos
=
chain
.
find
(
prefix
);
if
(
pos
!=
0
)
return
chain
;
return
chain
.
substr
(
prefix
.
length
()
+
sizeof
(
O
BJECT_ACCESSCHAIN_DELIMITER
));
return
chain
.
substr
(
prefix
.
length
()
+
sizeof
(
O
bjectAccesschainDelimiter
));
}
//
...
...
@@ -415,7 +416,7 @@ bool TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit /* visit
// object. We need to record the accesschain information of the current
// node into its object id.
unsigned
struct_dereference_index
=
getStructIndexFromConstantUnion
(
node
->
getRight
());
object_to_be_defined_
.
push_back
(
O
BJECT_ACCESSCHAIN_DELIMITER
);
object_to_be_defined_
.
push_back
(
O
bjectAccesschainDelimiter
);
object_to_be_defined_
.
append
(
std
::
to_string
(
struct_dereference_index
));
accesschain_mapping_
[
node
]
=
object_to_be_defined_
;
...
...
@@ -728,7 +729,7 @@ protected:
if
(
remained_accesschain_
.
empty
())
{
node
->
getWritableType
().
getQualifier
().
noContraction
=
true
;
}
else
{
new_precise_accesschain
+=
O
BJECT_ACCESSCHAIN_DELIMITER
+
remained_accesschain_
;
new_precise_accesschain
+=
O
bjectAccesschainDelimiter
+
remained_accesschain_
;
}
// Cache the accesschain as added precise object, so we won't add the
// same object to the worklist again.
...
...
@@ -777,7 +778,7 @@ protected:
if
(
remained_accesschain_
.
empty
())
{
node
->
getWritableType
().
getQualifier
().
noContraction
=
true
;
}
else
{
new_precise_accesschain
+=
O
BJECT_ACCESSCHAIN_DELIMITER
+
remained_accesschain_
;
new_precise_accesschain
+=
O
bjectAccesschainDelimiter
+
remained_accesschain_
;
}
// Add the new 'precise' accesschain to the worklist and make sure we
// don't visit it again.
...
...
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