Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2022-04-13 08:38:52 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2022-04-13 16:51:51 +0300
commit9c09e5ba242fffc4906d86ce111def89e481c048 (patch)
tree2f2b9bbfd908a920097a2a48fd5d30a745e0a4a7
parente22fd7247adc4ce6de5eb7b4275b91116177109a (diff)
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
-rw-r--r--source/blender/draw/intern/draw_cache_impl_subdivision.cc4
-rw-r--r--source/blender/editors/interface/interface_icons.c4
-rw-r--r--source/blender/python/gpu/gpu_py_shader.c9
3 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
index 2653035a39f..e0ec0e64ea2 100644
--- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc
+++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
@@ -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);
}
/** \} */
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index e3bf1a48907..332b9b44b0a 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -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);
diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
index cdcf22df7a1..9fe4bdcbaa0 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -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;
}