GPU: Replace U32/I32 combination with GPU_FETCH_INT_TO_FLOAT in UI code
The conversion from int to float is not supported natively so it ends up happening beforehand on the CPU or as a step before the vertex buffer can be used. It's better to just upload floats in the first place. Related to: -1e1ac2bb9b-617858e453Pull Request: https://projects.blender.org/blender/blender/pulls/138855
This commit is contained in:
@@ -166,7 +166,7 @@ static void drw_volume_wireframe_cb(
|
||||
GPUVertFormat format{};
|
||||
attr_id.pos_hq_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
||||
attr_id.nor_hq_id = GPU_vertformat_attr_add(
|
||||
&format, "nor", GPU_COMP_I16, 3, GPU_FETCH_INT_TO_FLOAT_UNIT);
|
||||
&format, "nor", GPU_COMP_I16, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
|
||||
return format;
|
||||
}();
|
||||
|
||||
|
||||
@@ -182,16 +182,15 @@ static void ui_draw_button_sections_alignment_separator(const ARegion *region,
|
||||
/* Separator line. */
|
||||
{
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
const uint pos = GPU_vertformat_attr_add(
|
||||
format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4fv(bg_color);
|
||||
|
||||
if (align == uiButtonSectionsAlign::Top) {
|
||||
immRecti(pos, 0, region->winy - separator_line_width, region->winx, region->winy);
|
||||
immRectf(pos, 0, region->winy - separator_line_width, region->winx, region->winy);
|
||||
}
|
||||
else if (align == uiButtonSectionsAlign::Bottom) {
|
||||
immRecti(pos, 0, 0, region->winx, separator_line_width);
|
||||
immRectf(pos, 0, 0, region->winx, separator_line_width);
|
||||
}
|
||||
else {
|
||||
BLI_assert_unreachable();
|
||||
|
||||
@@ -220,12 +220,12 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo
|
||||
const int ofs_y = 4 * U.pixelsize;
|
||||
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4fv(color);
|
||||
|
||||
immRecti(pos, pos_x, pos_y - ofs_y, pos_x + len, pos_y - ofs_y + (height * U.pixelsize));
|
||||
immRectf(pos, pos_x, pos_y - ofs_y, pos_x + len, pos_y - ofs_y + (height * U.pixelsize));
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
|
||||
@@ -420,22 +420,21 @@ static void vicon_colorset_draw(int index, int x, int y, int w, int h, float /*a
|
||||
const int b = x + w / 3 * 2;
|
||||
const int c = x + w;
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
/* XXX: Include alpha into this... */
|
||||
/* normal */
|
||||
immUniformColor3ubv(cs->solid);
|
||||
immRecti(pos, x, y, a, y + h);
|
||||
immRectf(pos, x, y, a, y + h);
|
||||
|
||||
/* selected */
|
||||
immUniformColor3ubv(cs->select);
|
||||
immRecti(pos, a, y, b, y + h);
|
||||
immRectf(pos, a, y, b, y + h);
|
||||
|
||||
/* active */
|
||||
immUniformColor3ubv(cs->active);
|
||||
immRecti(pos, b, y, c, y + h);
|
||||
immRectf(pos, b, y, c, y + h);
|
||||
|
||||
immUnbindProgram();
|
||||
}
|
||||
@@ -654,12 +653,11 @@ static void vicon_gplayer_color_draw(Icon *icon, int x, int y, int w, int h)
|
||||
/* TODO: Make this have rounded corners, and maybe be a bit smaller.
|
||||
* However, UI_draw_roundbox_aa() draws the colors too dark, so can't be used.
|
||||
*/
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
immUniformColor3fv(gpl->color);
|
||||
immRecti(pos, x, y, x + w - 1, y + h - 1);
|
||||
immRectf(pos, x, y, x + w - 1, y + h - 1);
|
||||
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
@@ -1444,8 +1444,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
|
||||
/* Begin drawing. */
|
||||
GPU_line_smooth(true);
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
/* Draw the background. */
|
||||
@@ -1458,11 +1457,11 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
|
||||
}
|
||||
|
||||
if (is_left) {
|
||||
immRecti(
|
||||
immRectf(
|
||||
pos, v2d->mask.xmin, v2d->mask.ymin, v2d->mask.xmin + category_tabs_width, v2d->mask.ymax);
|
||||
}
|
||||
else {
|
||||
immRecti(
|
||||
immRectf(
|
||||
pos, v2d->mask.xmax - category_tabs_width, v2d->mask.ymin, v2d->mask.xmax, v2d->mask.ymax);
|
||||
}
|
||||
|
||||
@@ -1492,11 +1491,10 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
|
||||
#ifdef USE_FLAT_INACTIVE
|
||||
/* Draw line between inactive tabs. */
|
||||
if (is_active == false && is_active_prev == false && pc_dyn->prev) {
|
||||
pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor3fvAlpha(theme_col_tab_outline, 0.3f);
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
is_left ? v2d->mask.xmin + (category_tabs_width / 5) :
|
||||
v2d->mask.xmax - (category_tabs_width / 5),
|
||||
rct->ymax + px,
|
||||
@@ -1526,12 +1524,11 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
|
||||
UI_draw_roundbox_4fv(&box_rect, false, tab_curve_radius, theme_col_tab_outline);
|
||||
|
||||
/* Disguise the outline on one side to join the tab to the panel. */
|
||||
pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
immUniformColor4fv(is_active ? theme_col_tab_active : theme_col_tab_inactive);
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
is_left ? rct->xmax - px : rct->xmin,
|
||||
rct->ymin + px,
|
||||
is_left ? rct->xmax : rct->xmin + px,
|
||||
|
||||
@@ -2059,7 +2059,7 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
UI_widgetbase_draw_cache_flush();
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4ubv(wcol->item);
|
||||
const auto boxes = BLF_str_selection_boxes(
|
||||
@@ -2069,7 +2069,7 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
||||
(but->selsta >= but->ofs) ? but->selsta - but->ofs : 0,
|
||||
but->selend - std::max(but->ofs, but->selsta));
|
||||
for (auto bounds : boxes) {
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
rect->xmin + bounds.min,
|
||||
rect->ymin + U.pixelsize,
|
||||
std::min(rect->xmin + bounds.max, rect->xmax - 2),
|
||||
@@ -2113,13 +2113,13 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
immUniformThemeColor(TH_WIDGET_TEXT_CURSOR);
|
||||
|
||||
/* draw cursor */
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
rect->xmin + t,
|
||||
rect->ymin + U.pixelsize,
|
||||
rect->xmin + t + int(2.0f * U.pixelsize),
|
||||
|
||||
@@ -788,8 +788,7 @@ void ED_mask_draw_frames(
|
||||
const rcti *rect_visible = ED_region_visible_rect(region);
|
||||
const int region_bottom = rect_visible->ymin;
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4ub(255, 175, 0, 255);
|
||||
@@ -802,8 +801,8 @@ void ED_mask_draw_frames(
|
||||
// draw_keyframe(i, scene->r.cfra, sfra, framelen, 1);
|
||||
int height = (frame == cfra) ? 22 : 10;
|
||||
int x = (frame - sfra) * framelen;
|
||||
immVertex2i(pos, x, region_bottom);
|
||||
immVertex2i(pos, x, region_bottom + height * UI_SCALE_FAC);
|
||||
immVertex2f(pos, x, region_bottom);
|
||||
immVertex2f(pos, x, region_bottom + height * UI_SCALE_FAC);
|
||||
}
|
||||
immEnd();
|
||||
immUnbindProgram();
|
||||
|
||||
@@ -3839,10 +3839,10 @@ void ED_region_info_draw_multiline(ARegion *region,
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4fv(fill_color);
|
||||
immRecti(pos, rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1);
|
||||
immRectf(pos, rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1);
|
||||
immUnbindProgram();
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
|
||||
@@ -4059,11 +4059,10 @@ void ED_region_cache_draw_background(ARegion *region)
|
||||
const rcti *rect_visible = ED_region_visible_rect(region);
|
||||
const int region_bottom = rect_visible->ymin;
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4ub(128, 128, 255, 64);
|
||||
immRecti(pos, 0, region_bottom, region->winx, region_bottom + 8 * UI_SCALE_FAC);
|
||||
immRectf(pos, 0, region_bottom, region->winx, region_bottom + 8 * UI_SCALE_FAC);
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
@@ -4111,8 +4110,7 @@ void ED_region_cache_draw_cached_segments(
|
||||
const rcti *rect_visible = ED_region_visible_rect(region);
|
||||
const int region_bottom = rect_visible->ymin;
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4ub(128, 128, 255, 128);
|
||||
|
||||
@@ -4120,7 +4118,7 @@ void ED_region_cache_draw_cached_segments(
|
||||
float x1 = float(points[a * 2] - sfra) / (efra - sfra + 1) * region->winx;
|
||||
float x2 = float(points[a * 2 + 1] - sfra + 1) / (efra - sfra + 1) * region->winx;
|
||||
|
||||
immRecti(pos, x1, region_bottom, x2, region_bottom + 8 * UI_SCALE_FAC);
|
||||
immRectf(pos, x1, region_bottom, x2, region_bottom + 8 * UI_SCALE_FAC);
|
||||
/* TODO(merwin): use primitive restart to draw multiple rects more efficiently */
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ static void gradient_draw_line(bContext * /*C*/,
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
ARegion *region = pop->vc.region;
|
||||
|
||||
@@ -264,8 +264,8 @@ static void gradient_draw_line(bContext * /*C*/,
|
||||
immUniformColor4ub(0, 0, 0, 255);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex2iv(pos, xy);
|
||||
immVertex2i(
|
||||
immVertex2fv(pos, blender::float2(xy));
|
||||
immVertex2f(
|
||||
pos, pop->startmouse[0] + region->winrct.xmin, pop->startmouse[1] + region->winrct.ymin);
|
||||
immEnd();
|
||||
|
||||
@@ -273,8 +273,8 @@ static void gradient_draw_line(bContext * /*C*/,
|
||||
immUniformColor4ub(255, 255, 255, 255);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex2iv(pos, xy);
|
||||
immVertex2i(
|
||||
immVertex2fv(pos, blender::float2(xy));
|
||||
immVertex2f(
|
||||
pos, pop->startmouse[0] + region->winrct.xmin, pop->startmouse[1] + region->winrct.ymin);
|
||||
immEnd();
|
||||
|
||||
|
||||
@@ -59,12 +59,12 @@ static void draw_keyframe(int frame, int cfra, int sfra, float framelen, int wid
|
||||
|
||||
if (width == 1) {
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex2i(pos, x, 0);
|
||||
immVertex2i(pos, x, height * UI_SCALE_FAC);
|
||||
immVertex2f(pos, x, 0);
|
||||
immVertex2f(pos, x, height * UI_SCALE_FAC);
|
||||
immEnd();
|
||||
}
|
||||
else {
|
||||
immRecti(pos, x, 0, x + width, height * UI_SCALE_FAC);
|
||||
immRectf(pos, x, 0, x + width, height * UI_SCALE_FAC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,8 +145,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *region, MovieClip *clip
|
||||
BKE_movieclip_get_cache_segments(clip, &sc->user, &totseg, &points);
|
||||
ED_region_cache_draw_cached_segments(region, totseg, points, sfra, efra);
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
/* track */
|
||||
@@ -189,7 +188,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *region, MovieClip *clip
|
||||
immUniformColor4ub(255, 255, 0, 96);
|
||||
}
|
||||
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
(i - sfra + clip->start_frame - 1) * framelen,
|
||||
0,
|
||||
(i - sfra + clip->start_frame) * framelen,
|
||||
@@ -221,7 +220,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *region, MovieClip *clip
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
(i - sfra + clip->start_frame - 1) * framelen,
|
||||
0,
|
||||
(i - sfra + clip->start_frame) * framelen,
|
||||
@@ -236,14 +235,14 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *region, MovieClip *clip
|
||||
x = (sc->user.framenr - sfra) / (efra - sfra + 1) * region->winx;
|
||||
|
||||
immUniformThemeColor(TH_CFRAME);
|
||||
immRecti(pos, x, 0, x + ceilf(framelen), 8 * UI_SCALE_FAC);
|
||||
immRectf(pos, x, 0, x + ceilf(framelen), 8 * UI_SCALE_FAC);
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
ED_region_cache_draw_curfra_label(
|
||||
sc->user.framenr, x + roundf(framelen / 2), 8.0f * UI_SCALE_FAC);
|
||||
|
||||
pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
/* solver keyframes */
|
||||
|
||||
@@ -1001,7 +1001,7 @@ static void draw_dividers(FileLayout *layout, View2D *v2d)
|
||||
}
|
||||
|
||||
if (vertex_len > 0) {
|
||||
int v1[2], v2[2];
|
||||
float v1[2], v2[2];
|
||||
float col_hi[3], col_lo[3];
|
||||
|
||||
UI_GetThemeColorShade3fv(TH_BACK, 30, col_hi);
|
||||
@@ -1011,7 +1011,7 @@ static void draw_dividers(FileLayout *layout, View2D *v2d)
|
||||
v2[1] = v2d->cur.ymin;
|
||||
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
|
||||
@@ -1023,15 +1023,15 @@ static void draw_dividers(FileLayout *layout, View2D *v2d)
|
||||
|
||||
v1[0] = v2[0] = sx;
|
||||
immAttrSkip(color);
|
||||
immVertex2iv(pos, v1);
|
||||
immVertex2fv(pos, v1);
|
||||
immAttr3fv(color, col_lo);
|
||||
immVertex2iv(pos, v2);
|
||||
immVertex2fv(pos, v2);
|
||||
|
||||
v1[0] = v2[0] = sx + 1;
|
||||
immAttrSkip(color);
|
||||
immVertex2iv(pos, v1);
|
||||
immVertex2fv(pos, v1);
|
||||
immAttr3fv(color, col_hi);
|
||||
immVertex2iv(pos, v2);
|
||||
immVertex2fv(pos, v2);
|
||||
}
|
||||
|
||||
immEnd();
|
||||
|
||||
@@ -139,13 +139,12 @@ void ED_image_draw_info(Scene *scene,
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
/* noisy, high contrast make impossible to read if lower alpha is used. */
|
||||
immUniformColor4ub(0, 0, 0, 190);
|
||||
immRecti(pos, 0, ymin, BLI_rcti_size_x(®ion->winrct) + 1, ymin + UI_UNIT_Y);
|
||||
immRectf(pos, 0, ymin, BLI_rcti_size_x(®ion->winrct) + 1, ymin + UI_UNIT_Y);
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
@@ -307,7 +306,7 @@ void ED_image_draw_info(Scene *scene,
|
||||
ymin + 0.85f * UI_UNIT_Y);
|
||||
|
||||
/* BLF uses immediate mode too, so we must reset our vertex format */
|
||||
pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
if (channels == 4) {
|
||||
@@ -317,7 +316,7 @@ void ED_image_draw_info(Scene *scene,
|
||||
color_rect_half = color_rect;
|
||||
color_rect_half.xmax = BLI_rcti_cent_x(&color_rect);
|
||||
/* what color ??? */
|
||||
immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
|
||||
immRectf(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
|
||||
|
||||
color_rect_half = color_rect;
|
||||
color_rect_half.xmin = BLI_rcti_cent_x(&color_rect);
|
||||
@@ -326,26 +325,26 @@ void ED_image_draw_info(Scene *scene,
|
||||
color_quater_y = BLI_rcti_cent_y(&color_rect_half);
|
||||
|
||||
immUniformColor3ub(UI_ALPHA_CHECKER_DARK, UI_ALPHA_CHECKER_DARK, UI_ALPHA_CHECKER_DARK);
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
color_rect_half.xmin,
|
||||
color_rect_half.ymin,
|
||||
color_rect_half.xmax,
|
||||
color_rect_half.ymax);
|
||||
|
||||
immUniformColor3ub(UI_ALPHA_CHECKER_LIGHT, UI_ALPHA_CHECKER_LIGHT, UI_ALPHA_CHECKER_LIGHT);
|
||||
immRecti(pos, color_quater_x, color_quater_y, color_rect_half.xmax, color_rect_half.ymax);
|
||||
immRecti(pos, color_rect_half.xmin, color_rect_half.ymin, color_quater_x, color_quater_y);
|
||||
immRectf(pos, color_quater_x, color_quater_y, color_rect_half.xmax, color_rect_half.ymax);
|
||||
immRectf(pos, color_rect_half.xmin, color_rect_half.ymin, color_quater_x, color_quater_y);
|
||||
|
||||
if (fp != nullptr || cp != nullptr) {
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
immUniformColor3fvAlpha(finalcol, fp ? fp[3] : (cp[3] / 255.0f));
|
||||
immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
|
||||
immRectf(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
immUniformColor3fv(finalcol);
|
||||
immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
|
||||
immRectf(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
|
||||
}
|
||||
immUnbindProgram();
|
||||
|
||||
@@ -526,11 +525,10 @@ void draw_image_cache(const bContext *C, ARegion *region)
|
||||
/* Draw current frame. */
|
||||
x = (cfra - sfra) / (efra - sfra + 1) * region->winx;
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformThemeColor(TH_CFRAME);
|
||||
immRecti(pos, x, region_bottom, x + ceilf(framelen), region_bottom + 8 * UI_SCALE_FAC);
|
||||
immRectf(pos, x, region_bottom, x + ceilf(framelen), region_bottom + 8 * UI_SCALE_FAC);
|
||||
immUnbindProgram();
|
||||
|
||||
ED_region_cache_draw_curfra_label(
|
||||
|
||||
@@ -80,11 +80,11 @@ static void textview_draw_sel(const char *str,
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
immUniformColor4ubv(bg_sel);
|
||||
immRecti(pos, xy[0] + (cwidth * sta), xy[1] + lheight, xy[0] + (cwidth * end), xy[1]);
|
||||
immRectf(pos, xy[0] + (cwidth * sta), xy[1] + lheight, xy[0] + (cwidth * end), xy[1]);
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
@@ -207,10 +207,10 @@ static bool textview_draw_string(TextViewDrawState *tds,
|
||||
|
||||
if (bg) {
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4ubv(bg);
|
||||
immRecti(pos, tds->draw_rect_outer->xmin, line_bottom, tds->draw_rect_outer->xmax, line_top);
|
||||
immRectf(pos, tds->draw_rect_outer->xmin, line_bottom, tds->draw_rect_outer->xmax, line_top);
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
|
||||
@@ -3700,10 +3700,10 @@ static void outliner_draw_struct_marks(ARegion *region,
|
||||
if (TSELEM_OPEN(tselem, space_outliner)) {
|
||||
if (tselem->type == TSE_RNA_STRUCT) {
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immThemeColorShadeAlpha(TH_BACK, -15, -200);
|
||||
immRecti(pos, 0, *starty + 1, int(region->v2d.cur.xmax), *starty + UI_UNIT_Y - 1);
|
||||
immRectf(pos, 0, *starty + 1, int(region->v2d.cur.xmax), *starty + UI_UNIT_Y - 1);
|
||||
immUnbindProgram();
|
||||
}
|
||||
}
|
||||
@@ -3749,11 +3749,11 @@ static void outliner_draw_highlights(uint pos,
|
||||
/* Selection status. */
|
||||
if ((tselem->flag & TSE_ACTIVE) && (tselem->flag & TSE_SELECTED)) {
|
||||
immUniformColor4fv(col_active);
|
||||
immRecti(pos, 0, start_y, int(region->v2d.cur.xmax), start_y + UI_UNIT_Y);
|
||||
immRectf(pos, 0, start_y, int(region->v2d.cur.xmax), start_y + UI_UNIT_Y);
|
||||
}
|
||||
else if (tselem->flag & TSE_SELECTED) {
|
||||
immUniformColor4fv(col_selection);
|
||||
immRecti(pos, 0, start_y, int(region->v2d.cur.xmax), start_y + UI_UNIT_Y);
|
||||
immRectf(pos, 0, start_y, int(region->v2d.cur.xmax), start_y + UI_UNIT_Y);
|
||||
}
|
||||
|
||||
/* Highlights. */
|
||||
@@ -3767,7 +3767,7 @@ static void outliner_draw_highlights(uint pos,
|
||||
|
||||
if (tselem->flag & TSE_DRAG_BEFORE) {
|
||||
immUniformColor4fv(col);
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
start_x,
|
||||
start_y + UI_UNIT_Y - U.pixelsize,
|
||||
end_x,
|
||||
@@ -3775,11 +3775,11 @@ static void outliner_draw_highlights(uint pos,
|
||||
}
|
||||
else if (tselem->flag & TSE_DRAG_AFTER) {
|
||||
immUniformColor4fv(col);
|
||||
immRecti(pos, start_x, start_y - U.pixelsize, end_x, start_y + U.pixelsize);
|
||||
immRectf(pos, start_x, start_y - U.pixelsize, end_x, start_y + U.pixelsize);
|
||||
}
|
||||
else {
|
||||
immUniformColor3fvAlpha(col, col[3] * 0.5f);
|
||||
immRecti(pos, start_x, start_y, end_x, start_y + UI_UNIT_Y);
|
||||
immRectf(pos, start_x, start_y, end_x, start_y + UI_UNIT_Y);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -3787,12 +3787,12 @@ static void outliner_draw_highlights(uint pos,
|
||||
/* Search match highlights. We don't expand items when searching in the data-blocks,
|
||||
* but we still want to highlight any filter matches. */
|
||||
immUniformColor4fv(col_searchmatch);
|
||||
immRecti(pos, start_x, start_y, end_x, start_y + UI_UNIT_Y);
|
||||
immRectf(pos, start_x, start_y, end_x, start_y + UI_UNIT_Y);
|
||||
}
|
||||
else if (tselem->flag & TSE_HIGHLIGHTED) {
|
||||
/* Mouse hover highlight. */
|
||||
immUniformColor4fv(col_highlight);
|
||||
immRecti(pos, 0, start_y, end_x, start_y + UI_UNIT_Y);
|
||||
immRectf(pos, 0, start_y, end_x, start_y + UI_UNIT_Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3818,7 +3818,7 @@ static void outliner_draw_highlights(ARegion *region,
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
outliner_draw_highlights(pos,
|
||||
region,
|
||||
|
||||
@@ -55,7 +55,7 @@ static void draw_index_column_background(const uint pos,
|
||||
const SpreadsheetDrawer &drawer)
|
||||
{
|
||||
immUniformThemeColorShade(TH_BACK, 11);
|
||||
immRecti(pos, 0, region->winy - drawer.top_row_height, drawer.left_column_width, 0);
|
||||
immRectf(pos, 0, region->winy - drawer.top_row_height, drawer.left_column_width, 0);
|
||||
}
|
||||
|
||||
static void draw_alternating_row_overlay(const uint pos,
|
||||
@@ -75,7 +75,7 @@ static void draw_alternating_row_overlay(const uint pos,
|
||||
int y_bottom = y_top - drawer.row_height;
|
||||
y_top = std::min(y_top, region->winy - drawer.top_row_height);
|
||||
y_bottom = std::min(y_bottom, region->winy - drawer.top_row_height);
|
||||
immRecti(pos, x_left, y_top, x_right, y_bottom);
|
||||
immRectf(pos, x_left, y_top, x_right, y_bottom);
|
||||
}
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ static void draw_top_row_background(const uint pos,
|
||||
const SpreadsheetDrawer &drawer)
|
||||
{
|
||||
immUniformThemeColorShade(TH_BACK, 11);
|
||||
immRecti(pos, 0, region->winy, region->winx, region->winy - drawer.top_row_height);
|
||||
immRectf(pos, 0, region->winy, region->winx, region->winy - drawer.top_row_height);
|
||||
}
|
||||
|
||||
static void draw_separator_lines(const uint pos,
|
||||
@@ -98,12 +98,12 @@ static void draw_separator_lines(const uint pos,
|
||||
immBeginAtMost(GPU_PRIM_LINES, drawer.tot_columns * 2 + 4);
|
||||
|
||||
/* Left column line. */
|
||||
immVertex2i(pos, drawer.left_column_width, region->winy);
|
||||
immVertex2i(pos, drawer.left_column_width, 0);
|
||||
immVertex2f(pos, drawer.left_column_width, region->winy);
|
||||
immVertex2f(pos, drawer.left_column_width, 0);
|
||||
|
||||
/* Top row line. */
|
||||
immVertex2i(pos, 0, region->winy - drawer.top_row_height);
|
||||
immVertex2i(pos, region->winx, region->winy - drawer.top_row_height);
|
||||
immVertex2f(pos, 0, region->winy - drawer.top_row_height);
|
||||
immVertex2f(pos, region->winx, region->winy - drawer.top_row_height);
|
||||
|
||||
/* Column separator lines. */
|
||||
int line_x = drawer.left_column_width - scroll_offset_x;
|
||||
@@ -111,8 +111,8 @@ static void draw_separator_lines(const uint pos,
|
||||
const int column_width = drawer.column_width(column_index);
|
||||
line_x += column_width;
|
||||
if (line_x >= drawer.left_column_width) {
|
||||
immVertex2i(pos, line_x, region->winy);
|
||||
immVertex2i(pos, line_x, 0);
|
||||
immVertex2f(pos, line_x, region->winy);
|
||||
immVertex2f(pos, line_x, 0);
|
||||
}
|
||||
}
|
||||
immEnd();
|
||||
@@ -275,7 +275,7 @@ void draw_spreadsheet_in_region(const bContext *C,
|
||||
const int scroll_offset_x = v2d->cur.xmin;
|
||||
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
draw_index_column_background(pos, region, drawer);
|
||||
|
||||
@@ -1019,11 +1019,10 @@ static void draw_textscroll(const SpaceText *st, const rcti *scroll, const rcti
|
||||
float rad;
|
||||
|
||||
/* Background so highlights don't go behind the scroll-bar. */
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformThemeColor(TH_BACK);
|
||||
immRecti(pos, back->xmin, back->ymin, back->xmax, back->ymax);
|
||||
immRectf(pos, back->xmin, back->ymin, back->xmax, back->ymax);
|
||||
immUnbindProgram();
|
||||
|
||||
UI_draw_widget_scroll(&wcol,
|
||||
@@ -1112,14 +1111,13 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
|
||||
ui_draw_dropshadow(&rect, 0.0f, 8.0f, 1.0f, 0.5f);
|
||||
}
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
immUniformThemeColor(TH_SHADE1);
|
||||
immRecti(pos, x - 1, y + 1, x + boxw + 1, y - boxh - 1);
|
||||
immRectf(pos, x - 1, y + 1, x + boxw + 1, y - boxh - 1);
|
||||
immUniformThemeColorShade(TH_BACK, 16);
|
||||
immRecti(pos, x, y, x + boxw, y - boxh);
|
||||
immRectf(pos, x, y, x + boxw, y - boxh);
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
@@ -1139,11 +1137,11 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
|
||||
|
||||
if (item == sel) {
|
||||
uint posi = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
immUniformThemeColor(TH_SHADE2);
|
||||
immRecti(posi, x + margin_x, y - 3, x + margin_x + w, y + lheight - 3);
|
||||
immRectf(posi, x + margin_x, y - 3, x + margin_x + w, y + lheight - 3);
|
||||
|
||||
immUnbindProgram();
|
||||
}
|
||||
@@ -1186,8 +1184,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
|
||||
return;
|
||||
}
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
/* Draw the selection */
|
||||
@@ -1211,14 +1208,14 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
|
||||
y -= vcurl * lheight;
|
||||
|
||||
if (vcurc < vselc) {
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
x + vcurc * st->runtime->cwidth_px,
|
||||
y,
|
||||
x + vselc * st->runtime->cwidth_px,
|
||||
y - lheight);
|
||||
}
|
||||
else {
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
x + vselc * st->runtime->cwidth_px,
|
||||
y,
|
||||
x + vcurc * st->runtime->cwidth_px,
|
||||
@@ -1243,17 +1240,17 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
|
||||
|
||||
y -= froml * lheight;
|
||||
|
||||
immRecti(
|
||||
immRectf(
|
||||
pos, x + fromc * st->runtime->cwidth_px - U.pixelsize, y, region->winx, y - lheight);
|
||||
y -= lheight;
|
||||
|
||||
for (int i = froml + 1; i < tol; i++) {
|
||||
immRecti(pos, x - U.pixelsize, y, region->winx, y - lheight);
|
||||
immRectf(pos, x - U.pixelsize, y, region->winx, y - lheight);
|
||||
y -= lheight;
|
||||
}
|
||||
|
||||
if (x + toc * st->runtime->cwidth_px > x) {
|
||||
immRecti(pos, x - U.pixelsize, y, x + toc * st->runtime->cwidth_px, y - lheight);
|
||||
immRectf(pos, x - U.pixelsize, y, x + toc * st->runtime->cwidth_px, y - lheight);
|
||||
}
|
||||
y -= lheight;
|
||||
}
|
||||
@@ -1289,7 +1286,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
|
||||
highlight_color[3] = 0.1f;
|
||||
immUniformColor4fv(highlight_color);
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
immRecti(pos, 0, y1, region->winx, y2);
|
||||
immRectf(pos, 0, y1, region->winx, y2);
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
}
|
||||
@@ -1313,11 +1310,11 @@ static void draw_text_decoration(SpaceText *st, ARegion *region)
|
||||
w *= st->tabnumber - (vselc + st->left) % st->tabnumber;
|
||||
}
|
||||
|
||||
immRecti(
|
||||
immRectf(
|
||||
pos, x, y - lheight - U.pixelsize, x + w + U.pixelsize, y - lheight - (3 * U.pixelsize));
|
||||
}
|
||||
else {
|
||||
immRecti(pos, x - U.pixelsize, y, x + U.pixelsize, y - lheight);
|
||||
immRectf(pos, x - U.pixelsize, y, x + U.pixelsize, y - lheight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1573,11 +1570,10 @@ void draw_text_main(SpaceText *st, ARegion *region)
|
||||
|
||||
/* draw line numbers background */
|
||||
if (st->showlinenrs) {
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformThemeColor(TH_GRID);
|
||||
immRecti(pos, 0, 0, TXT_NUMCOL_WIDTH(st), region->winy);
|
||||
immRectf(pos, 0, 0, TXT_NUMCOL_WIDTH(st), region->winy);
|
||||
immUnbindProgram();
|
||||
}
|
||||
else {
|
||||
@@ -1634,14 +1630,14 @@ void draw_text_main(SpaceText *st, ARegion *region)
|
||||
margin_column_x = x + st->runtime->cwidth_px * (st->margin_column - st->left);
|
||||
if (margin_column_x >= x) {
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
float margin_color[4];
|
||||
UI_GetThemeColor4fv(TH_TEXT, margin_color);
|
||||
margin_color[3] = 0.2f;
|
||||
immUniformColor4fv(margin_color);
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
immRecti(pos, margin_column_x, 0, margin_column_x + U.pixelsize, region->winy);
|
||||
immRectf(pos, margin_column_x, 0, margin_column_x + U.pixelsize, region->winy);
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ static void drawWalkPixel(const bContext * /*C*/, ARegion *region, void *arg)
|
||||
}
|
||||
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
|
||||
@@ -142,10 +142,10 @@ void immRectf_with_texco(const uint pos, const uint tex_coord, const rctf &p, co
|
||||
void immRecti_complete(int x1, int y1, int x2, int y2, const float color[4])
|
||||
{
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = add_attr(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = add_attr(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4fv(color);
|
||||
immRecti(pos, x1, y1, x2, y2);
|
||||
immRectf(pos, x1, y1, x2, y2);
|
||||
immUnbindProgram();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -307,20 +307,19 @@ static void wm_software_cursor_draw_crosshair(const int event_xy[2])
|
||||
* NOTE: the `win->cursor` could be used for drawing although it's complicated as some cursors
|
||||
* are set by the operating-system, where the pixel information isn't easily available. */
|
||||
const float unit = max_ff(UI_SCALE_FAC, 1.0f);
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
immUniformColor4f(1, 1, 1, 1);
|
||||
{
|
||||
const int ofs_line = (8 * unit);
|
||||
const int ofs_size = (2 * unit);
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
event_xy[0] - ofs_line,
|
||||
event_xy[1] - ofs_size,
|
||||
event_xy[0] + ofs_line,
|
||||
event_xy[1] + ofs_size);
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
event_xy[0] - ofs_size,
|
||||
event_xy[1] - ofs_line,
|
||||
event_xy[0] + ofs_size,
|
||||
@@ -330,12 +329,12 @@ static void wm_software_cursor_draw_crosshair(const int event_xy[2])
|
||||
{
|
||||
const int ofs_line = (7 * unit);
|
||||
const int ofs_size = (1 * unit);
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
event_xy[0] - ofs_line,
|
||||
event_xy[1] - ofs_size,
|
||||
event_xy[0] + ofs_line,
|
||||
event_xy[1] + ofs_size);
|
||||
immRecti(pos,
|
||||
immRectf(pos,
|
||||
event_xy[0] - ofs_size,
|
||||
event_xy[1] - ofs_line,
|
||||
event_xy[0] + ofs_size,
|
||||
|
||||
@@ -216,14 +216,14 @@ static void wm_gesture_draw_rect(wmGesture *gt)
|
||||
const rcti *rect = static_cast<const rcti *>(gt->customdata);
|
||||
|
||||
uint shdr_pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f);
|
||||
|
||||
immRecti(shdr_pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
|
||||
immRectf(shdr_pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user