diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2022-09-01 18:32:28 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-09-05 22:34:05 +0300 |
commit | 4536de98d18b8887edee37b03a12da015590bb45 (patch) | |
tree | 7ae1b21db0ebf0ef00d102f32523cad225fdddf9 /source/blender/editors/interface | |
parent | 0c3953d545441a8ae551c3ecb0c16c1bccc3839f (diff) |
GPU: remove 'GPU_SHADER_2D_SMOOTH_COLOR'
The only real difference between `GPU_SHADER_2D_SMOOTH_COLOR` and
`GPU_SHADER_3D_SMOOTH_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_SMOOTH_COLOR' and '3D_SMOOTH_COLOR'
is 'SMOOTH_COLOR', but the old names still work for backward
compatibility.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 6 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 4dae8222b14..02325920e6d 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -205,7 +205,7 @@ void ui_draw_but_TAB_outline(const rcti *rect, mul_v2_fl(vec[a], rad); } - immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); + immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); immBeginAtMost(GPU_PRIM_LINE_STRIP, 25); immAttr3ubv(col, highlight); @@ -1242,7 +1242,7 @@ void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const format = immVertexFormat(); pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); col_id = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); + immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); /* layer: color ramp */ GPU_blend(GPU_BLEND_ALPHA); @@ -2288,7 +2288,7 @@ void UI_draw_box_shadow(const rctf *rect, uchar alpha) uint color = GPU_vertformat_attr_add( format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); - immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); + immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); immBegin(GPU_PRIM_TRIS, 54); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index f49863cf306..53b1967d668 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2930,7 +2930,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, const uiWidgetColors *wcol, const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); const uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); + immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); immBegin(GPU_PRIM_TRI_FAN, tot + 2); immAttr3fv(color, rgb_center); @@ -3061,7 +3061,7 @@ void ui_draw_gradient(const rcti *rect, GPUVertFormat *format = immVertexFormat(); const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); const uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); + immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); immBegin(GPU_PRIM_TRIS, steps * 3 * 6); @@ -5155,7 +5155,7 @@ static void draw_disk_shaded(float start, const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); if (shaded) { col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); - immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); + immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); } else { immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); |