GLSL: Emit precise for fp16/fp64 types as well.
diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp
index a5b7fca..c5550ee 100644
--- a/spirv_glsl.cpp
+++ b/spirv_glsl.cpp
@@ -12921,17 +12921,20 @@
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();