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
1a6e8534
Commit
1a6e8534
authored
Jul 13, 2019
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GLSL: Fix #1833: Don't constant fold integer mix to a float.
parent
25a508cc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
14 deletions
+27
-14
310.frag
Test/310.frag
+1
-1
310.frag.out
Test/baseResults/310.frag.out
+10
-0
Constant.cpp
glslang/MachineIndependent/Constant.cpp
+16
-13
No files found.
Test/310.frag
100644 → 100755
View file @
1a6e8534
...
@@ -58,8 +58,8 @@ void foo23()
...
@@ -58,8 +58,8 @@ void foo23()
b1
=
mix
(
b2
,
b3
,
b
);
b1
=
mix
(
b2
,
b3
,
b
);
uvec3
um3
=
mix
(
uvec3
(
i
),
uvec3
(
i
),
bvec3
(
b
));
uvec3
um3
=
mix
(
uvec3
(
i
),
uvec3
(
i
),
bvec3
(
b
));
ivec4
im4
=
mix
(
ivec4
(
i
),
ivec4
(
i
),
bvec4
(
b
));
ivec4
im4
=
mix
(
ivec4
(
i
),
ivec4
(
i
),
bvec4
(
b
));
1
<<
mix
(
1u
,
1u
,
false
);
// does not require folding
}
}
layout
(
binding
=
3
)
uniform
sampler2D
s1
;
layout
(
binding
=
3
)
uniform
sampler2D
s1
;
layout
(
binding
=
3
)
uniform
sampler2D
s2
;
// ERROR: overlapping bindings? Don't see that in the 310 spec.
layout
(
binding
=
3
)
uniform
sampler2D
s2
;
// ERROR: overlapping bindings? Don't see that in the 310 spec.
highp
layout
(
binding
=
2
)
uniform
writeonly
image2D
i2D
;
highp
layout
(
binding
=
2
)
uniform
writeonly
image2D
i2D
;
...
...
Test/baseResults/310.frag.out
View file @
1a6e8534
...
@@ -337,6 +337,16 @@ ERROR: node is still EOpNull!
...
@@ -337,6 +337,16 @@ ERROR: node is still EOpNull!
0:60 'i' ( uniform mediump int)
0:60 'i' ( uniform mediump int)
0:60 Construct bvec4 ( temp 4-component vector of bool)
0:60 Construct bvec4 ( temp 4-component vector of bool)
0:60 'b' ( temp bool)
0:60 'b' ( temp bool)
0:61 left-shift ( temp int)
0:61 Constant:
0:61 1 (const int)
0:61 mix ( global uint)
0:61 Constant:
0:61 1 (const uint)
0:61 Constant:
0:61 1 (const uint)
0:61 Constant:
0:61 false (const bool)
0:98 Function Definition: foots( ( global void)
0:98 Function Definition: foots( ( global void)
0:98 Function Parameters:
0:98 Function Parameters:
0:100 Sequence
0:100 Sequence
...
...
glslang/MachineIndependent/Constant.cpp
100644 → 100755
View file @
1a6e8534
...
@@ -415,8 +415,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
...
@@ -415,8 +415,8 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
case
EOpEmitStreamVertex
:
case
EOpEmitStreamVertex
:
case
EOpEndStreamPrimitive
:
case
EOpEndStreamPrimitive
:
// These don't
actually
fold
// These don't fold
return
0
;
return
nullptr
;
case
EOpPackSnorm2x16
:
case
EOpPackSnorm2x16
:
case
EOpPackUnorm2x16
:
case
EOpPackUnorm2x16
:
...
@@ -491,8 +491,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
...
@@ -491,8 +491,6 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
break
;
break
;
}
}
// TODO: 3.0 Functionality: unary constant folding: the rest of the ops have to be fleshed out
case
EOpPackSnorm2x16
:
case
EOpPackSnorm2x16
:
case
EOpPackUnorm2x16
:
case
EOpPackUnorm2x16
:
case
EOpPackHalf2x16
:
case
EOpPackHalf2x16
:
...
@@ -510,7 +508,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
...
@@ -510,7 +508,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
case
EOpDeterminant
:
case
EOpDeterminant
:
case
EOpMatrixInverse
:
case
EOpMatrixInverse
:
case
EOpTranspose
:
case
EOpTranspose
:
return
0
;
return
nullptr
;
default
:
default
:
assert
(
componentWise
);
assert
(
componentWise
);
...
@@ -538,7 +536,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
...
@@ -538,7 +536,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
case
EbtInt64
:
newConstArray
[
i
].
setI64Const
(
-
unionArray
[
i
].
getI64Const
());
break
;
case
EbtInt64
:
newConstArray
[
i
].
setI64Const
(
-
unionArray
[
i
].
getI64Const
());
break
;
case
EbtUint64
:
newConstArray
[
i
].
setU64Const
(
static_cast
<
unsigned
long
long
>
(
-
static_cast
<
long
long
>
(
unionArray
[
i
].
getU64Const
())));
break
;
case
EbtUint64
:
newConstArray
[
i
].
setU64Const
(
static_cast
<
unsigned
long
long
>
(
-
static_cast
<
long
long
>
(
unionArray
[
i
].
getU64Const
())));
break
;
default
:
default
:
return
0
;
return
nullptr
;
}
}
break
;
break
;
case
EOpLogicalNot
:
case
EOpLogicalNot
:
...
@@ -546,7 +544,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
...
@@ -546,7 +544,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
switch
(
getType
().
getBasicType
())
{
switch
(
getType
().
getBasicType
())
{
case
EbtBool
:
newConstArray
[
i
].
setBConst
(
!
unionArray
[
i
].
getBConst
());
break
;
case
EbtBool
:
newConstArray
[
i
].
setBConst
(
!
unionArray
[
i
].
getBConst
());
break
;
default
:
default
:
return
0
;
return
nullptr
;
}
}
break
;
break
;
case
EOpBitwiseNot
:
case
EOpBitwiseNot
:
...
@@ -970,7 +968,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
...
@@ -970,7 +968,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
case
EOpInt16BitsToFloat16
:
case
EOpInt16BitsToFloat16
:
case
EOpUint16BitsToFloat16
:
case
EOpUint16BitsToFloat16
:
default
:
default
:
return
0
;
return
nullptr
;
}
}
}
}
...
@@ -1201,12 +1199,17 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
...
@@ -1201,12 +1199,17 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode)
newConstArray
[
comp
].
setBConst
(
childConstUnions
[
0
][
arg0comp
]
!=
childConstUnions
[
1
][
arg1comp
]);
newConstArray
[
comp
].
setBConst
(
childConstUnions
[
0
][
arg0comp
]
!=
childConstUnions
[
1
][
arg1comp
]);
break
;
break
;
case
EOpMix
:
case
EOpMix
:
if
(
children
[
2
]
->
getAsTyped
()
->
getBasicType
()
==
EbtBool
)
if
(
!
children
[
0
]
->
getAsTyped
()
->
isFloatingDomain
())
newConstArray
[
comp
].
setDConst
(
childConstUnions
[
2
][
arg2comp
].
getBConst
()
?
childConstUnions
[
1
][
arg1comp
].
getDConst
()
:
return
aggrNode
;
childConstUnions
[
0
][
arg0comp
].
getDConst
());
if
(
children
[
2
]
->
getAsTyped
()
->
getBasicType
()
==
EbtBool
)
{
else
newConstArray
[
comp
].
setDConst
(
childConstUnions
[
2
][
arg2comp
].
getBConst
()
newConstArray
[
comp
].
setDConst
(
childConstUnions
[
0
][
arg0comp
].
getDConst
()
*
(
1.0
-
childConstUnions
[
2
][
arg2comp
].
getDConst
())
+
?
childConstUnions
[
1
][
arg1comp
].
getDConst
()
:
childConstUnions
[
0
][
arg0comp
].
getDConst
());
}
else
{
newConstArray
[
comp
].
setDConst
(
childConstUnions
[
0
][
arg0comp
].
getDConst
()
*
(
1.0
-
childConstUnions
[
2
][
arg2comp
].
getDConst
())
+
childConstUnions
[
1
][
arg1comp
].
getDConst
()
*
childConstUnions
[
2
][
arg2comp
].
getDConst
());
childConstUnions
[
1
][
arg1comp
].
getDConst
()
*
childConstUnions
[
2
][
arg2comp
].
getDConst
());
}
break
;
break
;
case
EOpStep
:
case
EOpStep
:
newConstArray
[
comp
].
setDConst
(
childConstUnions
[
1
][
arg1comp
].
getDConst
()
<
childConstUnions
[
0
][
arg0comp
].
getDConst
()
?
0.0
:
1.0
);
newConstArray
[
comp
].
setDConst
(
childConstUnions
[
1
][
arg1comp
].
getDConst
()
<
childConstUnions
[
0
][
arg0comp
].
getDConst
()
?
0.0
:
1.0
);
...
...
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