首页 > 解决方案 > 关闭 Activity 会导致 monogame 的表面缓冲区错误

问题描述

我有一个单人游戏,我要从中启动一项活动以登录。游戏运行良好。当我启动该活动时,它也运行良好,并且游戏循环似乎被阻止了。当我完成()活动或执行 OnBackPressed()时,真正的问题出现了。我得到表面缓冲区错误,屏幕变黑但游戏循环恢复。如果我尝试在模拟器中关闭主机 GPU,则应用程序将在关闭活动时崩溃。

When activity opens:
[EGL_emulation] tid 18496: eglSurfaceAttrib(1210): error 0x3009 (EGL_BAD_MATCH)
[OpenGLRenderer] Failed to set EGL_SWAP_BEHAVIOR on surface 0x81448da0, error=EGL_BAD_MATCH


When back pressed in activity or calling Finish():
[EGL_emulation] eglMakeCurrent: 0xa4805a80: ver 2 0 (tinfo 0x82aff0b0)
[EGL_emulation] tid 18496: eglSurfaceAttrib(1210): error 0x3009 (EGL_BAD_MATCH)
[OpenGLRenderer] Failed to set EGL_SWAP_BEHAVIOR on surface 0x81456b00, error=EGL_BAD_MATCH
[EGL_emulation] eglMakeCurrent: 0xa4805a80: ver 2 0 (tinfo 0x82aff0b0)
[Surface] getSlotFromBufferLocked: unknown buffer: 0x0
[EGL_emulation] tid 18458: swapBuffers(531): error 0x300d (EGL_BAD_SURFACE)
[IInputConnectionWrapper] finishComposingText on inactive InputConnection
[EGL_emulation] egl_window_surface_t::swapBuffers called with NULL buffer
[EGL_emulation] tid 18458: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[EGL_emulation] egl_window_surface_t::swapBuffers called with NULL buffer
[EGL_emulation] tid 18458: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[EGL_emulation] egl_window_surface_t::swapBuffers called with NULL buffer
[EGL_emulation] tid 18458: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[EGL_emulation] egl_window_surface_t::swapBuffers called with NULL buffer
[EGL_emulation] tid 18458: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)
[EGL_emulation] egl_window_surface_t::swapBuffers called with NULL buffer
[EGL_emulation] tid 18458: swapBuffers(498): error 0x300d (EGL_BAD_SURFACE)

Without using host gpu it crashes with:
[Surface] getSlotFromBufferLocked: unknown buffer: 0x7a697320

标签: androidxamarin.androidmonogame

解决方案


不幸的是,我最终不得不在 monogame 中创建自己的软键盘,因此不再启动任何 android 活动。


推荐阅读