[Android] Due to recent changes in code breaking Tegra 4 support, and also the upcoming code which will be breaking GLES2 support entirely. Taking the initiative to drop the remaining support code from the codebase in preparation for the upcoming changes. For a look at how Dolphin on Tegra 4 looked like prior and would not have been able to be fixed at all due to Tegra 4 not supporting the precision we need in our shaders; Look at this Youtube video http://youtu.be/Ga7Jc_Ote7U

This commit is contained in:
Ryan Houdek 2013-11-24 15:49:23 -06:00
parent d410fe7c96
commit f292819ff5
10 changed files with 42 additions and 165 deletions

View File

@ -182,14 +182,6 @@ public final class VideoSettingsFragment extends PreferenceFragment
mSupportsGLES3 = true; mSupportsGLES3 = true;
} }
} }
if (!mSupportsGLES3 &&
m_GLVendor != null && m_GLVendor.equals("NVIDIA Corporation") &&
m_GLRenderer != null && m_GLRenderer.equals("NVIDIA Tegra") &&
m_GLExtensions != null && m_GLExtensions.contains("GL_OES_depth24"))
{
// Is a Tegra 4 since it supports 24bit depth
mSupportsGLES3 = true;
}
return mSupportsGLES3; return mSupportsGLES3;
} }

View File

