diff options
| author | Lioncash <mathew1800@gmail.com> | 2014-01-21 00:12:40 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2014-01-21 00:12:40 -0500 |
| commit | 0dc437e94dc8cdcbec42e3c2a50427effdccdfda (patch) | |
| tree | 1fe65eddfa6d78fe514eb39e5c579e5fb1502c49 /Source | |
| parent | f8abdbf91a9996a008a11c47e4a92334a323fc12 (diff) | |
[Android] Finally check if regular OpenGL is possible on devices and display/hide it's fragment based upon this in AboutActivity.java.
Also added another constructor to EGLHelper which can be used to quickly query for information.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Android/src/org/dolphinemu/dolphinemu/about/AboutActivity.java | 65 | ||||
| -rw-r--r-- | Source/Android/src/org/dolphinemu/dolphinemu/utils/EGLHelper.java | 21 |
2 files changed, 61 insertions, 25 deletions
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() @@ -62,6 +59,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) { // When the given tab is selected, switch to the corresponding page in the ViewPager. @@ -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 @@ -36,6 +36,21 @@ public final class EGLHelper /** * Constructor + * <p> + * 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 * * @param width Width of the underlying {@link EGLSurface}. * @param height Height of the underlying {@link EGLSurface}. @@ -85,8 +100,8 @@ public final class EGLHelper * Gets information through EGL.<br/> * <p> * Index 0: Vendor <br/> - * Index 1: Renderer <br/> - * Index 2: Version <br/> + * Index 1: Version <br/> + * Index 2: Renderer <br/> * Index 3: Extensions <br/> * * @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), }; |
