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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user