diff options
Diffstat (limited to 'Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index 767e98f1b6..d99509780f 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -50,12 +50,18 @@ static std::string GetGLSLVersionString() return "#version 300 es"; case GLSLES_310: return "#version 310 es"; + case GLSLES_320: + return "#version 320 es"; case GLSL_130: return "#version 130"; case GLSL_140: return "#version 140"; case GLSL_150: return "#version 150"; + case GLSL_330: + return "#version 330"; + case GLSL_400: + return "#version 400"; default: // Shouldn't ever hit this return "#version ERROR"; @@ -521,6 +527,28 @@ void ProgramShaderCache::CreateHeader() { GLSL_VERSION v = g_ogl_config.eSupportedGLSLVersion; bool is_glsles = v >= GLSLES_300; + std::string SupportedESPointSize; + std::string SupportedESTextureBuffer; + switch (g_ogl_config.SupportedESPointSize) + { + case 1: SupportedESPointSize = "#extension GL_OES_geometry_point_size : enable"; break; + case 2: SupportedESPointSize = "#extension GL_EXT_geometry_point_size : enable"; break; + default: SupportedESPointSize = ""; break; + } + + switch (g_ogl_config.SupportedESTextureBuffer) + { + case ES_TEXBUF_TYPE::TEXBUF_EXT: + SupportedESTextureBuffer = "#extension GL_EXT_texture_buffer : enable"; + break; + case ES_TEXBUF_TYPE::TEXBUF_OES: + SupportedESTextureBuffer = "#extension GL_OES_texture_buffer : enable"; + break; + case ES_TEXBUF_TYPE::TEXBUF_CORE: + case ES_TEXBUF_TYPE::TEXBUF_NONE: + SupportedESTextureBuffer = ""; + break; + } snprintf(s_glsl_header, sizeof(s_glsl_header), "%s\n" @@ -528,17 +556,22 @@ void ProgramShaderCache::CreateHeader() "%s\n" // early-z "%s\n" // 420pack "%s\n" // msaa - "%s\n" // sample shading "%s\n" // Sampler binding "%s\n" // storage buffer "%s\n" // shader5 + "%s\n" // SSAA + "%s\n" // Geometry point size "%s\n" // AEP "%s\n" // texture buffer + "%s\n" // ES texture buffer + "%s\n" // ES dual source blend // Precision defines for GLSL ES "%s\n" "%s\n" "%s\n" + "%s\n" + "%s\n" // Silly differences "#define float2 vec2\n" @@ -555,28 +588,26 @@ void ProgramShaderCache::CreateHeader() "#define frac fract\n" "#define lerp mix\n" - // Terrible hacks, look at DriverDetails.h - "%s\n" // replace textureSize as constant - "%s\n" // wipe out all centroid usages - , GetGLSLVersionString().c_str() - , v<GLSL_140 ? "#extension GL_ARB_uniform_buffer_object : enable" : "" + , v < GLSL_140 ? "#extension GL_ARB_uniform_buffer_object : enable" : "" , !is_glsles && g_ActiveConfig.backend_info.bSupportsEarlyZ ? "#extension GL_ARB_shader_image_load_store : enable" : "" , (g_ActiveConfig.backend_info.bSupportsBindingLayout && v < GLSLES_310) ? "#extension GL_ARB_shading_language_420pack : enable" : "" , (g_ogl_config.bSupportsMSAA && v < GLSL_150) ? "#extension GL_ARB_texture_multisample : enable" : "" - , (g_ogl_config.bSupportSampleShading) ? "#extension GL_ARB_sample_shading : enable" : "" , g_ActiveConfig.backend_info.bSupportsBindingLayout ? "#define SAMPLER_BINDING(x) layout(binding = x)" : "#define SAMPLER_BINDING(x)" , g_ActiveConfig.backend_info.bSupportsBBox ? "#extension GL_ARB_shader_storage_buffer_object : enable" : "" - , g_ActiveConfig.backend_info.bSupportsGSInstancing ? "#extension GL_ARB_gpu_shader5 : enable" : "" + , v < GLSL_400 && g_ActiveConfig.backend_info.bSupportsGSInstancing ? "#extension GL_ARB_gpu_shader5 : enable" : "" + , v < GLSL_400 && g_ActiveConfig.backend_info.bSupportsSSAA ? "#extension GL_ARB_sample_shading : enable" : "" + , SupportedESPointSize.c_str() , g_ogl_config.bSupportsAEP ? "#extension GL_ANDROID_extension_pack_es31a : enable" : "" - , v<GLSL_140 && g_ActiveConfig.backend_info.bSupportsPaletteConversion ? "#extension GL_ARB_texture_buffer_object : enable" : "" + , v < GLSL_140 && g_ActiveConfig.backend_info.bSupportsPaletteConversion ? "#extension GL_ARB_texture_buffer_object : enable" : "" + , SupportedESTextureBuffer.c_str() + , is_glsles && g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "#extension GL_EXT_blend_func_extended : enable" : "" , is_glsles ? "precision highp float;" : "" , is_glsles ? "precision highp int;" : "" , is_glsles ? "precision highp sampler2DArray;" : "" - - , DriverDetails::HasBug(DriverDetails::BUG_BROKENTEXTURESIZE) ? "#define textureSize(x, y) ivec2(1, 1)" : "" - , DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "#define centroid" : "" + , (is_glsles && g_ActiveConfig.backend_info.bSupportsPaletteConversion) ? "precision highp usamplerBuffer;" : "" + , v > GLSLES_300 ? "precision highp sampler2DMS;" : "" ); } |
