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
5bec2b56
Commit
5bec2b56
authored
May 06, 2016
by
qining
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integer type operation should not be noContraction
parent
34d25718
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
118 deletions
+110
-118
precise.tesc.out
Test/baseResults/precise.tesc.out
+94
-102
precise_struct_block.vert.out
Test/baseResults/precise_struct_block.vert.out
+4
-4
precise.tesc
Test/precise.tesc
+10
-10
precise_struct_block.vert
Test/precise_struct_block.vert
+1
-1
propagateNoContraction.cpp
glslang/MachineIndependent/propagateNoContraction.cpp
+1
-1
No files found.
Test/baseResults/precise.tesc.out
View file @
5bec2b56
...
@@ -55,46 +55,45 @@ vertices = -1
...
@@ -55,46 +55,45 @@ vertices = -1
0:16 Constant:
0:16 Constant:
0:16 5.000000
0:16 5.000000
0:17 Sequence
0:17 Sequence
0:17 move second child to first child (temp
in
t)
0:17 move second child to first child (temp
floa
t)
0:17 'a' (noContraction temp
in
t)
0:17 'a' (noContraction temp
floa
t)
0:17 Constant:
0:17 Constant:
0:17 10
(const int)
0:17 10
.000000
0:18 Sequence
0:18 Sequence
0:18 move second child to first child (temp
in
t)
0:18 move second child to first child (temp
floa
t)
0:18 'b' (noContraction temp
in
t)
0:18 'b' (noContraction temp
floa
t)
0:18 Constant:
0:18 Constant:
0:18 20
(const int)
0:18 20
.000000
0:19 move second child to first child (temp float)
0:19 move second child to first child (temp float)
0:19 'result' (noContraction temp float)
0:19 'result' (noContraction temp float)
0:19 Convert int to float (temp float)
0:19 move second child to first child (temp float)
0:19 move second child to first child (temp int)
0:19 'a' (noContraction temp float)
0:19 'a' (noContraction temp int)
0:19 add (noContraction temp float)
0:19 add (noContraction temp int)
0:19 'b' (noContraction temp float)
0:19 'b' (noContraction temp int)
0:19 Constant:
0:19 Constant:
0:19
4 (const int)
0:19
4.000000
0:22 Function Definition: convert( (global void)
0:22 Function Definition: convert( (global void)
0:22 Function Parameters:
0:22 Function Parameters:
0:? Sequence
0:? Sequence
0:24 Sequence
0:24 Sequence
0:24 move second child to first child (temp
in
t)
0:24 move second child to first child (temp
floa
t)
0:24 'a' (noContraction temp
in
t)
0:24 'a' (noContraction temp
floa
t)
0:24 Constant:
0:24 Constant:
0:24 10
(const int)
0:24 10
.000000
0:25 Sequence
0:25 Sequence
0:25 move second child to first child (temp
in
t)
0:25 move second child to first child (temp
floa
t)
0:25 'b' (noContraction temp
in
t)
0:25 'b' (noContraction temp
floa
t)
0:25 Constant:
0:25 Constant:
0:25 20
(const int)
0:25 20
.000000
0:26 move second child to first child (temp
in
t)
0:26 move second child to first child (temp
floa
t)
0:26 'b' (noContraction temp
in
t)
0:26 'b' (noContraction temp
floa
t)
0:26 add (noContraction temp
in
t)
0:26 add (noContraction temp
floa
t)
0:26 'a' (noContraction temp
in
t)
0:26 'a' (noContraction temp
floa
t)
0:26 'b' (noContraction temp
in
t)
0:26 'b' (noContraction temp
floa
t)
0:27 move second child to first child (temp
float
)
0:27 move second child to first child (temp
double
)
0:27 'result' (noContraction temp
float
)
0:27 'result' (noContraction temp
double
)
0:27 Convert
int to float (temp float
)
0:27 Convert
float to double (temp double
)
0:27 'b' (noContraction temp
in
t)
0:27 'b' (noContraction temp
floa
t)
0:30 Function Definition: loop_for( (global float)
0:30 Function Definition: loop_for( (global float)
0:30 Function Parameters:
0:30 Function Parameters:
0:31 Sequence
0:31 Sequence
...
@@ -168,12 +167,7 @@ vertices = -1
...
@@ -168,12 +167,7 @@ vertices = -1
0:42 'r2' (noContraction temp float)
0:42 'r2' (noContraction temp float)
0:45 Function Definition: loop_array( (global void)
0:45 Function Definition: loop_array( (global void)
0:45 Function Parameters:
0:45 Function Parameters:
0:46 Sequence
0:? Sequence
0:46 Sequence
0:46 move second child to first child (temp int)
0:46 'result' (noContraction temp int)
0:46 Constant:
0:46 5 (const int)
0:48 Sequence
0:48 Sequence
0:48 move second child to first child (temp int)
0:48 move second child to first child (temp int)
0:48 'x' (noContraction temp int)
0:48 'x' (noContraction temp int)
...
@@ -184,10 +178,12 @@ vertices = -1
...
@@ -184,10 +178,12 @@ vertices = -1
0:49 'y' (noContraction temp int)
0:49 'y' (noContraction temp int)
0:49 Constant:
0:49 Constant:
0:49 33 (const int)
0:49 33 (const int)
0:52 add second child into first child (noContraction temp int)
0:52 add second child into first child (noContraction temp float)
0:52 'result' (noContraction temp int)
0:52 'result' (noContraction temp float)
0:52 add (noContraction temp int)
0:52 add (noContraction temp float)
0:52 Convert int to float (temp float)
0:52 'x' (noContraction temp int)
0:52 'x' (noContraction temp int)
0:52 Convert int to float (temp float)
0:52 'y' (noContraction temp int)
0:52 'y' (noContraction temp int)
0:54 Sequence
0:54 Sequence
0:54 Sequence
0:54 Sequence
...
@@ -203,23 +199,23 @@ vertices = -1
...
@@ -203,23 +199,23 @@ vertices = -1
0:54 3 (const int)
0:54 3 (const int)
0:54 Loop Body
0:54 Loop Body
0:56 Sequence
0:56 Sequence
0:56 add second child into first child (noContraction temp
in
t)
0:56 add second child into first child (noContraction temp
floa
t)
0:56 'result' (noContraction temp
in
t)
0:56 'result' (noContraction temp
floa
t)
0:56 add (noContraction temp
in
t)
0:56 add (noContraction temp
floa
t)
0:56 indirect index (noContraction temp
in
t)
0:56 indirect index (noContraction temp
floa
t)
0:56 'a0' (temp 3-element array of
in
t)
0:56 'a0' (temp 3-element array of
floa
t)
0:56 'i' (temp int)
0:56 'i' (temp int)
0:56 Constant:
0:56 Constant:
0:56 2
(const int)
0:56 2
.000000
0:58 move second child to first child (temp
in
t)
0:58 move second child to first child (temp
floa
t)
0:58 indirect index (noContraction temp
in
t)
0:58 indirect index (noContraction temp
floa
t)
0:58 'a0' (noContraction temp 3-element array of
in
t)
0:58 'a0' (noContraction temp 3-element array of
floa
t)
0:58 'i' (temp int)
0:58 'i' (temp int)
0:58 subtract (noContraction temp
in
t)
0:58 subtract (noContraction temp
floa
t)
0:58 Constant:
0:58 Constant:
0:58 3
(const int)
0:58 3
.000000
0:58 Post-Increment (noContraction temp
in
t)
0:58 Post-Increment (noContraction temp
floa
t)
0:58 'result' (noContraction temp
in
t)
0:58 'result' (noContraction temp
floa
t)
0:54 Loop Terminal Expression
0:54 Loop Terminal Expression
0:54 Pre-Increment (temp int)
0:54 Pre-Increment (temp int)
0:54 'i' (temp int)
0:54 'i' (temp int)
...
@@ -259,8 +255,8 @@ vertices = -1
...
@@ -259,8 +255,8 @@ vertices = -1
0:69 move second child to first child (temp float)
0:69 move second child to first child (temp float)
0:69 'result' (noContraction temp float)
0:69 'result' (noContraction temp float)
0:69 Convert int to float (temp float)
0:69 Convert int to float (temp float)
0:69 add (
noContraction
temp int)
0:69 add (temp int)
0:69 add (
noContraction
temp int)
0:69 add (temp int)
0:69 'a' (noContraction temp int)
0:69 'a' (noContraction temp int)
0:69 'b' (noContraction temp int)
0:69 'b' (noContraction temp int)
0:69 Constant:
0:69 Constant:
...
@@ -444,46 +440,45 @@ vertices = -1
...
@@ -444,46 +440,45 @@ vertices = -1
0:16 Constant:
0:16 Constant:
0:16 5.000000
0:16 5.000000
0:17 Sequence
0:17 Sequence
0:17 move second child to first child (temp
in
t)
0:17 move second child to first child (temp
floa
t)
0:17 'a' (noContraction temp
in
t)
0:17 'a' (noContraction temp
floa
t)
0:17 Constant:
0:17 Constant:
0:17 10
(const int)
0:17 10
.000000
0:18 Sequence
0:18 Sequence
0:18 move second child to first child (temp
in
t)
0:18 move second child to first child (temp
floa
t)
0:18 'b' (noContraction temp
in
t)
0:18 'b' (noContraction temp
floa
t)
0:18 Constant:
0:18 Constant:
0:18 20
(const int)
0:18 20
.000000
0:19 move second child to first child (temp float)
0:19 move second child to first child (temp float)
0:19 'result' (noContraction temp float)
0:19 'result' (noContraction temp float)
0:19 Convert int to float (temp float)
0:19 move second child to first child (temp float)
0:19 move second child to first child (temp int)
0:19 'a' (noContraction temp float)
0:19 'a' (noContraction temp int)
0:19 add (noContraction temp float)
0:19 add (noContraction temp int)
0:19 'b' (noContraction temp float)
0:19 'b' (noContraction temp int)
0:19 Constant:
0:19 Constant:
0:19
4 (const int)
0:19
4.000000
0:22 Function Definition: convert( (global void)
0:22 Function Definition: convert( (global void)
0:22 Function Parameters:
0:22 Function Parameters:
0:? Sequence
0:? Sequence
0:24 Sequence
0:24 Sequence
0:24 move second child to first child (temp
in
t)
0:24 move second child to first child (temp
floa
t)
0:24 'a' (noContraction temp
in
t)
0:24 'a' (noContraction temp
floa
t)
0:24 Constant:
0:24 Constant:
0:24 10
(const int)
0:24 10
.000000
0:25 Sequence
0:25 Sequence
0:25 move second child to first child (temp
in
t)
0:25 move second child to first child (temp
floa
t)
0:25 'b' (noContraction temp
in
t)
0:25 'b' (noContraction temp
floa
t)
0:25 Constant:
0:25 Constant:
0:25 20
(const int)
0:25 20
.000000
0:26 move second child to first child (temp
in
t)
0:26 move second child to first child (temp
floa
t)
0:26 'b' (noContraction temp
in
t)
0:26 'b' (noContraction temp
floa
t)
0:26 add (noContraction temp
in
t)
0:26 add (noContraction temp
floa
t)
0:26 'a' (noContraction temp
in
t)
0:26 'a' (noContraction temp
floa
t)
0:26 'b' (noContraction temp
in
t)
0:26 'b' (noContraction temp
floa
t)
0:27 move second child to first child (temp
float
)
0:27 move second child to first child (temp
double
)
0:27 'result' (noContraction temp
float
)
0:27 'result' (noContraction temp
double
)
0:27 Convert
int to float (temp float
)
0:27 Convert
float to double (temp double
)
0:27 'b' (noContraction temp
in
t)
0:27 'b' (noContraction temp
floa
t)
0:30 Function Definition: loop_for( (global float)
0:30 Function Definition: loop_for( (global float)
0:30 Function Parameters:
0:30 Function Parameters:
0:31 Sequence
0:31 Sequence
...
@@ -557,12 +552,7 @@ vertices = -1
...
@@ -557,12 +552,7 @@ vertices = -1
0:42 'r2' (noContraction temp float)
0:42 'r2' (noContraction temp float)
0:45 Function Definition: loop_array( (global void)
0:45 Function Definition: loop_array( (global void)
0:45 Function Parameters:
0:45 Function Parameters:
0:46 Sequence
0:? Sequence
0:46 Sequence
0:46 move second child to first child (temp int)
0:46 'result' (noContraction temp int)
0:46 Constant:
0:46 5 (const int)
0:48 Sequence
0:48 Sequence
0:48 move second child to first child (temp int)
0:48 move second child to first child (temp int)
0:48 'x' (noContraction temp int)
0:48 'x' (noContraction temp int)
...
@@ -573,10 +563,12 @@ vertices = -1
...
@@ -573,10 +563,12 @@ vertices = -1
0:49 'y' (noContraction temp int)
0:49 'y' (noContraction temp int)
0:49 Constant:
0:49 Constant:
0:49 33 (const int)
0:49 33 (const int)
0:52 add second child into first child (noContraction temp int)
0:52 add second child into first child (noContraction temp float)
0:52 'result' (noContraction temp int)
0:52 'result' (noContraction temp float)
0:52 add (noContraction temp int)
0:52 add (noContraction temp float)
0:52 Convert int to float (temp float)
0:52 'x' (noContraction temp int)
0:52 'x' (noContraction temp int)
0:52 Convert int to float (temp float)
0:52 'y' (noContraction temp int)
0:52 'y' (noContraction temp int)
0:54 Sequence
0:54 Sequence
0:54 Sequence
0:54 Sequence
...
@@ -592,23 +584,23 @@ vertices = -1
...
@@ -592,23 +584,23 @@ vertices = -1
0:54 3 (const int)
0:54 3 (const int)
0:54 Loop Body
0:54 Loop Body
0:56 Sequence
0:56 Sequence
0:56 add second child into first child (noContraction temp
in
t)
0:56 add second child into first child (noContraction temp
floa
t)
0:56 'result' (noContraction temp
in
t)
0:56 'result' (noContraction temp
floa
t)
0:56 add (noContraction temp
in
t)
0:56 add (noContraction temp
floa
t)
0:56 indirect index (noContraction temp
in
t)
0:56 indirect index (noContraction temp
floa
t)
0:56 'a0' (temp 3-element array of
in
t)
0:56 'a0' (temp 3-element array of
floa
t)
0:56 'i' (temp int)
0:56 'i' (temp int)
0:56 Constant:
0:56 Constant:
0:56 2
(const int)
0:56 2
.000000
0:58 move second child to first child (temp
in
t)
0:58 move second child to first child (temp
floa
t)
0:58 indirect index (noContraction temp
in
t)
0:58 indirect index (noContraction temp
floa
t)
0:58 'a0' (noContraction temp 3-element array of
in
t)
0:58 'a0' (noContraction temp 3-element array of
floa
t)
0:58 'i' (temp int)
0:58 'i' (temp int)
0:58 subtract (noContraction temp
in
t)
0:58 subtract (noContraction temp
floa
t)
0:58 Constant:
0:58 Constant:
0:58 3
(const int)
0:58 3
.000000
0:58 Post-Increment (noContraction temp
in
t)
0:58 Post-Increment (noContraction temp
floa
t)
0:58 'result' (noContraction temp
in
t)
0:58 'result' (noContraction temp
floa
t)
0:54 Loop Terminal Expression
0:54 Loop Terminal Expression
0:54 Pre-Increment (temp int)
0:54 Pre-Increment (temp int)
0:54 'i' (temp int)
0:54 'i' (temp int)
...
@@ -648,8 +640,8 @@ vertices = -1
...
@@ -648,8 +640,8 @@ vertices = -1
0:69 move second child to first child (temp float)
0:69 move second child to first child (temp float)
0:69 'result' (noContraction temp float)
0:69 'result' (noContraction temp float)
0:69 Convert int to float (temp float)
0:69 Convert int to float (temp float)
0:69 add (
noContraction
temp int)
0:69 add (temp int)
0:69 add (
noContraction
temp int)
0:69 add (temp int)
0:69 'a' (noContraction temp int)
0:69 'a' (noContraction temp int)
0:69 'b' (noContraction temp int)
0:69 'b' (noContraction temp int)
0:69 Constant:
0:69 Constant:
...
...
Test/baseResults/precise_struct_block.vert.out
View file @
5bec2b56
...
@@ -325,8 +325,8 @@ Shader version: 450
...
@@ -325,8 +325,8 @@ Shader version: 450
0:63 0 (const int)
0:63 0 (const int)
0:63 'k' (temp int)
0:63 'k' (temp int)
0:63 Convert int to float (temp float)
0:63 Convert int to float (temp float)
0:63 add (
noContraction
temp int)
0:63 add (temp int)
0:63 component-wise multiply (
noContraction
temp int)
0:63 component-wise multiply (temp int)
0:63 'i' (noContraction temp int)
0:63 'i' (noContraction temp int)
0:63 'j' (noContraction temp int)
0:63 'j' (noContraction temp int)
0:63 'k' (noContraction temp int)
0:63 'k' (noContraction temp int)
...
@@ -848,8 +848,8 @@ Shader version: 450
...
@@ -848,8 +848,8 @@ Shader version: 450
0:63 0 (const int)
0:63 0 (const int)
0:63 'k' (temp int)
0:63 'k' (temp int)
0:63 Convert int to float (temp float)
0:63 Convert int to float (temp float)
0:63 add (
noContraction
temp int)
0:63 add (temp int)
0:63 component-wise multiply (
noContraction
temp int)
0:63 component-wise multiply (temp int)
0:63 'i' (noContraction temp int)
0:63 'i' (noContraction temp int)
0:63 'j' (noContraction temp int)
0:63 'j' (noContraction temp int)
0:63 'k' (noContraction temp int)
0:63 'k' (noContraction temp int)
...
...
Test/precise.tesc
View file @
5bec2b56
...
@@ -14,17 +14,17 @@ float minimal() {
...
@@ -14,17 +14,17 @@ float minimal() {
void continuous_assignment() {
void continuous_assignment() {
precise float result = 5.0;
precise float result = 5.0;
int a = 1
0;
float a = 10.
0;
int b = 2
0;
float b = 20.
0;
result = a = b + 4; // b + 4 should be 'noContraction'.
result = a = b + 4; // b + 4 should be 'noContraction'.
}
}
void convert() {
void convert() {
precise
float
result;
precise
double
result;
int a = 1
0;
float a = 10.
0;
int b = 2
0;
float b = 20.
0;
b = a + b; // a + b should be 'noContraction'.
b = a + b; // a + b should be 'noContraction'.
result =
float
(b); // convert operation should not be 'noContraction'.
result =
double
(b); // convert operation should not be 'noContraction'.
}
}
float loop_for() {
float loop_for() {
...
@@ -43,13 +43,13 @@ float loop_for() {
...
@@ -43,13 +43,13 @@ float loop_for() {
}
}
void loop_array(void) {
void loop_array(void) {
precise
int result = 5
;
precise
float result
;
int x = 22;
int x = 22;
int y = 33;
int y = 33;
in
t a0[3];
floa
t a0[3];
result +=
x + y
; // x + y should be 'noContraction' also result + rvalue.
result +=
float(x) + float(y)
; // x + y should be 'noContraction' also result + rvalue.
for (int i = 0; i < 3; ++i) {
for (int i = 0; i < 3; ++i) {
// a's dereference + 2 should be 'noContraction'.
// a's dereference + 2 should be 'noContraction'.
...
@@ -66,7 +66,7 @@ void loop_while() {
...
@@ -66,7 +66,7 @@ void loop_while() {
while (result < 10) {
while (result < 10) {
result += 3.12 + b; // result + 3.12 should be 'noContraction'.
result += 3.12 + b; // result + 3.12 should be 'noContraction'.
}
}
result = a + b + 5; // b + 5 should
be 'noCtraction' and also a + rvalue
.
result = a + b + 5; // b + 5 should
not be 'noCtraction' because all operands are integers
.
result = 11.1;
result = 11.1;
}
}
...
...
Test/precise_struct_block.vert
View file @
5bec2b56
...
@@ -60,7 +60,7 @@ float complex_array_struct() {
...
@@ -60,7 +60,7 @@ float complex_array_struct() {
for
(
int
j
=
0
;
j
<
6
;
j
++
)
{
for
(
int
j
=
0
;
j
<
6
;
j
++
)
{
for
(
int
k
=
0
;
k
<
3
;
k
++
)
{
for
(
int
k
=
0
;
k
<
3
;
k
++
)
{
t3
[
i
].
t2
.
t1c
[
j
].
t1_array
[
k
]
=
i
*
j
+
k
;
// No
Contraction
t3
[
i
].
t2
.
t1c
[
j
].
t1_array
[
k
]
=
i
*
j
+
k
;
// No
t NoContraction because all operands are integers
}
}
t3
[
i
].
t2
.
t1c
[
j
].
t1_scalar
=
j
*
2
.
0
/
i
;
// Not NoContraction
t3
[
i
].
t2
.
t1c
[
j
].
t1_scalar
=
j
*
2
.
0
/
i
;
// Not NoContraction
}
}
...
...
glslang/MachineIndependent/propagateNoContraction.cpp
View file @
5bec2b56
...
@@ -712,7 +712,7 @@ protected:
...
@@ -712,7 +712,7 @@ protected:
return
false
;
return
false
;
}
}
// If this is an arithmetic operation, marks this node as 'noContraction'.
// If this is an arithmetic operation, marks this node as 'noContraction'.
if
(
isArithmeticOperation
(
node
->
getOp
()))
{
if
(
isArithmeticOperation
(
node
->
getOp
())
&&
node
->
getBasicType
()
!=
glslang
::
EbtInt
)
{
node
->
getWritableType
().
getQualifier
().
noContraction
=
true
;
node
->
getWritableType
().
getQualifier
().
noContraction
=
true
;
}
}
// As this node is not an object node, need to traverse the children nodes.
// As this node is not an object node, need to traverse the children nodes.
...
...
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