You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Fall back to GLES2 if GLES3 is not working
This adds a static is_viable() method to all rasterizers which has to be called before initializing the rasterizer. This allows us to check what rasterizer to use in OS::initialize together with the GL context initialization. This commit also adds a new project setting "rendering/quality/driver/driver_fallback" which allows the creator of a project to specify whether or not fallback to GLES2 is allowed. This setting is ignored for the editor so the editor will always open even if the project itself cannot run. This will hopefully reduce confusion for users downloading projects from the internet. We also no longer crash when GLES3 is not functioning on a platform. This fixes #15324
This commit is contained in:
@@ -108,28 +108,24 @@ Error ContextGL_Win::initialize() {
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
if (!hDC) {
|
||||
MessageBox(NULL, "Can't Create A GL Device Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
return ERR_CANT_CREATE; // Return FALSE
|
||||
}
|
||||
|
||||
pixel_format = ChoosePixelFormat(hDC, &pfd);
|
||||
if (!pixel_format) // Did Windows Find A Matching Pixel Format?
|
||||
{
|
||||
MessageBox(NULL, "Can't Find A Suitable pixel_format.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
return ERR_CANT_CREATE; // Return FALSE
|
||||
}
|
||||
|
||||
BOOL ret = SetPixelFormat(hDC, pixel_format, &pfd);
|
||||
if (!ret) // Are We Able To Set The Pixel Format?
|
||||
{
|
||||
MessageBox(NULL, "Can't Set The pixel_format.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
return ERR_CANT_CREATE; // Return FALSE
|
||||
}
|
||||
|
||||
hRC = wglCreateContext(hDC);
|
||||
if (!hRC) // Are We Able To Get A Rendering Context?
|
||||
{
|
||||
MessageBox(NULL, "Can't Create A Temporary GL Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
return ERR_CANT_CREATE; // Return FALSE
|
||||
}
|
||||
|
||||
@@ -151,7 +147,6 @@ Error ContextGL_Win::initialize() {
|
||||
|
||||
if (wglCreateContextAttribsARB == NULL) //OpenGL 3.0 is not supported
|
||||
{
|
||||
MessageBox(NULL, "Cannot get Proc Address for CreateContextAttribs", "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
wglDeleteContext(hRC);
|
||||
return ERR_CANT_CREATE;
|
||||
}
|
||||
@@ -159,7 +154,6 @@ Error ContextGL_Win::initialize() {
|
||||
HGLRC new_hRC = wglCreateContextAttribsARB(hDC, 0, attribs);
|
||||
if (!new_hRC) {
|
||||
wglDeleteContext(hRC);
|
||||
MessageBox(NULL, "Can't Create An OpenGL 3.3 Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
return ERR_CANT_CREATE; // Return false
|
||||
}
|
||||
wglMakeCurrent(hDC, NULL);
|
||||
@@ -168,7 +162,6 @@ Error ContextGL_Win::initialize() {
|
||||
|
||||
if (!wglMakeCurrent(hDC, hRC)) // Try To Activate The Rendering Context
|
||||
{
|
||||
MessageBox(NULL, "Can't Activate The GL 3.3 Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
|
||||
return ERR_CANT_CREATE; // Return FALSE
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user