@ -66,15 +66,6 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
// alpha channel should be ignored if the EFB does not have one. // alpha channel should be ignored if the EFB does not have one.
// Create EFB target. // Create EFB target.
u32 depthType;
if (DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA))
{
depthType = GL_DEPTH_COMPONENT;
}
else
{
depthType = GL_DEPTH_COMPONENT24;
}
glGenFramebuffers(1, &m_efbFramebuffer); glGenFramebuffers(1, &m_efbFramebuffer);
glActiveTexture(GL_TEXTURE0 + 9); glActiveTexture(GL_TEXTURE0 + 9);
@ -94,7 +85,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
glBindTexture(getFbType(), m_efbDepth); glBindTexture(getFbType(), m_efbDepth);
glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(getFbType(), 0, depthType, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); glTexImage2D(getFbType(), 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
glBindTexture(getFbType(), m_resolvedColorTexture); glBindTexture(getFbType(), m_resolvedColorTexture);
glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0);
@ -159,7 +150,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
glBindTexture(getFbType(), m_resolvedDepthTexture); glBindTexture(getFbType(), m_resolvedDepthTexture);
glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(getFbType(), 0, depthType, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); glTexImage2D(getFbType(), 0, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
// Bind resolved textures to resolved framebuffer. // Bind resolved textures to resolved framebuffer.
@ -235,13 +226,8 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
" ocol0 = float4(dst6) / 63.f;\n" " ocol0 = float4(dst6) / 63.f;\n"
"}"; "}";
if(g_ogl_config.eSupportedGLSLVersion != GLSLES2) ProgramShaderCache::CompileShader(m_pixel_format_shaders[0], vs, ps_rgb8_to_rgba6);
{ ProgramShaderCache::CompileShader(m_pixel_format_shaders[1], vs, ps_rgba6_to_rgb8);
// HACK: This shaders aren't glsles2 compatible as glsles2 don't support bit operations
// it could be workaround by floor + frac + tons off additions, but I think it isn't worth
ProgramShaderCache::CompileShader(m_pixel_format_shaders[0], vs, ps_rgb8_to_rgba6);
ProgramShaderCache::CompileShader(m_pixel_format_shaders[1], vs, ps_rgba6_to_rgb8);
}
} }
FramebufferManager::~FramebufferManager() FramebufferManager::~FramebufferManager()
@ -372,19 +358,6 @@ GLuint FramebufferManager::ResolveAndGetDepthTarget(const EFBRectangle &source_r
void FramebufferManager::ReinterpretPixelData(unsigned int convtype) void FramebufferManager::ReinterpretPixelData(unsigned int convtype)
{ {
if(g_ogl_config.eSupportedGLSLVersion == GLSLES2) {
// This feature isn't supported by glsles2
// TODO: move this to InitBackendInfo
// We have to disable both the active and the stored config. Else we
// would either
// show this line per format change in one frame or
// once per frame.
OSD::AddMessage("Format Change Emulation isn't supported by your GPU.", 10000);
g_ActiveConfig.bEFBEmulateFormatChanges = false;
g_Config.bEFBEmulateFormatChanges = false;
return;
}
g_renderer->ResetAPIState(); g_renderer->ResetAPIState();
GLuint src_texture = 0; GLuint src_texture = 0;

View File

@ -72,67 +72,42 @@ namespace GLFunc
self = dlopen(NULL, RTLD_LAZY); self = dlopen(NULL, RTLD_LAZY);
LoadFunction("glUnmapBuffer", (void**)&glUnmapBuffer); LoadFunction("glUnmapBuffer", (void**)&glUnmapBuffer);
LoadFunction("glBeginQuery", (void**)&glBeginQuery);
LoadFunction("glEndQuery", (void**)&glEndQuery);
LoadFunction("glGetQueryObjectuiv", (void**)&glGetQueryObjectuiv);
LoadFunction("glDeleteQueries", (void**)&glDeleteQueries);
LoadFunction("glGenQueries", (void**)&glGenQueries);
if (DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA)) LoadFunction("glMapBufferRange", (void**)&glMapBufferRange);
{ LoadFunction("glBindBufferRange", (void**)&glBindBufferRange);
LoadFunction("glBeginQueryEXT", (void**)&glBeginQuery); LoadFunction("glBlitFramebuffer", (void**)&glBlitFramebuffer);
LoadFunction("glEndQueryEXT", (void**)&glEndQuery);
LoadFunction("glGetQueryObjectuivEXT", (void**)&glGetQueryObjectuiv);
LoadFunction("glDeleteQueriesEXT", (void**)&glDeleteQueries);
LoadFunction("glGenQueriesEXT", (void**)&glGenQueries);
LoadFunction("glMapBufferRangeNV", (void**)&glMapBufferRange); LoadFunction("glGenVertexArrays", (void**)&glGenVertexArrays);
LoadFunction("glBindBufferRangeNV", (void**)&glBindBufferRange); LoadFunction("glDeleteVertexArrays", (void**)&glDeleteVertexArrays);
LoadFunction("glBlitFramebufferNV", (void**)&glBlitFramebuffer); LoadFunction("glBindVertexArray", (void**)&glBindVertexArray);
LoadFunction("glGenVertexArraysOES", (void**)&glGenVertexArrays); LoadFunction("glClientWaitSync", (void**)&glClientWaitSync);
LoadFunction("glDeleteVertexArraysOES", (void**)&glDeleteVertexArrays); LoadFunction("glDeleteSync", (void**)&glDeleteSync);
LoadFunction("glBindVertexArrayOES", (void**)&glBindVertexArray); LoadFunction("glFenceSync", (void**)&glFenceSync);
LoadFunction("glRenderbufferStorageMultisampleNV", (void**)&glRenderbufferStorageMultisample); LoadFunction("glSamplerParameterf", (void**)&glSamplerParameterf);
LoadFunction("glSamplerParameteri", (void**)&glSamplerParameteri);
LoadFunction("glSamplerParameterfv", (void**)&glSamplerParameterfv);
LoadFunction("glBindSampler", (void**)&glBindSampler);
LoadFunction("glDeleteSamplers", (void**)&glDeleteSamplers);
LoadFunction("glGenSamplers", (void**)&glGenSamplers);
LoadFunction("glGetUniformBlockIndexNV", (void**)&glGetUniformBlockIndex); LoadFunction("glGetProgramBinary", (void**)&glGetProgramBinary);
LoadFunction("glUniformBlockBindingNV", (void**)&glUniformBlockBinding); LoadFunction("glProgramBinary", (void**)&glProgramBinary);
} LoadFunction("glProgramParameteri", (void**)&glProgramParameteri);
else
{
LoadFunction("glBeginQuery", (void**)&glBeginQuery);
LoadFunction("glEndQuery", (void**)&glEndQuery);
LoadFunction("glGetQueryObjectuiv", (void**)&glGetQueryObjectuiv);
LoadFunction("glDeleteQueries", (void**)&glDeleteQueries);
LoadFunction("glGenQueries", (void**)&glGenQueries);
LoadFunction("glMapBufferRange", (void**)&glMapBufferRange); LoadFunction("glDrawRangeElements", (void**)&glDrawRangeElements);
LoadFunction("glBindBufferRange", (void**)&glBindBufferRange);
LoadFunction("glBlitFramebuffer", (void**)&glBlitFramebuffer);
LoadFunction("glGenVertexArrays", (void**)&glGenVertexArrays); LoadFunction("glRenderbufferStorageMultisample", (void**)&glRenderbufferStorageMultisample);
LoadFunction("glDeleteVertexArrays", (void**)&glDeleteVertexArrays);
LoadFunction("glBindVertexArray", (void**)&glBindVertexArray);
LoadFunction("glClientWaitSync", (void**)&glClientWaitSync); LoadFunction("glGetUniformBlockIndex", (void**)&glGetUniformBlockIndex);
LoadFunction("glDeleteSync", (void**)&glDeleteSync); LoadFunction("glUniformBlockBinding", (void**)&glUniformBlockBinding);
LoadFunction("glFenceSync", (void**)&glFenceSync);
LoadFunction("glSamplerParameterf", (void**)&glSamplerParameterf);
LoadFunction("glSamplerParameteri", (void**)&glSamplerParameteri);
LoadFunction("glSamplerParameterfv", (void**)&glSamplerParameterfv);
LoadFunction("glBindSampler", (void**)&glBindSampler);
LoadFunction("glDeleteSamplers", (void**)&glDeleteSamplers);
LoadFunction("glGenSamplers", (void**)&glGenSamplers);
LoadFunction("glGetProgramBinary", (void**)&glGetProgramBinary);
LoadFunction("glProgramBinary", (void**)&glProgramBinary);
LoadFunction("glProgramParameteri", (void**)&glProgramParameteri);
LoadFunction("glDrawRangeElements", (void**)&glDrawRangeElements);
LoadFunction("glRenderbufferStorageMultisample", (void**)&glRenderbufferStorageMultisample);
LoadFunction("glGetUniformBlockIndex", (void**)&glGetUniformBlockIndex);
LoadFunction("glUniformBlockBinding", (void**)&glUniformBlockBinding);
}
dlclose(self); dlclose(self);
} }
} }

