GLSL: Need extension to use bitcast on GLSL < 330.
This commit is contained in:
Родитель
9f3bebe3d0
Коммит
63bcbd511e
|
@ -5919,13 +5919,38 @@ string CompilerGLSL::bitcast_glsl_op(const SPIRType &out_type, const SPIRType &i
|
|||
// Floating <-> Integer special casts. Just have to enumerate all cases. :(
|
||||
// 16-bit, 32-bit and 64-bit floats.
|
||||
if (out_type.basetype == SPIRType::UInt && in_type.basetype == SPIRType::Float)
|
||||
{
|
||||
if (is_legacy_es())
|
||||
SPIRV_CROSS_THROW("Float -> Uint bitcast not supported on legacy ESSL.");
|
||||
else if (!options.es && options.version < 330)
|
||||
require_extension_internal("GL_ARB_shader_bit_encoding");
|
||||
return "floatBitsToUint";
|
||||
}
|
||||
else if (out_type.basetype == SPIRType::Int && in_type.basetype == SPIRType::Float)
|
||||
{
|
||||
if (is_legacy_es())
|
||||
SPIRV_CROSS_THROW("Float -> Int bitcast not supported on legacy ESSL.");
|
||||
else if (!options.es && options.version < 330)
|
||||
require_extension_internal("GL_ARB_shader_bit_encoding");
|
||||
return "floatBitsToInt";
|
||||
}
|
||||
else if (out_type.basetype == SPIRType::Float && in_type.basetype == SPIRType::UInt)
|
||||
{
|
||||
if (is_legacy_es())
|
||||
SPIRV_CROSS_THROW("Uint -> Float bitcast not supported on legacy ESSL.");
|
||||
else if (!options.es && options.version < 330)
|
||||
require_extension_internal("GL_ARB_shader_bit_encoding");
|
||||
return "uintBitsToFloat";
|
||||
}
|
||||
else if (out_type.basetype == SPIRType::Float && in_type.basetype == SPIRType::Int)
|
||||
{
|
||||
if (is_legacy_es())
|
||||
SPIRV_CROSS_THROW("Int -> Float bitcast not supported on legacy ESSL.");
|
||||
else if (!options.es && options.version < 330)
|
||||
require_extension_internal("GL_ARB_shader_bit_encoding");
|
||||
return "intBitsToFloat";
|
||||
}
|
||||
|
||||
else if (out_type.basetype == SPIRType::Int64 && in_type.basetype == SPIRType::Double)
|
||||
return "doubleBitsToInt64";
|
||||
else if (out_type.basetype == SPIRType::UInt64 && in_type.basetype == SPIRType::Double)
|
||||
|
|
Загрузка…
Ссылка в новой задаче