GLSL: Emit precise for fp16/fp64 types as well.

This commit is contained in:
Hans-Kristian Arntzen 2021-07-26 22:05:55 +02:00
parent cd22336a38
commit ac11a91792

View File

@ -12921,17 +12921,20 @@ string CompilerGLSL::flags_to_qualifiers_glsl(const SPIRType &type, const Bitset
if (flags.get(DecorationRestrictPointerEXT))
return "restrict ";
// Structs do not have precision qualifiers, neither do doubles (desktop only anyways, so no mediump/highp).
if (type.basetype != SPIRType::Float && type.basetype != SPIRType::Int && type.basetype != SPIRType::UInt &&
type.basetype != SPIRType::Image && type.basetype != SPIRType::SampledImage &&
type.basetype != SPIRType::Sampler)
return "";
string qual;
if (flags.get(DecorationNoContraction) && backend.support_precise_qualifier)
if (type_is_floating_point(type) && flags.get(DecorationNoContraction) && backend.support_precise_qualifier)
qual = "precise ";
// Structs do not have precision qualifiers, neither do doubles (desktop only anyways, so no mediump/highp).
bool type_supports_precision =
type.basetype == SPIRType::Float || type.basetype == SPIRType::Int || type.basetype == SPIRType::UInt ||
type.basetype == SPIRType::Image || type.basetype == SPIRType::SampledImage ||
type.basetype == SPIRType::Sampler;
if (!type_supports_precision)
return qual;
if (options.es)
{
auto &execution = get_entry_point();