Non-functional (almost): Refactor when 'extensionRequested' is called.
This detangles incorrect conflation of HLSL with GLSL extensions, defers asking expensive questions until it's time to ask, and removes some dead code.
This commit is contained in:
parent
bdf9e647f5
commit
7d66a5d4be
@ -819,22 +819,25 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped
|
|||||||
node->getBasicType() == EbtFloat ||
|
node->getBasicType() == EbtFloat ||
|
||||||
node->getBasicType() == EbtDouble);
|
node->getBasicType() == EbtDouble);
|
||||||
|
|
||||||
if (! getArithemeticInt8Enabled()) {
|
if (((convertTo == EbtInt8 || convertTo == EbtUint8) && ! convertFromIntTypes) ||
|
||||||
if (((convertTo == EbtInt8 || convertTo == EbtUint8) && ! convertFromIntTypes) ||
|
((node->getBasicType() == EbtInt8 || node->getBasicType() == EbtUint8) && ! convertToIntTypes)) {
|
||||||
((node->getBasicType() == EbtInt8 || node->getBasicType() == EbtUint8) && ! convertToIntTypes))
|
if (! getArithemeticInt8Enabled()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! getArithemeticInt16Enabled()) {
|
if (((convertTo == EbtInt16 || convertTo == EbtUint16) && ! convertFromIntTypes) ||
|
||||||
if (((convertTo == EbtInt16 || convertTo == EbtUint16) && ! convertFromIntTypes) ||
|
((node->getBasicType() == EbtInt16 || node->getBasicType() == EbtUint16) && ! convertToIntTypes)) {
|
||||||
((node->getBasicType() == EbtInt16 || node->getBasicType() == EbtUint16) && ! convertToIntTypes))
|
if (! getArithemeticInt16Enabled()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! getArithemeticFloat16Enabled()) {
|
if ((convertTo == EbtFloat16 && ! convertFromFloatTypes) ||
|
||||||
if ((convertTo == EbtFloat16 && ! convertFromFloatTypes) ||
|
(node->getBasicType() == EbtFloat16 && ! convertToFloatTypes)) {
|
||||||
(node->getBasicType() == EbtFloat16 && ! convertToFloatTypes))
|
if (! getArithemeticFloat16Enabled()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1650,55 +1653,38 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool explicitTypesEnabled = extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
if (getSource() == EShSourceHlsl) {
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8) ||
|
// HLSL
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16) ||
|
if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat))
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int32) ||
|
|
||||||
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int64) ||
|
|
||||||
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)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
|
// GLSL
|
||||||
|
if (isIntegralPromotion(from, to) ||
|
||||||
|
isFPPromotion(from, to) ||
|
||||||
|
isIntegralConversion(from, to) ||
|
||||||
|
isFPConversion(from, to) ||
|
||||||
|
isFPIntegralConversion(from, to)) {
|
||||||
|
|
||||||
// floating-point promotions
|
if (extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types) ||
|
||||||
if (isFPPromotion(from, to)) {
|
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int8) ||
|
||||||
return true;
|
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int16) ||
|
||||||
}
|
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int32) ||
|
||||||
|
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_int64) ||
|
||||||
// integral conversions
|
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float16) ||
|
||||||
if (isIntegralConversion(from, to)) {
|
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float32) ||
|
||||||
return true;
|
extensionRequested(E_GL_EXT_shader_explicit_arithmetic_types_float64)) {
|
||||||
}
|
|
||||||
|
|
||||||
// floating-point conversions
|
|
||||||
if (isFPConversion(from, to)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// floating-integral conversions
|
|
||||||
if (isFPIntegralConversion(from, to)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// hlsl supported conversions
|
|
||||||
if (getSource() == EShSourceHlsl) {
|
|
||||||
if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat))
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (isEsProfile()) {
|
}
|
||||||
|
|
||||||
|
if (isEsProfile()) {
|
||||||
switch (to) {
|
switch (to) {
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
return extensionRequested(E_GL_EXT_shader_implicit_conversions);
|
return extensionRequested(E_GL_EXT_shader_implicit_conversions);
|
||||||
case EbtFloat:
|
|
||||||
return true;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1706,8 +1692,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
return extensionRequested(E_GL_EXT_shader_implicit_conversions);
|
return extensionRequested(E_GL_EXT_shader_implicit_conversions);
|
||||||
case EbtUint:
|
|
||||||
return true;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1723,7 +1707,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
case EbtUint64:
|
case EbtUint64:
|
||||||
case EbtFloat:
|
case EbtFloat:
|
||||||
case EbtDouble:
|
|
||||||
return version >= 400 || extensionRequested(E_GL_ARB_gpu_shader_fp64);
|
return version >= 400 || extensionRequested(E_GL_ARB_gpu_shader_fp64);
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
@ -1739,7 +1722,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
case EbtFloat:
|
|
||||||
return true;
|
return true;
|
||||||
case EbtBool:
|
case EbtBool:
|
||||||
return getSource() == EShSourceHlsl;
|
return getSource() == EShSourceHlsl;
|
||||||
@ -1756,8 +1738,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
return version >= 400 || getSource() == EShSourceHlsl;
|
return version >= 400 || getSource() == EShSourceHlsl;
|
||||||
case EbtUint:
|
|
||||||
return true;
|
|
||||||
case EbtBool:
|
case EbtBool:
|
||||||
return getSource() == EShSourceHlsl;
|
return getSource() == EShSourceHlsl;
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
@ -1768,8 +1748,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
}
|
}
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
|
||||||
return true;
|
|
||||||
case EbtBool:
|
case EbtBool:
|
||||||
return getSource() == EShSourceHlsl;
|
return getSource() == EShSourceHlsl;
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
@ -1782,7 +1760,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
case EbtInt:
|
case EbtInt:
|
||||||
case EbtUint:
|
case EbtUint:
|
||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
case EbtUint64:
|
|
||||||
return true;
|
return true;
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
@ -1793,7 +1770,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
case EbtInt64:
|
case EbtInt64:
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt:
|
case EbtInt:
|
||||||
case EbtInt64:
|
|
||||||
return true;
|
return true;
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||||
@ -1805,8 +1781,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||||
case EbtFloat16:
|
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_half_float);
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1814,7 +1788,6 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat
|
|||||||
case EbtUint16:
|
case EbtUint16:
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case EbtInt16:
|
case EbtInt16:
|
||||||
case EbtUint16:
|
|
||||||
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
return extensionRequested(E_GL_AMD_gpu_shader_int16);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user