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:
2022-04-13 02:38:52 -03:00
parent e22fd7247a
commit 9c09e5ba24
3 changed files with 8 additions and 9 deletions

View File

@@ -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;
}