This commit is contained in:
Pedro J. Estébanez 2021-11-11 11:12:38 +01:00 committed by GitHub
commit 3fb12f9c5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 24 deletions

View file

@ -1691,7 +1691,7 @@ 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::INT, "graphics/depth_buffer_bits", PROPERTY_HINT_ENUM, "16 bits,24 bits [default],32 bits"), 1));
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));
@ -2530,9 +2530,10 @@ 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");
int depth_buffer_bits_index = p_preset->get("graphics/depth_buffer_bits");
if (depth_buffer_bits_index >= 0 && depth_buffer_bits_index <= 2) {
int depth_buffer_bits = 16 + depth_buffer_bits_index * 8;
command_line_strings.push_back(vformat("--use_depth=%d", depth_buffer_bits));
}
bool immersive = p_preset->get("screen/immersive_mode");

View file

@ -127,7 +127,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
private Button mWiFiSettingsButton;
private XRMode xrMode = XRMode.REGULAR;
private boolean use_32_bits = false;
private int depth_buffer_bits = 24;
private boolean use_immersive = false;
private boolean use_debug_opengl = false;
private boolean translucent = false;
@ -358,7 +358,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
// ...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, depth_buffer_bits, use_debug_opengl, translucent);
containerLayout.addView(mView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
edittext.setView(mView);
io.setEdit(edittext);
@ -621,8 +621,12 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
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].startsWith("--use_depth=")) {
try {
depth_buffer_bits = Integer.parseInt(command_line[i].split("=")[1]);
} catch (Exception e) {
e.printStackTrace();
}
} else if (command_line[i].equals("--debug_opengl")) {
use_debug_opengl = true;
} else if (command_line[i].equals("--translucent")) {

View file

@ -84,10 +84,10 @@ public class GodotView extends GLSurfaceView {
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) {
int p_depth_buffer_bits, boolean p_use_debug_opengl, boolean p_translucent) {
super(context);
GLUtils.use_gl3 = p_use_gl3;
GLUtils.use_32 = p_use_32_bits;
GLUtils.depth_buffer_bits = p_depth_buffer_bits;
GLUtils.use_debug_opengl = p_use_debug_opengl;
this.godot = godot;
@ -163,17 +163,14 @@ public class GodotView extends GLSurfaceView {
* 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, 16, stencil,
new RegularConfigChooser(5, 6, 5, 0, 16, stencil));
if (GLUtils.depth_buffer_bits >= 24) {
eglConfigChooser = new RegularFallbackConfigChooser(8, 8, 8, 8, 24, stencil, eglConfigChooser);
if (GLUtils.depth_buffer_bits >= 32) {
eglConfigChooser = new RegularFallbackConfigChooser(8, 8, 8, 8, 32, stencil, eglConfigChooser);
}
}
break;
}

View file

@ -45,7 +45,7 @@ public class GLUtils {
public static final boolean DEBUG = false;
public static boolean use_gl3 = false;
public static boolean use_32 = false;
public static int depth_buffer_bits; // No need to reiterate the default here
public static boolean use_debug_opengl = false;
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.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();
@ -55,7 +55,6 @@ public class RegularFallbackConfigChooser extends RegularConfigChooser {
if (ec == null) {
Log.w(TAG, "Trying ConfigChooser fallback");
ec = fallback.chooseConfig(egl, display, configs);
GLUtils.use_32 = false;
}
return ec;
}