diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/export/export.cpp | 5 | ||||
-rw-r--r-- | platform/android/java/src/org/godotengine/godot/Godot.java | 5 | ||||
-rw-r--r-- | platform/android/java/src/org/godotengine/godot/GodotView.java | 20 |
3 files changed, 25 insertions, 5 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 021a92ca1e..3b503e2657 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1085,6 +1085,7 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_normal"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_large"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_xlarge"), true)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/opengl_debug"), false)); for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_icons[i].option_id, PROPERTY_HINT_FILE, "*.png"), "")); @@ -1438,6 +1439,7 @@ public: bool use_32_fb = p_preset->get("graphics/32_bits_framebuffer"); bool immersive = p_preset->get("screen/immersive_mode"); + bool debug_opengl = p_preset->get("screen/opengl_debug"); bool _signed = p_preset->get("package/signed"); @@ -1639,6 +1641,9 @@ public: if (immersive) cl.push_back("--use_immersive"); + if (debug_opengl) + cl.push_back("--debug_opengl"); + if (cl.size()) { //add comandline Vector<uint8_t> clf; diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index c23037f3e0..ab37f7a02c 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -116,6 +116,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC private boolean use_32_bits = false; private boolean use_immersive = false; + private boolean use_debug_opengl = false; private boolean mStatePaused; private int mState; private boolean keep_screen_on = true; @@ -278,7 +279,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC // ...add to FrameLayout layout.addView(edittext); - mView = new GodotView(getApplication(), io, use_gl3, use_32_bits, this); + mView = new GodotView(getApplication(), io, use_gl3, use_32_bits, use_debug_opengl,this); layout.addView(mView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); edittext.setView(mView); io.setEdit(edittext); @@ -471,6 +472,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC boolean has_extra = i < command_line.length - 1; if (command_line[i].equals("--use_depth_32")) { use_32_bits = true; + } else if (command_line[i].equals("--debug_opengl")) { + use_debug_opengl = true; } else if (command_line[i].equals("--use_immersive")) { use_immersive = true; if (Build.VERSION.SDK_INT >= 19.0) { // check if the application runs on an android 4.4+ diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java index 23723c2696..181ffc3b4b 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotView.java +++ b/platform/android/java/src/org/godotengine/godot/GodotView.java @@ -81,16 +81,18 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener { private static boolean firsttime = true; private static boolean use_gl3 = false; private static boolean use_32 = false; + private static boolean use_debug_opengl = false; private Godot activity; private InputManagerCompat mInputManager; - public GodotView(Context context, GodotIO p_io, boolean p_use_gl3, boolean p_use_32_bits, Godot p_activity) { + public GodotView(Context context, GodotIO p_io, boolean p_use_gl3, boolean p_use_32_bits, boolean p_use_debug_opengl,Godot p_activity) { super(context); ctx = context; io = p_io; use_gl3 = p_use_gl3; use_32 = p_use_32_bits; + use_debug_opengl = p_use_debug_opengl; activity = p_activity; @@ -406,6 +408,9 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener { setRenderer(new Renderer()); } + private static final int _EGL_CONTEXT_FLAGS_KHR = 0x30FC; + private static final int _EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR= 0x00000001; + private static class ContextFactory implements GLSurfaceView.EGLContextFactory { private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098; public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) { @@ -415,9 +420,16 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener { Log.w(TAG, "creating OpenGL ES 2.0 context :"); checkEglError("Before eglCreateContext", egl); - int[] attrib_list2 = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE }; - int[] attrib_list3 = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL10.EGL_NONE }; - EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, use_gl3 ? attrib_list3 : attrib_list2); + EGLContext context; + if (use_debug_opengl) { + int[] attrib_list2 = { EGL_CONTEXT_CLIENT_VERSION, 2,_EGL_CONTEXT_FLAGS_KHR,_EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, EGL10.EGL_NONE }; + int[] attrib_list3 = { EGL_CONTEXT_CLIENT_VERSION, 3,_EGL_CONTEXT_FLAGS_KHR,_EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR, EGL10.EGL_NONE }; + context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, use_gl3 ? attrib_list3 : attrib_list2); + } else { + int[] attrib_list2 = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE }; + int[] attrib_list3 = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL10.EGL_NONE }; + context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, use_gl3 ? attrib_list3 : attrib_list2); + } checkEglError("After eglCreateContext", egl); return context; } |