Merge pull request #54431 from RandomShaper/fix_gl3_32bits_3.x

This commit is contained in:
Rémi Verschelde 2021-11-15 17:54:31 +01:00 committed by GitHub
commit 77416d5806
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 30 deletions

View file

@ -1691,7 +1691,6 @@ void EditorExportPlatformAndroid::get_export_options(List<ExportOption> *r_optio
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_adaptive_icon_foreground_option, PROPERTY_HINT_FILE, "*.png"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_adaptive_icon_foreground_option, PROPERTY_HINT_FILE, "*.png"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_adaptive_icon_background_option, PROPERTY_HINT_FILE, "*.png"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_adaptive_icon_background_option, PROPERTY_HINT_FILE, "*.png"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/32_bits_framebuffer"), true));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/opengl_debug"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/opengl_debug"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/xr_mode", PROPERTY_HINT_ENUM, "Regular,Oculus Mobile VR"), 0)); r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/xr_mode", PROPERTY_HINT_ENUM, "Regular,Oculus Mobile VR"), 0));
@ -2530,11 +2529,6 @@ void EditorExportPlatformAndroid::get_command_line_flags(const Ref<EditorExportP
command_line_strings.push_back("--xr_mode_regular"); command_line_strings.push_back("--xr_mode_regular");
} }
bool use_32_bit_framebuffer = p_preset->get("graphics/32_bits_framebuffer");
if (use_32_bit_framebuffer) {
command_line_strings.push_back("--use_depth_32");
}
bool immersive = p_preset->get("screen/immersive_mode"); bool immersive = p_preset->get("screen/immersive_mode");
if (immersive) { if (immersive) {
command_line_strings.push_back("--use_immersive"); command_line_strings.push_back("--use_immersive");

View file

@ -127,7 +127,6 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
private Button mWiFiSettingsButton; private Button mWiFiSettingsButton;
private XRMode xrMode = XRMode.REGULAR; private XRMode xrMode = XRMode.REGULAR;
private boolean use_32_bits = false;
private boolean use_immersive = false; private boolean use_immersive = false;
private boolean use_debug_opengl = false; private boolean use_debug_opengl = false;
private boolean translucent = false; private boolean translucent = false;
@ -358,7 +357,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
// ...add to FrameLayout // ...add to FrameLayout
containerLayout.addView(edittext); containerLayout.addView(edittext);
mView = new GodotView(activity, this, xrMode, use_gl3, use_32_bits, use_debug_opengl, translucent); mView = new GodotView(activity, this, xrMode, use_gl3, use_debug_opengl, translucent);
containerLayout.addView(mView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); containerLayout.addView(mView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
edittext.setView(mView); edittext.setView(mView);
io.setEdit(edittext); io.setEdit(edittext);
@ -621,8 +620,6 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
xrMode = XRMode.REGULAR; xrMode = XRMode.REGULAR;
} else if (command_line[i].equals(XRMode.OVR.cmdLineArg)) { } else if (command_line[i].equals(XRMode.OVR.cmdLineArg)) {
xrMode = XRMode.OVR; xrMode = XRMode.OVR;
} else if (command_line[i].equals("--use_depth_32")) {
use_32_bits = true;
} else if (command_line[i].equals("--debug_opengl")) { } else if (command_line[i].equals("--debug_opengl")) {
use_debug_opengl = true; use_debug_opengl = true;
} else if (command_line[i].equals("--translucent")) { } else if (command_line[i].equals("--translucent")) {

View file

@ -83,11 +83,9 @@ public class GodotView extends GLSurfaceView {
private EGLContextFactory eglContextFactory; private EGLContextFactory eglContextFactory;
private EGLContext eglSecondaryContext; private EGLContext eglSecondaryContext;
public GodotView(Context context, Godot godot, XRMode xrMode, boolean p_use_gl3, public GodotView(Context context, Godot godot, XRMode xrMode, boolean p_use_gl3, boolean p_use_debug_opengl, boolean p_translucent) {
boolean p_use_32_bits, boolean p_use_debug_opengl, boolean p_translucent) {
super(context); super(context);
GLUtils.use_gl3 = p_use_gl3; GLUtils.use_gl3 = p_use_gl3;
GLUtils.use_32 = p_use_32_bits;
GLUtils.use_debug_opengl = p_use_debug_opengl; GLUtils.use_debug_opengl = p_use_debug_opengl;
this.godot = godot; this.godot = godot;
@ -95,7 +93,7 @@ public class GodotView extends GLSurfaceView {
this.detector = new GestureDetector(context, new GodotGestureHandler(this)); this.detector = new GestureDetector(context, new GodotGestureHandler(this));
this.godotRenderer = new GodotRenderer(); this.godotRenderer = new GodotRenderer();
init(xrMode, p_translucent, 16, 0); init(xrMode, p_translucent);
} }
public void initInputDevices() { public void initInputDevices() {
@ -125,7 +123,7 @@ public class GodotView extends GLSurfaceView {
return inputHandler.onGenericMotionEvent(event) || super.onGenericMotionEvent(event); return inputHandler.onGenericMotionEvent(event) || super.onGenericMotionEvent(event);
} }
private void init(XRMode xrMode, boolean translucent, int depth, int stencil) { private void init(XRMode xrMode, boolean translucent) {
setPreserveEGLContextOnPause(true); setPreserveEGLContextOnPause(true);
setFocusableInTouchMode(true); setFocusableInTouchMode(true);
switch (xrMode) { switch (xrMode) {
@ -163,18 +161,12 @@ public class GodotView extends GLSurfaceView {
* below. * below.
*/ */
if (GLUtils.use_32) { eglConfigChooser =
eglConfigChooser = translucent new RegularFallbackConfigChooser(8, 8, 8, 8, 24, 0,
? new RegularFallbackConfigChooser(8, 8, 8, 8, 24, stencil, new RegularFallbackConfigChooser(8, 8, 8, 8, 16, 0,
new RegularConfigChooser(8, 8, 8, 8, 16, stencil)) // Let such a desperate fallback be used if under some circumstances that's the best we can get
: new RegularFallbackConfigChooser(8, 8, 8, 8, 24, stencil, // (the translucency flag would be ignored, but that's better than not running at all)
new RegularConfigChooser(5, 6, 5, 0, 16, stencil)); new RegularConfigChooser(5, 6, 5, 0, 16, 0)));
} else {
eglConfigChooser = translucent
? new RegularConfigChooser(8, 8, 8, 8, 16, stencil)
: new RegularConfigChooser(5, 6, 5, 0, 16, stencil);
}
break; break;
} }
setEGLConfigChooser(eglConfigChooser); setEGLConfigChooser(eglConfigChooser);

View file

@ -45,7 +45,6 @@ public class GLUtils {
public static final boolean DEBUG = false; public static final boolean DEBUG = false;
public static boolean use_gl3 = false; public static boolean use_gl3 = false;
public static boolean use_32 = false;
public static boolean use_debug_opengl = false; public static boolean use_debug_opengl = false;
private static final String[] ATTRIBUTES_NAMES = new String[] { private static final String[] ATTRIBUTES_NAMES = new String[] {

View file

@ -38,7 +38,7 @@ import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLDisplay;
/* Fallback if 32bit View is not supported*/ /* Fallback if the requested configuration is not supported */
public class RegularFallbackConfigChooser extends RegularConfigChooser { public class RegularFallbackConfigChooser extends RegularConfigChooser {
private static final String TAG = RegularFallbackConfigChooser.class.getSimpleName(); private static final String TAG = RegularFallbackConfigChooser.class.getSimpleName();
@ -55,7 +55,6 @@ public class RegularFallbackConfigChooser extends RegularConfigChooser {
if (ec == null) { if (ec == null) {
Log.w(TAG, "Trying ConfigChooser fallback"); Log.w(TAG, "Trying ConfigChooser fallback");
ec = fallback.chooseConfig(egl, display, configs); ec = fallback.chooseConfig(egl, display, configs);
GLUtils.use_32 = false;
} }
return ec; return ec;
} }