[Android] Show the OpenGL ES 3 backend video option only on devices that support it.
This commit is contained in:
parent
970cb4329f
commit
95d4dc92c1
|
@ -118,37 +118,21 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="InputConfigActivity.java" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/InputConfigActivity.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="97" column="16" selection-start="3629" selection-end="3721" vertical-scroll-proportion="0.0" vertical-offset="1230" max-vertical-offset="2775">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="AndroidManifest.xml" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/AndroidManifest.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="3" column="26" selection-start="174" selection-end="174" vertical-scroll-proportion="0.0" vertical-offset="30" max-vertical-offset="825">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="PrefsActivity.java" pinned="false" current="false" current-in-tab="false">
|
||||
<file leaf-file-name="PrefsActivity.java" pinned="false" current="true" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/PrefsActivity.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="62" column="0" selection-start="1857" selection-end="1857" vertical-scroll-proportion="0.0" vertical-offset="720" max-vertical-offset="1260">
|
||||
<folding />
|
||||
<state line="177" column="17" selection-start="5357" selection-end="5357" vertical-scroll-proportion="0.09090909" vertical-offset="2619" max-vertical-offset="3375">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="prefs.xml" pinned="false" current="true" current-in-tab="true">
|
||||
<file leaf-file-name="prefs.xml" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/res/layout/prefs.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="6" column="37" selection-start="267" selection-end="267" vertical-scroll-proportion="0.2425876" vertical-offset="0" max-vertical-offset="420">
|
||||
<state line="20" column="33" selection-start="799" selection-end="819" vertical-scroll-proportion="-12.0" vertical-offset="0" max-vertical-offset="435">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -169,7 +153,7 @@
|
|||
<file leaf-file-name="prefvalues.xml" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/res/values/prefvalues.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="1" column="11" selection-start="50" selection-end="50" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="255">
|
||||
<state line="8" column="14" selection-start="231" selection-end="248" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="255">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -178,7 +162,7 @@
|
|||
<file leaf-file-name="GameListItem.java" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/GameListItem.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="22" column="24" selection-start="570" selection-end="570" vertical-scroll-proportion="0.0" vertical-offset="315" max-vertical-offset="1230">
|
||||
<state line="22" column="24" selection-start="570" selection-end="570" vertical-scroll-proportion="0.0" vertical-offset="225" max-vertical-offset="1140">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -220,8 +204,8 @@
|
|||
<option value="$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/GameListFragment.java" />
|
||||
<option value="$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java" />
|
||||
<option value="$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/FolderBrowser.java" />
|
||||
<option value="$PROJECT_DIR$/res/layout/prefs.xml" />
|
||||
<option value="$PROJECT_DIR$/res/values/prefvalues.xml" />
|
||||
<option value="$PROJECT_DIR$/res/layout/prefs.xml" />
|
||||
<option value="$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/PrefsActivity.java" />
|
||||
</list>
|
||||
</option>
|
||||
|
@ -781,13 +765,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/GameListItem.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="22" column="24" selection-start="570" selection-end="570" vertical-scroll-proportion="0.0" vertical-offset="405" max-vertical-offset="1140">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/AboutActivity.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="26" column="125" selection-start="741" selection-end="741" vertical-scroll-proportion="0.0" vertical-offset="120" max-vertical-offset="495">
|
||||
|
@ -816,13 +793,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/GameListActivity.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="173" column="16" selection-start="5541" selection-end="5638" vertical-scroll-proportion="0.0" vertical-offset="2070" max-vertical-offset="3390">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/DolphinEmulator.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="224" column="45" selection-start="6730" selection-end="6769" vertical-scroll-proportion="0.0" vertical-offset="2668" max-vertical-offset="3315">
|
||||
|
@ -830,13 +800,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/InputConfigActivity.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="97" column="16" selection-start="3629" selection-end="3721" vertical-scroll-proportion="0.0" vertical-offset="900" max-vertical-offset="2775">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/AndroidManifest.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="3" column="26" selection-start="174" selection-end="174" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="825">
|
||||
|
@ -844,6 +807,20 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/InputConfigActivity.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="97" column="16" selection-start="3629" selection-end="3721" vertical-scroll-proportion="0.03787879" vertical-offset="1230" max-vertical-offset="2775">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/GameListItem.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="22" column="24" selection-start="570" selection-end="570" vertical-scroll-proportion="0.0" vertical-offset="405" max-vertical-offset="1140">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/res/values/strings.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="396">
|
||||
|
@ -851,30 +828,39 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/res/layout/prefs.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="20" column="33" selection-start="799" selection-end="819" vertical-scroll-proportion="-12.0" vertical-offset="0" max-vertical-offset="435">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
<provider editor-type-id="android-designer">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/res/values/prefvalues.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="1" column="11" selection-start="50" selection-end="50" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="255">
|
||||
<state line="8" column="14" selection-start="231" selection-end="248" vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="255">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/GameListActivity.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="173" column="16" selection-start="5541" selection-end="5638" vertical-scroll-proportion="0.0" vertical-offset="2070" max-vertical-offset="3390">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/org/dolphinemu/dolphinemu/PrefsActivity.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="62" column="0" selection-start="1857" selection-end="1857" vertical-scroll-proportion="0.0" vertical-offset="720" max-vertical-offset="1260">
|
||||
<folding />
|
||||
<state line="177" column="17" selection-start="5357" selection-end="5357" vertical-scroll-proportion="0.09090909" vertical-offset="2619" max-vertical-offset="3375">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/res/layout/prefs.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="6" column="37" selection-start="267" selection-end="267" vertical-scroll-proportion="0.2425876" vertical-offset="0" max-vertical-offset="420">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
<provider editor-type-id="android-designer">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:summary="Settings"
|
||||
android:title="Video Settings" >
|
||||
android:title="Video Settings"
|
||||
android:key="videoprefcat">
|
||||
<ListPreference
|
||||
android:entries="@array/gpuOptions"
|
||||
android:entryValues="@array/gpuValues"
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.dolphinemu.dolphinemu;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
|
@ -9,6 +10,9 @@ import android.preference.PreferenceActivity;
|
|||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
import javax.microedition.khronos.egl.*;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
/**
|
||||
* Copyright 2013 Dolphin Emulator Project
|
||||
* Licensed under GPLv2
|
||||
|
@ -16,6 +20,85 @@ import android.preference.PreferenceFragment;
|
|||
*/
|
||||
public class PrefsActivity extends PreferenceActivity {
|
||||
private PrefsActivity m_activity;
|
||||
private String m_GLVersion;
|
||||
private String m_GLVendor;
|
||||
private String m_GLRenderer;
|
||||
|
||||
|
||||
public class VersionCheck {
|
||||
GLSurfaceView.Renderer mRenderer; // borrow this interface
|
||||
|
||||
EGL10 mEGL;
|
||||
EGLDisplay mEGLDisplay;
|
||||
EGLConfig[] mEGLConfigs;
|
||||
EGLConfig mEGLConfig;
|
||||
EGLContext mEGLContext;
|
||||
EGLSurface mEGLSurface;
|
||||
GL10 mGL;
|
||||
|
||||
String mThreadOwner;
|
||||
|
||||
public VersionCheck() {
|
||||
|
||||
int[] version = new int[2];
|
||||
int[] attribList = new int[] {
|
||||
EGL10.EGL_WIDTH, 1,
|
||||
EGL10.EGL_HEIGHT, 1,
|
||||
EGL10.EGL_RENDERABLE_TYPE, 4,
|
||||
EGL10.EGL_NONE
|
||||
};
|
||||
|
||||
// No error checking performed, minimum required code to elucidate logic
|
||||
mEGL = (EGL10) EGLContext.getEGL();
|
||||
mEGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
|
||||
mEGL.eglInitialize(mEGLDisplay, version);
|
||||
mEGLConfig = chooseConfig(); // Choosing a config is a little more complicated
|
||||
mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig, EGL10.EGL_NO_CONTEXT, null);
|
||||
mEGLSurface = mEGL.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig, attribList);
|
||||
mEGL.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext);
|
||||
mGL = (GL10) mEGLContext.getGL();
|
||||
|
||||
// Record thread owner of OpenGL context
|
||||
mThreadOwner = Thread.currentThread().getName();
|
||||
}
|
||||
|
||||
public String getVersion()
|
||||
{
|
||||
return mGL.glGetString(GL10.GL_VERSION);
|
||||
}
|
||||
|
||||
public String getVendor()
|
||||
{
|
||||
return mGL.glGetString(GL10.GL_VENDOR);
|
||||
}
|
||||
public String getRenderer()
|
||||
{
|
||||
return mGL.glGetString(GL10.GL_RENDERER);
|
||||
}
|
||||
private EGLConfig chooseConfig() {
|
||||
int[] attribList = new int[] {
|
||||
EGL10.EGL_DEPTH_SIZE, 0,
|
||||
EGL10.EGL_STENCIL_SIZE, 0,
|
||||
EGL10.EGL_RED_SIZE, 8,
|
||||
EGL10.EGL_GREEN_SIZE, 8,
|
||||
EGL10.EGL_BLUE_SIZE, 8,
|
||||
EGL10.EGL_ALPHA_SIZE, 8,
|
||||
EGL10.EGL_NONE
|
||||
};
|
||||
|
||||
// No error checking performed, minimum required code to elucidate logic
|
||||
// Expand on this logic to be more selective in choosing a configuration
|
||||
int[] numConfig = new int[1];
|
||||
mEGL.eglChooseConfig(mEGLDisplay, attribList, null, 0, numConfig);
|
||||
int configSize = numConfig[0];
|
||||
mEGLConfigs = new EGLConfig[configSize];
|
||||
mEGL.eglChooseConfig(mEGLDisplay, attribList, mEGLConfigs, configSize, numConfig);
|
||||
|
||||
return mEGLConfigs[0]; // Best match is probably the first configuration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class PrefsFragment extends PreferenceFragment {
|
||||
|
||||
|
@ -63,6 +146,57 @@ public class PrefsActivity extends PreferenceActivity {
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mSupportsGLES3)
|
||||
{
|
||||
mCategory = (PreferenceCategory) findPreference("videoprefcat");
|
||||
ListPreference mPref = (ListPreference) findPreference("gpupref");
|
||||
mCategory.removePreference(mPref);
|
||||
|
||||
final ListPreference videobackend = new ListPreference(m_activity);
|
||||
|
||||
_entries = new CharSequence[] {
|
||||
"Software Renderer",
|
||||
};
|
||||
_entryvalues = new CharSequence[] {"Software Renderer"};
|
||||
|
||||
videobackend.setKey("gpupref");
|
||||
videobackend.setTitle("Video Backend");
|
||||
videobackend.setSummary("Video backend to use");
|
||||
|
||||
videobackend.setEntries(_entries);
|
||||
videobackend.setEntryValues(_entryvalues);
|
||||
|
||||
mCategory.addPreference(videobackend);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue