mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
Merge pull request #54463 from RandomShaper/fix_gl3_32bits
This commit is contained in:
commit
8a15e404b2
12 changed files with 31 additions and 39 deletions
|
|
@ -119,7 +119,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 mStatePaused;
|
||||
|
|
@ -266,7 +266,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
|||
if (videoDriver.equals("vulkan")) {
|
||||
mRenderView = new GodotVulkanRenderView(activity, this);
|
||||
} else {
|
||||
mRenderView = new GodotGLRenderView(activity, this, xrMode, use_32_bits,
|
||||
mRenderView = new GodotGLRenderView(activity, this, xrMode, depth_buffer_bits,
|
||||
use_debug_opengl);
|
||||
}
|
||||
|
||||
|
|
@ -506,8 +506,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("--use_immersive")) {
|
||||
|
|
|
|||
|
|
@ -78,10 +78,10 @@ public class GodotGLRenderView extends GLSurfaceView implements GodotRenderView
|
|||
private final GodotRenderer godotRenderer;
|
||||
private PointerIcon pointerIcon;
|
||||
|
||||
public GodotGLRenderView(Context context, Godot godot, XRMode xrMode, boolean p_use_32_bits,
|
||||
public GodotGLRenderView(Context context, Godot godot, XRMode xrMode, int p_depth_buffer_bits,
|
||||
boolean p_use_debug_opengl) {
|
||||
super(context);
|
||||
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;
|
||||
|
|
@ -209,18 +209,16 @@ public class GodotGLRenderView extends GLSurfaceView implements GodotRenderView
|
|||
* below.
|
||||
*/
|
||||
|
||||
if (GLUtils.use_32) {
|
||||
setEGLConfigChooser(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 {
|
||||
setEGLConfigChooser(translucent
|
||||
? new RegularConfigChooser(8, 8, 8, 8, 16, stencil)
|
||||
: new RegularConfigChooser(5, 6, 5, 0, 16, stencil));
|
||||
RegularConfigChooser configChooser =
|
||||
new RegularFallbackConfigChooser(8, 8, 8, 8, 16, stencil,
|
||||
new RegularConfigChooser(5, 6, 5, 0, 16, stencil));
|
||||
if (GLUtils.depth_buffer_bits >= 24) {
|
||||
configChooser = new RegularFallbackConfigChooser(8, 8, 8, 8, 24, stencil, configChooser);
|
||||
if (GLUtils.depth_buffer_bits >= 32) {
|
||||
configChooser = new RegularFallbackConfigChooser(8, 8, 8, 8, 32, stencil, configChooser);
|
||||
}
|
||||
}
|
||||
setEGLConfigChooser(configChooser);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,9 +75,8 @@ public class GodotLib {
|
|||
/**
|
||||
* Invoked on the render thread when the underlying Android surface is created or recreated.
|
||||
* @param p_surface
|
||||
* @param p_32_bits
|
||||
*/
|
||||
public static native void newcontext(Surface p_surface, boolean p_32_bits);
|
||||
public static native void newcontext(Surface p_surface);
|
||||
|
||||
/**
|
||||
* Forward {@link Activity#onBackPressed()} event from the main thread to the GL thread.
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class GodotRenderer implements GLSurfaceView.Renderer {
|
|||
}
|
||||
|
||||
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
|
||||
GodotLib.newcontext(null, GLUtils.use_32);
|
||||
GodotLib.newcontext(null);
|
||||
for (GodotPlugin plugin : pluginRegistry.getAllPlugins()) {
|
||||
plugin.onGLSurfaceCreated(gl, config);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class GLUtils {
|
|||
|
||||
public static final boolean DEBUG = 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[] {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ internal class VkRenderer {
|
|||
* Called when the surface is created and signals the beginning of rendering.
|
||||
*/
|
||||
fun onVkSurfaceCreated(surface: Surface) {
|
||||
GodotLib.newcontext(surface, false)
|
||||
GodotLib.newcontext(surface)
|
||||
|
||||
for (plugin in pluginRegistry.getAllPlugins()) {
|
||||
plugin.onVkSurfaceCreated(surface)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue