diff options
-rw-r--r-- | source/blender/draw/modes/shaders/common_view_lib.glsl | 7 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.c | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/draw/modes/shaders/common_view_lib.glsl b/source/blender/draw/modes/shaders/common_view_lib.glsl index e669eb9d39a..fa4bb4f68c0 100644 --- a/source/blender/draw/modes/shaders/common_view_lib.glsl +++ b/source/blender/draw/modes/shaders/common_view_lib.glsl @@ -36,6 +36,11 @@ uniform int baseInstance; # ifdef IN_PLACE_INSTANCES /* When drawing instances of an object at the same position. */ # define instanceId 0 +# elif defined(GPU_DEPRECATED_AMD_DRIVER) +/* A driver bug make it so that when using an attribute with GL_INT_2_10_10_10_REV as format, + * the gl_InstanceID is incremented by the 2 bit component of the attrib. + * Ignore gl_InstanceID then. */ +# define instanceId 0 # else # define instanceId gl_InstanceID # endif @@ -66,7 +71,7 @@ flat in int resourceIDFrag; # define resource_id resourceIDFrag #endif -#ifndef GPU_INTEL +#if !defined(GPU_INTEL) && !defined(GPU_DEPRECATED_AMD_DRIVER) struct ObjectMatrices { mat4 drw_modelMatrix; mat4 drw_modelMatrixInverse; diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index f896848648c..015df078228 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -258,6 +258,9 @@ static void gpu_shader_standard_defines(char defines[MAX_DEFINE_LENGTH]) /* some useful defines to detect GPU type */ if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) { strcat(defines, "#define GPU_ATI\n"); + if (GPU_crappy_amd_driver()) { + strcat(defines, "#define GPU_DEPRECATED_AMD_DRIVER\n"); + } } else if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY)) { strcat(defines, "#define GPU_NVIDIA\n"); |