e0a2e1f4bf
build / build (push) Successful in 2m44s
- opengl_end_frame() bound framebuffer 0 on Android, which has no valid target there (real presentation goes through the OpenXR swapchain's own FBOs) - gl4es reported this every frame. Skip it there. - render_hack_cameras() re-entered opengl_start_frame()/opengl_end_frame() for camera-monitor renders that never touch the GL screen; excluded them to match use_opengl()'s existing behavior. Also drains a stray error left by xrPollEvent(). - ChangeScreenSize() never called opengl_resize() on Android, freezing the 3D render target at launch size after an in-game resolution change; and xr_get_game_resolution() used the swapchain's fixed size instead of the current screen resolution, misplacing the laser-pointer cursor after such a change. - Removes all temporary bisection diagnostics added while tracking down the GL_INVALID_OPERATION source.
69 lines
3.0 KiB
Diff
69 lines
3.0 KiB
Diff
--- a/src/MacSrc/ShockBitmap.c
|
|
+++ b/src/MacSrc/ShockBitmap.c
|
|
@@ -27,6 +27,9 @@
|
|
#include "Shock.h"
|
|
#include "ShockBitmap.h"
|
|
#include "2d.h"
|
|
+#ifdef __ANDROID__
|
|
+#include "OpenGL.h"
|
|
+#endif
|
|
|
|
//--------------------
|
|
// Globals
|
|
@@ -42,11 +45,26 @@
|
|
|
|
SDL_RenderClear(renderer);
|
|
|
|
+#ifndef __ANDROID__
|
|
+ // On Android there's exactly one OS-controlled-size surface - no
|
|
+ // desktop-style window to resize, move, or toggle fullscreen on.
|
|
+ // SDL_SetWindowSize() still "succeeds" there (Android has no
|
|
+ // SetWindowSize driver hook, so SDL's generic layer just overwrites its
|
|
+ // own cached window->w/h to the requested game resolution, e.g.
|
|
+ // 640x480, and synthesizes a resize event from that) - which desyncs
|
|
+ // SDL's own notion of the window size from the real, unchanged Android
|
|
+ // surface size (e.g. 1600x1200), and that desync is exactly what then
|
|
+ // makes both SDL's internal renderer viewport and this engine's own
|
|
+ // custom GL viewport (OpenGL.cc's opengl_resize(), driven by that same
|
|
+ // now-wrong cached size) shrink to the game's resolution instead of
|
|
+ // filling the real surface. Skip the desktop-only calls on Android
|
|
+ // entirely, leaving SDL's window-size bookkeeping untouched.
|
|
extern bool fullscreenActive;
|
|
SDL_SetWindowFullscreen(window, fullscreenActive ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
|
|
|
SDL_SetWindowSize(window, width, height);
|
|
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
|
+#endif
|
|
|
|
SDL_RenderSetLogicalSize(renderer, width, height);
|
|
|
|
@@ -54,6 +72,28 @@
|
|
|
|
gScreenWide = width;
|
|
gScreenHigh = height;
|
|
+
|
|
+#ifdef __ANDROID__
|
|
+ // Skipping SDL_SetWindowSize() above (see the comment for why) also
|
|
+ // means no native resize event ever fires on Android when the in-game
|
|
+ // resolution changes - opengl_resize() (OpenGL.cc) only ever runs from
|
|
+ // that event (see sdl_events.c) or once at OpenGL init, and it's what
|
|
+ // (re)creates backupBuffer, the offscreen 3D-view render target, sized
|
|
+ // to the logical resolution just changed above. Without this, it stays
|
|
+ // stuck at whatever size it was at launch while the rest of the game
|
|
+ // (drawSurface/gScreenWide/gScreenHigh, just updated above) moves on to
|
|
+ // the new resolution - the actual cause of the display breaking and
|
|
+ // becoming unresponsive to further input after changing resolution
|
|
+ // in-game. Call it directly instead - after gScreenWide/gScreenHigh
|
|
+ // update above, same as the desktop resize event (delivered via
|
|
+ // SDL_PollEvent(), so always processed after this function has already
|
|
+ // returned) - using the same physical window size init_opengl() itself
|
|
+ // used (SDL_GetWindowSize()); that never changes on Android, only the
|
|
+ // logical size set above does.
|
|
+ int physWidth, physHeight;
|
|
+ SDL_GetWindowSize(window, &physWidth, &physHeight);
|
|
+ opengl_resize(physWidth, physHeight);
|
|
+#endif
|
|
}
|
|
|
|
//------------------------------------------------------------------------------------
|