From 3207b912596e5d3e62ca5932279198b1f5167b8c Mon Sep 17 00:00:00 2001 From: Logan McNaughton Date: Tue, 31 Jan 2017 14:21:08 -0800 Subject: [PATCH] Fix Image Textures on devices < GL4.2 --- .../OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp index 12bd9c0c..49cb8eab 100644 --- a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp +++ b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramBuilder.cpp @@ -204,6 +204,10 @@ public: else { std::stringstream ss; ss << "#version " << Utils::to_string(_glinfo.majorVersion) << Utils::to_string(_glinfo.minorVersion) << "0 core " << std::endl; + if (_glinfo.imageTextures && _glinfo.majorVersion * 10 + _glinfo.minorVersion < 42) { + ss << "#extension GL_ARB_shader_image_load_store : enable" << std::endl + << "#extension GL_ARB_shading_language_420pack : enable" << std::endl; + } ss << "# define IN in" << std::endl << "# define OUT out" << std::endl; m_part = ss.str(); } @@ -431,6 +435,10 @@ public: } else { std::stringstream ss; ss << "#version " << Utils::to_string(_glinfo.majorVersion) << Utils::to_string(_glinfo.minorVersion) << "0 core " << std::endl; + if (_glinfo.imageTextures && _glinfo.majorVersion * 10 + _glinfo.minorVersion < 42) { + ss << "#extension GL_ARB_shader_image_load_store : enable" << std::endl + << "#extension GL_ARB_shading_language_420pack : enable" << std::endl; + } ss << "# define IN in" << std::endl << "# define OUT out" << std::endl << "# define texture2D texture" << std::endl;