mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
OpenGL: Drop the dead Intel dual-source check, fix the ES3 init fallback
The Intel workaround sscanf'd "Build %d.%d.%d.%d" against glGetString(GL_VERSION), which reads like "4.5.0 - Build 26.20.100.7870" - sscanf literals have to match from the start, so it never returned 4 and HasIntelDualSrcBug was never consulted. It's been inert since it was written, and the drivers it targeted are long gone. Removing it orphaned the two helpers, so those go too. Separately, when gl3stubInit() fails we left ver[0] at 3 while clearing GLES3. Extension enumeration keys off the version, not the flag, so it went on to call glGetStringi - one of the very entry points whose absence makes gl3stubInit() fail. Drop back to 2.0 on that path, like the branch above it already does, and null-check what glGetStringi hands back. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vd8ntC2brCUtCrDJMqLbs8
This commit is contained in:
1 parent
14ce62af9e
commit
2b9d556772
2 files changed
+10
-31
No files matched your search
@@ -306,6 +306,13 @@ bool CheckGLExtensions() {
|
||||
// Otherwise, let's trust GL_MAJOR_VERSION. Note that Mali is intentionally not banned here.
|
||||
if (gl_extensions.ver[0] >= 3) {
|
||||
gl_extensions.GLES3 = gl3stubInit();
|
||||
if (!gl_extensions.GLES3) {
|
||||
// We failed to load the ES3 entry points, so we can't use any of them - including
|
||||
// glGetStringi below, which is one of the ones gl3stubInit() checks for. Drop back
|
||||
// to 2.0 so nothing downstream keys off the version and calls into a null pointer.
|
||||
gl_extensions.ver[0] = 2;
|
||||
gl_extensions.ver[1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -331,6 +338,9 @@ bool CheckGLExtensions() {
|
||||
g_set_gl_extensions.clear();
|
||||
for (GLint i = 0; i < numExtensions; ++i) {
|
||||
const char *ext = (const char *)glGetStringi(GL_EXTENSIONS, i);
|
||||
if (!ext) {
|
||||
continue;
|
||||
}
|
||||
g_set_gl_extensions.insert(ext);
|
||||
g_all_gl_extensions += ext;
|
||||
g_all_gl_extensions += " ";
|
||||
|
||||
@@ -534,26 +534,6 @@ private:
|
||||
PresentMode requestedPresentMode_{};
|
||||
};
|
||||
|
||||
static constexpr int MakeIntelSimpleVer(int v1, int v2, int v3) {
|
||||
return (v1 << 16) | (v2 << 8) | v3;
|
||||
}
|
||||
|
||||
static bool HasIntelDualSrcBug(const int versions[4]) {
|
||||
// Intel uses a confusing set of at least 3 version numbering schemes. This is the one given to OpenGL.
|
||||
switch (MakeIntelSimpleVer(versions[0], versions[1], versions[2])) {
|
||||
case MakeIntelSimpleVer(9, 17, 10):
|
||||
case MakeIntelSimpleVer(9, 18, 10):
|
||||
return false;
|
||||
case MakeIntelSimpleVer(10, 18, 10):
|
||||
return versions[3] < 4061;
|
||||
case MakeIntelSimpleVer(10, 18, 14):
|
||||
return versions[3] < 4080;
|
||||
default:
|
||||
// Older than above didn't support dual src anyway, newer should have the fix.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
OpenGLContext::OpenGLContext(bool canChangeSwapInterval) : renderManager_(frameTimeHistory_) {
|
||||
if (gl_extensions.IsGLES) {
|
||||
if (gl_extensions.OES_packed_depth_stencil || gl_extensions.OES_depth24) {
|
||||
@@ -647,17 +627,6 @@ OpenGLContext::OpenGLContext(bool canChangeSwapInterval) : renderManager_(frameT
|
||||
if (!gl_extensions.VersionGEThan(3, 0, 0)) {
|
||||
// Don't use this extension on sub 3.0 OpenGL versions as it does not seem reliable.
|
||||
bugs_.Infest(Bugs::DUAL_SOURCE_BLENDING_BROKEN);
|
||||
} else if (caps_.vendor == GPUVendor::VENDOR_INTEL) {
|
||||
// Note: this is for Intel drivers with GL3+.
|
||||
// Also on Intel, see https://github.com/hrydgard/ppsspp/issues/10117
|
||||
// TODO: Remove entirely sometime reasonably far in driver years after 2015.
|
||||
const std::string ver = OpenGLContext::GetInfoString(Draw::InfoField::APIVERSION);
|
||||
int versions[4]{};
|
||||
if (sscanf(ver.c_str(), "Build %d.%d.%d.%d", &versions[0], &versions[1], &versions[2], &versions[3]) == 4) {
|
||||
if (HasIntelDualSrcBug(versions)) {
|
||||
bugs_.Infest(Bugs::DUAL_SOURCE_BLENDING_BROKEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if PPSSPP_ARCH(ARMV7)
|
||||
|
||||
Reference in new issue
Block a user