Haiku: Fix crash when exiting game

Also use legacy render mode when running under llvmpipe to reduce disappearing water/bedrock outside map into fog
This commit is contained in:
UnknownShadow200 2024-03-20 07:02:31 +11:00
parent 2ab73f7d6c
commit e08a26481c
2 changed files with 26 additions and 11 deletions

View File

@ -590,23 +590,27 @@ static void Gfx_RestoreState(void) {
cc_bool Gfx_WarnIfNecessary(void) {
cc_string renderer = String_FromReadonly((const char*)glGetString(GL_RENDERER));
if (String_ContainsConst(&renderer, "llvmpipe")) {
Chat_AddRaw("&cSoftware rendering is being used, performance will greatly suffer.");
}
#ifdef CC_BUILD_GL11
Chat_AddRaw("&cYou are using the very outdated OpenGL backend.");
Chat_AddRaw("&cAs such you may experience poor performance.");
Chat_AddRaw("&cIt is likely you need to install video card drivers.");
#endif
if (!String_ContainsConst(&renderer, "Intel")) return false;
Chat_AddRaw("&cIntel graphics cards are known to have issues with the OpenGL build.");
Chat_AddRaw("&cVSync may not work, and you may see disappearing clouds and map edges.");
#ifdef CC_BUILD_WIN
Chat_AddRaw("&cTry downloading the Direct3D 9 build instead.");
#endif
return true;
if (String_ContainsConst(&renderer, "llvmpipe")) {
Chat_AddRaw("&cSoftware rendering is being used, performance will greatly suffer.");
Chat_AddRaw("&cVSync may not work, and you may see disappearing clouds and map edges.");
return true;
}
if (String_ContainsConst(&renderer, "Intel")) {
Chat_AddRaw("&cIntel graphics cards are known to have issues with the OpenGL build.");
Chat_AddRaw("&cVSync may not work, and you may see disappearing clouds and map edges.");
#ifdef CC_BUILD_WIN
Chat_AddRaw("&cTry downloading the Direct3D 9 build instead.");
#endif
return true;
}
return false;
}

View File

@ -243,6 +243,17 @@ class CC_BWindow : public BWindow
public:
CC_BWindow(BRect frame) : BWindow(frame, "", B_TITLED_WINDOW, 0) { }
void DispatchMessage(BMessage* msg, BHandler* handler);
virtual ~CC_BWindow() {
if (!view_3D) return;
// Fixes OpenGL related crashes on exit since Mesa 21
// Calling RemoveChild seems to fix the crash as per https://dev.haiku-os.org/ticket/16840
// "Some OpenGL applications like GLInfo crash on exit under Mesa 21"
this->Lock();
this->RemoveChild(view_3D);
this->Unlock();
}
};
static void ProcessKeyInput(BMessage* msg) {