Fix some usages of 'GPU_shader_get_uniform_block'
`GPU_shader_get_uniform_block` is marked as deprecated and the value returned does not match what `GPU_uniformbuf_bind` expects. Also, small typo fix in python error message. Differential Revision: https://developer.blender.org/D14638
This commit is contained in:
parent
e22fd7247a
commit
9c09e5ba24
|
@ -1162,8 +1162,8 @@ static void draw_subdiv_ubo_update_and_bind(const DRWSubdivCache *cache,
|
|||
|
||||
GPU_uniformbuf_update(cache->ubo, &storage);
|
||||
|
||||
const int location = GPU_shader_get_uniform_block(shader, "shader_data");
|
||||
GPU_uniformbuf_bind(cache->ubo, location);
|
||||
const int binding = GPU_shader_get_uniform_block_binding(shader, "shader_data");
|
||||
GPU_uniformbuf_bind(cache->ubo, binding);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -1584,10 +1584,10 @@ static void icon_draw_cache_texture_flush_ex(GPUTexture *texture,
|
|||
GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR);
|
||||
GPU_shader_bind(shader);
|
||||
|
||||
const int data_loc = GPU_shader_get_uniform_block(shader, "multi_rect_data");
|
||||
const int data_binding = GPU_shader_get_uniform_block_binding(shader, "multi_rect_data");
|
||||
GPUUniformBuf *ubo = GPU_uniformbuf_create_ex(
|
||||
sizeof(struct MultiRectCallData), texture_draw_calls->drawcall_cache, __func__);
|
||||
GPU_uniformbuf_bind(ubo, data_loc);
|
||||
GPU_uniformbuf_bind(ubo, data_binding);
|
||||
|
||||
const int img_binding = GPU_shader_get_texture_binding(shader, "image");
|
||||
GPU_texture_bind_ex(texture, GPU_SAMPLER_ICON, img_binding, false);
|
||||
|
|
|
@ -537,16 +537,15 @@ static PyObject *pygpu_shader_uniform_block(BPyGPUShader *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int slot = GPU_shader_get_uniform_block(self->shader, name);
|
||||
if (slot == -1) {
|
||||
int binding = GPU_shader_get_uniform_block_binding(self->shader, name);
|
||||
if (binding == -1) {
|
||||
PyErr_SetString(
|
||||
PyExc_BufferError,
|
||||
"GPUShader.uniform_buffer: uniform block not found, make sure the name is correct");
|
||||
"GPUShader.uniform_block: uniform block not found, make sure the name is correct");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GPU_uniformbuf_bind(py_ubo->ubo, slot);
|
||||
GPU_shader_uniform_1i(self->shader, name, slot);
|
||||
GPU_uniformbuf_bind(py_ubo->ubo, binding);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue