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
22f23024
Commit
22f23024
authored
Oct 24, 2017
by
Alexander Galazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore original canImplicitlyPromote implementation
This change restores original canImplicitlyPromote implementation in case the explicit type extension wasn't requested.
parent
d55c2d9b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
153 additions
and
24 deletions
+153
-24
spv.int64.frag.out
Test/baseResults/spv.int64.frag.out
+1
-0
spv.int64.frag
Test/spv.int64.frag
+1
-0
Intermediate.cpp
glslang/MachineIndependent/Intermediate.cpp
+150
-24
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+1
-0
No files found.
Test/baseResults/spv.int64.frag.out
View file @
22f23024
...
...
@@ -12,6 +12,7 @@ spv.int64.frag
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_ARB_gpu_shader_int64"
SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int64"
Name 4 "main"
Name 6 "literal("
Name 8 "typeCast("
...
...
Test/spv.int64.frag
View file @
22f23024
#version 450
#extension GL_ARB_gpu_shader_int64: enable
#extension GL_KHX_shader_explicit_arithmetic_types_int64: require
layout
(
binding
=
0
)
uniform
Uniforms
{
...
...
glslang/MachineIndependent/Intermediate.cpp
View file @
22f23024
...
...
@@ -1429,6 +1429,7 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const
}
return
false
;
}
//
// See if the 'from' type is allowed to be implicitly converted to the
// 'to' type. This is not about vector/array/struct, only about basic type.
...
...
@@ -1474,36 +1475,161 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
}
}
bool
explicitTypesEnabled
=
extensionRequested
(
E_GL_KHX_shader_explicit_arithmetic_types
)
||
extensionRequested
(
E_GL_KHX_shader_explicit_arithmetic_types_int8
)
||
extensionRequested
(
E_GL_KHX_shader_explicit_arithmetic_types_int16
)
||
extensionRequested
(
E_GL_KHX_shader_explicit_arithmetic_types_int32
)
||
extensionRequested
(
E_GL_KHX_shader_explicit_arithmetic_types_int64
)
||
extensionRequested
(
E_GL_KHX_shader_explicit_arithmetic_types_float16
)
||
extensionRequested
(
E_GL_KHX_shader_explicit_arithmetic_types_float32
)
||
extensionRequested
(
E_GL_KHX_shader_explicit_arithmetic_types_float64
);
// integral promotions
if
(
isIntegralPromotion
(
from
,
to
))
{
return
true
;
}
if
(
explicitTypesEnabled
)
{
// floating-point
promotions
if
(
isFP
Promotion
(
from
,
to
))
{
return
true
;
}
// integral
promotions
if
(
isIntegral
Promotion
(
from
,
to
))
{
return
true
;
}
// integral convers
ions
if
(
isIntegralConvers
ion
(
from
,
to
))
{
return
true
;
}
// floating-point promot
ions
if
(
isFPPromot
ion
(
from
,
to
))
{
return
true
;
}
// floating-point
conversions
if
(
isFP
Conversion
(
from
,
to
))
{
return
true
;
}
// integral
conversions
if
(
isIntegral
Conversion
(
from
,
to
))
{
return
true
;
}
// floating-integral
conversions
if
(
isFPIntegral
Conversion
(
from
,
to
))
{
return
true
;
}
// floating-point
conversions
if
(
isFP
Conversion
(
from
,
to
))
{
return
true
;
}
// hlsl supported conversions
if
(
source
==
EShSourceHlsl
)
{
if
(
from
==
EbtBool
&&
(
to
==
EbtInt
||
to
==
EbtUint
||
to
==
EbtFloat
))
return
true
;
// floating-integral conversions
if
(
isFPIntegralConversion
(
from
,
to
))
{
return
true
;
}
// hlsl supported conversions
if
(
source
==
EShSourceHlsl
)
{
if
(
from
==
EbtBool
&&
(
to
==
EbtInt
||
to
==
EbtUint
||
to
==
EbtFloat
))
return
true
;
}
}
else
{
switch
(
to
)
{
case
EbtDouble
:
switch
(
from
)
{
case
EbtInt
:
case
EbtUint
:
case
EbtInt64
:
case
EbtUint64
:
#ifdef AMD_EXTENSIONS
case
EbtInt16
:
case
EbtUint16
:
#endif
case
EbtFloat
:
case
EbtDouble
:
#ifdef AMD_EXTENSIONS
case
EbtFloat16
:
#endif
return
true
;
default
:
return
false
;
}
case
EbtFloat
:
switch
(
from
)
{
case
EbtInt
:
case
EbtUint
:
#ifdef AMD_EXTENSIONS
case
EbtInt16
:
case
EbtUint16
:
#endif
case
EbtFloat
:
#ifdef AMD_EXTENSIONS
case
EbtFloat16
:
#endif
return
true
;
case
EbtBool
:
return
(
source
==
EShSourceHlsl
);
default
:
return
false
;
}
case
EbtUint
:
switch
(
from
)
{
case
EbtInt
:
return
version
>=
400
||
(
source
==
EShSourceHlsl
);
case
EbtUint
:
#ifdef AMD_EXTENSIONS
case
EbtInt16
:
case
EbtUint16
:
#endif
return
true
;
case
EbtBool
:
return
(
source
==
EShSourceHlsl
);
default
:
return
false
;
}
case
EbtInt
:
switch
(
from
)
{
case
EbtInt
:
#ifdef AMD_EXTENSIONS
case
EbtInt16
:
#endif
return
true
;
case
EbtBool
:
return
(
source
==
EShSourceHlsl
);
default
:
return
false
;
}
case
EbtUint64
:
switch
(
from
)
{
case
EbtInt
:
case
EbtUint
:
case
EbtInt64
:
case
EbtUint64
:
#ifdef AMD_EXTENSIONS
case
EbtInt16
:
case
EbtUint16
:
#endif
return
true
;
default
:
return
false
;
}
case
EbtInt64
:
switch
(
from
)
{
case
EbtInt
:
case
EbtInt64
:
#ifdef AMD_EXTENSIONS
case
EbtInt16
:
#endif
return
true
;
default
:
return
false
;
}
#ifdef AMD_EXTENSIONS
case
EbtFloat16
:
switch
(
from
)
{
case
EbtInt16
:
case
EbtUint16
:
case
EbtFloat16
:
return
true
;
default
:
return
false
;
}
case
EbtUint16
:
switch
(
from
)
{
case
EbtInt16
:
case
EbtUint16
:
return
true
;
default
:
return
false
;
}
#endif
default
:
return
false
;
}
}
return
false
;
...
...
glslang/MachineIndependent/localintermediate.h
View file @
22f23024
...
...
@@ -647,6 +647,7 @@ protected:
bool
isConversionAllowed
(
TOperator
op
,
TIntermTyped
*
node
)
const
;
TIntermUnary
*
createConversion
(
TBasicType
convertTo
,
TIntermTyped
*
node
)
const
;
std
::
tuple
<
TBasicType
,
TBasicType
>
getConversionDestinatonType
(
TBasicType
type0
,
TBasicType
type1
,
TOperator
op
)
const
;
bool
extensionRequested
(
const
char
*
extension
)
const
{
return
requestedExtensions
.
find
(
extension
)
!=
requestedExtensions
.
end
();}
const
EShLanguage
language
;
// stage, known at construction time
EShSource
source
;
// source language, known a bit later
...
...
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