Android: Support old devices whose GPUs only support a 16 bit depth buffer (Thanks popdymc)

This commit is contained in:
UnknownShadow200 2022-06-04 11:55:29 +10:00
parent a2dfd26bbd
commit 4e12d1ba45
2 changed files with 8 additions and 2 deletions

View File

@ -1383,6 +1383,7 @@ cc_result Cw_Save(struct Stream* stream) {
cur = Nbt_WriteUInt16(cur, "Y", World.Height);
cur = Nbt_WriteUInt16(cur, "Z", World.Length);
/* TODO: Maybe keep real spawn too? */
cur = Nbt_WriteDict(cur, "Spawn");
{
cur = Nbt_WriteUInt16(cur, "X", (cc_uint16)p->Base.Position.X);

View File

@ -146,7 +146,7 @@ void GLContext_Create(void) {
#else
static EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 1, EGL_NONE };
#endif
static EGLint attribs[19] = {
static EGLint attribs[] = {
EGL_RED_SIZE, 0, EGL_GREEN_SIZE, 0,
EGL_BLUE_SIZE, 0, EGL_ALPHA_SIZE, 0,
EGL_DEPTH_SIZE, GLCONTEXT_DEFAULT_DEPTH,
@ -174,9 +174,14 @@ void GLContext_Create(void) {
eglBindAPI(EGL_OPENGL_ES_API);
eglChooseConfig(ctx_display, attribs, &ctx_config, 1, &ctx_numConfig);
if (!ctx_config) {
attribs[9] = 16; // some older devices only support 16 bit depth buffer
eglChooseConfig(ctx_display, attribs, &ctx_config, 1, &ctx_numConfig);
}
if (!ctx_config) Window_ShowDialog("Warning", "Failed to choose EGL config, ClassiCube may be unable to start");
ctx_context = eglCreateContext(ctx_display, ctx_config, EGL_NO_CONTEXT, context_attribs);
if (!ctx_context) Logger_Abort2(eglGetError(), "Failed to create EGL context");
GLContext_InitSurface();
}