diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-07-31 22:35:06 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-07-31 22:36:18 +0300 |
commit | d8fb63661b3218e536f548e763675a08221e18cd (patch) | |
tree | d47dd711b72180345811457f243f0877905b2415 /source/blender | |
parent | ea3690e32974005c6ccb871f4e2f49471ad837ab (diff) |
Fix T67951: Bone selection is broken on some Intel GPUs
The problem is that the `glDrawArraysInstancedBaseInstance` is ignoring the last parameter.
The solution is to indicate that `GLEW_ARB_base_instance` is not supported in these cases.
Reviewers: fclem, brecht, jbakker
Reviewed By: fclem, brecht
Differential Revision: https://developer.blender.org/D5383
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/gpu/GPU_extensions.h | 1 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_batch.c | 7 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 12 |
3 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index d0abf671fcd..023cbb804d9 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -43,6 +43,7 @@ int GPU_max_ubo_binds(void); int GPU_max_ubo_size(void); float GPU_max_line_width(void); void GPU_get_dfdy_factors(float fac[2]); +bool GPU_arb_base_instance_is_supported(void); bool GPU_mip_render_workaround(void); bool GPU_depth_blitting_workaround(void); bool GPU_unused_fb_slot_workaround(void); diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c index ba3c7f68518..11b487f7be4 100644 --- a/source/blender/gpu/intern/gpu_batch.c +++ b/source/blender/gpu/intern/gpu_batch.c @@ -28,6 +28,7 @@ #include "GPU_batch.h" #include "GPU_batch_presets.h" +#include "GPU_extensions.h" #include "GPU_matrix.h" #include "GPU_shader.h" @@ -599,7 +600,7 @@ void GPU_batch_draw_advanced(GPUBatch *batch, int v_first, int v_count, int i_fi i_count = (batch->inst) ? batch->inst->vertex_len : 1; } - if (!GLEW_ARB_base_instance) { + if (!GPU_arb_base_instance_is_supported()) { if (i_first > 0 && i_count > 0) { /* If using offset drawing with instancing, we must * use the default VAO and redo bindings. */ @@ -624,7 +625,7 @@ void GPU_batch_draw_advanced(GPUBatch *batch, int v_first, int v_count, int i_fi #endif void *v_first_ofs = elem_offset(el, v_first); - if (GLEW_ARB_base_instance) { + if (GPU_arb_base_instance_is_supported()) { glDrawElementsInstancedBaseVertexBaseInstance( batch->gl_prim_type, v_count, index_type, v_first_ofs, i_count, base_index, i_first); } @@ -637,7 +638,7 @@ void GPU_batch_draw_advanced(GPUBatch *batch, int v_first, int v_count, int i_fi #ifdef __APPLE__ glDisable(GL_PRIMITIVE_RESTART); #endif - if (GLEW_ARB_base_instance) { + if (GPU_arb_base_instance_is_supported()) { glDrawArraysInstancedBaseInstance(batch->gl_prim_type, v_first, v_count, i_count, i_first); } else { diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index ba5cf214a42..61f7ba6da7c 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -77,6 +77,9 @@ static struct GPUGlobal { * number is factor on screen and second is off-screen */ float dfdyfactors[2]; float max_anisotropy; + /* Some Intel drivers have limited support for `GLEW_ARB_base_instance` so in + * these cases it is best to indicate that it is not supported. See T67951 */ + bool glew_arb_base_instance_is_supported; /* Some Intel drivers have issues with using mips as framebuffer targets if * GL_TEXTURE_MAX_LEVEL is higher than the target mip. * We need a workaround in this cases. */ @@ -197,6 +200,11 @@ void GPU_get_dfdy_factors(float fac[2]) copy_v2_v2(fac, GG.dfdyfactors); } +bool GPU_arb_base_instance_is_supported(void) +{ + return GG.glew_arb_base_instance_is_supported; +} + bool GPU_mip_render_workaround(void) { return GG.mip_render_workaround; @@ -343,6 +351,7 @@ void gpu_extensions_init(void) GG.os = GPU_OS_UNIX; #endif + GG.glew_arb_base_instance_is_supported = GLEW_ARB_base_instance; gpu_detect_mip_render_workaround(); if (G.debug & G_DEBUG_GPU_FORCE_WORKAROUNDS) { @@ -383,6 +392,9 @@ void gpu_extensions_init(void) strstr(version, "Build 10.18.10.4653") || strstr(version, "Build 10.18.10.5069") || strstr(version, "Build 10.18.14.4264") || strstr(version, "Build 10.18.14.4432") || strstr(version, "Build 10.18.14.5067")) { + /* Maybe not all of these drivers have problems with `GLEW_ARB_base_instance`. + * But it's hard to test each case. */ + GG.glew_arb_base_instance_is_supported = false; GG.context_local_shaders_workaround = true; } } |