View File

@ -571,12 +571,12 @@ void ProgramShaderCache::CreateHeader ( void )
"%s\n" // ubo "%s\n" // ubo
"%s\n" // early-z "%s\n" // early-z
// Precision defines for GLSLES2/3 // Precision defines for GLSLES3
"%s\n" "%s\n"
"\n"// A few required defines and ones that will make our lives a lot easier "\n"// A few required defines and ones that will make our lives a lot easier
"#define ATTRIN %s\n" "#define ATTRIN in\n"
"#define ATTROUT %s\n" "#define ATTROUT out\n"
"#define VARYIN %s\n" "#define VARYIN %s\n"
"#define VARYOUT %s\n" "#define VARYOUT %s\n"
@ -594,40 +594,18 @@ void ProgramShaderCache::CreateHeader ( void )
"%s\n" "%s\n"
"%s\n" "%s\n"
// GLSLES2 hacks , v==GLSLES3 ? "#version 300 es" : v==GLSL_130 ? "#version 130" : v==GLSL_140 ? "#version 140" : "#version 150"
"%s\n"
"%s\n"
"%s\n"
"%s\n"
"%s\n"
"%s\n"
"%s\n"
"#define COLOROUT(name) %s\n"
, 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.bSupportsGLSLUBO && v<GLSL_140 ? "#extension GL_ARB_uniform_buffer_object : enable" : ""
, g_ActiveConfig.backend_info.bSupportsEarlyZ ? "#extension GL_ARB_shader_image_load_store : enable" : "" , g_ActiveConfig.backend_info.bSupportsEarlyZ ? "#extension GL_ARB_shader_image_load_store : enable" : ""
, (v==GLSLES3 || v==GLSLES2) ? "precision highp float;" : "" , v==GLSLES3 ? "precision highp float;" : ""
, v==GLSLES2 ? "attribute" : "in" , DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "in" : "centroid in"
, v==GLSLES2 ? "attribute" : "out" , DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "out" : "centroid out"
, v==GLSLES2 ? "varying" : DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "in" : "centroid in"
, v==GLSLES2 ? "varying" : DriverDetails::HasBug(DriverDetails::BUG_BROKENCENTROID) ? "out" : "centroid out"
, v==GLSLES2 ? "#define texture2DRect texture2D" : v==GLSLES3 ? "" : v<=GLSL_130 ? "#extension GL_ARB_texture_rectangle : enable" : "#define texture2DRect texture" , 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 texture2DRect(samp, uv) texelFetch(samp, ivec2(floor(uv)), 0)" : ""
, (v==GLSLES3 || v==GLSLES2) ? "#define sampler2DRect sampler2D" : "" , v==GLSLES3 ? "#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" : ""
, DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA) ? "#extension GL_NV_uniform_buffer_object : enable" : ""
, DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA) ? "#extension GL_NV_fragdepth : enable" : ""
, v==GLSLES2 ? "" : "out vec4 name;"
); );
} }

View File

@ -371,10 +371,7 @@ Renderer::Renderer()
g_ogl_config.bSupportSampleShading = false; g_ogl_config.bSupportSampleShading = false;
g_ogl_config.bSupportOGL31 = false; g_ogl_config.bSupportOGL31 = false;
g_ogl_config.bSupportViewportFloat = false; g_ogl_config.bSupportViewportFloat = false;
if (DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA) || DriverDetails::HasBug(DriverDetails::BUG_ISPOWERVR)) g_ogl_config.eSupportedGLSLVersion = GLSLES3;
g_ogl_config.eSupportedGLSLVersion = GLSLES2;
else
g_ogl_config.eSupportedGLSLVersion = GLSLES3;
#else #else
#ifdef __APPLE__ #ifdef __APPLE__
glewExperimental = 1; glewExperimental = 1;

View File

@ -13,7 +13,6 @@ enum GLSL_VERSION {
GLSL_130, GLSL_130,
GLSL_140, GLSL_140,
GLSL_150, // and above GLSL_150, // and above
GLSLES2,
GLSLES3 GLSLES3
}; };

View File

@ -16,14 +16,11 @@ SamplerCache::SamplerCache()
SamplerCache::~SamplerCache() SamplerCache::~SamplerCache()
{ {
if (!DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA)) Clear();
Clear();
} }
void SamplerCache::SetSamplerState(int stage, const TexMode0& tm0, const TexMode1& tm1) void SamplerCache::SetSamplerState(int stage, const TexMode0& tm0, const TexMode1& tm1)
{ {
if (DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA))
return;
// TODO: can this go somewhere else? // TODO: can this go somewhere else?
if (m_last_max_anisotropy != g_ActiveConfig.iMaxAnisotropy) if (m_last_max_anisotropy != g_ActiveConfig.iMaxAnisotropy)
{ {

View File

@ -134,24 +134,6 @@ void VertexManager::Draw(u32 stride)
glDrawRangeElementsBaseVertex(GL_POINTS, 0, max_index, point_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[2], (GLint)s_baseVertex); glDrawRangeElementsBaseVertex(GL_POINTS, 0, max_index, point_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[2], (GLint)s_baseVertex);
INCSTAT(stats.thisFrame.numIndexedDrawCalls); INCSTAT(stats.thisFrame.numIndexedDrawCalls);
} }
}
else if (DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA))
{
if (triangle_index_size > 0)
{
glDrawElements(triangle_mode, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0]);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
if (line_index_size > 0)
{
glDrawElements(GL_LINES, line_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[1]);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
if (point_index_size > 0)
{
glDrawElements(GL_POINTS, point_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[2]);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
} else { } else {
if (triangle_index_size > 0) if (triangle_index_size > 0)
{ {

View File

@ -39,8 +39,6 @@ namespace DriverDetails
{VENDOR_MESA, DRIVER_I965, BUG_BROKENUBO, 900, 920, true}, {VENDOR_MESA, DRIVER_I965, BUG_BROKENUBO, 900, 920, true},
{VENDOR_ATI, DRIVER_ATI, BUG_BROKENHACKEDBUFFER, -1.0, -1.0, true}, {VENDOR_ATI, DRIVER_ATI, BUG_BROKENHACKEDBUFFER, -1.0, -1.0, true},
{VENDOR_MESA, DRIVER_NOUVEAU, BUG_BROKENHACKEDBUFFER, -1.0, -1.0, true}, {VENDOR_MESA, DRIVER_NOUVEAU, BUG_BROKENHACKEDBUFFER, -1.0, -1.0, true},
{VENDOR_TEGRA, DRIVER_NVIDIA, BUG_ISTEGRA, -1.0, -1.0, true},
{VENDOR_IMGTEC, DRIVER_IMGTEC, BUG_ISPOWERVR, -1.0, -1.0, true},
}; };
std::map<Bug, BugInfo> m_bugs; std::map<Bug, BugInfo> m_bugs;

View File

@ -116,20 +116,6 @@ namespace DriverDetails
// Drawing on screen text causes the whole screen to swizzle in a terrible fashion // Drawing on screen text causes the whole screen to swizzle in a terrible fashion
// Clearing the framebuffer causes one to never see a frame. // Clearing the framebuffer causes one to never see a frame.
BUG_BROKENSWAP, BUG_BROKENSWAP,
// Bug: Running on a Tegra 4 device
// Affected devices: Nvidia Tegra
// Started Version: 4
// Ended Version: 5
// Tegra 4 hardware limitations don't allow it to support OpenGL ES 3
// This is fixed in Tegra 5
BUG_ISTEGRA,
// Bug: Running on a PowerVR5 device
// Affected devices: PowerVR54x
// Started Version: 540
// Ended Version: 6xxx
// PowerVR 5 hardware limitations don't allow it to support OpenGL ES 3
// This is fixed in PowerVR6
BUG_ISPOWERVR,
// Bug: glBufferSubData/glMapBufferRange stalls + OOM // Bug: glBufferSubData/glMapBufferRange stalls + OOM
// Affected devices: Adreno a3xx/Mali-t6xx // Affected devices: Adreno a3xx/Mali-t6xx
// Started Version: -1 // Started Version: -1