From b70fa22d230d7fdbcbee207e7c7ab0bc250342e4 Mon Sep 17 00:00:00 2001 From: Elderme Date: Mon, 2 Nov 2015 18:14:01 +0100 Subject: [PATCH] Define default precision in fragment shaders after #extension --- src/graphics/shader.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/graphics/shader.cpp b/src/graphics/shader.cpp index 6132a49c8..548b45be7 100644 --- a/src/graphics/shader.cpp +++ b/src/graphics/shader.cpp @@ -66,10 +66,6 @@ GLuint ShaderBase::loadShader(const std::string &file, unsigned type) std::ostringstream code; code << "#version " << CVS->getGLSLVersion()<<"\n"; - //shader compilation fails with some drivers if there is no precision qualifier - if (type == GL_FRAGMENT_SHADER) - code << "precision mediump float;\n"; - if (CVS->isAMDVertexShaderLayerUsable()) code << "#extension GL_AMD_vertex_shader_layer : enable\n"; if (CVS->isAZDOEnabled()) @@ -84,6 +80,11 @@ GLuint ShaderBase::loadShader(const std::string &file, unsigned type) code << "#define VSLayer\n"; if (CVS->needsRGBBindlessWorkaround()) code << "#define SRGBBindlessFix\n"; + + //shader compilation fails with some drivers if there is no precision qualifier + if (type == GL_FRAGMENT_SHADER) + code << "precision mediump float;\n"; + code << getHeader(); std::ifstream stream(file_manager->getShader(file), std::ios::in);