From f292819ff5d9017094c8d2debca2e4a93add448c Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 24 Nov 2013 15:49:23 -0600 Subject: [PATCH] [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 --- .../settings/VideoSettingsFragment.java | 8 -- .../OGL/Src/FramebufferManager.cpp | 35 +------- .../VideoBackends/OGL/Src/GLFunctions.cpp | 79 +++++++------------ .../OGL/Src/ProgramShaderCache.cpp | 40 +++------- Source/Core/VideoBackends/OGL/Src/Render.cpp | 5 +- Source/Core/VideoBackends/OGL/Src/Render.h | 1 - .../VideoBackends/OGL/Src/SamplerCache.cpp | 5 +- .../VideoBackends/OGL/Src/VertexManager.cpp | 18 ----- Source/Core/VideoCommon/Src/DriverDetails.cpp | 2 - Source/Core/VideoCommon/Src/DriverDetails.h | 14 ---- 10 files changed, 42 insertions(+), 165 deletions(-) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java index b88ea07afe..e181fc32bc 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java @@ -182,14 +182,6 @@ public final class VideoSettingsFragment extends PreferenceFragment 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; } diff --git a/Source/Core/VideoBackends/OGL/Src/FramebufferManager.cpp b/Source/Core/VideoBackends/OGL/Src/FramebufferManager.cpp index e2e4d873dd..1530016336 100644 --- a/Source/Core/VideoBackends/OGL/Src/FramebufferManager.cpp +++ b/Source/Core/VideoBackends/OGL/Src/FramebufferManager.cpp @@ -66,15 +66,6 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms // alpha channel should be ignored if the EFB does not have one. // Create EFB target. - u32 depthType; - if (DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA)) - { - depthType = GL_DEPTH_COMPONENT; - } - else - { - depthType = GL_DEPTH_COMPONENT24; - } glGenFramebuffers(1, &m_efbFramebuffer); glActiveTexture(GL_TEXTURE0 + 9); @@ -94,7 +85,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms glBindTexture(getFbType(), m_efbDepth); 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); glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0); @@ -159,7 +150,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms glBindTexture(getFbType(), m_resolvedDepthTexture); 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. @@ -235,13 +226,8 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms " ocol0 = float4(dst6) / 63.f;\n" "}"; - if(g_ogl_config.eSupportedGLSLVersion != GLSLES2) - { - // 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); - } + 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() @@ -372,19 +358,6 @@ GLuint FramebufferManager::ResolveAndGetDepthTarget(const EFBRectangle &source_r 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(); GLuint src_texture = 0; diff --git a/Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp b/Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp index 6ff264aebe..c91908ea11 100644 --- a/Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp +++ b/Source/Core/VideoBackends/OGL/Src/GLFunctions.cpp @@ -72,67 +72,42 @@ namespace GLFunc self = dlopen(NULL, RTLD_LAZY); 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("glBeginQueryEXT", (void**)&glBeginQuery); - LoadFunction("glEndQueryEXT", (void**)&glEndQuery); - LoadFunction("glGetQueryObjectuivEXT", (void**)&glGetQueryObjectuiv); - LoadFunction("glDeleteQueriesEXT", (void**)&glDeleteQueries); - LoadFunction("glGenQueriesEXT", (void**)&glGenQueries); + LoadFunction("glMapBufferRange", (void**)&glMapBufferRange); + LoadFunction("glBindBufferRange", (void**)&glBindBufferRange); + LoadFunction("glBlitFramebuffer", (void**)&glBlitFramebuffer); - LoadFunction("glMapBufferRangeNV", (void**)&glMapBufferRange); - LoadFunction("glBindBufferRangeNV", (void**)&glBindBufferRange); - LoadFunction("glBlitFramebufferNV", (void**)&glBlitFramebuffer); + LoadFunction("glGenVertexArrays", (void**)&glGenVertexArrays); + LoadFunction("glDeleteVertexArrays", (void**)&glDeleteVertexArrays); + LoadFunction("glBindVertexArray", (void**)&glBindVertexArray); - LoadFunction("glGenVertexArraysOES", (void**)&glGenVertexArrays); - LoadFunction("glDeleteVertexArraysOES", (void**)&glDeleteVertexArrays); - LoadFunction("glBindVertexArrayOES", (void**)&glBindVertexArray); + LoadFunction("glClientWaitSync", (void**)&glClientWaitSync); + LoadFunction("glDeleteSync", (void**)&glDeleteSync); + 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("glUniformBlockBindingNV", (void**)&glUniformBlockBinding); - } - else - { - LoadFunction("glBeginQuery", (void**)&glBeginQuery); - LoadFunction("glEndQuery", (void**)&glEndQuery); - LoadFunction("glGetQueryObjectuiv", (void**)&glGetQueryObjectuiv); - LoadFunction("glDeleteQueries", (void**)&glDeleteQueries); - LoadFunction("glGenQueries", (void**)&glGenQueries); + LoadFunction("glGetProgramBinary", (void**)&glGetProgramBinary); + LoadFunction("glProgramBinary", (void**)&glProgramBinary); + LoadFunction("glProgramParameteri", (void**)&glProgramParameteri); - LoadFunction("glMapBufferRange", (void**)&glMapBufferRange); - LoadFunction("glBindBufferRange", (void**)&glBindBufferRange); - LoadFunction("glBlitFramebuffer", (void**)&glBlitFramebuffer); + LoadFunction("glDrawRangeElements", (void**)&glDrawRangeElements); - LoadFunction("glGenVertexArrays", (void**)&glGenVertexArrays); - LoadFunction("glDeleteVertexArrays", (void**)&glDeleteVertexArrays); - LoadFunction("glBindVertexArray", (void**)&glBindVertexArray); + LoadFunction("glRenderbufferStorageMultisample", (void**)&glRenderbufferStorageMultisample); - LoadFunction("glClientWaitSync", (void**)&glClientWaitSync); - LoadFunction("glDeleteSync", (void**)&glDeleteSync); - LoadFunction("glFenceSync", (void**)&glFenceSync); + LoadFunction("glGetUniformBlockIndex", (void**)&glGetUniformBlockIndex); + LoadFunction("glUniformBlockBinding", (void**)&glUniformBlockBinding); - 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); } } diff --git a/Source/Core/VideoBackends/OGL/Src/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/Src/ProgramShaderCache.cpp index cc807b7952..f998c6ced2 100644 --- a/Source/Core/VideoBackends/OGL/Src/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/Src/ProgramShaderCache.cpp @@ -571,12 +571,12 @@ void ProgramShaderCache::CreateHeader ( void ) "%s\n" // ubo "%s\n" // early-z - // Precision defines for GLSLES2/3 + // Precision defines for GLSLES3 "%s\n" "\n"// A few required defines and ones that will make our lives a lot easier - "#define ATTRIN %s\n" - "#define ATTROUT %s\n" + "#define ATTRIN in\n" + "#define ATTROUT out\n" "#define VARYIN %s\n" "#define VARYOUT %s\n" @@ -594,40 +594,18 @@ void ProgramShaderCache::CreateHeader ( void ) "%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==GLSLES2 ? "" : v==GLSLES3 ? "#version 300 es" : v==GLSL_130 ? "#version 130" : v==GLSL_140 ? "#version 140" : "#version 150" + , v==GLSLES3 ? "#version 300 es" : v==GLSL_130 ? "#version 130" : v==GLSL_140 ? "#version 140" : "#version 150" , g_ActiveConfig.backend_info.bSupportsGLSLUBO && v 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 { if (triangle_index_size > 0) { diff --git a/Source/Core/VideoCommon/Src/DriverDetails.cpp b/Source/Core/VideoCommon/Src/DriverDetails.cpp index d2e8f2a059..3e975e0917 100644 --- a/Source/Core/VideoCommon/Src/DriverDetails.cpp +++ b/Source/Core/VideoCommon/Src/DriverDetails.cpp @@ -39,8 +39,6 @@ namespace DriverDetails {VENDOR_MESA, DRIVER_I965, BUG_BROKENUBO, 900, 920, true}, {VENDOR_ATI, DRIVER_ATI, 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 m_bugs; diff --git a/Source/Core/VideoCommon/Src/DriverDetails.h b/Source/Core/VideoCommon/Src/DriverDetails.h index 49af92084e..0ddf097ea1 100644 --- a/Source/Core/VideoCommon/Src/DriverDetails.h +++ b/Source/Core/VideoCommon/Src/DriverDetails.h @@ -116,20 +116,6 @@ namespace DriverDetails // Drawing on screen text causes the whole screen to swizzle in a terrible fashion // Clearing the framebuffer causes one to never see a frame. 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 // Affected devices: Adreno a3xx/Mali-t6xx // Started Version: -1