Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Android] In the About pane, show if the phone supports OpenGL ES 3. …
…Makes it less confusing for users.
  • Loading branch information
Sonicadvance1 committed Jul 16, 2013
1 parent 023922c commit ee26564
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 33 deletions.
Expand Up @@ -40,6 +40,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
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);

Expand Down
70 changes: 37 additions & 33 deletions Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java
Expand Up @@ -17,13 +17,8 @@
*/
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;
Expand Down Expand Up @@ -93,7 +88,42 @@ private EGLConfig chooseConfig() {
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);
Expand Down Expand Up @@ -138,34 +168,8 @@ else if (Build.CPU_ABI.contains("arm"))

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)
{
Expand Down

0 comments on commit ee26564

Please sign in to comment.