--- a/src/MacSrc/OpenGL.cc +++ b/src/MacSrc/OpenGL.cc @@ -455,10 +455,30 @@ #ifndef __ANDROID__ // See opengl_resize()'s comment above. SDL_GL_MakeCurrent(window, context); -#endif // Done rendering to the frame buffer, reset back to normal BindFrameBuffer(nullptr); +#else + // BindFrameBuffer(nullptr) (glBindFramebuffer/glBindRenderbuffer to id + // 0) means "the real window surface" - on desktop that's SDL's actual + // GL window, but this app's real presentation target is never that + // SDLSurface's own EGL surface at all - it's the OpenXR swapchain's + // per-image FBOs, set up separately in xr_swapchain.c. Whatever + // framebuffer/renderbuffer 0 actually resolves to for gl4es in this + // configuration, binding it here reliably left gl4es reporting a + // persistent GL_INVALID_OPERATION (1282) - confirmed by bisecting + // through this whole render path with per-call checkpoints, all clean + // right up until "after opengl_end_frame", the one immediately after + // this exact call. + // + // The bind is also functionally dead on Android regardless of that: + // by the time anything next draws, Shock.c's SDLDraw() has already + // run xr_frame_begin() -> xr_swapchain_acquire(), which rebinds to + // that frame's real swapchain FBO before opengl_swap_and_restore() + // (the only thing that draws before the next opengl_start_frame()'s + // own BindFrameBuffer(&backupBuffer)) runs - so skipping it changes + // nothing about what actually gets rendered where. +#endif palette_dirty = false; }