diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java index 4c5eb4d978..784839470a 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java @@ -3,13 +3,16 @@ package org.dolphinemu.dolphinemu; import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; +import android.preference.PreferenceManager; import android.util.DisplayMetrics; import android.view.*; import android.view.WindowManager.LayoutParams; import org.dolphinemu.dolphinemu.settings.InputConfigFragment; +import org.dolphinemu.dolphinemu.settings.VideoSettingsFragment; import java.util.List; @@ -52,7 +55,18 @@ public final class EmulationActivity extends Activity // and set on the native side of the code so the emulator can actually // load the game. Intent gameToEmulate = getIntent(); - NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight); + + // Due to a bug in Adreno, it renders the screen rotated 90 degrees when using OpenGL + // Flip the width and height when on Adreno to work around this. + // Mali isn't affected by this bug. + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + if (prefs.getString("gpuPref", "Software Rendering").equals("OGL") + && VideoSettingsFragment.SupportsGLES3() + && VideoSettingsFragment.m_GLVendor.equals("Qualcomm")) + NativeLibrary.SetDimensions((int)screenHeight, (int)screenWidth); + else + NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight); + NativeLibrary.SetFilename(gameToEmulate.getStringExtra("SelectedGame")); Running = true; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java index 9f7448765b..498e6607b1 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java @@ -6,15 +6,6 @@ package org.dolphinemu.dolphinemu.settings; -import javax.microedition.khronos.egl.EGL10; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.egl.EGLContext; -import javax.microedition.khronos.egl.EGLDisplay; -import javax.microedition.khronos.egl.EGLSurface; -import javax.microedition.khronos.opengles.GL10; - -import org.dolphinemu.dolphinemu.R; - import android.app.Activity; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; @@ -23,12 +14,19 @@ import android.preference.ListPreference; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; +import org.dolphinemu.dolphinemu.R; + +import javax.microedition.khronos.egl.*; +import javax.microedition.khronos.opengles.GL10; /** * Responsible for handling the loading of the video preferences. */ public final class VideoSettingsFragment extends PreferenceFragment { + public static String m_GLVersion; + public static String m_GLVendor; + public static String m_GLRenderer; private Activity m_activity; /** @@ -138,9 +136,9 @@ public final class VideoSettingsFragment extends PreferenceFragment public static boolean SupportsGLES3() { VersionCheck mbuffer = new VersionCheck(); - String m_GLVersion = mbuffer.getVersion(); - String m_GLVendor = mbuffer.getVendor(); - String m_GLRenderer = mbuffer.getRenderer(); + m_GLVersion = mbuffer.getVersion(); + m_GLVendor = mbuffer.getVendor(); + m_GLRenderer = mbuffer.getRenderer(); boolean mSupportsGLES3 = false; diff --git a/Source/Core/VideoCommon/Src/DriverDetails.cpp b/Source/Core/VideoCommon/Src/DriverDetails.cpp index cdecc71cd1..779edf91e8 100644 --- a/Source/Core/VideoCommon/Src/DriverDetails.cpp +++ b/Source/Core/VideoCommon/Src/DriverDetails.cpp @@ -30,6 +30,8 @@ namespace DriverDetails {VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_NODYNUBOACCESS, 14.0, -1.0, true}, {VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENCENTROID, 14.0, -1.0, true}, {VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENINFOLOG, -1.0, -1.0, true}, + {VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_ANNIHILATEDUBOS, 41.0, 46.0, true}, + {VENDOR_QUALCOMM, DRIVER_QUALCOMM_3XX, BUG_BROKENSWAP, -1.0, -1.0, true}, {VENDOR_MESA, DRIVER_NOUVEAU, BUG_BROKENUBO, 900, 916, true}, {VENDOR_MESA, DRIVER_R600, BUG_BROKENUBO, 900, 913, true}, {VENDOR_MESA, DRIVER_I965, BUG_BROKENUBO, 900, 920, true}, diff --git a/Source/Core/VideoCommon/Src/DriverDetails.h b/Source/Core/VideoCommon/Src/DriverDetails.h index dc0d2900eb..a9a9b40f54 100644 --- a/Source/Core/VideoCommon/Src/DriverDetails.h +++ b/Source/Core/VideoCommon/Src/DriverDetails.h @@ -99,6 +99,22 @@ namespace DriverDetails // to be broken. We just get flickering/black rendering when using pinned memory here -- degasus - 2013/08/20 // Please see issue #6105 on google code. Let's hope buffer storage solves this issues. BUG_BROKENPINNEDMEMORY, + // Bug: Entirely broken UBOs + // Affected devices: Qualcomm/Adreno + // Started Version: ? (Noticed on v45) + // Ended Version: -1 + // Uniform buffers are entirely broken on Qualcomm drivers with v45 + // Trying to use the uniform buffers causes a malloc to fail inside the driver + // To be safe, blanket drivers from v41 - v45 + BUG_ANNIHILATEDUBOS, + // Bug : Can't draw on screen text and clear correctly. + // Affected devices: Qualcomm/Adreno + // Started Version: ? + // Ended Version: ? + // Current code for drawing on screen text and clearing the framebuffer doesn't work on Adreno + // 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, }; // Initializes our internal vendor, device family, and driver version diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index a5a50d28ff..352058c26f 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -372,11 +372,15 @@ Renderer::Renderer() GLFunc::Init(); WARN_LOG(VIDEO, "Running the OpenGL ES 3 backend!"); g_Config.backend_info.bSupportsDualSourceBlend = false; - g_Config.backend_info.bSupportsGLSLUBO = true; + g_Config.backend_info.bSupportsGLSLUBO = !DriverDetails::HasBug(DriverDetails::BUG_ANNIHILATEDUBOS); g_Config.backend_info.bSupportsPrimitiveRestart = true; g_Config.backend_info.bSupportsEarlyZ = false; - + +#ifdef ANDROID + g_ogl_config.bSupportsGLSLCache = false; +#else g_ogl_config.bSupportsGLSLCache = true; +#endif g_ogl_config.bSupportsGLPinnedMemory = false; g_ogl_config.bSupportsGLSync = true; g_ogl_config.bSupportsGLBaseVertex = false; @@ -1557,31 +1561,35 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons if (XFBWrited) s_fps = UpdateFPSCounter(); // --------------------------------------------------------------------- - GL_REPORT_ERRORD(); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + if (!DriverDetails::HasBug(DriverDetails::BUG_BROKENSWAP)) + { + GL_REPORT_ERRORD(); - DrawDebugInfo(); - DrawDebugText(); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - GL_REPORT_ERRORD(); - - // Do our OSD callbacks - OSD::DoCallbacks(OSD::OSD_ONFRAME); - OSD::DrawMessages(); - GL_REPORT_ERRORD(); + DrawDebugInfo(); + DrawDebugText(); + GL_REPORT_ERRORD(); + + // Do our OSD callbacks + OSD::DoCallbacks(OSD::OSD_ONFRAME); + OSD::DrawMessages(); + GL_REPORT_ERRORD(); + } // Copy the rendered frame to the real window GLInterface->Swap(); GL_REPORT_ERRORD(); // Clear framebuffer - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - - GL_REPORT_ERRORD(); + if (!DriverDetails::HasBug(DriverDetails::BUG_BROKENSWAP)) + { + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + GL_REPORT_ERRORD(); + } if(s_vsync != g_ActiveConfig.IsVSync()) {