Vulkan: Fix Point rendering in UI (Curves)
`ui_draw_but_CURVE` used a flat color shader to draw points. This isn't valid as that shader doesn't support point rendering. This is fixed to replace the `GPU_SHADER_3D_FLAT_COLOR` with `GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR`. Regression found when loading `monster.blend` using Vulkan. This scene has the color management tab open with a custom curve. Pull Request: https://projects.blender.org/blender/blender/pulls/124025
This commit is contained in:
@@ -1793,7 +1793,8 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol,
|
||||
format = immVertexFormat();
|
||||
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_3D_FLAT_COLOR);
|
||||
const uint size = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR);
|
||||
|
||||
/* Calculate vertex colors based on text theme. */
|
||||
float color_vert[4], color_vert_select[4];
|
||||
@@ -1808,12 +1809,13 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol,
|
||||
}
|
||||
|
||||
cmp = cuma->curve;
|
||||
GPU_point_size(max_ff(1.0f, min_ff(UI_SCALE_FAC / but->block->aspect * 4.0f, 4.0f)));
|
||||
const float point_size = max_ff(1.0f, min_ff(UI_SCALE_FAC / but->block->aspect * 4.0f, 4.0f));
|
||||
immBegin(GPU_PRIM_POINTS, cuma->totpoint);
|
||||
for (int a = 0; a < cuma->totpoint; a++) {
|
||||
const float fx = rect->xmin + zoomx * (cmp[a].x - offsx);
|
||||
const float fy = rect->ymin + zoomy * (cmp[a].y - offsy);
|
||||
immAttr4fv(col, (cmp[a].flag & CUMA_SELECT) ? color_vert_select : color_vert);
|
||||
immAttr1f(size, point_size);
|
||||
immVertex2f(pos, fx, fy);
|
||||
}
|
||||
immEnd();
|
||||
|
||||
Reference in New Issue
Block a user