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-09-19 15:39:48 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2022-09-19 15:40:20 +0300
commit2ce8b01c597c232d165ef2c004e3cd8d9db22cbf (patch)
treed027df183b9de31836b3bee235173fc505cc8615 /source/blender/python/gpu/gpu_py_shader.c
parent2fffd7d7a85d9e35d4f2b6e0de15504178b26e07 (diff)
PyGPU: call 'GPU_shader_bind' in 'GPUShader.uniform_' methods
This simplifies python code. When we call a method like shader.uniform_float("color", (1,1,1,1)), we expect the shader's uniform to be updated regardless of whether the shader is bound or not. And `batch.draw()` already calls `GPU_shader_bind` inside. Differential Revision: https://developer.blender.org/D15929
Diffstat (limited to 'source/blender/python/gpu/gpu_py_shader.c')
-rw-r--r--source/blender/python/gpu/gpu_py_shader.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
index 9bac23fd7e7..43b50dbbef0 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -270,6 +270,7 @@ static PyObject *pygpu_shader_uniform_vector_float(BPyGPUShader *self, PyObject
return NULL;
}
+ GPU_shader_bind(self->shader);
GPU_shader_uniform_vector(self->shader, location, length, count, pybuffer.buf);
PyBuffer_Release(&pybuffer);
@@ -292,6 +293,7 @@ static PyObject *pygpu_shader_uniform_vector_int(BPyGPUShader *self, PyObject *a
return NULL;
}
+ GPU_shader_bind(self->shader);
GPU_shader_uniform_vector_int(self->shader, location, length, count, pybuffer.buf);
PyBuffer_Release(&pybuffer);
@@ -359,6 +361,7 @@ static PyObject *pygpu_shader_uniform_bool(BPyGPUShader *self, PyObject *args)
return NULL;
}
+ GPU_shader_bind(self->shader);
GPU_shader_uniform_vector_int(self->shader, location, length, 1, values);
Py_RETURN_NONE;
@@ -428,6 +431,7 @@ static PyObject *pygpu_shader_uniform_float(BPyGPUShader *self, PyObject *args)
return NULL;
}
+ GPU_shader_bind(self->shader);
GPU_shader_uniform_vector(self->shader, location, length, 1, values);
Py_RETURN_NONE;
@@ -499,6 +503,7 @@ static PyObject *pygpu_shader_uniform_int(BPyGPUShader *self, PyObject *args)
return NULL;
}
+ GPU_shader_bind(self->shader);
GPU_shader_uniform_vector_int(self->shader, location, length, 1, values);
Py_RETURN_NONE;
@@ -522,6 +527,7 @@ static PyObject *pygpu_shader_uniform_sampler(BPyGPUShader *self, PyObject *args
return NULL;
}
+ GPU_shader_bind(self->shader);
int slot = GPU_shader_get_texture_binding(self->shader, name);
GPU_texture_bind(py_texture->tex, slot);
GPU_shader_uniform_1i(self->shader, name, slot);
@@ -556,6 +562,7 @@ static PyObject *pygpu_shader_uniform_block(BPyGPUShader *self, PyObject *args)
return NULL;
}
+ GPU_shader_bind(self->shader);
GPU_uniformbuf_bind(py_ubo->ubo, binding);
Py_RETURN_NONE;