Fix #144174: DRW: Base instance workaround not working
The part of the workaround that was inside the gpu module was not updated. Candidate for backporting to 4.5 LTS. Pull Request: https://projects.blender.org/blender/blender/pulls/144346
This commit is contained in:
committed by
Clément Foucault
parent
92b555452b
commit
ca57cf0750
@@ -25,7 +25,7 @@ uint drw_resource_id_raw()
|
||||
#if defined(GPU_VERTEX_SHADER)
|
||||
# if defined(RESOURCE_ID_FALLBACK)
|
||||
# ifdef WITH_CUSTOM_IDS
|
||||
uint id = in_resource_id.x;
|
||||
uint id = in_resource_id_custom_id.x;
|
||||
# else
|
||||
uint id = in_resource_id;
|
||||
# endif
|
||||
@@ -54,7 +54,7 @@ uint drw_custom_id()
|
||||
#ifdef WITH_CUSTOM_IDS
|
||||
# if defined(GPU_VERTEX_SHADER)
|
||||
# if defined(RESOURCE_ID_FALLBACK)
|
||||
return in_resource_id.y;
|
||||
return in_resource_id_custom_id.y;
|
||||
# else
|
||||
uint inst_id = gpu_BaseInstance + gl_InstanceID;
|
||||
return resource_id_buf[gpu_BaseInstance + gl_InstanceID].y;
|
||||
|
||||
@@ -59,7 +59,7 @@ GPU_SHADER_CREATE_END()
|
||||
GPU_SHADER_CREATE_INFO(draw_resource_with_custom_id_fallback)
|
||||
DEFINE("RESOURCE_ID_FALLBACK")
|
||||
DEFINE("WITH_CUSTOM_IDS")
|
||||
VERTEX_IN(15, uint2, in_resource_id)
|
||||
VERTEX_IN(15, uint2, in_resource_id_custom_id)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -107,11 +107,11 @@ void GLVertArray::update_bindings(const GLuint vao,
|
||||
}
|
||||
|
||||
if (batch->resource_id_buf) {
|
||||
const ShaderInput *input = interface->attr_get("drw_ResourceID");
|
||||
const ShaderInput *input = interface->attr_get("in_resource_id");
|
||||
int component_len = 1;
|
||||
if (input == nullptr) {
|
||||
/* Uses Custom IDs */
|
||||
input = interface->attr_get("vertex_in_drw_ResourceID");
|
||||
input = interface->attr_get("in_resource_id_custom_id");
|
||||
component_len = 2;
|
||||
}
|
||||
if (input) {
|
||||
@@ -119,7 +119,7 @@ void GLVertArray::update_bindings(const GLuint vao,
|
||||
glEnableVertexAttribArray(input->location);
|
||||
glVertexAttribDivisor(input->location, 1);
|
||||
glVertexAttribIPointer(
|
||||
input->location, component_len, to_gl(GPU_COMP_I32), 0, (GLvoid *)nullptr);
|
||||
input->location, component_len, to_gl(GPU_COMP_U32), 0, (GLvoid *)nullptr);
|
||||
attr_mask &= ~(1 << input->location);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user