Merge pull request #60 from Sonicadvance1/Android-GLDetect
Fix the Android OpenGL About tab.
This commit is contained in:
commit
60a5d8900b
|
@ -200,6 +200,9 @@ public final class NativeLibrary
|
||||||
/** Stops emulation. */
|
/** Stops emulation. */
|
||||||
public static native void StopEmulation();
|
public static native void StopEmulation();
|
||||||
|
|
||||||
|
/** Native EGL functions not exposed by Java bindings **/
|
||||||
|
public static native void eglBindAPI(int api);
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -28,8 +28,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public final class GLES2InfoFragment extends ListFragment
|
public final class GLES2InfoFragment extends ListFragment
|
||||||
{
|
{
|
||||||
private final EGLHelper eglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_ES2_BIT);
|
|
||||||
|
|
||||||
private final Limit[] Limits = {
|
private final Limit[] Limits = {
|
||||||
new Limit("Vendor", GLES20.GL_VENDOR, Type.STRING),
|
new Limit("Vendor", GLES20.GL_VENDOR, Type.STRING),
|
||||||
new Limit("Version", GLES20.GL_VERSION, Type.STRING),
|
new Limit("Version", GLES20.GL_VERSION, Type.STRING),
|
||||||
|
@ -56,6 +54,8 @@ public final class GLES2InfoFragment extends ListFragment
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
|
final EGLHelper eglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_ES2_BIT);
|
||||||
|
|
||||||
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||||
List<AboutActivity.AboutFragmentItem> Input = new ArrayList<AboutActivity.AboutFragmentItem>();
|
List<AboutActivity.AboutFragmentItem> Input = new ArrayList<AboutActivity.AboutFragmentItem>();
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public final class GLES3InfoFragment extends ListFragment
|
public final class GLES3InfoFragment extends ListFragment
|
||||||
{
|
{
|
||||||
private final EGLHelper eglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_ES3_BIT_KHR);
|
|
||||||
|
|
||||||
private final Limit[] Limits = {
|
private final Limit[] Limits = {
|
||||||
new Limit("Vendor", GLES30.GL_VENDOR, Type.STRING),
|
new Limit("Vendor", GLES30.GL_VENDOR, Type.STRING),
|
||||||
new Limit("Version", GLES30.GL_VERSION, Type.STRING),
|
new Limit("Version", GLES30.GL_VERSION, Type.STRING),
|
||||||
|
@ -88,6 +86,8 @@ public final class GLES3InfoFragment extends ListFragment
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
|
final EGLHelper eglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_ES3_BIT_KHR);
|
||||||
|
|
||||||
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||||
List<AboutActivity.AboutFragmentItem> Input = new ArrayList<AboutActivity.AboutFragmentItem>();
|
List<AboutActivity.AboutFragmentItem> Input = new ArrayList<AboutActivity.AboutFragmentItem>();
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,6 @@ import javax.microedition.khronos.opengles.GL10;
|
||||||
*/
|
*/
|
||||||
public final class GLInfoFragment extends ListFragment
|
public final class GLInfoFragment extends ListFragment
|
||||||
{
|
{
|
||||||
private final EGLHelper eglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_BIT);
|
|
||||||
|
|
||||||
private final Limit[] Limits = {
|
private final Limit[] Limits = {
|
||||||
new Limit("Vendor", GL10.GL_VENDOR, Type.STRING),
|
new Limit("Vendor", GL10.GL_VENDOR, Type.STRING),
|
||||||
new Limit("Version", GL10.GL_VERSION, Type.STRING),
|
new Limit("Version", GL10.GL_VERSION, Type.STRING),
|
||||||
|
@ -43,6 +41,8 @@ public final class GLInfoFragment extends ListFragment
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
|
final EGLHelper eglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_BIT);
|
||||||
|
|
||||||
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||||
List<AboutActivity.AboutFragmentItem> Input = new ArrayList<AboutActivity.AboutFragmentItem>();
|
List<AboutActivity.AboutFragmentItem> Input = new ArrayList<AboutActivity.AboutFragmentItem>();
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,8 @@ import javax.microedition.khronos.opengles.GL10;
|
||||||
import android.opengl.GLES30;
|
import android.opengl.GLES30;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class that abstracts all the stuff about
|
* Utility class that abstracts all the stuff about
|
||||||
* EGL initialization out of the way if all that is
|
* EGL initialization out of the way if all that is
|
||||||
|
@ -41,6 +43,10 @@ public final class EGLHelper
|
||||||
public static final int EGL_OPENGL_BIT = 0x0008;
|
public static final int EGL_OPENGL_BIT = 0x0008;
|
||||||
public static final int EGL_OPENGL_ES3_BIT_KHR = 0x0040;
|
public static final int EGL_OPENGL_ES3_BIT_KHR = 0x0040;
|
||||||
|
|
||||||
|
// API types
|
||||||
|
public static final int EGL_OPENGL_ES_API = 0x30A0;
|
||||||
|
public static final int EGL_OPENGL_API = 0x30A2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -295,6 +301,10 @@ public final class EGLHelper
|
||||||
ctx_attribs[1] = 2;
|
ctx_attribs[1] = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (renderableType == EGL_OPENGL_BIT)
|
||||||
|
NativeLibrary.eglBindAPI(EGL_OPENGL_API);
|
||||||
|
else
|
||||||
|
NativeLibrary.eglBindAPI(EGL_OPENGL_ES_API);
|
||||||
|
|
||||||
mEGLContext = mEGL.eglCreateContext(mDisplay, mEGLConfigs[0], EGL10.EGL_NO_CONTEXT, ctx_attribs);
|
mEGLContext = mEGL.eglCreateContext(mDisplay, mEGLConfigs[0], EGL10.EGL_NO_CONTEXT, ctx_attribs);
|
||||||
mEGLSurface = mEGL.eglCreatePbufferSurface(mDisplay, mEGLConfigs[0], attribs);
|
mEGLSurface = mEGL.eglCreatePbufferSurface(mDisplay, mEGLConfigs[0], attribs);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#include <android/native_window_jni.h>
|
#include <android/native_window_jni.h>
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
|
||||||
#include "Android/ButtonManager.h"
|
#include "Android/ButtonManager.h"
|
||||||
#include "Common/Common.h"
|
#include "Common/Common.h"
|
||||||
|
@ -297,6 +298,11 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenSh
|
||||||
Core::SaveScreenShot();
|
Core::SaveScreenShot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_eglBindAPI(JNIEnv *env, jobject obj, jint api)
|
||||||
|
{
|
||||||
|
eglBindAPI(api);
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig(JNIEnv *env, jobject obj, jstring jFile, jstring jKey, jstring jValue, jstring jDefault)
|
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig(JNIEnv *env, jobject obj, jstring jFile, jstring jKey, jstring jValue, jstring jDefault)
|
||||||
{
|
{
|
||||||
IniFile ini;
|
IniFile ini;
|
||||||
|
|
Loading…
Reference in New Issue