From 3251d78f8934b500b4cbdf06f3fd62038cb2047d Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 30 Mar 2014 13:58:05 -0500 Subject: Add initial support for GLSL ES 3.10. GLSL ES 3.10 adds implicit support for the binding layout qualifier that we use. Changes our GLSL version enums to bit values so we can check for both ES versions easily. --- .../Core/VideoBackends/OGL/ProgramShaderCache.cpp | 34 ++++++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp') diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index 90c73bf6ea..7cf40eed34 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 // Refer to the license.txt file included. +#include + #include "Common/MathUtil.h" #include "VideoBackends/OGL/ProgramShaderCache.h" @@ -36,13 +38,33 @@ UidChecker ProgramShaderCache::vertex_uid_chec static char s_glsl_header[1024] = ""; +std::string GetGLSLVersionString() +{ + GLSL_VERSION v = g_ogl_config.eSupportedGLSLVersion; + switch(v) + { + case GLSLES_300: + return "#version 300 es"; + case GLSLES_310: + return "#version 310 es"; + case GLSL_130: + return "#version 130"; + case GLSL_140: + return "#version 140"; + case GLSL_150: + return "#version 150"; + } + // Shouldn't ever hit this + return "#version ERROR"; +} + void SHADER::SetProgramVariables() { // glsl shader must be bind to set samplers Bind(); // Bind UBO - if (!g_ActiveConfig.backend_info.bSupportShadingLanguage420pack) + if (!g_ActiveConfig.backend_info.bSupportsBindingLayout) { GLint PSBlock_id = glGetUniformBlockIndex(glprogid, "PSBlock"); GLint VSBlock_id = glGetUniformBlockIndex(glprogid, "VSBlock"); @@ -455,7 +477,7 @@ void ProgramShaderCache::CreateHeader ( void ) "%s\n" // early-z "%s\n" // 420pack - // Precision defines for GLSLES3 + // Precision defines for GLSL ES "%s\n" "%s\n" @@ -478,13 +500,13 @@ void ProgramShaderCache::CreateHeader ( void ) "%s\n" // replace textureSize as constant "%s\n" // wipe out all centroid usages - , v==GLSLES3 ? "#version 300 es" : v==GLSL_130 ? "#version 130" : v==GLSL_140 ? "#version 140" : "#version 150" + , GetGLSLVersionString().c_str() , v=GLSLES_300 ? "precision highp float;" : "" + , v>=GLSLES_300 ? "precision highp int;" : "" , DriverDetails::HasBug(DriverDetails::BUG_BROKENTEXTURESIZE) ? "#define textureSize(x, y) ivec2(1, 1)" : "" , DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "#define centroid" : "" -- cgit v1.2.3