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
This commit is contained in:
@@ -43,6 +43,7 @@ int GPU_max_ubo_binds(void);
|
|||||||
int GPU_max_ubo_size(void);
|
int GPU_max_ubo_size(void);
|
||||||
float GPU_max_line_width(void);
|
float GPU_max_line_width(void);
|
||||||
void GPU_get_dfdy_factors(float fac[2]);
|
void GPU_get_dfdy_factors(float fac[2]);
|
||||||
|
bool GPU_arb_base_instance_is_supported(void);
|
||||||
bool GPU_mip_render_workaround(void);
|
bool GPU_mip_render_workaround(void);
|
||||||
bool GPU_depth_blitting_workaround(void);
|
bool GPU_depth_blitting_workaround(void);
|
||||||
bool GPU_unused_fb_slot_workaround(void);
|
bool GPU_unused_fb_slot_workaround(void);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "GPU_batch.h"
|
#include "GPU_batch.h"
|
||||||
#include "GPU_batch_presets.h"
|
#include "GPU_batch_presets.h"
|
||||||
|
#include "GPU_extensions.h"
|
||||||
#include "GPU_matrix.h"
|
#include "GPU_matrix.h"
|
||||||
#include "GPU_shader.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;
|
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 (i_first > 0 && i_count > 0) {
|
||||||
/* If using offset drawing with instancing, we must
|
/* If using offset drawing with instancing, we must
|
||||||
* use the default VAO and redo bindings. */
|
* 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
|
#endif
|
||||||
void *v_first_ofs = elem_offset(el, v_first);
|
void *v_first_ofs = elem_offset(el, v_first);
|
||||||
|
|
||||||
if (GLEW_ARB_base_instance) {
|
if (GPU_arb_base_instance_is_supported()) {
|
||||||
glDrawElementsInstancedBaseVertexBaseInstance(
|
glDrawElementsInstancedBaseVertexBaseInstance(
|
||||||
batch->gl_prim_type, v_count, index_type, v_first_ofs, i_count, base_index, i_first);
|
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__
|
#ifdef __APPLE__
|
||||||
glDisable(GL_PRIMITIVE_RESTART);
|
glDisable(GL_PRIMITIVE_RESTART);
|
||||||
#endif
|
#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);
|
glDrawArraysInstancedBaseInstance(batch->gl_prim_type, v_first, v_count, i_count, i_first);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ static struct GPUGlobal {
|
|||||||
* number is factor on screen and second is off-screen */
|
* number is factor on screen and second is off-screen */
|
||||||
float dfdyfactors[2];
|
float dfdyfactors[2];
|
||||||
float max_anisotropy;
|
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
|
/* Some Intel drivers have issues with using mips as framebuffer targets if
|
||||||
* GL_TEXTURE_MAX_LEVEL is higher than the target mip.
|
* GL_TEXTURE_MAX_LEVEL is higher than the target mip.
|
||||||
* We need a workaround in this cases. */
|
* 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);
|
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)
|
bool GPU_mip_render_workaround(void)
|
||||||
{
|
{
|
||||||
return GG.mip_render_workaround;
|
return GG.mip_render_workaround;
|
||||||
@@ -343,6 +351,7 @@ void gpu_extensions_init(void)
|
|||||||
GG.os = GPU_OS_UNIX;
|
GG.os = GPU_OS_UNIX;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GG.glew_arb_base_instance_is_supported = GLEW_ARB_base_instance;
|
||||||
gpu_detect_mip_render_workaround();
|
gpu_detect_mip_render_workaround();
|
||||||
|
|
||||||
if (G.debug & G_DEBUG_GPU_FORCE_WORKAROUNDS) {
|
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.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.4264") || strstr(version, "Build 10.18.14.4432") ||
|
||||||
strstr(version, "Build 10.18.14.5067")) {
|
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;
|
GG.context_local_shaders_workaround = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user