diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2022-09-01 15:31:07 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-09-05 22:34:05 +0300 |
commit | 223665b994d785672c023432ac3861d4d2c0ffb6 (patch) | |
tree | 9057bd0aa7a3f25f7434e57a29951b31349e2698 /source/blender/editors/animation/anim_draw.c | |
parent | cec67176b117557d797199ab6fd13bba54dba16f (diff) |
GPU: remove 'GPU_SHADER_2D_UNIFORM_COLOR'
The only real difference between `GPU_SHADER_2D_UNIFORM_COLOR` and
`GPU_SHADER_3D_UNIFORM_COLOR` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.
But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.
So there is no real benefit to having two different shader versions.
This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.
In python the new name for '2D_UNIFORM_COLOR'' and '3D_UNIFORM_COLOR'
is 'UNIFORM_COLOR', but the old names still work for backward
compatibility.
Differential Revision: https://developer.blender.org/D15836
Diffstat (limited to 'source/blender/editors/animation/anim_draw.c')
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index e352b4e26fe..06a0077df9b 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -60,7 +60,7 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); /* Draw a light green line to indicate current frame */ immUniformThemeColor(TH_CFRAME); @@ -87,7 +87,7 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width) GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_ANIM_PREVIEW_RANGE, -25, -30); /* XXX: Fix this hardcoded color (anim_active) */ // immUniformColor4f(0.8f, 0.44f, 0.1f, 0.2f); @@ -118,7 +118,7 @@ void ANIM_draw_framerange(Scene *scene, View2D *v2d) GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -25, -100); if (scene->r.sfra < scene->r.efra) { @@ -193,7 +193,7 @@ void ANIM_draw_action_framerange( GPU_blend(GPU_BLEND_NONE); /* Thin lines where the actual frames are. */ - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, -60); GPU_line_width(1.0f); |