GlslWriter: Handle OpenGL ES precision qualifier
This commit is contained in:
parent
b076a517c6
commit
cd01facd01
|
|
@ -35,8 +35,7 @@ namespace Nz
|
||||||
const auto& contextParams = context.GetParams();
|
const auto& contextParams = context.GetParams();
|
||||||
|
|
||||||
GlslWriter::Environment env;
|
GlslWriter::Environment env;
|
||||||
env.glES = false;
|
env.glES = (contextParams.type == GL::ContextType::OpenGL_ES);
|
||||||
//env.glES = (contextParams.type == GL::ContextType::OpenGL_ES);
|
|
||||||
env.glMajorVersion = contextParams.glMajorVersion;
|
env.glMajorVersion = contextParams.glMajorVersion;
|
||||||
env.glMinorVersion = contextParams.glMinorVersion;
|
env.glMinorVersion = contextParams.glMinorVersion;
|
||||||
env.extCallback = [&](const std::string_view& ext)
|
env.extCallback = [&](const std::string_view& ext)
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,16 @@ namespace Nz
|
||||||
AppendLine();
|
AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_environment.glES)
|
||||||
|
{
|
||||||
|
AppendLine("#if GL_FRAGMENT_PRECISION_HIGH");
|
||||||
|
AppendLine("precision highp float;");
|
||||||
|
AppendLine("#else");
|
||||||
|
AppendLine("precision mediump float;");
|
||||||
|
AppendLine("#endif");
|
||||||
|
AppendLine();
|
||||||
|
}
|
||||||
|
|
||||||
// Global variables (uniforms, input and outputs)
|
// Global variables (uniforms, input and outputs)
|
||||||
const char* inKeyword = (glslVersion >= 130) ? "in" : "varying";
|
const char* inKeyword = (glslVersion >= 130) ? "in" : "varying";
|
||||||
const char* outKeyword = (glslVersion >= 130) ? "out" : "varying";
|
const char* outKeyword = (glslVersion >= 130) ? "out" : "varying";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue