summaryrefslogtreecommitdiff
path: root/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2013-10-06 03:12:13 -0500
committerRyan Houdek <Sonicadvance1@gmail.com>2013-10-06 03:12:29 -0500
commit6bdcde9dd6ab3a6fe192653749849f5d00ecb806 (patch)
tree3b10ca19970feecb6d7f3e13a131160678ef4eef /Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
parent2b08172a452324e340b7030043e4e3f789a5b37b (diff)
[Android] Tegra 4 'support.' This brings up the OpenGL backend to support Tegra 4 to the point where it will run games but it doesn't have any video output for some reason. This is a large change that doesn't actually change much functionally. Walking through the changes.
It changes the string in the Android backend select to just OpenGL ES. Adds a check in the Android code to check for Tegra 4 and to enable the option to select the OpenGL ES backend. Adds a DriverDetails bug under BUG_ISTEGRA as a blanket case of Tegra 4 support. The changes that effects most lines in this change. Removing all float suffixes in the pixel/vertex/util shaders since OpenGL ES 2 doesn't support float suffixes. Disables the shaders for reinterpreting the EFB format since Tegra 4 doesn't support integers. Changes GLFunctions.cpp to grab the correct Tegra extension functions. Readds the GLSL 1.2 'hacks' as GLSLES2 'hacks' since they are required for GLSL ES 2 Adds a GLSLES2 to the GLSL_VERSION enum. Disable the SamplerCache on Tegra since Tegra doesn't support samplers... Enable glBufferSubData on Tegra since it is the only mobile GPU to correctly work with it. Disable glDrawRangeElements on Tegra since it doesn't support it, This uses glDrawElements instead.
Diffstat (limited to 'Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp')
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp49
1 files changed, 37 insertions, 12 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
index f27f56d701..a8360fa9c3 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
@@ -518,16 +518,18 @@ void ProgramShaderCache::CreateHeader ( void )
{
GLSL_VERSION v = g_ogl_config.eSupportedGLSLVersion;
snprintf(s_glsl_header, sizeof(s_glsl_header),
- "#version %s\n"
- "%s\n" // default precision
+ "%s\n"
"%s\n" // ubo
"%s\n" // early-z
+ // Precision defines for GLSLES2/3
+ "%s\n"
+
"\n"// A few required defines and ones that will make our lives a lot easier
- "#define ATTRIN in\n"
- "#define ATTROUT out\n"
- "#define VARYIN %s in\n"
- "#define VARYOUT %s out\n"
+ "#define ATTRIN %s\n"
+ "#define ATTROUT %s\n"
+ "#define VARYIN %s\n"
+ "#define VARYOUT %s\n"
// Silly differences
"#define float2 vec2\n"
@@ -542,18 +544,41 @@ void ProgramShaderCache::CreateHeader ( void )
"%s\n"
"%s\n"
"%s\n"
+
+ // GLSLES2 hacks
+ "%s\n"
+ "%s\n"
+ "%s\n"
+ "%s\n"
+ "%s\n"
+ "%s\n"
+ "%s\n"
+ "#define COLOROUT(name) %s\n"
+
- , v==GLSLES3 ? "300 es" : v==GLSL_130 ? "130" : v==GLSL_140 ? "140" : "150"
- , v==GLSLES3 ? "precision highp float;" : ""
+ , v==GLSLES2 ? "" : v==GLSLES3 ? "#version 300 es" : v==GLSL_130 ? "#version 130" : v==GLSL_140 ? "#version 140" : "#version 150"
, g_ActiveConfig.backend_info.bSupportsGLSLUBO && v<GLSL_140 ? "#extension GL_ARB_uniform_buffer_object : enable" : ""
, g_ActiveConfig.backend_info.bSupportsEarlyZ ? "#extension GL_ARB_shader_image_load_store : enable" : ""
- , DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "" : "centroid"
- , DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "" : "centroid"
+ , (v==GLSLES3 || v==GLSLES2) ? "precision highp float;" : ""
+
+ , v==GLSLES2 ? "attribute" : "in"
+ , v==GLSLES2 ? "attribute" : "out"
+ , v==GLSLES2 ? "varying" : DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "in" : "centroid in"
+ , v==GLSLES2 ? "varying" : DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "out" : "centroid out"
- , v==GLSLES3 ? "" : v<=GLSL_130 ? "#extension GL_ARB_texture_rectangle : enable" : "#define texture2DRect texture"
+ , v==GLSLES2 ? "#define texture2DRect texture2D" : v==GLSLES3 ? "" : v<=GLSL_130 ? "#extension GL_ARB_texture_rectangle : enable" : "#define texture2DRect texture"
, v==GLSLES3 ? "#define texture2DRect(samp, uv) texelFetch(samp, ivec2(floor(uv)), 0)" : ""
- , v==GLSLES3 ? "#define sampler2DRect sampler2D" : ""
+ , (v==GLSLES3 || v==GLSLES2) ? "#define sampler2DRect sampler2D" : ""
+
+ , v==GLSLES2 ? "#define texture texture2D" : ""
+ , v==GLSLES2 ? "#define round(x) floor((x)+0.5)" : ""
+ , v==GLSLES2 ? "#define out " : ""
+ , v==GLSLES2 ? "#define ocol0 gl_FragColor" : ""
+ , v==GLSLES2 ? "#define ocol1 gl_FragColor" : ""
+ , v==GLSLES2 ? "#extension GL_NV_uniform_buffer_object : enable" : ""
+ , v==GLSLES2 ? "#extension GL_NV_fragdepth : enable" : ""
+ , v==GLSLES2 ? "" : "out vec4 name;"
);
}