Use highp precision qualifier.

For OpenGL 3.x renderer it only matters for some buggy drivers (i.e old AMD driver that complains about missing precision qualifier). Based on specification is should have no effect and was added for compatibility with GL ES.

In our case vertex and fragment must have the same precision because we use common header for both shader types and the precision for uniform variables must match.
Also "precision highp float;" is defined by default for both vertex and fragment shaders, so it seems to be more proper.

This will hopefully solve the problem with nvidia driver that tries to use f16vec4 instead of just vec4, see:
https://forum.freegamedev.net/viewtopic.php?f=17&t=7397&sid=06682ddb05ee9fbf48a2984d0bd48d5b
This commit is contained in:
Deve 2017-03-24 22:18:30 +01:00
parent 8461ffcc68
commit 5931e20f8b

View File

@ -169,7 +169,7 @@ GLuint ShaderFilesManager::loadShader(const std::string &file, unsigned type)
// shader compilation fails with some drivers if there is no precision
// qualifier
if (type == GL_FRAGMENT_SHADER)
code << "precision mediump float;\n";
code << "precision highp float;\n";
#else
int range[2], precision;
glGetShaderPrecisionFormat(GL_FRAGMENT_SHADER, GL_HIGH_FLOAT, range,