From ee26564c65fe697202097337f1868178eac2760f Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 16 Jul 2013 05:43:45 -0500 Subject: [PATCH] [Android] In the About pane, show if the phone supports OpenGL ES 3. Makes it less confusing for users. --- .../dolphinemu/dolphinemu/AboutFragment.java | 1 + .../dolphinemu/dolphinemu/PrefsFragment.java | 70 ++++++++++--------- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java index 4f0cf10702..5c47b79a3e 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java @@ -40,6 +40,7 @@ public class AboutFragment extends Fragment { int a = 0; Input.add(a++, new GameListItem(m_activity, "Build Revision", NativeLibrary.GetVersionString(), "", true)); + Input.add(a++, new GameListItem(m_activity, "Supports OpenGL ES 3", PrefsFragment.SupportsGLES3() ? "Yes" : "No", "", true)); adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, Input); mMainList.setAdapter(adapter); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java index d039c236bb..08ed852cdc 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java @@ -17,13 +17,8 @@ import javax.microedition.khronos.opengles.GL10; */ public class PrefsFragment extends PreferenceFragment { private Activity m_activity; - - private String m_GLVersion; - private String m_GLVendor; - private String m_GLRenderer; - - public class VersionCheck { + static public class VersionCheck { EGL10 mEGL; EGLDisplay mEGLDisplay; EGLConfig[] mEGLConfigs; @@ -93,7 +88,42 @@ public class PrefsFragment extends PreferenceFragment { return mEGLConfigs[0]; // Best match is probably the first configuration } } + static public boolean SupportsGLES3() + { + String m_GLVersion; + String m_GLVendor; + String m_GLRenderer; + VersionCheck mbuffer = new VersionCheck(); + m_GLVersion = mbuffer.getVersion(); + m_GLVendor = mbuffer.getVendor(); + m_GLRenderer = mbuffer.getRenderer(); + + boolean mSupportsGLES3 = false; + + if (m_GLVersion.contains("OpenGL ES 3.0")) // 3.0 support + mSupportsGLES3 = true; + if (!mSupportsGLES3 && m_GLVendor.equals("Qualcomm")) + { + if (m_GLRenderer.contains("Adreno (TM) 3")) + { + int mVStart, mVEnd = 0; + float mVersion; + mVStart = m_GLVersion.indexOf("V@") + 2; + for (int a = mVStart; a < m_GLVersion.length(); ++a) + if (m_GLVersion.charAt(a) == ' ') + { + mVEnd = a; + break; + } + mVersion = Float.parseFloat(m_GLVersion.substring(mVStart, mVEnd)); + + if (mVersion >= 14.0f) + mSupportsGLES3 = true; + } + } + return mSupportsGLES3; + } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -138,34 +168,8 @@ public class PrefsFragment extends PreferenceFragment { PreferenceCategory mCategory = (PreferenceCategory) findPreference("cpuprefcat"); mCategory.addPreference(etp); - VersionCheck mbuffer = new VersionCheck(); - m_GLVersion = mbuffer.getVersion(); - m_GLVendor = mbuffer.getVendor(); - m_GLRenderer = mbuffer.getRenderer(); - boolean mSupportsGLES3 = false; - - if (m_GLVersion.contains("OpenGL ES 3.0")) // 3.0 support - mSupportsGLES3 = true; - if (!mSupportsGLES3 && m_GLVendor.equals("Qualcomm")) - { - if (m_GLRenderer.contains("Adreno (TM) 3")) - { - int mVStart, mVEnd = 0; - float mVersion; - mVStart = m_GLVersion.indexOf("V@") + 2; - for (int a = mVStart; a < m_GLVersion.length(); ++a) - if (m_GLVersion.charAt(a) == ' ') - { - mVEnd = a; - break; - } - mVersion = Float.parseFloat(m_GLVersion.substring(mVStart, mVEnd)); - - if (mVersion >= 14.0f) - mSupportsGLES3 = true; - } - } + boolean mSupportsGLES3 = SupportsGLES3(); if (!mSupportsGLES3) {