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
d932cc42
Commit
d932cc42
authored
Apr 25, 2019
by
Rex Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issues of explicit conversions.
For certain int8/int16/float16 conversions,they are conditionally allowed when extensions defining explicit arithmetic types are enabled.
parent
86c72c94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
Intermediate.cpp
glslang/MachineIndependent/Intermediate.cpp
+52
-0
No files found.
glslang/MachineIndependent/Intermediate.cpp
View file @
d932cc42
...
@@ -498,6 +498,58 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
...
@@ -498,6 +498,58 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
TOperator
newOp
=
EOpNull
;
TOperator
newOp
=
EOpNull
;
// Certain explicit conversions are allowed conditionally
bool
arithemeticInt8Enabled
=
extensionRequested
(
E_GL_EXT_shader_explicit_arithmetic_types
)
||
extensionRequested
(
E_GL_EXT_shader_explicit_arithmetic_types_int8
);
#ifdef AMD_EXTENSIONS
bool
arithemeticInt16Enabled
=
extensionRequested
(
E_GL_EXT_shader_explicit_arithmetic_types
)
||
extensionRequested
(
E_GL_EXT_shader_explicit_arithmetic_types_int16
)
||
extensionRequested
(
E_GL_AMD_gpu_shader_int16
);
bool
arithemeticFloat16Enabled
=
extensionRequested
(
E_GL_EXT_shader_explicit_arithmetic_types
)
||
extensionRequested
(
E_GL_EXT_shader_explicit_arithmetic_types_float16
)
||
extensionRequested
(
E_GL_AMD_gpu_shader_half_float
);
#else
bool
arithemeticInt16Enabled
=
extensionRequested
(
E_GL_EXT_shader_explicit_arithmetic_types
)
||
extensionRequested
(
E_GL_EXT_shader_explicit_arithmetic_types_int16
);
bool
arithemeticFloat16Enabled
=
extensionRequested
(
E_GL_EXT_shader_explicit_arithmetic_types
)
||
extensionRequested
(
E_GL_EXT_shader_explicit_arithmetic_types_float16
);
#endif
bool
convertToIntTypes
=
(
convertTo
==
EbtInt8
||
convertTo
==
EbtUint8
||
convertTo
==
EbtInt16
||
convertTo
==
EbtUint16
||
convertTo
==
EbtInt
||
convertTo
==
EbtUint
||
convertTo
==
EbtInt64
||
convertTo
==
EbtUint64
);
bool
convertFromIntTypes
=
(
node
->
getBasicType
()
==
EbtInt8
||
node
->
getBasicType
()
==
EbtUint8
||
node
->
getBasicType
()
==
EbtInt16
||
node
->
getBasicType
()
==
EbtUint16
||
node
->
getBasicType
()
==
EbtInt
||
node
->
getBasicType
()
==
EbtUint
||
node
->
getBasicType
()
==
EbtInt64
||
node
->
getBasicType
()
==
EbtUint64
);
bool
convertToFloatTypes
=
(
convertTo
==
EbtFloat16
||
convertTo
==
EbtFloat
||
convertTo
==
EbtDouble
);
bool
convertFromFloatTypes
=
(
node
->
getBasicType
()
==
EbtFloat16
||
node
->
getBasicType
()
==
EbtFloat
||
node
->
getBasicType
()
==
EbtDouble
);
if
(
!
arithemeticInt8Enabled
)
{
if
(((
convertTo
==
EbtInt8
||
convertTo
==
EbtUint8
)
&&
!
convertFromIntTypes
)
||
((
node
->
getBasicType
()
==
EbtInt8
||
node
->
getBasicType
()
==
EbtUint8
)
&&
!
convertToIntTypes
))
return
nullptr
;
}
if
(
!
arithemeticInt16Enabled
)
{
if
(((
convertTo
==
EbtInt16
||
convertTo
==
EbtUint16
)
&&
!
convertFromIntTypes
)
||
((
node
->
getBasicType
()
==
EbtInt16
||
node
->
getBasicType
()
==
EbtUint16
)
&&
!
convertToIntTypes
))
return
nullptr
;
}
if
(
!
arithemeticFloat16Enabled
)
{
if
((
convertTo
==
EbtFloat16
&&
!
convertFromFloatTypes
)
||
(
node
->
getBasicType
()
==
EbtFloat16
&&
!
convertToFloatTypes
))
return
nullptr
;
}
switch
(
convertTo
)
{
switch
(
convertTo
)
{
case
EbtDouble
:
case
EbtDouble
:
switch
(
node
->
getBasicType
())
{
switch
(
node
->
getBasicType
())
{
...
...
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