diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-07-26 23:05:55 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-07-26 23:05:55 +0300 |
commit | ac11a9179270f86ccc3f71aa523378542690a797 (patch) | |
tree | 66bd09d4354157ed5e6beeb39f7cfe1b9eee777a /spirv_glsl.cpp | |
parent | cd22336a38b7688056ae815c4372103373f2a186 (diff) |
GLSL: Emit precise for fp16/fp64 types as well.
Diffstat (limited to 'spirv_glsl.cpp')
-rw-r--r-- | spirv_glsl.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp index a5b7fcab..c5550ee5 100644 --- a/spirv_glsl.cpp +++ b/spirv_glsl.cpp @@ -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(); |