diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/about/AboutActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/about/AboutActivity.java index c3f0f61af8..70b15b9685 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/about/AboutActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/about/AboutActivity.java @@ -1,7 +1,7 @@ package org.dolphinemu.dolphinemu.about; import org.dolphinemu.dolphinemu.R; -import org.dolphinemu.dolphinemu.settings.video.VideoSettingsFragment; +import org.dolphinemu.dolphinemu.utils.EGLHelper; import android.app.ActionBar; import android.app.ActionBar.Tab; @@ -21,7 +21,7 @@ import android.support.v4.view.ViewPager; public final class AboutActivity extends Activity implements TabListener { private ViewPager viewPager; - private boolean supportsGles3; + private EGLHelper eglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_ES2_BIT); @Override protected void onCreate(Bundle savedInstanceState) @@ -32,9 +32,6 @@ public final class AboutActivity extends Activity implements TabListener setContentView(R.layout.viewpager); viewPager = (ViewPager) findViewById(R.id.pager); - // Check if GLES3 is supported - supportsGles3 = VideoSettingsFragment.SupportsGLES3(); - // Initialize the ViewPager adapter. final ViewPagerAdapter adapter = new ViewPagerAdapter(getFragmentManager()); viewPager.setAdapter(adapter); @@ -45,10 +42,10 @@ public final class AboutActivity extends Activity implements TabListener actionBar.addTab(actionBar.newTab().setText(R.string.general).setTabListener(this)); actionBar.addTab(actionBar.newTab().setText(R.string.cpu).setTabListener(this)); actionBar.addTab(actionBar.newTab().setText(R.string.gles_two).setTabListener(this)); - if (supportsGles3) + if (eglHelper.supportsGLES3()) actionBar.addTab(actionBar.newTab().setText(R.string.gles_three).setTabListener(this)); - // TODO: Check if Desktop GL is possible before enabling. - actionBar.addTab(actionBar.newTab().setText(R.string.desktop_gl).setTabListener(this)); + if (eglHelper.supportsOpenGL()) + actionBar.addTab(actionBar.newTab().setText(R.string.desktop_gl).setTabListener(this)); // Set the page change listener viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() @@ -61,6 +58,14 @@ public final class AboutActivity extends Activity implements TabListener }); } + @Override + public void onDestroy() + { + super.onDestroy(); + + eglHelper.closeHelper(); + } + @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { @@ -94,30 +99,46 @@ public final class AboutActivity extends Activity implements TabListener @Override public Fragment getItem(int position) { - switch (position) + if (position == 0) { - case 0: return new DolphinInfoFragment(); - // TODO: The rest of these fragments - case 1: return new Fragment(); // CPU - case 2: return new Fragment(); // GLES 2 - case 3: return new Fragment(); // GLES 3 - case 4: return new Fragment(); // Desktop GL - - default: // Should never happen - return null; + return new DolphinInfoFragment(); } + else if (position == 1) + { + return new Fragment(); // CPU + } + else if (position == 2) // GLES 2 + { + return new Fragment(); + } + else if (position == 3) // GLES 3 or OpenGL (depending on circumstances) + { + if (eglHelper.supportsGLES3()) + return new Fragment(); // TODO: Return the GLES 3 fragment in this case (normal case) + else + return new Fragment(); // TODO: Return the OpenGL fragment in this case (GLES3 not supported case) + } + else if (position == 4) // OpenGL fragment + { + return new Fragment(); + } + + // This should never happen. + return null; } @Override public int getCount() { - // TODO: In the future, make sure to take into account - // whether or not regular Desktop GL is possible. - if (supportsGles3) + if (eglHelper.supportsGLES3() && eglHelper.supportsOpenGL()) { return 5; } - else + else if (!eglHelper.supportsGLES3() && !eglHelper.supportsOpenGL()) + { + return 3; + } + else // Either regular OpenGL or GLES3 isn't supported { return 4; } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/utils/EGLHelper.java b/Source/Android/src/org/dolphinemu/dolphinemu/utils/EGLHelper.java index 2633ad681b..2f38f10a8a 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/utils/EGLHelper.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/utils/EGLHelper.java @@ -34,6 +34,21 @@ public final class EGLHelper public static final int EGL_OPENGL_BIT = 0x0008; public static final int EGL_OPENGL_ES3_BIT_KHR = 0x0040; + /** + * Constructor + *

+ * Initializes the underlying {@link EGLSurface} with a width and height of 1. + * This is useful if all you need to use this class for is to query information + * from specific API contexts. + * + * @param renderableType Bitmask indicating which types of client API contexts + * the framebuffer config must support. + */ + public EGLHelper(int renderableType) + { + this(1, 1, renderableType); + } + /** * Constructor * @@ -85,8 +100,8 @@ public final class EGLHelper * Gets information through EGL.
*

* Index 0: Vendor
- * Index 1: Renderer
- * Index 2: Version
+ * Index 1: Version
+ * Index 2: Renderer
* Index 3: Extensions
* * @return information retrieved through EGL. @@ -95,8 +110,8 @@ public final class EGLHelper { String[] info = { mGL.glGetString(GL10.GL_VENDOR), - mGL.glGetString(GL10.GL_RENDERER), mGL.glGetString(GL10.GL_VERSION), + mGL.glGetString(GL10.GL_RENDERER), mGL.glGetString(GL10.GL_EXTENSIONS), };