Fix T45909: Garbage output in Viewport with OpenSubdiv device set to GLSL Compute

This isn't a Blender issue and the same bug happens with official OpenSubdiv
examples. For until it's either worked around from OpenSubdiv side or fixed
in the driver we'll force disable GLSL Compute for AMD hardware.
This commit is contained in:
Sergey Sharybin 2015-08-26 12:10:24 +02:00
parent bcc0d2fb1d
commit 6ca12d157f
Notes: blender-bot 2023-02-14 08:47:32 +01:00
Referenced by issue #46253, Pull in new version of OpenSubdiv and re-enable AMD GLSL Compute
Referenced by issue #45915, Can not select keys in Dope Sheet
Referenced by issue #45916, Edge Slide crashes if you press R
Referenced by issue #45909, Garbage output in Viewport with OpenSubdiv device set to GLSL Compute
Referenced by issue #45708, OSD Crash
1 changed files with 19 additions and 1 deletions

View File

@ -26,6 +26,7 @@
#include "opensubdiv_capi.h"
#include <cstring>
#include <GL/glew.h>
#ifdef _MSC_VER
@ -71,7 +72,24 @@ int openSubdiv_getAvailableEvaluators(void)
#endif /* OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK */
#ifdef OPENSUBDIV_HAS_GLSL_COMPUTE
flags |= OPENSUBDIV_EVALUATOR_GLSL_COMPUTE;
static bool vendor_checked = false;
static bool disable_glsl_compute = false;
/* Force disable GLSL Compute on AMD hardware because it has really
* hard time evaluating required shaders.
*/
if (!vendor_checked) {
const char *vendor = (const char *)glGetString(GL_VENDOR);
const char *renderer = (const char *)glGetString(GL_RENDERER);
if (strstr(vendor, "ATI") ||
strstr(renderer, "Mesa DRI R") ||
(strstr(renderer, "Gallium ") && strstr(renderer, " on ATI ")))
{
disable_glsl_compute = true;
}
}
if (!disable_glsl_compute) {
flags |= OPENSUBDIV_EVALUATOR_GLSL_COMPUTE;
}
#endif /* OPENSUBDIV_HAS_GLSL_COMPUTE */
return flags;