Add support for extension GL_EXT_shader_implicit_conversions

Updated extension management in TIntermediate class.
This commit is contained in:
Pankaj Mistry 2020-04-26 17:52:31 -07:00
parent 97ee5c88de
commit 2a8ead2109
10 changed files with 182 additions and 17 deletions

View file

@ -1620,7 +1620,7 @@ bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const
//
bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op) const
{
if (isEsProfile() || version == 110)
if ((isEsProfile() && version < 310 ) || version == 110)
return false;
if (from == to)
@ -1667,7 +1667,7 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16) ||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float32) ||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float64);
if (explicitTypesEnabled) {
// integral promotions
if (isIntegralPromotion(from, to)) {
@ -1699,6 +1699,30 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat))
return true;
}
} else if (isEsProfile()) {
switch (to) {
case EbtFloat:
switch (from) {
case EbtInt:
case EbtUint:
return extensionRequested(E_GL_EXT_shader_implicit_conversions);
case EbtFloat:
return true;
default:
return false;
}
case EbtUint:
switch (from) {
case EbtInt:
return extensionRequested(E_GL_EXT_shader_implicit_conversions);
case EbtUint:
return true;
default:
return false;
}
default:
return false;
}
} else {
switch (to) {
case EbtDouble:
@ -1731,15 +1755,14 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
return extensionRequested(E_GL_AMD_gpu_shader_int16);
case EbtFloat16:
return
extensionRequested(E_GL_AMD_gpu_shader_half_float) ||
getSource() == EShSourceHlsl;
extensionRequested(E_GL_AMD_gpu_shader_half_float) || getSource() == EShSourceHlsl;
default:
return false;
}
case EbtUint:
switch (from) {
case EbtInt:
return version >= 400 || getSource() == EShSourceHlsl;
return version >= 400 || getSource() == EShSourceHlsl;
case EbtUint:
return true;
case EbtBool:
@ -1931,7 +1954,9 @@ std::tuple<TBasicType, TBasicType> TIntermediate::getConversionDestinatonType(TB
TBasicType res0 = EbtNumTypes;
TBasicType res1 = EbtNumTypes;
if (isEsProfile() || version == 110)
if ((isEsProfile() &&
(version < 310 || !extensionRequested(E_GL_EXT_shader_implicit_conversions))) ||
version == 110)
return std::make_tuple(res0, res1);
if (getSource() == EShSourceHlsl) {