diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2022-09-19 15:39:48 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-09-19 15:40:20 +0300 |
commit | 2ce8b01c597c232d165ef2c004e3cd8d9db22cbf (patch) | |
tree | d027df183b9de31836b3bee235173fc505cc8615 /release/scripts | |
parent | 2fffd7d7a85d9e35d4f2b6e0de15504178b26e07 (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 'release/scripts')
-rw-r--r-- | release/scripts/modules/bpy_types.py | 1 | ||||
-rw-r--r-- | release/scripts/modules/gpu_extras/presets.py | 1 | ||||
-rw-r--r-- | release/scripts/templates_py/operator_modal_draw.py | 1 |
3 files changed, 0 insertions, 3 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index b2f4d71ed92..d8d6a9123f2 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -742,7 +742,6 @@ class Gizmo(StructRNA): matrix = self.matrix_world batch, shader = shape - shader.bind() if select_id is not None: gpu.select.load_id(select_id) diff --git a/release/scripts/modules/gpu_extras/presets.py b/release/scripts/modules/gpu_extras/presets.py index f68824d76c8..f0d80e855c1 100644 --- a/release/scripts/modules/gpu_extras/presets.py +++ b/release/scripts/modules/gpu_extras/presets.py @@ -78,7 +78,6 @@ def draw_texture_2d(texture, position, width, height): gpu.matrix.scale((width, height)) shader = gpu.shader.from_builtin('IMAGE') - shader.bind() if isinstance(texture, int): # Call the legacy bgl to not break the existing API diff --git a/release/scripts/templates_py/operator_modal_draw.py b/release/scripts/templates_py/operator_modal_draw.py index 78edf874791..77371a75605 100644 --- a/release/scripts/templates_py/operator_modal_draw.py +++ b/release/scripts/templates_py/operator_modal_draw.py @@ -19,7 +19,6 @@ def draw_callback_px(self, context): gpu.state.blend_set('ALPHA') gpu.state.line_width_set(2.0) batch = batch_for_shader(shader, 'LINE_STRIP', {"pos": self.mouse_path}) - shader.bind() shader.uniform_float("color", (0.0, 0.0, 0.0, 0.5)) batch.draw(shader) |