Use mediump on images in --vulkan-semantics as well.

This commit is contained in:
Hans-Kristian Arntzen 2018-05-11 10:59:29 +02:00
parent 9d370aca58
commit 01080365fa
2 changed files with 3 additions and 5 deletions

View File

@ -3708,6 +3708,8 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry)
auto &e = compiler.set<SPIRExpression>(args[1], "", args[0], true);
auto *backing_variable = compiler.maybe_get_backing_variable(ptr);
e.loaded_from = backing_variable ? backing_variable->self : 0;
// Other backends might use SPIRAccessChain for this later.
compiler.ids[args[1]].set_allow_type_rewrite();
break;
}

View File

@ -8085,11 +8085,7 @@ const char *CompilerGLSL::flags_to_precision_qualifiers_glsl(const SPIRType &typ
// Vulkan GLSL supports precision qualifiers, even in desktop profiles, which is convenient.
// The default is highp however, so only emit mediump in the rare case that a shader has these.
if (flags.get(DecorationRelaxedPrecision))
{
bool can_use_mediump =
type.basetype == SPIRType::Float || type.basetype == SPIRType::Int || type.basetype == SPIRType::UInt;
return can_use_mediump ? "mediump " : "";
}
return "mediump ";
else
return "";
}