Browse Source

Fall back to glTexImage instead of glTexStorage on Radeon 3xxx drivers on Windows. Potentially works around a graphics driver bug which prevented text from showing up.

Alex Szpakowski 6 years ago
parent
commit
1c853cbcc3
2 changed files with 26 additions and 1 deletions
  1. 16 1
      src/modules/graphics/opengl/OpenGL.cpp
  2. 10 0
      src/modules/graphics/opengl/OpenGL.h

+ 16 - 1
src/modules/graphics/opengl/OpenGL.cpp

@@ -156,6 +156,18 @@ bool OpenGL::initContext()
 	}
 #endif
 
+#ifdef LOVE_WINDOWS
+	if (getVendor() == VENDOR_AMD)
+	{
+		// Radeon HD drivers switched from "ATI Radeon" to "AMD Radeon" around
+		// the 7000 series. We'll assume this bug doesn't affect those newer
+		// GPUs / drivers.
+		const char *device = (const char *) glGetString(GL_RENDERER);
+		if (strstr(device, "ATI Radeon HD "))
+			bugs.texStorageBreaksSubImage = true;
+	}
+#endif
+
 	contextInitialized = true;
 
 	return true;
@@ -282,7 +294,7 @@ void OpenGL::initVendor()
 
 	// http://feedback.wildfiregames.com/report/opengl/feature/GL_VENDOR
 	// http://stackoverflow.com/questions/2093594/opengl-extensions-available-on-different-android-devices
-	// http://opengl.gpuinfo.org/gl_stats_caps_single.php?listreportsbycap=GL_VENDOR
+	// https://opengl.gpuinfo.org/displaycapability.php?name=GL_VENDOR
 	if (strstr(vstr, "ATI Technologies") || strstr(vstr, "AMD") || strstr(vstr, "Advanced Micro Devices"))
 		vendor = VENDOR_AMD;
 	else if (strstr(vstr, "NVIDIA"))
@@ -1168,6 +1180,9 @@ bool OpenGL::isTexStorageSupported()
 		supportsTexStorage = true;
 #endif
 
+	if (gl.bugs.texStorageBreaksSubImage)
+		supportsTexStorage = false;
+
 	return supportsTexStorage;
 }
 

+ 10 - 0
src/modules/graphics/opengl/OpenGL.h

@@ -159,6 +159,16 @@ public:
 		 **/
 		bool clientWaitSyncStalls;
 
+		/**
+		 * glTexStorage on some older AMD/ATI graphics drivers on Windows seems
+		 * to break subsequent sub-rectangle glTexSubImage calls after an
+		 * initial full-size one (determined after some investigation with an
+		 * affected user on Discord.)
+		 * https://bitbucket.org/rude/love/issues/1436/bug-with-lovegraphicsprint-on-older-ati
+		 *
+		 **/
+		bool texStorageBreaksSubImage;
+
 		/**
 		 * Other bugs which have workarounds that don't use conditional code at
 		 * the moment: