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
2d70e98d
Unverified
Commit
2d70e98d
authored
Feb 06, 2020
by
John Kessenich
Committed by
GitHub
Feb 06, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2028 from ShchchowAMD/constant_expressions_array_mod
GLSL: Support constant folding for mod
parents
656650f4
44e842cd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
12 deletions
+23
-12
460.vert
Test/460.vert
+1
-0
460.vert.out
Test/baseResults/460.vert.out
+12
-12
Constant.cpp
glslang/MachineIndependent/Constant.cpp
+10
-0
No files found.
Test/460.vert
View file @
2d70e98d
...
@@ -7,6 +7,7 @@ float f;;;
...
@@ -7,6 +7,7 @@ float f;;;
void
main
()
void
main
()
{
{
bool
b1
;
bool
b1
;
float
array
[
int
(
mod
(
float
(
7
.
1
),
float
(
4
.
0
)))];
b1
=
anyInvocation
(
b1
);
b1
=
anyInvocation
(
b1
);
b1
=
allInvocations
(
b1
);
b1
=
allInvocations
(
b1
);
b1
=
allInvocationsEqual
(
b1
);
b1
=
allInvocationsEqual
(
b1
);
...
...
Test/baseResults/460.vert.out
View file @
2d70e98d
...
@@ -4,18 +4,18 @@ Shader version: 460
...
@@ -4,18 +4,18 @@ Shader version: 460
0:7 Function Definition: main( ( global void)
0:7 Function Definition: main( ( global void)
0:7 Function Parameters:
0:7 Function Parameters:
0:? Sequence
0:? Sequence
0:10 move second child to first child ( temp bool)
0:10 'b1' ( temp bool)
0:10 anyInvocation ( global bool)
0:10 'b1' ( temp bool)
0:11 move second child to first child ( temp bool)
0:11 move second child to first child ( temp bool)
0:11 'b1' ( temp bool)
0:11 'b1' ( temp bool)
0:11 a
llInvocations
( global bool)
0:11 a
nyInvocation
( global bool)
0:11 'b1' ( temp bool)
0:11 'b1' ( temp bool)
0:12 move second child to first child ( temp bool)
0:12 move second child to first child ( temp bool)
0:12 'b1' ( temp bool)
0:12 'b1' ( temp bool)
0:12 allInvocations
Equal
( global bool)
0:12 allInvocations ( global bool)
0:12 'b1' ( temp bool)
0:12 'b1' ( temp bool)
0:13 move second child to first child ( temp bool)
0:13 'b1' ( temp bool)
0:13 allInvocationsEqual ( global bool)
0:13 'b1' ( temp bool)
0:? Linker Objects
0:? Linker Objects
0:? 'i' ( global int)
0:? 'i' ( global int)
0:? 'f' ( global float)
0:? 'f' ( global float)
...
@@ -31,18 +31,18 @@ Shader version: 460
...
@@ -31,18 +31,18 @@ Shader version: 460
0:7 Function Definition: main( ( global void)
0:7 Function Definition: main( ( global void)
0:7 Function Parameters:
0:7 Function Parameters:
0:? Sequence
0:? Sequence
0:10 move second child to first child ( temp bool)
0:10 'b1' ( temp bool)
0:10 anyInvocation ( global bool)
0:10 'b1' ( temp bool)
0:11 move second child to first child ( temp bool)
0:11 move second child to first child ( temp bool)
0:11 'b1' ( temp bool)
0:11 'b1' ( temp bool)
0:11 a
llInvocations
( global bool)
0:11 a
nyInvocation
( global bool)
0:11 'b1' ( temp bool)
0:11 'b1' ( temp bool)
0:12 move second child to first child ( temp bool)
0:12 move second child to first child ( temp bool)
0:12 'b1' ( temp bool)
0:12 'b1' ( temp bool)
0:12 allInvocations
Equal
( global bool)
0:12 allInvocations ( global bool)
0:12 'b1' ( temp bool)
0:12 'b1' ( temp bool)
0:13 move second child to first child ( temp bool)
0:13 'b1' ( temp bool)
0:13 allInvocationsEqual ( global bool)
0:13 'b1' ( temp bool)
0:? Linker Objects
0:? Linker Objects
0:? 'i' ( global int)
0:? 'i' ( global int)
0:? 'f' ( global float)
0:? 'f' ( global float)
...
...
glslang/MachineIndependent/Constant.cpp
View file @
2d70e98d
...
@@ -1012,6 +1012,7 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
...
@@ -1012,6 +1012,7 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
case
EOpMin
:
case
EOpMin
:
case
EOpMax
:
case
EOpMax
:
case
EOpMix
:
case
EOpMix
:
case
EOpMod
:
case
EOpClamp
:
case
EOpClamp
:
case
EOpLessThan
:
case
EOpLessThan
:
case
EOpGreaterThan
:
case
EOpGreaterThan
:
...
@@ -1074,6 +1075,15 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
...
@@ -1074,6 +1075,15 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
case
EOpPow
:
case
EOpPow
:
newConstArray
[
comp
].
setDConst
(
pow
(
childConstUnions
[
0
][
arg0comp
].
getDConst
(),
childConstUnions
[
1
][
arg1comp
].
getDConst
()));
newConstArray
[
comp
].
setDConst
(
pow
(
childConstUnions
[
0
][
arg0comp
].
getDConst
(),
childConstUnions
[
1
][
arg1comp
].
getDConst
()));
break
;
break
;
case
EOpMod
:
{
double
arg0
=
childConstUnions
[
0
][
arg0comp
].
getDConst
();
double
arg1
=
childConstUnions
[
1
][
arg1comp
].
getDConst
();
assert
(
arg1
!=
0.0
);
double
result
=
arg0
-
arg1
*
floor
(
arg0
/
arg1
);
newConstArray
[
comp
].
setDConst
(
result
);
break
;
}
case
EOpMin
:
case
EOpMin
:
switch
(
children
[
0
]
->
getAsTyped
()
->
getBasicType
())
{
switch
(
children
[
0
]
->
getAsTyped
()
->
getBasicType
())
{
case
EbtFloat16
:
case
EbtFloat16
:
...
...
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