Skip to content

Commit

Permalink
Merge pull request #54431 from RandomShaper/fix_gl3_32bits_3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Nov 15, 2021
2 parents 1919b17 + 4f8bc77 commit 77416d5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 30 deletions.
6 changes: 0 additions & 6 deletions platform/android/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_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::INT, "xr_features/xr_mode", PROPERTY_HINT_ENUM, "Regular,Oculus Mobile VR"), 0));
Expand Down Expand Up @@ -2530,11 +2529,6 @@ void EditorExportPlatformAndroid::get_command_line_flags(const Ref<EditorExportP
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");
if (immersive) {
command_line_strings.push_back("--use_immersive");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
private Button mWiFiSettingsButton;

private XRMode xrMode = XRMode.REGULAR;
private boolean use_32_bits = false;
private boolean use_immersive = false;
private boolean use_debug_opengl = false;
private boolean translucent = false;
Expand Down Expand Up @@ -358,7 +357,7 @@ private void onVideoInit() {
// ...add to FrameLayout
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));
edittext.setView(mView);
io.setEdit(edittext);
Expand Down Expand Up @@ -621,8 +620,6 @@ public void onCreate(Bundle icicle) {
xrMode = XRMode.REGULAR;
} else if (command_line[i].equals(XRMode.OVR.cmdLineArg)) {
xrMode = XRMode.OVR;
} else 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("--translucent")) {
Expand Down
26 changes: 9 additions & 17 deletions platform/android/java/lib/src/org/godotengine/godot/GodotView.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,17 @@ public class GodotView extends GLSurfaceView {
private EGLContextFactory eglContextFactory;
private EGLContext eglSecondaryContext;

public GodotView(Context context, Godot godot, XRMode xrMode, boolean p_use_gl3,
boolean p_use_32_bits, boolean p_use_debug_opengl, boolean p_translucent) {
public GodotView(Context context, Godot godot, XRMode xrMode, boolean p_use_gl3, boolean p_use_debug_opengl, boolean p_translucent) {
super(context);
GLUtils.use_gl3 = p_use_gl3;
GLUtils.use_32 = p_use_32_bits;
GLUtils.use_debug_opengl = p_use_debug_opengl;

this.godot = godot;
this.inputHandler = new GodotInputHandler(this);
this.detector = new GestureDetector(context, new GodotGestureHandler(this));
this.godotRenderer = new GodotRenderer();

init(xrMode, p_translucent, 16, 0);
init(xrMode, p_translucent);
}

public void initInputDevices() {
Expand Down Expand Up @@ -125,7 +123,7 @@ public boolean onGenericMotionEvent(MotionEvent 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);
setFocusableInTouchMode(true);
switch (xrMode) {
Expand Down Expand Up @@ -163,18 +161,12 @@ private void init(XRMode xrMode, boolean translucent, int depth, int stencil) {
* below.
*/

if (GLUtils.use_32) {
eglConfigChooser = translucent
? new RegularFallbackConfigChooser(8, 8, 8, 8, 24, stencil,
new RegularConfigChooser(8, 8, 8, 8, 16, stencil))
: new RegularFallbackConfigChooser(8, 8, 8, 8, 24, stencil,
new RegularConfigChooser(5, 6, 5, 0, 16, stencil));

} else {
eglConfigChooser = translucent
? new RegularConfigChooser(8, 8, 8, 8, 16, stencil)
: new RegularConfigChooser(5, 6, 5, 0, 16, stencil);
}
eglConfigChooser =
new RegularFallbackConfigChooser(8, 8, 8, 8, 24, 0,
new RegularFallbackConfigChooser(8, 8, 8, 8, 16, 0,
// Let such a desperate fallback be used if under some circumstances that's the best we can get
// (the translucency flag would be ignored, but that's better than not running at all)
new RegularConfigChooser(5, 6, 5, 0, 16, 0)));
break;
}
setEGLConfigChooser(eglConfigChooser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class GLUtils {
public static final boolean DEBUG = false;

public static boolean use_gl3 = false;
public static boolean use_32 = false;
public static boolean use_debug_opengl = false;

private static final String[] ATTRIBUTES_NAMES = new String[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import javax.microedition.khronos.egl.EGLConfig;
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 {
private static final String TAG = RegularFallbackConfigChooser.class.getSimpleName();

Expand All @@ -55,7 +55,6 @@ public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display, EGLConfig[] configs
if (ec == null) {
Log.w(TAG, "Trying ConfigChooser fallback");
ec = fallback.chooseConfig(egl, display, configs);
GLUtils.use_32 = false;
}
return ec;
}
Expand Down

0 comments on commit 77416d5

Please sign in to comment.