diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-07-18 01:12:21 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-07-18 12:49:15 +0300 |
commit | 8cd7828792419fb4eac9a2a477968535b4c71535 (patch) | |
tree | 8fc733149fe07b7d9edd4b8b1e709519b4481887 /source/blender/editors | |
parent | 247ad2034de2c33a6d9cb7d3b6f1ef7ffa5b859d (diff) |
GWN: Port to GPU module: Replace GWN prefix by GPU
Diffstat (limited to 'source/blender/editors')
68 files changed, 1015 insertions, 1015 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index c70790e0550..3c10cda6456 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -146,7 +146,7 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[3]; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); /* set backdrop drawing color */ acf->get_backdrop_color(ac, ale, color); @@ -235,7 +235,7 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, f short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[3]; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); /* set backdrop drawing color */ acf->get_backdrop_color(ac, ale, color); @@ -3868,7 +3868,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float /* for F-Curves, draw color-preview of curve behind checkbox */ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) { FCurve *fcu = (FCurve *)ale->data; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -3924,7 +3924,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float /* draw red underline if channel is disabled */ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE) && (ale->flag & FCURVE_DISABLED)) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -3933,7 +3933,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float GPU_line_width(2.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, (float)offset, yminc); immVertex2f(pos, (float)v2d->cur.xmax, yminc); immEnd(); @@ -3952,7 +3952,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float short draw_sliders = 0; float ymin_ofs = 0.0f; float color[3]; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 129cf07b7c4..780e984f870 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -141,15 +141,15 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) GPU_line_width((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* Draw a light green line to indicate current frame */ immUniformThemeColor(TH_CFRAME); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */ immVertex2f(pos, x, v2d->cur.ymax); immEnd(); @@ -170,8 +170,8 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width) GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); GPU_blend(true); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_ANIM_ACTIVE, -25, -30); @@ -203,8 +203,8 @@ void ANIM_draw_framerange(Scene *scene, View2D *v2d) GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); GPU_blend(true); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -25, -100); @@ -222,7 +222,7 @@ void ANIM_draw_framerange(Scene *scene, View2D *v2d) /* thin lines where the actual frames are */ immUniformThemeColorShade(TH_BACK, -60); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, (float)SFRA, v2d->cur.ymin); immVertex2f(pos, (float)SFRA, v2d->cur.ymax); diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index f809bff536f..e1f4092c494 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -400,8 +400,8 @@ static void draw_marker( if (flag & DRAW_MARKERS_LINES) #endif { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -418,7 +418,7 @@ static void draw_marker( immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, xpos + 0.5f, 12.0f); immVertex2f(pos, xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale); immEnd(); @@ -486,7 +486,7 @@ void ED_markers_draw(const bContext *C, int flag) v2d = UI_view2d_fromcontext(C); if (flag & DRAW_MARKERS_MARGIN) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); const unsigned char shade[4] = {0, 0, 0, 16}; diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 78ce24db503..30130ce4dac 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -593,12 +593,12 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa } if (block_len > 0) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint color_id = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GWN_PRIM_TRIS, 6 * block_len); + immBegin(GPU_PRIM_TRIS, 6 * block_len); for (ActKeyBlock *ab = blocks->first; ab; ab = ab->next) { if (actkeyblock_is_valid(ab, keys)) { if (ab->flag & ACTKEYBLOCK_FLAG_MOVING_HOLD) { @@ -633,14 +633,14 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa if (key_len > 0) { /* draw keys */ - Gwn_VertFormat *format = immVertexFormat(); - uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - uint color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); - uint outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint size_id = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); + uint color_id = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); + uint outline_color_id = GPU_vertformat_attr_add(format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); - immBegin(GWN_PRIM_POINTS, key_len); + immBegin(GPU_PRIM_POINTS, key_len); for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) { if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax)) { diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 927b8b8514d..dd0430f4f65 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -387,9 +387,9 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS float color[3]; UI_GetThemeColor3fv(TH_WIRE, color); - Gwn_Batch *sphere = GPU_batch_preset_sphere(0); - GWN_batch_program_set_builtin(sphere, GPU_SHADER_3D_UNIFORM_COLOR); - GWN_batch_uniform_3fv(sphere, "color", color); + GPUBatch *sphere = GPU_batch_preset_sphere(0); + GPU_batch_program_set_builtin(sphere, GPU_SHADER_3D_UNIFORM_COLOR); + GPU_batch_uniform_3fv(sphere, "color", color); /* scale to edit-mode space */ GPU_matrix_push(); @@ -407,7 +407,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS GPU_matrix_push(); GPU_matrix_scale_1f(radius); - GWN_batch_draw(sphere); + GPU_batch_draw(sphere); GPU_matrix_pop(); location_prev = selem->location_local; @@ -430,8 +430,8 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS } { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); GPU_depth_test(false); @@ -440,7 +440,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS GPU_line_width(3.0f); imm_cpack(0x0); - immBegin(GWN_PRIM_LINE_STRIP, stroke_len); + immBegin(GPU_PRIM_LINE_STRIP, stroke_len); for (int i = 0; i < stroke_len; i++) { immVertex3fv(pos, coord_array[i]); } @@ -449,7 +449,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS GPU_line_width(1.0f); imm_cpack(0xffffffff); - immBegin(GWN_PRIM_LINE_STRIP, stroke_len); + immBegin(GPU_PRIM_LINE_STRIP, stroke_len); for (int i = 0; i < stroke_len; i++) { immVertex3fv(pos, coord_array[i]); } diff --git a/source/blender/editors/gizmo_library/gizmo_draw_utils.c b/source/blender/editors/gizmo_library/gizmo_draw_utils.c index aaaee182c71..5ccb1fa1f6d 100644 --- a/source/blender/editors/gizmo_library/gizmo_draw_utils.c +++ b/source/blender/editors/gizmo_library/gizmo_draw_utils.c @@ -64,31 +64,31 @@ void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, const bool UNUSED(sel /* TODO store the Batches inside the GizmoGeomInfo and updated it when geom changes * So we don't need to re-created and discard it every time */ - Gwn_VertBuf *vbo; - Gwn_IndexBuf *el; - Gwn_Batch *batch; - Gwn_IndexBufBuilder elb = {0}; + GPUVertBuf *vbo; + GPUIndexBuf *el; + GPUBatch *batch; + GPUIndexBufBuilder elb = {0}; - Gwn_VertFormat format = {0}; - uint pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + GPUVertFormat format = {0}; + uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); /* Elements */ - GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, info->ntris, info->nverts); + GPU_indexbuf_init(&elb, GPU_PRIM_TRIS, info->ntris, info->nverts); for (int i = 0; i < info->ntris; ++i) { const unsigned short *idx = &info->indices[i * 3]; - GWN_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]); + GPU_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]); } - el = GWN_indexbuf_build(&elb); + el = GPU_indexbuf_build(&elb); - vbo = GWN_vertbuf_create_with_format(&format); - GWN_vertbuf_data_alloc(vbo, info->nverts); + vbo = GPU_vertbuf_create_with_format(&format); + GPU_vertbuf_data_alloc(vbo, info->nverts); - GWN_vertbuf_attr_fill(vbo, pos_id, info->verts); + GPU_vertbuf_attr_fill(vbo, pos_id, info->verts); - batch = GWN_batch_create_ex(GWN_PRIM_TRIS, vbo, el, GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX); - GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); + batch = GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, el, GPU_BATCH_OWNS_VBO | GPU_BATCH_OWNS_INDEX); + GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); - GWN_batch_uniform_4fv(batch, "color", color); + GPU_batch_uniform_4fv(batch, "color", color); /* We may want to re-visit this, for now disable * since it causes issues leaving the GL state modified. */ @@ -97,7 +97,7 @@ void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, const bool UNUSED(sel GPU_depth_test(true); #endif - GWN_batch_draw(batch); + GPU_batch_draw(batch); #if 0 GPU_depth_test(false); @@ -105,7 +105,7 @@ void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, const bool UNUSED(sel #endif - GWN_batch_discard(batch); + GPU_batch_discard(batch); } void wm_gizmo_vec_draw( diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c index 673e38e4a1a..cb8e2a90b07 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c @@ -70,7 +70,7 @@ static void arrow2d_draw_geom(wmGizmo *gz, const float matrix[4][4], const float const float arrow_length = RNA_float_get(gz->ptr, "length") - size_length; const float arrow_angle = RNA_float_get(gz->ptr, "angle"); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); GPU_matrix_push(); GPU_matrix_mul(matrix); @@ -80,12 +80,12 @@ static void arrow2d_draw_geom(wmGizmo *gz, const float matrix[4][4], const float immUniformColor4fv(color); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, 0.0f, 0.0f); immVertex2f(pos, 0.0f, arrow_length); immEnd(); - immBegin(GWN_PRIM_TRIS, 3); + immBegin(GPU_PRIM_TRIS, 3); immVertex2f(pos, size_breadth, arrow_length); immVertex2f(pos, -size_breadth, arrow_length); immVertex2f(pos, 0.0f, arrow_length + size_length); diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c index da4bce680b8..0f8389af17d 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c @@ -90,7 +90,7 @@ static void gizmo_arrow_matrix_basis_get(const wmGizmo *gz, float r_matrix[4][4] static void arrow_draw_geom(const ArrowGizmo3D *arrow, const bool select, const float color[4]) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); bool unbind_shader = true; const int draw_style = RNA_enum_get(arrow->gizmo.ptr, "draw_style"); const int draw_options = RNA_enum_get(arrow->gizmo.ptr, "draw_options"); @@ -100,7 +100,7 @@ static void arrow_draw_geom(const ArrowGizmo3D *arrow, const bool select, const if (draw_style == ED_GIZMO_ARROW_STYLE_CROSS) { immUniformColor4fv(color); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex3f(pos, -1.0f, 0.0f, 0.0f); immVertex3f(pos, 1.0f, 0.0f, 0.0f); immVertex3f(pos, 0.0f, -1.0f, 0.0f); @@ -120,7 +120,7 @@ static void arrow_draw_geom(const ArrowGizmo3D *arrow, const bool select, const }; GPU_line_width(arrow->gizmo.line_width); - wm_gizmo_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_LOOP); + wm_gizmo_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GPU_PRIM_LINE_LOOP); } else { #ifdef USE_GIZMO_CUSTOM_ARROWS @@ -135,7 +135,7 @@ static void arrow_draw_geom(const ArrowGizmo3D *arrow, const bool select, const if (draw_options & ED_GIZMO_ARROW_DRAW_FLAG_STEM) { GPU_line_width(arrow->gizmo.line_width); - wm_gizmo_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_STRIP); + wm_gizmo_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GPU_PRIM_LINE_STRIP); } else { immUniformColor4fv(color); diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c index 13711325038..d976adc06bf 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c @@ -72,7 +72,7 @@ typedef struct ButtonGizmo2D { bool is_init; /* Use an icon or shape */ int icon; - Gwn_Batch *shape_batch[2]; + GPUBatch *shape_batch[2]; } ButtonGizmo2D; #define CIRCLE_RESOLUTION 32 @@ -84,8 +84,8 @@ static void button2d_geom_draw_backdrop( { GPU_line_width(gz->line_width); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -137,12 +137,12 @@ static void button2d_draw_intern( if (draw_options & ED_GIZMO_BUTTON_SHOW_HELPLINE) { float matrix_final_no_offset[4][4]; WM_gizmo_calc_matrix_final_no_offset(gz, matrix_final_no_offset); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(color); GPU_line_width(gz->line_width); immUniformColor4fv(color); - immBegin(GWN_PRIM_LINE_STRIP, 2); + immBegin(GPU_PRIM_LINE_STRIP, 2); immVertex3fv(pos, matrix_final[3]); immVertex3fv(pos, matrix_final_no_offset[3]); immEnd(); @@ -177,9 +177,9 @@ static void button2d_draw_intern( GPU_line_width(1.0f); for (uint i = 0; i < ARRAY_SIZE(button->shape_batch) && button->shape_batch[i]; i++) { /* Invert line color for wire. */ - GWN_batch_program_set_builtin(button->shape_batch[i], GPU_SHADER_2D_UNIFORM_COLOR); - GWN_batch_uniform_4f(button->shape_batch[i], "color", UNPACK4(color)); - GWN_batch_draw(button->shape_batch[i]); + GPU_batch_program_set_builtin(button->shape_batch[i], GPU_SHADER_2D_UNIFORM_COLOR); + GPU_batch_uniform_4f(button->shape_batch[i], "color", UNPACK4(color)); + GPU_batch_draw(button->shape_batch[i]); if (draw_options & ED_GIZMO_BUTTON_SHOW_OUTLINE) { color[0] = 1.0f - color[0]; @@ -270,7 +270,7 @@ static void gizmo_button2d_free(wmGizmo *gz) ButtonGizmo2D *shape = (ButtonGizmo2D *)gz; for (uint i = 0; i < ARRAY_SIZE(shape->shape_batch); i++) { - GWN_BATCH_DISCARD_SAFE(shape->shape_batch[i]); + GPU_BATCH_DISCARD_SAFE(shape->shape_batch[i]); } } diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c index 5e3b7bb21c6..2869b93a790 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c @@ -136,12 +136,12 @@ static void gizmo_rect_pivot_from_scale_part(int part, float r_pt[2], bool r_con static void cage2d_draw_box_corners( const rctf *r, const float margin[2], const float color[3]) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3fv(color); - immBegin(GWN_PRIM_LINES, 16); + immBegin(GPU_PRIM_LINES, 16); immVertex2f(pos, r->xmin, r->ymin + margin[1]); immVertex2f(pos, r->xmin, r->ymin); @@ -176,7 +176,7 @@ static void cage2d_draw_box_interaction( /* 4 verts for translate, otherwise only 3 are used. */ float verts[4][2]; uint verts_len = 0; - Gwn_PrimType prim_type = GWN_PRIM_NONE; + GPUPrimType prim_type = GPU_PRIM_NONE; switch (highlighted) { case ED_GIZMO_CAGE2D_PART_SCALE_MIN_X: @@ -192,10 +192,10 @@ static void cage2d_draw_box_interaction( ARRAY_SET_ITEMS(verts[2], r.xmax, r.ymax); ARRAY_SET_ITEMS(verts[3], r.xmax, r.ymin); verts_len += 2; - prim_type = GWN_PRIM_TRI_FAN; + prim_type = GPU_PRIM_TRI_FAN; } else { - prim_type = GWN_PRIM_LINE_STRIP; + prim_type = GPU_PRIM_LINE_STRIP; } break; } @@ -212,10 +212,10 @@ static void cage2d_draw_box_interaction( ARRAY_SET_ITEMS(verts[2], r.xmin, r.ymax); ARRAY_SET_ITEMS(verts[3], r.xmin, r.ymin); verts_len += 2; - prim_type = GWN_PRIM_TRI_FAN; + prim_type = GPU_PRIM_TRI_FAN; } else { - prim_type = GWN_PRIM_LINE_STRIP; + prim_type = GPU_PRIM_LINE_STRIP; } break; } @@ -232,10 +232,10 @@ static void cage2d_draw_box_interaction( ARRAY_SET_ITEMS(verts[2], r.xmax, r.ymax); ARRAY_SET_ITEMS(verts[3], r.xmin, r.ymax); verts_len += 2; - prim_type = GWN_PRIM_TRI_FAN; + prim_type = GPU_PRIM_TRI_FAN; } else { - prim_type = GWN_PRIM_LINE_STRIP; + prim_type = GPU_PRIM_LINE_STRIP; } break; } @@ -252,10 +252,10 @@ static void cage2d_draw_box_interaction( ARRAY_SET_ITEMS(verts[2], r.xmax, r.ymin); ARRAY_SET_ITEMS(verts[3], r.xmin, r.ymin); verts_len += 2; - prim_type = GWN_PRIM_TRI_FAN; + prim_type = GPU_PRIM_TRI_FAN; } else { - prim_type = GWN_PRIM_LINE_STRIP; + prim_type = GPU_PRIM_LINE_STRIP; } break; } @@ -272,10 +272,10 @@ static void cage2d_draw_box_interaction( if (is_solid) { ARRAY_SET_ITEMS(verts[3], r.xmin, r.ymin); verts_len += 1; - prim_type = GWN_PRIM_TRI_FAN; + prim_type = GPU_PRIM_TRI_FAN; } else { - prim_type = GWN_PRIM_LINE_STRIP; + prim_type = GPU_PRIM_LINE_STRIP; } break; } @@ -292,10 +292,10 @@ static void cage2d_draw_box_interaction( if (is_solid) { ARRAY_SET_ITEMS(verts[3], r.xmin, r.ymax); verts_len += 1; - prim_type = GWN_PRIM_TRI_FAN; + prim_type = GPU_PRIM_TRI_FAN; } else { - prim_type = GWN_PRIM_LINE_STRIP; + prim_type = GPU_PRIM_LINE_STRIP; } break; } @@ -312,10 +312,10 @@ static void cage2d_draw_box_interaction( if (is_solid) { ARRAY_SET_ITEMS(verts[3], r.xmax, r.ymin); verts_len += 1; - prim_type = GWN_PRIM_TRI_FAN; + prim_type = GPU_PRIM_TRI_FAN; } else { - prim_type = GWN_PRIM_LINE_STRIP; + prim_type = GPU_PRIM_LINE_STRIP; } break; } @@ -332,10 +332,10 @@ static void cage2d_draw_box_interaction( if (is_solid) { ARRAY_SET_ITEMS(verts[3], r.xmax, r.ymax); verts_len += 1; - prim_type = GWN_PRIM_TRI_FAN; + prim_type = GPU_PRIM_TRI_FAN; } else { - prim_type = GWN_PRIM_LINE_STRIP; + prim_type = GPU_PRIM_LINE_STRIP; } break; } @@ -355,10 +355,10 @@ static void cage2d_draw_box_interaction( ARRAY_SET_ITEMS(verts[3], r_rotate.xmax, r_rotate.ymin); verts_len = 4; if (is_solid) { - prim_type = GWN_PRIM_TRI_FAN; + prim_type = GPU_PRIM_TRI_FAN; } else { - prim_type = GWN_PRIM_LINE_STRIP; + prim_type = GPU_PRIM_LINE_STRIP; } break; } @@ -371,10 +371,10 @@ static void cage2d_draw_box_interaction( ARRAY_SET_ITEMS(verts[3], margin[0] / 2, -margin[1] / 2); verts_len = 4; if (is_solid) { - prim_type = GWN_PRIM_TRI_FAN; + prim_type = GPU_PRIM_TRI_FAN; } else { - prim_type = GWN_PRIM_LINES; + prim_type = GPU_PRIM_LINES; } } else { @@ -385,12 +385,12 @@ static void cage2d_draw_box_interaction( ARRAY_SET_ITEMS(verts[3], size[0], -size[1]); verts_len = 4; if (is_solid) { - prim_type = GWN_PRIM_TRI_FAN; + prim_type = GPU_PRIM_TRI_FAN; } else { /* unreachable */ BLI_assert(0); - prim_type = GWN_PRIM_LINE_STRIP; + prim_type = GPU_PRIM_LINE_STRIP; } } break; @@ -398,20 +398,20 @@ static void cage2d_draw_box_interaction( return; } - BLI_assert(prim_type != GWN_PRIM_NONE); + BLI_assert(prim_type != GPU_PRIM_NONE); - Gwn_VertFormat *format = immVertexFormat(); + GPUVertFormat *format = immVertexFormat(); struct { uint pos, col; } attr_id = { - .pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT), - .col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT), + .pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT), + .col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT), }; immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); { if (is_solid) { - BLI_assert(ELEM(prim_type, GWN_PRIM_TRI_FAN)); + BLI_assert(ELEM(prim_type, GPU_PRIM_TRI_FAN)); immBegin(prim_type, verts_len); immAttrib3f(attr_id.col, 0.0f, 0.0f, 0.0f); for (uint i = 0; i < verts_len; i++) { @@ -420,7 +420,7 @@ static void cage2d_draw_box_interaction( immEnd(); } else { - BLI_assert(ELEM(prim_type, GWN_PRIM_LINE_STRIP, GWN_PRIM_LINES)); + BLI_assert(ELEM(prim_type, GPU_PRIM_LINE_STRIP, GPU_PRIM_LINES)); GPU_line_width(line_width + 3.0f); immBegin(prim_type, verts_len); @@ -455,7 +455,7 @@ static void cage2d_draw_box_interaction( static void imm_draw_point_aspect_2d( uint pos, float x, float y, float rad_x, float rad_y, bool solid) { - immBegin(solid ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, 4); + immBegin(solid ? GPU_PRIM_TRI_FAN : GPU_PRIM_LINE_LOOP, 4); immVertex2f(pos, x - rad_x, y - rad_y); immVertex2f(pos, x - rad_x, y + rad_y); immVertex2f(pos, x + rad_x, y + rad_y); @@ -467,12 +467,12 @@ static void cage2d_draw_circle_wire( const rctf *r, const float margin[2], const float color[3], const int transform_flag, const int draw_options) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3fv(color); - immBegin(GWN_PRIM_LINE_LOOP, 4); + immBegin(GPU_PRIM_LINE_LOOP, 4); immVertex2f(pos, r->xmin, r->ymin); immVertex2f(pos, r->xmax, r->ymin); immVertex2f(pos, r->xmax, r->ymax); @@ -480,7 +480,7 @@ static void cage2d_draw_circle_wire( immEnd(); if (transform_flag & ED_GIZMO_CAGE2D_XFORM_FLAG_ROTATE) { - immBegin(GWN_PRIM_LINE_LOOP, 2); + immBegin(GPU_PRIM_LINE_LOOP, 2); immVertex2f(pos, BLI_rctf_cent_x(r), r->ymax); immVertex2f(pos, BLI_rctf_cent_x(r), r->ymax + margin[1]); immEnd(); @@ -491,7 +491,7 @@ static void cage2d_draw_circle_wire( const float rad[2] = {margin[0] / 2, margin[1] / 2}; const float center[2] = {BLI_rctf_cent_x(r), BLI_rctf_cent_y(r)}; - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, center[0] - rad[0], center[1] - rad[1]); immVertex2f(pos, center[0] + rad[0], center[1] + rad[1]); immVertex2f(pos, center[0] + rad[0], center[1] - rad[1]); @@ -508,7 +508,7 @@ static void cage2d_draw_circle_handles( const int transform_flag, bool solid) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); void (*circle_fn)(uint, float, float, float, float, int) = (solid) ? imm_draw_circle_fill_aspect_2d : imm_draw_circle_wire_aspect_2d; const int resolu = 12; @@ -560,7 +560,7 @@ static void gizmo_cage2d_draw_intern( /* Handy for quick testing draw (if it's outside bounds). */ if (false) { GPU_blend(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv((const float[4]){1, 1, 1, 0.5f}); float s = 0.5f; diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c index 9cad82619ba..0f1d309c927 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c @@ -150,7 +150,7 @@ static void gizmo_rect_pivot_from_scale_part(int part, float r_pt[3], bool r_con static void cage3d_draw_box_corners( const float r[3], const float margin[3], const float color[3]) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); UNUSED_VARS(margin); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -185,7 +185,7 @@ static void cage3d_draw_box_interaction( const float rad[3] = {margin[0] / 3, margin[1] / 3, margin[2] / 3}; { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3fv(color); imm_draw_cube_fill_3d(pos, co, rad); @@ -217,7 +217,7 @@ static void cage3d_draw_circle_wire( const float r[3], const float margin[3], const float color[3], const int transform_flag, const int draw_options) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3fv(color); @@ -230,7 +230,7 @@ static void cage3d_draw_circle_wire( const float rad[2] = {margin[0] / 2, margin[1] / 2}; const float center[2] = {0.0f, 0.0f}; - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, center[0] - rad[0], center[1] - rad[1]); immVertex2f(pos, center[0] + rad[0], center[1] + rad[1]); immVertex2f(pos, center[0] + rad[0], center[1] - rad[1]); @@ -251,7 +251,7 @@ static void cage3d_draw_circle_handles( const float r[3], const float margin[3], const float color[3], bool solid, float scale) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); const float rad[3] = {margin[0] / 3, margin[1] / 3, margin[2] / 3}; immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -305,7 +305,7 @@ static void gizmo_cage3d_draw_intern( /* Handy for quick testing draw (if it's outside bounds). */ if (false) { GPU_blend(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv((const float[4]){1, 1, 1, 0.5f}); float s = 0.5f; diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c index 300ae222189..8e04703c14e 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c @@ -126,8 +126,8 @@ static void dial_geom_draw( GPU_line_width(gz->line_width); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); if (clip_plane) { immBindBuiltinProgram(GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR); @@ -164,13 +164,13 @@ static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[ GPU_matrix_push(); GPU_matrix_rotate_3f(RAD2DEGF(angle), 0.0f, 0.0f, -1.0f); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(color); - immBegin(GWN_PRIM_LINE_STRIP, 2); + immBegin(GPU_PRIM_LINE_STRIP, 2); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immVertex3fv(pos, co_outer); immEnd(); @@ -185,8 +185,8 @@ static void dial_ghostarc_draw( { const float width_inner = DIAL_WIDTH - gz->line_width * 0.5f / U.gizmo_size; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(color); imm_draw_disk_partial_fill_2d( diff --git a/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c index 840ea793b89..8d4db81c11f 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c @@ -105,8 +105,8 @@ static void grab_geom_draw( GPU_line_width(gz->line_width); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -121,7 +121,7 @@ static void grab_geom_draw( } } else if (draw_style == ED_GIZMO_GRAB_STYLE_CROSS_2D) { - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, 1.0f, 1.0f); immVertex2f(pos, -1.0f, -1.0f); diff --git a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c index b61c16b8d65..6443a6bf038 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c @@ -77,10 +77,10 @@ static void gizmo_primitive_draw_geom( } if (vert_count > 0) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - wm_gizmo_vec_draw(col_inner, verts, vert_count, pos, GWN_PRIM_TRI_FAN); - wm_gizmo_vec_draw(col_outer, verts, vert_count, pos, GWN_PRIM_LINE_LOOP); + wm_gizmo_vec_draw(col_inner, verts, vert_count, pos, GPU_PRIM_TRI_FAN); + wm_gizmo_vec_draw(col_outer, verts, vert_count, pos, GPU_PRIM_LINE_LOOP); immUnbindProgram(); } } diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index ec4310213ef..29b24886017 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -150,14 +150,14 @@ static void gp_draw_stroke_buffer_fill(const tGPspoint *points, int totpoints, f /* draw triangulation data */ if (tot_triangles > 0) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); + uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); /* Draw all triangles for filling the polygon */ - immBegin(GWN_PRIM_TRIS, tot_triangles * 3); + immBegin(GPU_PRIM_TRIS, tot_triangles * 3); /* TODO: use batch instead of immediate mode, to share vertices */ const tGPspoint *pt; @@ -208,9 +208,9 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short return; } - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); + uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); const tGPspoint *pt = points; @@ -218,7 +218,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short /* if drawing a single point, draw it larger */ GPU_point_size((float)(thickness + 2) * points->pressure); immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); gp_set_tpoint_varying_color(pt, ink, color); immVertex2iv(pos, &pt->x); } @@ -228,7 +228,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short /* draw stroke curve */ GPU_line_width(max_ff(oldpressure * thickness, 1.0)); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints); + immBeginAtMost(GPU_PRIM_LINE_STRIP, totpoints); /* TODO: implement this with a geometry shader to draw one continuous tapered stroke */ @@ -247,7 +247,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short draw_points = 0; GPU_line_width(max_ff(pt->pressure * thickness, 1.0f)); - immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - i + 1); + immBeginAtMost(GPU_PRIM_LINE_STRIP, totpoints - i + 1); /* need to roll-back one point to ensure that there are no gaps in the stroke */ if (i != 0) { @@ -319,14 +319,14 @@ static void gp_draw_stroke_volumetric_buffer(const tGPspoint *points, int totpoi if (dflag & (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_ONLYV2D)) return; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint size = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); + uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(GWN_PRIM_POINTS, totpoints); + immBegin(GPU_PRIM_POINTS, totpoints); const tGPspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { @@ -346,14 +346,14 @@ static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, int totpoints int offsx, int offsy, int winx, int winy, const float diff_mat[4][4], const float ink[4]) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint size = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); + uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(GWN_PRIM_POINTS, totpoints); + immBegin(GPU_PRIM_POINTS, totpoints); const bGPDspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { @@ -379,14 +379,14 @@ static void gp_draw_stroke_volumetric_3d( const bGPDspoint *points, int totpoints, short thickness, const float ink[4]) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - uint size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + uint size = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); + uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(GWN_PRIM_POINTS, totpoints); + immBegin(GPU_PRIM_POINTS, totpoints); const bGPDspoint *pt = points; for (int i = 0; i < totpoints && pt; i++, pt++) { @@ -519,18 +519,18 @@ static void gp_draw_stroke_fill( uint pos; if (gps->flag & GP_STROKE_3DSPACE) { - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); } else { - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); } immUniformColor4fv(color); /* Draw all triangles for filling the polygon (cache must be calculated before) */ - immBegin(GWN_PRIM_TRIS, gps->tot_triangles * 3); + immBegin(GPU_PRIM_TRIS, gps->tot_triangles * 3); /* TODO: use batch instead of immediate mode, to share vertices */ bGPDtriangle *stroke_triangle = gps->triangles; @@ -575,8 +575,8 @@ static void gp_draw_stroke_point( float fpt[3]; mul_v3_m4v3(fpt, diff_mat, &pt->x); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); if (sflag & GP_STROKE_3DSPACE) { immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); @@ -594,7 +594,7 @@ static void gp_draw_stroke_point( /* set point thickness (since there's only one of these) */ immUniform1f("size", (float)(thickness + 2) * pt->pressure); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex3fv(pos, fpt); immEnd(); @@ -617,9 +617,9 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi } - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); @@ -627,7 +627,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi /* draw stroke curve */ GPU_line_width(max_ff(curpressure * thickness, 1.0f)); - immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints + cyclic_add); + immBeginAtMost(GPU_PRIM_LINE_STRIP, totpoints + cyclic_add); const bGPDspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { gp_set_point_varying_color(pt, ink, color); @@ -648,7 +648,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi curpressure = pt->pressure; GPU_line_width(max_ff(curpressure * thickness, 1.0f)); - immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - i + 1 + cyclic_add); + immBeginAtMost(GPU_PRIM_LINE_STRIP, totpoints - i + 1 + cyclic_add); /* need to roll-back one point to ensure that there are no gaps in the stroke */ if (i != 0) { @@ -716,12 +716,12 @@ static void gp_draw_stroke_2d(const bGPDspoint *points, int totpoints, short thi int i; float fpt[3]; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + 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_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GWN_PRIM_TRI_STRIP, totpoints * 2 + 4); + immBegin(GPU_PRIM_TRI_STRIP, totpoints * 2 + 4); /* get x and y coordinates from first point */ mul_v3_m4v3(fpt, diff_mat, &points->x); @@ -1150,21 +1150,21 @@ static void gp_draw_strokes_edit( UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, selectColor); selectColor[3] = alpha; - Gwn_VertFormat *format = immVertexFormat(); + GPUVertFormat *format = immVertexFormat(); uint pos; /* specified later */ - uint size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint size = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); + uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); if (gps->flag & GP_STROKE_3DSPACE) { - pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); } else { - pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR); } - immBegin(GWN_PRIM_POINTS, gps->totpoints); + immBegin(GPU_PRIM_POINTS, gps->totpoints); /* Draw start and end point differently if enabled stroke direction hint */ bool show_direction_hint = (gpd->flag & GP_DATA_SHOW_DIRECTION) && (gps->totpoints > 1); diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index a8810df35ff..bd9bfcf7025 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -985,8 +985,8 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customda GP_EditBrush_Data *brush = gpsculpt_get_brush(CTX_data_scene(C)); if (brush) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_smooth(true); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index ec8a213301f..789e9865ae4 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1875,8 +1875,8 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr) tGPsdata *p = (tGPsdata *)p_ptr; if (p->paintmode == GP_PAINTMODE_ERASER) { - Gwn_VertFormat *format = immVertexFormat(); - const uint shdr_pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + const uint shdr_pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_smooth(true); diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index 9b0b2c970b2..64dee410526 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -109,7 +109,7 @@ typedef enum eKeyframeShapeDrawOpts { } eKeyframeShapeDrawOpts; /* draw simple diamond-shape keyframe */ -/* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND, immBegin(GWN_PRIM_POINTS, n), then call this n times */ +/* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND, immBegin(GPU_PRIM_POINTS, n), then call this n times */ void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type, short mode, float alpha, unsigned int pos_id, unsigned int size_id, unsigned int color_id, unsigned int outline_color_id); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index b1c3795b1af..6a304a8150e 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -130,19 +130,19 @@ void UI_draw_roundbox_aa(bool filled, float minx, float miny, float maxx, float /* WATCH: This is assuming the ModelViewProjectionMatrix is area pixel space. * If it has been scaled, then it's no longer valid. */ - Gwn_Batch *batch = ui_batch_roundbox_get(filled, true); - GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); - GWN_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&widget_params); - GWN_batch_draw(batch); + GPUBatch *batch = ui_batch_roundbox_get(filled, true); + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); + GPU_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&widget_params); + GPU_batch_draw(batch); } else { /* plain antialiased unfilled box */ GPU_line_smooth(true); - Gwn_Batch *batch = ui_batch_roundbox_get(filled, false); - GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); - GWN_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&widget_params); - GWN_batch_draw(batch); + GPUBatch *batch = ui_batch_roundbox_get(filled, false); + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); + GPU_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&widget_params); + GPU_batch_draw(batch); GPU_line_smooth(false); } @@ -159,8 +159,8 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float }; int a; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); /* mult */ for (a = 0; a < 7; a++) { @@ -176,7 +176,7 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(col); - immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_len); + immBegin(filled ? GPU_PRIM_TRI_FAN : GPU_PRIM_LINE_LOOP, vert_len); /* start with corner right-bottom */ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) { immVertex2f(pos, maxx - rad, miny); @@ -244,10 +244,10 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float .alpha_discard = 1.0f, }; - Gwn_Batch *batch = ui_batch_roundbox_get(filled, false); - GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); - GWN_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&widget_params); - GWN_batch_draw(batch); + GPUBatch *batch = ui_batch_roundbox_get(filled, false); + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); + GPU_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&widget_params); + GPU_batch_draw(batch); } #if 0 @@ -280,9 +280,9 @@ void UI_draw_roundbox_shade_x( int vert_count = 0; int a; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + 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, 4, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -304,7 +304,7 @@ void UI_draw_roundbox_shade_x( vert_count += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1; vert_count += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1; - immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_count); + immBegin(filled ? GPU_PRIM_TRI_FAN : GPU_PRIM_LINE_LOOP, vert_count); /* start with corner right-bottom */ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) { @@ -404,10 +404,10 @@ void UI_draw_roundbox_shade_x( .alpha_discard = 1.0f, }; - Gwn_Batch *batch = ui_batch_roundbox_get(filled, false); - GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); - GWN_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&widget_params); - GWN_batch_draw(batch); + GPUBatch *batch = ui_batch_roundbox_get(filled, false); + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); + GPU_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&widget_params); + GPU_batch_draw(batch); } #if 0 /* unused */ @@ -432,9 +432,9 @@ void UI_draw_roundbox_shade_y( mul_v2_fl(vec[a], rad); } - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + 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, 4, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -452,7 +452,7 @@ void UI_draw_roundbox_shade_y( vert_count += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1; vert_count += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1; - immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_count); + immBegin(filled ? GPU_PRIM_TRI_FAN : GPU_PRIM_LINE_LOOP, vert_count); /* start with corner right-bottom */ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) { @@ -535,8 +535,8 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo { int ofs_y = 4 * U.pixelsize; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color); @@ -550,9 +550,9 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo /* based on UI_draw_roundbox_gl_mode, check on making a version which allows us to skip some sides */ void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highlight[3], unsigned char highlight_fade[3]) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); /* add a 1px offset, looks nicer */ const int minx = rect->xmin + U.pixelsize, maxx = rect->xmax - U.pixelsize; const int miny = rect->ymin + U.pixelsize, maxy = rect->ymax - U.pixelsize; @@ -571,7 +571,7 @@ void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highligh } immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBeginAtMost(GWN_PRIM_LINE_STRIP, 25); + immBeginAtMost(GPU_PRIM_LINE_STRIP, 25); immAttrib3ubv(col, highlight); @@ -685,8 +685,8 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w * * \Note This functionn is to be used with the 2D dashed shader enabled. * - * \param pos is a PRIM_FLOAT, 2, GWN_FETCH_FLOAT vertex attrib - * \param line_origin is a PRIM_FLOAT, 2, GWN_FETCH_FLOAT vertex attrib + * \param pos is a PRIM_FLOAT, 2, GPU_FETCH_FLOAT vertex attrib + * \param line_origin is a PRIM_FLOAT, 2, GPU_FETCH_FLOAT vertex attrib * * The next 4 parameters are the offsets for the view, not the zones. */ @@ -749,7 +749,7 @@ static void histogram_draw_one( /* curve outline */ GPU_line_width(1.5); - immBegin(GWN_PRIM_LINE_STRIP, res); + immBegin(GPU_PRIM_LINE_STRIP, res); for (int i = 0; i < res; i++) { float x2 = x + i * (w / (float)res); immVertex2f(pos_attrib, x2, y + (data[i] * h)); @@ -758,7 +758,7 @@ static void histogram_draw_one( } else { /* under the curve */ - immBegin(GWN_PRIM_TRI_STRIP, res * 2); + immBegin(GPU_PRIM_TRI_STRIP, res * 2); immVertex2f(pos_attrib, x, y); immVertex2f(pos_attrib, x, y + (data[0] * h)); for (int i = 1; i < res; i++) { @@ -772,7 +772,7 @@ static void histogram_draw_one( immUniformColor4f(0.0f, 0.0f, 0.0f, 0.25f); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); - immBegin(GWN_PRIM_LINE_STRIP, res); + immBegin(GPU_PRIM_LINE_STRIP, res); for (int i = 0; i < res; i++) { float x2 = x + i * (w / (float)res); immVertex2f(pos_attrib, x2, y + (data[i] * h)); @@ -818,8 +818,8 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -833,7 +833,7 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); } - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, rect.xmin, rect.ymin + fac * h); immVertex2f(pos, rect.xmax, rect.ymin + fac * h); @@ -869,21 +869,21 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS static void waveform_draw_one(float *waveform, int nbr, const float col[3]) { - Gwn_VertFormat format = {0}; - uint pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat format = {0}; + uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format); - GWN_vertbuf_data_alloc(vbo, nbr); + GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format); + GPU_vertbuf_data_alloc(vbo, nbr); - GWN_vertbuf_attr_fill(vbo, pos_id, waveform); + GPU_vertbuf_attr_fill(vbo, pos_id, waveform); - /* TODO store the Gwn_Batch inside the scope */ - Gwn_Batch *batch = GWN_batch_create_ex(GWN_PRIM_POINTS, vbo, NULL, GWN_BATCH_OWNS_VBO); - GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR); - GWN_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f); - GWN_batch_draw(batch); + /* TODO store the GPUBatch inside the scope */ + GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_POINTS, vbo, NULL, GPU_BATCH_OWNS_VBO); + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR); + GPU_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f); + GPU_batch_draw(batch); - GWN_batch_discard(batch); + GPU_batch_discard(batch); } void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) @@ -957,15 +957,15 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE GPU_blend(true); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f); /* draw grid lines here */ - immBegin(GWN_PRIM_LINES, 12); + immBegin(GPU_PRIM_LINES, 12); for (int i = 0; i < 6; i++) { immVertex2f(pos, rect.xmin + 22, yofs + (i * 0.2f) * h); @@ -976,7 +976,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE /* 3 vertical separation */ if (scopes->wavefrm_mode != SCOPES_WAVEFRM_LUMA) { - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); for (int i = 1; i < 3; i++) { immVertex2f(pos, rect.xmin + i * w3, rect.ymin); @@ -987,7 +987,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE } /* separate min max zone on the right */ - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, rect.xmin + w, rect.ymin); immVertex2f(pos, rect.xmin + w, rect.ymax); immEnd(); @@ -995,7 +995,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE /* 16-235-240 level in case of ITU-R BT601/709 */ immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f); if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)) { - immBegin(GWN_PRIM_LINES, 8); + immBegin(GPU_PRIM_LINES, 8); immVertex2f(pos, rect.xmin + 22, yofs + h * 16.0f / 255.0f); immVertex2f(pos, rect.xmax + 1, yofs + h * 16.0f / 255.0f); @@ -1013,7 +1013,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE } /* 7.5 IRE black point level for NTSC */ if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) { - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, rect.xmin, yofs + h * 0.075f); immVertex2f(pos, rect.xmax + 1, yofs + h * 0.075f); immEnd(); @@ -1042,7 +1042,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE CLAMP(min, rect.ymin, rect.ymax); CLAMP(max, rect.ymin, rect.ymax); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, rect.xmax - 3, min); immVertex2f(pos, rect.xmax - 3, max); immEnd(); @@ -1096,7 +1096,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE CLAMP(min, rect.ymin, rect.ymax); CLAMP(max, rect.ymin, rect.ymax); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, rect.xmin + w + 2 + c * 2, min); immVertex2f(pos, rect.xmin + w + 2 + c * 2, max); immEnd(); @@ -1140,7 +1140,7 @@ static void vectorscope_draw_target(unsigned int pos, float centerx, float cente immUniformColor4f(1.0f, 1.0f, 1.0f, 0.12f); dangle = DEG2RADF(2.5f); dampli = 2.5f / 200.0f; - immBegin(GWN_PRIM_LINE_LOOP, 4); + immBegin(GPU_PRIM_LINE_LOOP, 4); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle), polar_to_y(centery, diam, tampli + dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle), polar_to_y(centery, diam, tampli - dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle), polar_to_y(centery, diam, tampli - dampli, tangle - dangle)); @@ -1152,22 +1152,22 @@ static void vectorscope_draw_target(unsigned int pos, float centerx, float cente dampli = 0.2f * tampli; dangle2 = DEG2RADF(5.0f); dampli2 = 0.5f * dampli; - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle + dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle), polar_to_y(centery, diam, tampli + dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle - dangle2), polar_to_y(centery, diam, tampli + dampli, tangle + dangle - dangle2)); immEnd(); - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle + dangle), polar_to_y(centery, diam, tampli - dampli + dampli2, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle), polar_to_y(centery, diam, tampli - dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle - dangle2), polar_to_y(centery, diam, tampli - dampli, tangle + dangle - dangle2)); immEnd(); - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle - dangle), polar_to_y(centery, diam, tampli - dampli + dampli2, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle), polar_to_y(centery, diam, tampli - dampli, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli - dampli, tangle - dangle + dangle2)); immEnd(); - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle - dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle), polar_to_y(centery, diam, tampli + dampli, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli + dampli, tangle - dangle + dangle2)); @@ -1215,15 +1215,15 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f); /* draw grid elements */ /* cross */ - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, centerx - (diam * 0.5f) - 5, centery); immVertex2f(pos, centerx + (diam * 0.5f) + 5, centery); @@ -1236,7 +1236,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN /* circles */ for (int j = 0; j < 5; j++) { const int increment = 15; - immBegin(GWN_PRIM_LINE_LOOP, (int)(360 / increment)); + immBegin(GPU_PRIM_LINE_LOOP, (int)(360 / increment)); for (int i = 0; i <= 360 - increment; i += increment) { const float a = DEG2RADF((float)i); const float r = (j + 1) * 0.1f; @@ -1247,7 +1247,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN /* skin tone line */ immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery, diam, 0.5f, skin_rad)); immVertex2f(pos, polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery, diam, 0.1f, skin_rad)); immEnd(); @@ -1284,7 +1284,7 @@ static void ui_draw_colorband_handle_tri_hlight(unsigned int pos, float x1, floa { GPU_line_smooth(true); - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2f(pos, x1 + halfwidth, y1); immVertex2f(pos, x1, y1 + height); immVertex2f(pos, x1 - halfwidth, y1); @@ -1297,7 +1297,7 @@ static void ui_draw_colorband_handle_tri(unsigned int pos, float x1, float y1, f { glEnable(fill ? GL_POLYGON_SMOOTH : GL_LINE_SMOOTH); - immBegin(fill ? GWN_PRIM_TRIS : GWN_PRIM_LINE_LOOP, 3); + immBegin(fill ? GPU_PRIM_TRIS : GPU_PRIM_LINE_LOOP, 3); immVertex2f(pos, x1 + halfwidth, y1); immVertex2f(pos, x1, y1 + height); immVertex2f(pos, x1 - halfwidth, y1); @@ -1308,7 +1308,7 @@ static void ui_draw_colorband_handle_tri(unsigned int pos, float x1, float y1, f static void ui_draw_colorband_handle_box(unsigned int pos, float x1, float y1, float x2, float y2, bool fill) { - immBegin(fill ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, 4); + immBegin(fill ? GPU_PRIM_TRI_FAN : GPU_PRIM_LINE_LOOP, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x1, y2); immVertex2f(pos, x2, y2); @@ -1348,7 +1348,7 @@ static void ui_draw_colorband_handle( immUniformArray4fv("colors", (float *)(float[][4]){{0.8f, 0.8f, 0.8f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2); immUniform1f("dash_width", active ? 4.0f : 2.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(shdr_pos, x, y1); immVertex2f(shdr_pos, x, y2); immEnd(); @@ -1419,8 +1419,8 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti float sizey_solid = sizey * 0.25f; float y1 = rect->ymin; - Gwn_VertFormat *format = immVertexFormat(); - pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_CHECKER); /* Drawing the checkerboard. */ @@ -1432,8 +1432,8 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti /* New format */ format = immVertexFormat(); - pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - col_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + 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); /* layer: color ramp */ @@ -1447,7 +1447,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti v1[1] = y1 + sizey_solid; v2[1] = rect->ymax; - immBegin(GWN_PRIM_TRI_STRIP, (sizex + 1) * 2); + immBegin(GPU_PRIM_TRI_STRIP, (sizex + 1) * 2); for (int a = 0; a <= sizex; a++) { float pos = ((float)a) / sizex; BKE_colorband_evaluate(coba, pos, colf); @@ -1466,7 +1466,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti v1[1] = y1; v2[1] = y1 + sizey_solid; - immBegin(GWN_PRIM_TRI_STRIP, (sizex + 1) * 2); + immBegin(GPU_PRIM_TRI_STRIP, (sizex + 1) * 2); for (int a = 0; a <= sizex; a++) { float pos = ((float)a) / sizex; BKE_colorband_evaluate(coba, pos, colf); @@ -1487,7 +1487,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti /* New format */ format = immVertexFormat(); - pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* layer: box outline */ @@ -1498,14 +1498,14 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti GPU_blend(true); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos_id, x1, y1); immVertex2f(pos_id, x1 + sizex, y1); immEnd(); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.25f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos_id, x1, y1 - 1); immVertex2f(pos_id, x1 + sizex, y1 - 1); immEnd(); @@ -1558,18 +1558,18 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) GPU_matrix_translate_2f(rect->xmin + 0.5f * BLI_rcti_size_x(rect), rect->ymin + 0.5f * BLI_rcti_size_y(rect)); GPU_matrix_scale_1f(size); - Gwn_Batch *sphere = GPU_batch_preset_sphere(2); - GWN_batch_program_set_builtin(sphere, GPU_SHADER_SIMPLE_LIGHTING); - GWN_batch_uniform_4f(sphere, "color", diffuse[0], diffuse[1], diffuse[2], 1.0f); - GWN_batch_uniform_3fv(sphere, "light", light); - GWN_batch_draw(sphere); + GPUBatch *sphere = GPU_batch_preset_sphere(2); + GPU_batch_program_set_builtin(sphere, GPU_SHADER_SIMPLE_LIGHTING); + GPU_batch_uniform_4f(sphere, "color", diffuse[0], diffuse[1], diffuse[2], 1.0f); + GPU_batch_uniform_3fv(sphere, "light", light); + GPU_batch_draw(sphere); /* restore */ glDisable(GL_CULL_FACE); /* AA circle */ - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv((unsigned char *)wcol->inner); @@ -1599,7 +1599,7 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo floorf((rect->xmax - fx) / dx) + 1.0f + floorf((rect->ymax - fy) / dy) + 1.0f); - immBegin(GWN_PRIM_LINES, (int)line_count * 2); + immBegin(GPU_PRIM_LINES, (int)line_count * 2); while (fx < rect->xmax) { immVertex2f(pos, fx, rect->ymin); immVertex2f(pos, fx, rect->ymax); @@ -1675,8 +1675,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti GPU_line_width(1.0f); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* backdrop */ @@ -1712,7 +1712,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 1.0f); /* axes */ gl_shaded_color((unsigned char *)wcol->inner, -50); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, rect->xmin, rect->ymin + zoomy * (-offsy)); immVertex2f(pos, rect->xmax, rect->ymin + zoomy * (-offsy)); immVertex2f(pos, rect->xmin + zoomx * (-offsx), rect->ymin); @@ -1725,7 +1725,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti #if 0 if (cumap->flag & CUMA_DRAW_CFRA) { immUniformColor3ub(0x60, 0xc0, 0x40); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymin); immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymax); immEnd(); @@ -1734,7 +1734,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti /* sample option */ if (cumap->flag & CUMA_DRAW_SAMPLE) { - immBegin(GWN_PRIM_LINES, 2); /* will draw one of the following 3 lines */ + immBegin(GPU_PRIM_LINES, 2); /* will draw one of the following 3 lines */ if (but->a1 == UI_GRAD_H) { float tsample[3]; float hsv[3]; @@ -1770,7 +1770,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti immUniformColor3ubv((unsigned char *)wcol->item); GPU_line_smooth(true); GPU_blend(true); - immBegin(GWN_PRIM_LINE_STRIP, (CM_TABLE + 1) + 2); + immBegin(GPU_PRIM_LINE_STRIP, (CM_TABLE + 1) + 2); if (cuma->table == NULL) curvemapping_changed(cumap, false); @@ -1807,13 +1807,13 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti /* the points, use aspect to make them visible on edges */ format = immVertexFormat(); - pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); cmp = cuma->curve; GPU_point_size(3.0f); - immBegin(GWN_PRIM_POINTS, cuma->totpoint); + immBegin(GPU_PRIM_POINTS, cuma->totpoint); for (int a = 0; a < cuma->totpoint; a++) { float color[4]; if (cmp[a].flag & CUMA_SELECT) @@ -1833,7 +1833,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti /* outline */ format = immVertexFormat(); - pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv((unsigned char *)wcol->outline); @@ -1926,16 +1926,16 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U BLI_rctf_size_x(&rect), BLI_rctf_size_y(&rect)); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); UI_GetThemeColor4fv(TH_SEL_MARKER, col_sel); UI_GetThemeColor4fv(TH_MARKER_OUTLINE, col_outline); /* Do stipple cross with geometry */ - immBegin(GWN_PRIM_LINES, 7 * 2 * 2); + immBegin(GPU_PRIM_LINES, 7 * 2 * 2); float pos_sel[8] = {-10.0f, -7.0f, -4.0f, -1.0f, 2.0f, 5.0f, 8.0f, 11.0f}; for (int axe = 0; axe < 2; ++axe) { for (int i = 0; i < 7; ++i) { @@ -2018,13 +2018,13 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol float x = 0.5f * (recti->xmin + recti->xmax); float y = 0.5f * (recti->ymin + recti->ymax); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(but->col); GPU_blend(true); - immBegin(GWN_PRIM_TRI_FAN, 16); + immBegin(GPU_PRIM_TRI_FAN, 16); for (int a = 0; a < 16; a++) immVertex2f(pos, x + size * si[a], y + size * co[a]); immEnd(); @@ -2032,7 +2032,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol immUniformColor4ub(0, 0, 0, 150); GPU_line_width(1); GPU_line_smooth(true); - immBegin(GWN_PRIM_LINE_LOOP, 16); + immBegin(GPU_PRIM_LINE_LOOP, 16); for (int a = 0; a < 16; a++) immVertex2f(pos, x + size * si[a], y + size * co[a]); immEnd(); @@ -2115,13 +2115,13 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, { GPU_blend(true); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + 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_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(GWN_PRIM_TRIS, 54); + immBegin(GPU_PRIM_TRIS, 54); /* accumulated outline boxes to make shade not linear, is more pleasant */ ui_shadowbox(pos, color, minx, miny, maxx, maxy, 11.0, (20 * alpha) >> 8); @@ -2186,11 +2186,11 @@ void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha .alpha_discard = 1.0f, }; - Gwn_Batch *batch = ui_batch_roundbox_shadow_get(); - GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_SHADOW); - GWN_batch_uniform_4fv_array(batch, "parameters", 4, (float *)&widget_params); - GWN_batch_uniform_1f(batch, "alpha", 1.0f - visibility); - GWN_batch_draw(batch); + GPUBatch *batch = ui_batch_roundbox_shadow_get(); + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_SHADOW); + GPU_batch_uniform_4fv_array(batch, "parameters", 4, (float *)&widget_params); + GPU_batch_uniform_1f(batch, "alpha", 1.0f - visibility); + GPU_batch_draw(batch); /* outline emphasis */ GPU_line_smooth(true); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index b9183461b4c..22b82898288 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -250,11 +250,11 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float viconutil_set_point(pts[1], cx - d2, cy - d); viconutil_set_point(pts[2], cx + d2, cy); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.2f, 0.2f, 0.2f, alpha); - immBegin(GWN_PRIM_TRIS, 3); + immBegin(GPU_PRIM_TRIS, 3); immVertex2iv(pos, pts[0]); immVertex2iv(pos, pts[1]); immVertex2iv(pos, pts[2]); @@ -280,15 +280,15 @@ static void vicon_keytype_draw_wrapper(int x, int y, int w, int h, float alpha, int xco = x + w / 2; int yco = y + h / 2; - Gwn_VertFormat *format = immVertexFormat(); - uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - uint color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); - uint outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint size_id = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); + uint color_id = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); + uint outline_color_id = GPU_vertformat_attr_add(format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); /* draw keyframe * - size: 0.6 * h (found out experimentally... dunno why!) @@ -343,7 +343,7 @@ static void vicon_colorset_draw(int index, int x, int y, int w, int h, float UNU const int b = x + w / 3 * 2; const int c = x + w; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* XXX: Include alpha into this... */ @@ -1262,7 +1262,7 @@ static void icon_draw_cache_flush_ex(void) glUniform1i(img_loc, 0); glUniform4fv(data_loc, ICON_DRAW_CACHE_SIZE * 3, (float *)g_icon_draw_cache.drawcall_cache); - GWN_draw_primitive(GWN_PRIM_TRIS, 6 * g_icon_draw_cache.calls); + GPU_draw_primitive(GPU_PRIM_TRIS, 6 * g_icon_draw_cache.calls); glBindTexture(GL_TEXTURE_2D, 0); @@ -1342,14 +1342,14 @@ static void icon_draw_texture( GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_RECT_COLOR); GPU_shader_bind(shader); - if (rgb) glUniform4f(GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_COLOR), rgb[0], rgb[1], rgb[2], alpha); - else glUniform4f(GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_COLOR), alpha, alpha, alpha, alpha); + if (rgb) glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), rgb[0], rgb[1], rgb[2], alpha); + else glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), alpha, alpha, alpha, alpha); glUniform1i(GPU_shader_get_uniform(shader, "image"), 0); glUniform4f(GPU_shader_get_uniform(shader, "rect_icon"), x1, y1, x2, y2); glUniform4f(GPU_shader_get_uniform(shader, "rect_geom"), x, y, x + w, y + h); - GWN_draw_primitive(GWN_PRIM_TRI_STRIP, 4); + GPU_draw_primitive(GPU_PRIM_TRI_STRIP, 4); glBindTexture(GL_TEXTURE_2D, 0); } diff --git a/source/blender/editors/interface/interface_icons_event.c b/source/blender/editors/interface/interface_icons_event.c index dc444b98b2c..fabf5f9bf48 100644 --- a/source/blender/editors/interface/interface_icons_event.c +++ b/source/blender/editors/interface/interface_icons_event.c @@ -136,8 +136,8 @@ static void icon_draw_rect_input_line_prim( { glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - BLI_assert(ELEM(prim, GWN_PRIM_LINE_LOOP, GWN_PRIM_LINE_STRIP)); - const uint pos_id = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + BLI_assert(ELEM(prim, GPU_PRIM_LINE_LOOP, GPU_PRIM_LINE_STRIP)); + const uint pos_id = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color); immBegin(prim, lines_len); @@ -289,7 +289,7 @@ void icon_draw_rect_input( else if (event_type == SPACEKEY) { const uchar lines[] = {60, 118, 60, 60, 195, 60, 195, 118}; icon_draw_rect_input_line_prim( - &rect, color, GWN_PRIM_LINE_STRIP, + &rect, color, GPU_PRIM_LINE_STRIP, (const void *)lines, ARRAY_SIZE(lines) / 2); } } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index ffc389c6dfd..f0060cd5758 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -752,9 +752,9 @@ enum { ROUNDBOX_TRIA_MAX, /* don't use */ }; -struct Gwn_Batch *ui_batch_roundbox_get(bool filled, bool antialiased); -struct Gwn_Batch *ui_batch_roundbox_widget_get(int tria); -struct Gwn_Batch *ui_batch_roundbox_shadow_get(void); +struct GPUBatch *ui_batch_roundbox_get(bool filled, bool antialiased); +struct GPUBatch *ui_batch_roundbox_widget_get(int tria); +struct GPUBatch *ui_batch_roundbox_shadow_get(void); void ui_draw_anti_tria_rect(const rctf *rect, char dir, const float color[4]); void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 79d92eedfa3..59fdf7e672d 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -478,7 +478,7 @@ static void ui_draw_anti_x(unsigned int pos, float x1, float y1, float x2, float GPU_line_width(2.0); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x2, y2); @@ -519,7 +519,7 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect) GPU_blend(true); immUniformColor4ub(255, 255, 255, 50); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, xmin, ymin); immVertex2f(pos, xmax, ymax); @@ -531,7 +531,7 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect) immUniformColor4ub(0, 0, 0, 50); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, xmin, ymin + 1); immVertex2f(pos, xmax, ymax + 1); @@ -584,7 +584,7 @@ static void ui_draw_panel_dragwidget(unsigned int pos, unsigned int col, const r UI_GetThemeColorShade4fv(TH_PANEL_BACK, -col_tint, col_dark); /* draw multiple boxes */ - immBegin(GWN_PRIM_TRIS, 4 * 2 * (6 * 2)); + immBegin(GPU_PRIM_TRIS, 4 * 2 * (6 * 2)); for (i_x = 0; i_x < 4; i_x++) { for (i_y = 0; i_y < 2; i_y++) { const int x_co = (x_min + x_ofs) + (i_x * (box_size + box_margin)); @@ -677,7 +677,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con titlerect.xmin += 5.0f / block->aspect; } - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); if (!is_subpanel) { @@ -691,7 +691,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con immUniformThemeColor(TH_PANEL_HEADER); immRectf(pos, minx, headrect.ymin, maxx, y); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, minx, y); immVertex2f(pos, maxx, y); @@ -729,9 +729,9 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con if (show_drag) { uint col; - Gwn_VertFormat *format = immVertexFormat(); - pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); /* itemrect smaller */ itemrect.xmax = headrect.xmax - 5.0f / block->aspect; @@ -745,7 +745,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con immUnbindProgram(); /* Restore format for the following draws. */ - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); } } @@ -758,7 +758,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con else if (is_closed_x) { /* draw vertical title */ ui_draw_aligned_panel_header(style, block, &headrect, 'v'); - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); } /* an open panel */ else { @@ -1700,9 +1700,9 @@ static void ui_panel_category_draw_tab( {0.98, 0.805}}; int a; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + 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_U8, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); /* mult */ for (a = 0; a < 4; a++) { @@ -1724,7 +1724,7 @@ static void ui_panel_category_draw_tab( immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_STRIP, vert_len); + immBegin(filled ? GPU_PRIM_TRI_FAN : GPU_PRIM_LINE_STRIP, vert_len); /* start with corner right-top */ if (use_highlight) { @@ -1929,7 +1929,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) /* begin drawing */ GPU_line_smooth(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw the background */ @@ -1991,7 +1991,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) /* tab blackline */ if (!is_active) { - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(theme_col_tab_divider); @@ -2022,7 +2022,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) GPU_blend(false); /* tab blackline remaining (last tab) */ - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); if (pc_dyn->prev == NULL) { immUniformColor3ubv(theme_col_tab_divider); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index aa3106b135b..52e6e237a58 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -247,22 +247,22 @@ static const int tria_vcount[ROUNDBOX_TRIA_MAX] = { }; static struct { - Gwn_Batch *roundbox_widget[ROUNDBOX_TRIA_MAX]; + GPUBatch *roundbox_widget[ROUNDBOX_TRIA_MAX]; - Gwn_Batch *roundbox_simple; - Gwn_Batch *roundbox_simple_aa; - Gwn_Batch *roundbox_simple_outline; - Gwn_Batch *roundbox_shadow; + GPUBatch *roundbox_simple; + GPUBatch *roundbox_simple_aa; + GPUBatch *roundbox_simple_outline; + GPUBatch *roundbox_shadow; - Gwn_VertFormat format; + GPUVertFormat format; uint vflag_id; } g_ui_batch_cache = {{0}}; -static Gwn_VertFormat *vflag_format(void) +static GPUVertFormat *vflag_format(void) { if (g_ui_batch_cache.format.attr_len == 0) { - Gwn_VertFormat *format = &g_ui_batch_cache.format; - g_ui_batch_cache.vflag_id = GWN_vertformat_attr_add(format, "vflag", GWN_COMP_U32, 1, GWN_FETCH_INT); + GPUVertFormat *format = &g_ui_batch_cache.format; + g_ui_batch_cache.vflag_id = GPU_vertformat_attr_add(format, "vflag", GPU_COMP_U32, 1, GPU_FETCH_INT); } return &g_ui_batch_cache.format; } @@ -273,17 +273,17 @@ static Gwn_VertFormat *vflag_format(void) #define NO_AA WIDGET_AA_JITTER static void set_roundbox_vertex_data( - Gwn_VertBufRaw *vflag_step, uint32_t d) + GPUVertBufRaw *vflag_step, uint32_t d) { - uint32_t *data = GWN_vertbuf_raw_step(vflag_step); + uint32_t *data = GPU_vertbuf_raw_step(vflag_step); *data = d; } static uint32_t set_roundbox_vertex( - Gwn_VertBufRaw *vflag_step, + GPUVertBufRaw *vflag_step, int corner_id, int corner_v, int jit_v, bool inner, bool emboss, int color) { - uint32_t *data = GWN_vertbuf_raw_step(vflag_step); + uint32_t *data = GPU_vertbuf_raw_step(vflag_step); *data = corner_id; *data |= corner_v << 2; *data |= jit_v << 6; @@ -294,10 +294,10 @@ static uint32_t set_roundbox_vertex( } static uint32_t set_tria_vertex( - Gwn_VertBufRaw *vflag_step, + GPUVertBufRaw *vflag_step, int tria_type, int tria_v, int tria_id, int jit_v) { - uint32_t *data = GWN_vertbuf_raw_step(vflag_step); + uint32_t *data = GPU_vertbuf_raw_step(vflag_step); if (ELEM(tria_type, ROUNDBOX_TRIA_ARROWS)) { tria_v += tria_id * tria_vcount[ROUNDBOX_TRIA_ARROWS]; } @@ -308,7 +308,7 @@ static uint32_t set_tria_vertex( return *data; } -static void roundbox_batch_add_tria(Gwn_VertBufRaw *vflag_step, int tria, uint32_t last_data) +static void roundbox_batch_add_tria(GPUVertBufRaw *vflag_step, int tria, uint32_t last_data) { const int tria_num = ELEM(tria, ROUNDBOX_TRIA_CHECK, ROUNDBOX_TRIA_HOLD_ACTION_ARROW, ROUNDBOX_TRIA_MENU) ? 1 : 2; /* for each tria */ @@ -324,12 +324,12 @@ static void roundbox_batch_add_tria(Gwn_VertBufRaw *vflag_step, int tria, uint32 } } -Gwn_Batch *ui_batch_roundbox_widget_get(int tria) +GPUBatch *ui_batch_roundbox_widget_get(int tria) { if (g_ui_batch_cache.roundbox_widget[tria] == NULL) { uint32_t last_data; - Gwn_VertBufRaw vflag_step; - Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(vflag_format()); + GPUVertBufRaw vflag_step; + GPUVertBuf *vbo = GPU_vertbuf_create_with_format(vflag_format()); int vcount = WIDGET_SIZE_MAX; /* inner */ vcount += 2; /* restart */ vcount += ((WIDGET_SIZE_MAX + 1) * 2) * WIDGET_AA_JITTER; /* outline (edges) */ @@ -341,8 +341,8 @@ Gwn_Batch *ui_batch_roundbox_widget_get(int tria) vcount += (tria_vcount[tria] + 2) * WIDGET_AA_JITTER; /* tria2 */ } } - GWN_vertbuf_data_alloc(vbo, vcount); - GWN_vertbuf_attr_get_raw_data(vbo, g_ui_batch_cache.vflag_id, &vflag_step); + GPU_vertbuf_data_alloc(vbo, vcount); + GPU_vertbuf_attr_get_raw_data(vbo, g_ui_batch_cache.vflag_id, &vflag_step); /* Inner */ for (int c1 = 0, c2 = 3; c1 < 2; c1++, c2--) { for (int a1 = 0, a2 = WIDGET_CURVE_RESOLU -1; a2 >= 0; a1++, a2--) { @@ -383,15 +383,15 @@ Gwn_Batch *ui_batch_roundbox_widget_get(int tria) if (tria) { roundbox_batch_add_tria(&vflag_step, tria, last_data); } - g_ui_batch_cache.roundbox_widget[tria] = GWN_batch_create_ex(GWN_PRIM_TRI_STRIP, vbo, NULL, GWN_BATCH_OWNS_VBO); + g_ui_batch_cache.roundbox_widget[tria] = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, NULL, GPU_BATCH_OWNS_VBO); gpu_batch_presets_register(g_ui_batch_cache.roundbox_widget[tria]); } return g_ui_batch_cache.roundbox_widget[tria]; } -Gwn_Batch *ui_batch_roundbox_get(bool filled, bool antialiased) +GPUBatch *ui_batch_roundbox_get(bool filled, bool antialiased) { - Gwn_Batch **batch = NULL; + GPUBatch **batch = NULL; if (filled) { if (antialiased) @@ -408,13 +408,13 @@ Gwn_Batch *ui_batch_roundbox_get(bool filled, bool antialiased) if (*batch == NULL) { uint32_t last_data; - Gwn_VertBufRaw vflag_step; - Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(vflag_format()); + GPUVertBufRaw vflag_step; + GPUVertBuf *vbo = GPU_vertbuf_create_with_format(vflag_format()); int vcount = WIDGET_SIZE_MAX; vcount += (filled) ? 2 : 0; vcount *= (antialiased) ? WIDGET_AA_JITTER : 1; - GWN_vertbuf_data_alloc(vbo, vcount); - GWN_vertbuf_attr_get_raw_data(vbo, g_ui_batch_cache.vflag_id, &vflag_step); + GPU_vertbuf_data_alloc(vbo, vcount); + GPU_vertbuf_attr_get_raw_data(vbo, g_ui_batch_cache.vflag_id, &vflag_step); if (filled) { for (int j = 0; j < WIDGET_AA_JITTER; j++) { @@ -435,7 +435,7 @@ Gwn_Batch *ui_batch_roundbox_get(bool filled, bool antialiased) break; } } - *batch = GWN_batch_create_ex(GWN_PRIM_TRI_STRIP, vbo, NULL, GWN_BATCH_OWNS_VBO); + *batch = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, NULL, GPU_BATCH_OWNS_VBO); } else { for (int j = 0; j < WIDGET_AA_JITTER; j++) { @@ -451,7 +451,7 @@ Gwn_Batch *ui_batch_roundbox_get(bool filled, bool antialiased) break; } } - *batch = GWN_batch_create_ex(GWN_PRIM_LINE_LOOP, vbo, NULL, GWN_BATCH_OWNS_VBO); + *batch = GPU_batch_create_ex(GPU_PRIM_LINE_LOOP, vbo, NULL, GPU_BATCH_OWNS_VBO); } gpu_batch_presets_register(*batch); @@ -459,15 +459,15 @@ Gwn_Batch *ui_batch_roundbox_get(bool filled, bool antialiased) return *batch; } -Gwn_Batch *ui_batch_roundbox_shadow_get(void) +GPUBatch *ui_batch_roundbox_shadow_get(void) { if (g_ui_batch_cache.roundbox_shadow == NULL) { uint32_t last_data; - Gwn_VertBufRaw vflag_step; - Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(vflag_format()); + GPUVertBufRaw vflag_step; + GPUVertBuf *vbo = GPU_vertbuf_create_with_format(vflag_format()); int vcount = (WIDGET_SIZE_MAX + 1) * 2 + 2 + WIDGET_SIZE_MAX; - GWN_vertbuf_data_alloc(vbo, vcount); - GWN_vertbuf_attr_get_raw_data(vbo, g_ui_batch_cache.vflag_id, &vflag_step); + GPU_vertbuf_data_alloc(vbo, vcount); + GPU_vertbuf_attr_get_raw_data(vbo, g_ui_batch_cache.vflag_id, &vflag_step); for (int c = 0; c < 4; c++) { for (int a = 0; a < WIDGET_CURVE_RESOLU; a++) { @@ -488,7 +488,7 @@ Gwn_Batch *ui_batch_roundbox_shadow_get(void) set_roundbox_vertex(&vflag_step, c2, a2, NO_AA, true, false, INNER); } } - g_ui_batch_cache.roundbox_shadow = GWN_batch_create_ex(GWN_PRIM_TRI_STRIP, vbo, NULL, GWN_BATCH_OWNS_VBO); + g_ui_batch_cache.roundbox_shadow = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, NULL, GPU_BATCH_OWNS_VBO); gpu_batch_presets_register(g_ui_batch_cache.roundbox_shadow); } return g_ui_batch_cache.roundbox_shadow; @@ -513,11 +513,11 @@ void UI_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y GPU_blend(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(draw_color); - immBegin(GWN_PRIM_TRIS, 3 * WIDGET_AA_JITTER); + immBegin(GPU_PRIM_TRIS, 3 * WIDGET_AA_JITTER); /* for each AA step */ for (int j = 0; j < WIDGET_AA_JITTER; j++) { @@ -556,14 +556,14 @@ void UI_draw_anti_fan(float tri_array[][2], unsigned int length, const float col GPU_blend(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(draw_color); /* for each AA step */ for (int j = 0; j < WIDGET_AA_JITTER; j++) { - immBegin(GWN_PRIM_TRI_FAN, length); + immBegin(GPU_PRIM_TRI_FAN, length); immVertex2f(pos, tri_array[0][0], tri_array[0][1]); immVertex2f(pos, tri_array[1][0], tri_array[1][1]); @@ -1084,7 +1084,7 @@ static void widgetbase_set_uniform_colors_ubv( #define MAX_WIDGET_PARAMETERS 11 struct { - Gwn_Batch *batch; /* Batch type */ + GPUBatch *batch; /* Batch type */ uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]; int count; bool enabled; @@ -1097,22 +1097,22 @@ void UI_widgetbase_draw_cache_flush(void) if (g_widget_base_batch.count == 0) return; - Gwn_Batch *batch = g_widget_base_batch.batch; + GPUBatch *batch = g_widget_base_batch.batch; if (g_widget_base_batch.count == 1) { /* draw single */ - GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); - GWN_batch_uniform_4fv_array(batch, "parameters", MAX_WIDGET_PARAMETERS, (float *)g_widget_base_batch.params); - GWN_batch_uniform_3fv(batch, "checkerColorAndSize", checker_params); - GWN_batch_draw(batch); + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); + GPU_batch_uniform_4fv_array(batch, "parameters", MAX_WIDGET_PARAMETERS, (float *)g_widget_base_batch.params); + GPU_batch_uniform_3fv(batch, "checkerColorAndSize", checker_params); + GPU_batch_draw(batch); } else { - GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE_INST); - GWN_batch_uniform_4fv_array(batch, "parameters", MAX_WIDGET_PARAMETERS * MAX_WIDGET_BASE_BATCH, + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE_INST); + GPU_batch_uniform_4fv_array(batch, "parameters", MAX_WIDGET_PARAMETERS * MAX_WIDGET_BASE_BATCH, (float *)g_widget_base_batch.params); - GWN_batch_uniform_3fv(batch, "checkerColorAndSize", checker_params); + GPU_batch_uniform_3fv(batch, "checkerColorAndSize", checker_params); GPU_matrix_bind(batch->interface); - GWN_batch_draw_range_ex(batch, 0, g_widget_base_batch.count, true); - GWN_batch_program_use_end(batch); + GPU_batch_draw_range_ex(batch, 0, g_widget_base_batch.count, true); + GPU_batch_program_use_end(batch); } g_widget_base_batch.count = 0; } @@ -1135,7 +1135,7 @@ void UI_widgetbase_draw_cache_end(void) GPU_blend(false); } -static void draw_widgetbase_batch(Gwn_Batch *batch, uiWidgetBase *wtb) +static void draw_widgetbase_batch(GPUBatch *batch, uiWidgetBase *wtb) { wtb->uniform_params.tria1_size = wtb->tria1.size; wtb->uniform_params.tria2_size = wtb->tria2.size; @@ -1171,10 +1171,10 @@ static void draw_widgetbase_batch(Gwn_Batch *batch, uiWidgetBase *wtb) else { float checker_params[3] = {UI_ALPHA_CHECKER_DARK / 255.0f, UI_ALPHA_CHECKER_LIGHT / 255.0f, 8.0f}; /* draw single */ - GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); - GWN_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&wtb->uniform_params); - GWN_batch_uniform_3fv(batch, "checkerColorAndSize", checker_params); - GWN_batch_draw(batch); + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); + GPU_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&wtb->uniform_params); + GPU_batch_uniform_3fv(batch, "checkerColorAndSize", checker_params); + GPU_batch_draw(batch); } } @@ -1228,7 +1228,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, const uiWidgetColors *wcol) if (inner_col1[3] || inner_col2[3] || outline_col[3] || emboss_col[3] || tria_col[3] || alpha_check) { widgetbase_set_uniform_colors_ubv(wtb, inner_col1, inner_col2, outline_col, emboss_col, tria_col, alpha_check); - Gwn_Batch *roundbox_batch = ui_batch_roundbox_widget_get(wtb->tria1.type); + GPUBatch *roundbox_batch = ui_batch_roundbox_widget_get(wtb->tria1.type); draw_widgetbase_batch(roundbox_batch, wtb); } @@ -1836,7 +1836,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b selwidth_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->selend - but->ofs); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv((unsigned char *)wcol->item); @@ -1872,7 +1872,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b UI_widgetbase_draw_cache_flush(); GPU_blend(false); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(0.2f, 0.6f, 0.9f); @@ -2423,7 +2423,7 @@ static void widget_softshadow(const rcti *rect, int roundboxalign, const float r /* we draw a number of increasing size alpha quad strips */ alphastep = 3.0f * btheme->tui.menu_shadow_fac / radout; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2475,7 +2475,7 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir static void ui_hsv_cursor(float x, float y) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2571,13 +2571,13 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * ui_color_picker_to_rgb(0.0f, 0.0f, hsv[2], colcent, colcent + 1, colcent + 2); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + 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_2D_SMOOTH_COLOR); - immBegin(GWN_PRIM_TRI_FAN, tot + 2); + immBegin(GPU_PRIM_TRI_FAN, tot + 2); immAttrib3fv(color, colcent); immVertex2f(pos, centx, centy); @@ -2598,7 +2598,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * /* fully rounded outline */ format = immVertexFormat(); - pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2682,12 +2682,12 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons } /* old below */ - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(GWN_PRIM_TRIS, steps * 3 * 6); + immBegin(GPU_PRIM_TRIS, steps * 3 * 6); for (dx = 0.0f; dx < 0.999f; dx += color_step) { /* 0.999 = prevent float inaccuracy for steps */ const float dx_next = dx + color_step; @@ -2843,7 +2843,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect) ui_hsv_cursor(x, y); /* outline */ - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ub(0, 0, 0); imm_draw_box_wire_2d(pos, (rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax)); @@ -2940,14 +2940,14 @@ static void ui_draw_separator(const rcti *rect, uiWidgetColors *wcol) 30 }; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_blend(true); immUniformColor4ubv(col); GPU_line_width(1.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, rect->xmin, y); immVertex2f(pos, rect->xmax, y); immEnd(); @@ -3402,11 +3402,11 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat UI_widgetbase_draw_cache_flush(); GPU_blend(false); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(bw, bw, bw); - immBegin(GWN_PRIM_TRIS, 3); + immBegin(GPU_PRIM_TRIS, 3); immVertex2f(pos, rect->xmin + 0.1f * width, rect->ymin + 0.9f * height); immVertex2f(pos, rect->xmin + 0.1f * width, rect->ymin + 0.5f * height); immVertex2f(pos, rect->xmin + 0.5f * width, rect->ymin + 0.9f * height); @@ -3783,7 +3783,7 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType * /* note: drawextra can change rect +1 or -1, to match round errors of existing previews */ but->block->drawextra(C, but->poin, but->block->drawextra_arg1, but->block->drawextra_arg2, rect); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* make mask to draw over image */ @@ -4420,11 +4420,11 @@ static void ui_draw_popover_back_impl( /* Draw popover arrow (top/bottom) */ if (ELEM(direction, UI_DIR_UP, UI_DIR_DOWN)) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv((unsigned char *)wcol->inner); GPU_blend(true); - immBegin(GWN_PRIM_TRIS, 3); + immBegin(GPU_PRIM_TRIS, 3); if (direction == UI_DIR_DOWN) { const float y = rect->ymax; immVertex2f(pos, cent_x - unit_half, y); @@ -4476,10 +4476,10 @@ static void draw_disk_shaded( unsigned char r_col[4]; unsigned int pos, col; - Gwn_VertFormat *format = immVertexFormat(); - pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); if (shaded) { - col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); } else { @@ -4487,7 +4487,7 @@ static void draw_disk_shaded( immUniformColor4ubv((unsigned char *)col1); } - immBegin(GWN_PRIM_TRI_STRIP, subd * 2); + immBegin(GPU_PRIM_TRI_STRIP, subd * 2); for (i = 0; i < subd; i++) { float a; @@ -4556,8 +4556,8 @@ void ui_draw_pie_center(uiBlock *block) } } - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv((unsigned char *)btheme->tui.wcol_pie_menu.outline); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 7d9eb1181ed..3a527712367 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1338,12 +1338,12 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) if (vertex_count == 0) return; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + 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_U8, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GWN_PRIM_LINES, vertex_count); + immBegin(GPU_PRIM_LINES, vertex_count); /* vertical lines */ if (flag & V2D_VERTICAL_LINES) { @@ -1480,15 +1480,15 @@ void UI_view2d_constant_grid_draw(View2D *v2d, float step) count_y = (v2d->cur.ymax - start_y) / step + 1; if (count_x > 0 || count_y > 0) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + 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); float theme_color[3]; UI_GetThemeColorShade3fv(TH_BACK, -10, theme_color); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GWN_PRIM_LINES, count_x * 2 + count_y * 2 + 4); + immBegin(GPU_PRIM_LINES, count_x * 2 + count_y * 2 + 4); immAttrib3fv(color, theme_color); for (int i = 0; i < count_x ; start_x += step, i++) { @@ -1531,14 +1531,14 @@ void UI_view2d_multi_grid_draw(View2D *v2d, int colorid, float step, int level_s vertex_count += 2 * ((int)((v2d->cur.xmax - v2d->cur.xmin) / lstep) + 1); vertex_count += 2 * ((int)((v2d->cur.ymax - v2d->cur.ymin) / lstep) + 1); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + 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_U8, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); GPU_line_width(1.0f); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBeginAtMost(GWN_PRIM_LINES, vertex_count); + immBeginAtMost(GPU_PRIM_LINES, vertex_count); for (int level = 0; level < totlevels; ++level) { UI_GetThemeColorShade3ubv(colorid, offset, grid_line_color); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 14cec724168..506dec2aa3e 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -124,8 +124,8 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin return; } - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); const unsigned char rgb_gray[4] = {0x60, 0x60, 0x60, 0xff}; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -134,7 +134,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin /* this could be split into its own loop */ if (draw_type == MASK_DT_OUTLINE) { GPU_line_width(3.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2fv(pos, point_pos); immVertex2fv(pos, handle_pos); immEnd(); @@ -154,7 +154,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin } GPU_line_width(1.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2fv(pos, point_pos); immVertex2fv(pos, handle_pos); immEnd(); @@ -178,7 +178,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin immUniform4fv("outlineColor", point_color); immUniformColor3fvAlpha(point_color, 0.25f); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex2fv(pos, handle_pos); immEnd(); @@ -212,8 +212,8 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline mask_spline_color_get(masklay, spline, is_spline_sel, rgb_spline); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); immUniform1f("size", 0.7f * handle_size); @@ -251,7 +251,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline immUniformThemeColor(TH_HANDLE_VERTEX); } - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex2fv(pos, feather_point); immEnd(); @@ -320,7 +320,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline else immUniformThemeColor(TH_HANDLE_VERTEX); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex2fv(pos, vert); immEnd(); @@ -350,7 +350,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline immUniform4f("outlineColor", 0.0f, 0.0f, 0.0f, 1.0f); immUniform1f("size", 12.0f); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex2f(pos, x, y); immEnd(); @@ -371,7 +371,7 @@ static void mask_color_active_tint(unsigned char r_rgb[4], const unsigned char r } } -static void mask_draw_array(unsigned int pos, Gwn_PrimType prim_type, const float (*points)[2], unsigned int vertex_len) +static void mask_draw_array(unsigned int pos, GPUPrimType prim_type, const float (*points)[2], unsigned int vertex_len) { immBegin(prim_type, vertex_len); for (unsigned int i = 0; i < vertex_len; ++i) { @@ -384,7 +384,7 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* const bool is_feather, const bool is_active, const unsigned char rgb_spline[4], const char draw_type) { - const Gwn_PrimType draw_method = (spline->flag & MASK_SPLINE_CYCLIC) ? GWN_PRIM_LINE_LOOP : GWN_PRIM_LINE_STRIP; + const GPUPrimType draw_method = (spline->flag & MASK_SPLINE_CYCLIC) ? GPU_PRIM_LINE_LOOP : GPU_PRIM_LINE_STRIP; const unsigned char rgb_black[4] = {0x00, 0x00, 0x00, 0xff}; unsigned char rgb_tmp[4]; SpaceClip *sc = CTX_wm_space_clip(C); @@ -402,8 +402,8 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* } } - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); switch (draw_type) { @@ -747,12 +747,12 @@ void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra unsigned int num_lines = BLI_listbase_count(&masklay->splines_shapes); if (num_lines > 0) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(255, 175, 0, 255); - immBegin(GWN_PRIM_LINES, 2 * num_lines); + immBegin(GPU_PRIM_LINES, 2 * num_lines); for (MaskLayerShape *masklay_shape = masklay->splines_shapes.first; masklay_shape; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index a2717e53358..99756269c1f 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1007,13 +1007,13 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd) copy_v3_v3(v2, ray_hit_best[1]); } - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_TRANSFORM); GPU_line_width(2.0); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex3fv(pos, v1); immVertex3fv(pos, v2); immEnd(); @@ -1048,7 +1048,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void GPU_matrix_push(); GPU_matrix_mul(kcd->ob->obmat); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -1059,7 +1059,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immUniformColor3ubv(kcd->colors.line); GPU_line_width(2.0); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex3fv(pos, kcd->prev.cage); immVertex3fv(pos, kcd->curr.cage); immEnd(); @@ -1069,7 +1069,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immUniformColor3ubv(kcd->colors.point); GPU_point_size(11); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex3fv(pos, kcd->prev.cage); immEnd(); } @@ -1078,7 +1078,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immUniformColor3ubv(kcd->colors.curpoint); GPU_point_size(9); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex3fv(pos, kcd->prev.cage); immEnd(); } @@ -1087,7 +1087,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immUniformColor3ubv(kcd->colors.edge); GPU_line_width(2.0); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex3fv(pos, kcd->curr.edge->v1->cageco); immVertex3fv(pos, kcd->curr.edge->v2->cageco); immEnd(); @@ -1096,7 +1096,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immUniformColor3ubv(kcd->colors.point); GPU_point_size(11); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex3fv(pos, kcd->curr.cage); immEnd(); } @@ -1105,7 +1105,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immUniformColor3ubv(kcd->colors.curpoint); GPU_point_size(9); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex3fv(pos, kcd->curr.cage); immEnd(); } @@ -1121,7 +1121,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immUniformColor4ubv(kcd->colors.point_a); GPU_point_size(11); - immBeginAtMost(GWN_PRIM_POINTS, kcd->totlinehit); + immBeginAtMost(GPU_PRIM_POINTS, kcd->totlinehit); lh = kcd->linehits; for (i = 0; i < kcd->totlinehit; i++, lh++) { @@ -1136,7 +1136,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immUniformColor4ubv(kcd->colors.curpoint_a); GPU_point_size(7); - immBeginAtMost(GWN_PRIM_POINTS, kcd->totlinehit); + immBeginAtMost(GPU_PRIM_POINTS, kcd->totlinehit); lh = kcd->linehits; for (i = 0; i < kcd->totlinehit; i++, lh++) { @@ -1157,7 +1157,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immUniformColor3ubv(kcd->colors.line); GPU_line_width(1.0); - immBeginAtMost(GWN_PRIM_LINES, BLI_mempool_len(kcd->kedges) * 2); + immBeginAtMost(GPU_PRIM_LINES, BLI_mempool_len(kcd->kedges) * 2); BLI_mempool_iternew(kcd->kedges, &iter); for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) { @@ -1178,7 +1178,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immUniformColor3ubv(kcd->colors.point); GPU_point_size(5.0); - immBeginAtMost(GWN_PRIM_POINTS, BLI_mempool_len(kcd->kverts)); + immBeginAtMost(GPU_PRIM_POINTS, BLI_mempool_len(kcd->kverts)); BLI_mempool_iternew(kcd->kverts, &iter); for (kfv = BLI_mempool_iterstep(&iter); kfv; kfv = BLI_mempool_iterstep(&iter)) { diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 9a58f1dcd08..95c94c146e4 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -116,13 +116,13 @@ static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *a GPU_matrix_push(); GPU_matrix_mul(lcd->ob->obmat); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ub(255, 0, 255); if (lcd->totedge > 0) { - immBegin(GWN_PRIM_LINES, lcd->totedge * 2); + immBegin(GPU_PRIM_LINES, lcd->totedge * 2); for (int i = 0; i < lcd->totedge; i++) { immVertex3fv(pos, lcd->edges[i][0]); @@ -135,7 +135,7 @@ static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *a if (lcd->totpoint > 0) { GPU_point_size(3.0f); - immBegin(GWN_PRIM_POINTS, lcd->totpoint); + immBegin(GPU_PRIM_POINTS, lcd->totpoint); for (int i = 0; i < lcd->totpoint; i++) { immVertex3fv(pos, lcd->points[i]); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 10d9c90aeb3..1b82e60b986 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -2892,7 +2892,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) brush = &pset->brush[pset->brushtype]; if (brush) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(255, 255, 255, 128); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index cb8fdba0ae1..1a63bc1cd53 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -105,12 +105,12 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct, int sides) float color[4] = {0.0f, 0.0f, 0.0f, 0.25f}; UI_GetThemeColor3fv(TH_EDITOR_OUTLINE, color); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color); - immBeginAtMost(GWN_PRIM_LINES, 8); + immBeginAtMost(GPU_PRIM_LINES, 8); /* right */ if (sides & REGION_EMBOSS_RIGHT) { @@ -262,8 +262,8 @@ static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, f BLI_rcti_init(&click_rect, x, x + icon_size, y, y + icon_size); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -271,7 +271,7 @@ static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, f imm_draw_box_wire_2d(pos, click_rect.xmin, click_rect.ymin, click_rect.xmax, click_rect.ymax); immUniformColor4f(0.0f, 1.0f, 1.0f, alpha); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, click_rect.xmin, click_rect.ymin); immVertex2f(pos, click_rect.xmax, click_rect.ymax); immVertex2f(pos, click_rect.xmin, click_rect.ymax); @@ -295,8 +295,8 @@ static void draw_azone_plus(float x1, float y1, float x2, float y2) float width = 0.1f * U.widget_unit; float pad = 0.2f * U.widget_unit; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); GPU_blend(true); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -500,8 +500,8 @@ void ED_region_do_draw(bContext *C, ARegion *ar) /* for debugging unneeded area redraws and partial redraw */ #if 0 GPU_blend(true); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(drand48(), drand48(), drand48(), 0.1f); immRectf(pos, ar->drawrct.xmin - ar->winrct.xmin, ar->drawrct.ymin - ar->winrct.ymin, @@ -2472,8 +2472,8 @@ void ED_region_info_draw_multiline(ARegion *ar, const char *text_array[], float GPU_blend(true); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(fill_color); immRecti(pos, rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1); @@ -2691,8 +2691,8 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame, /* set up rect */ BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymax, frame->ymax + box_y); /* draw top box */ - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_METADATA_BG); immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); @@ -2716,8 +2716,8 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame, /* set up box rect */ BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymin - box_y, frame->ymin); /* draw top box */ - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_METADATA_BG); immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); @@ -2745,8 +2745,8 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x1, &y1); UI_view2d_view_to_region(&ar->v2d, 1.0f, 1.0f, &x2, &y2); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, 20); @@ -2778,12 +2778,12 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) int count_large = 1.0f / (4.0f * gridstep); if (count_fine > 0) { - GWN_vertformat_clear(format); - pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - unsigned color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + GPU_vertformat_clear(format); + pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + unsigned color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GWN_PRIM_LINES, 4 * count_fine + 4 * count_large); + immBegin(GPU_PRIM_LINES, 4 * count_fine + 4 * count_large); float theme_color[3]; UI_GetThemeColorShade3fv(TH_BACK, (int)(20.0f * (1.0f - blendfac)), theme_color); @@ -2877,7 +2877,7 @@ void ED_region_visible_rect(ARegion *ar, rcti *rect) void ED_region_cache_draw_background(const ARegion *ar) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(128, 128, 255, 64); immRecti(pos, 0, 0, ar->winx, 8 * UI_DPI_FAC); @@ -2897,7 +2897,7 @@ void ED_region_cache_draw_curfra_label(const int framenr, const float x, const f BLF_width_and_height(fontid, numstr, sizeof(numstr), &font_dims[0], &font_dims[1]); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_CFRAME); immRecti(pos, x, y, x + font_dims[0] + 6.0f, y + font_dims[1] + 4.0f); @@ -2911,7 +2911,7 @@ void ED_region_cache_draw_curfra_label(const int framenr, const float x, const f void ED_region_cache_draw_cached_segments(const ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra) { if (num_segments) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(128, 128, 255, 128); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 41404aee9c9..7fa093106df 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -140,9 +140,9 @@ static int get_cached_work_texture(int *r_w, int *r_h) static void immDrawPixelsTexSetupAttributes(IMMDrawPixelsTexState *state) { - Gwn_VertFormat *vert_format = immVertexFormat(); - state->pos = GWN_vertformat_attr_add(vert_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - state->texco = GWN_vertformat_attr_add(vert_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *vert_format = immVertexFormat(); + state->pos = GPU_vertformat_attr_add(vert_format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + state->texco = GPU_vertformat_attr_add(vert_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); } /* To be used before calling immDrawPixelsTex @@ -297,7 +297,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state, glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, format, GL_UNSIGNED_BYTE, &uc_rect[(((size_t)subpart_y) * offset_y + subpart_h - 1) * img_w * components + (subpart_x * offset_x + subpart_w - 1) * components]); } - immBegin(GWN_PRIM_TRI_FAN, 4); + immBegin(GPU_PRIM_TRI_FAN, 4); immAttrib2f(texco, (float)(0 + offset_left) / tex_w, (float)(0 + offset_bot) / tex_h); immVertex2f(pos, rast_x + (float)offset_left * xzoom, rast_y + (float)offset_bot * yzoom); @@ -551,28 +551,28 @@ void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, flo delta_y = min_ff(delta_y, border->ymax - border->ymin); /* left bottom corner */ - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmin, border->ymin + delta_y); immVertex2f(pos, border->xmin, border->ymin); immVertex2f(pos, border->xmin + delta_x, border->ymin); immEnd(); /* left top corner */ - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmin, border->ymax - delta_y); immVertex2f(pos, border->xmin, border->ymax); immVertex2f(pos, border->xmin + delta_x, border->ymax); immEnd(); /* right bottom corner */ - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmax - delta_x, border->ymin); immVertex2f(pos, border->xmax, border->ymin); immVertex2f(pos, border->xmax, border->ymin + delta_y); immEnd(); /* right top corner */ - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmax - delta_x, border->ymax); immVertex2f(pos, border->xmax, border->ymax); immVertex2f(pos, border->xmax, border->ymax - delta_y); diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 6e512d6d4df..10d72d74b22 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -99,7 +99,7 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos) } } - immBegin(GWN_PRIM_TRI_FAN, 5); + immBegin(GPU_PRIM_TRI_FAN, 5); for (i = 0; i < 5; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -107,7 +107,7 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos) immEnd(); - immBegin(GWN_PRIM_TRI_FAN, 5); + immBegin(GPU_PRIM_TRI_FAN, 5); for (i = 4; i < 8; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -180,7 +180,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir, unsigned int pos) } } - immBegin(GWN_PRIM_TRI_FAN, 5); + immBegin(GPU_PRIM_TRI_FAN, 5); for (i = 0; i < 5; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -188,7 +188,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir, unsigned int pos) immEnd(); - immBegin(GWN_PRIM_TRI_FAN, 5); + immBegin(GPU_PRIM_TRI_FAN, 5); for (i = 4; i < 8; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -323,11 +323,11 @@ static void drawscredge_corner(ScrArea *sa, int sizex, int sizey) /* Wrap up the corners with a nice embossing. */ rcti rect = sa->totrct; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color); - immBeginAtMost(GWN_PRIM_LINES, 8); + immBeginAtMost(GPU_PRIM_LINES, 8); /* Right. */ immVertex2f(pos, rect.xmax, rect.ymax); @@ -386,7 +386,7 @@ static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, shor return; } - immBegin(GWN_PRIM_LINES, count); + immBegin(GPU_PRIM_LINES, count); /* right border area */ if (x2 < sizex - 1) { @@ -439,7 +439,7 @@ void ED_screen_draw_edges(wmWindow *win) ScrArea *sa; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* Note: first loop only draws if U.pixelsize > 1, skip otherwise */ @@ -477,7 +477,7 @@ void ED_screen_draw_edges(wmWindow *win) */ void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_width(1); @@ -518,14 +518,14 @@ void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2) void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* splitpoint */ GPU_blend(true); immUniformColor4ub(255, 255, 255, 100); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); if (dir == 'h') { const float y = (1 - fac) * sa->totrct.ymin + fac * sa->totrct.ymax; @@ -537,7 +537,7 @@ void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac) immUniformColor4ub(0, 0, 0, 100); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, sa->totrct.xmin, y + 1); immVertex2f(pos, sa->totrct.xmax, y + 1); @@ -555,7 +555,7 @@ void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac) immUniformColor4ub(0, 0, 0, 100); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, x + 1, sa->totrct.ymin); immVertex2f(pos, x + 1, sa->totrct.ymax); @@ -594,7 +594,7 @@ static void screen_preview_draw_areas(const bScreen *screen, const float scale[2 const float ofs_between_areas) { const float ofs_h = ofs_between_areas * 0.5f; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(col); @@ -607,7 +607,7 @@ static void screen_preview_draw_areas(const bScreen *screen, const float scale[2 .ymax = sa->totrct.ymax * scale[1] - ofs_h }; - immBegin(GWN_PRIM_TRI_FAN, 4); + immBegin(GPU_PRIM_TRI_FAN, 4); immVertex2f(pos, rect.xmin, rect.ymin); immVertex2f(pos, rect.xmax, rect.ymin); immVertex2f(pos, rect.xmax, rect.ymax); diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index e1de86910ff..997fe1282f9 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -680,9 +680,9 @@ static void paint_draw_tex_overlay( } /* set quad color. Colored overlay does not get blending */ - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint texCoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); if (col) { immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); @@ -696,7 +696,7 @@ static void paint_draw_tex_overlay( /* draw textured quad */ immUniform1i("image", GL_TEXTURE0); - immBegin(GWN_PRIM_TRI_FAN, 4); + immBegin(GPU_PRIM_TRI_FAN, 4); immAttrib2f(texCoord, 0.0f, 0.0f); immVertex2f(pos, quad.xmin, quad.ymin); immAttrib2f(texCoord, 1.0f, 0.0f); @@ -769,9 +769,9 @@ static void paint_draw_cursor_overlay( GPU_matrix_translate_2f(-center[0], -center[1]); } - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint texCoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); @@ -782,7 +782,7 @@ static void paint_draw_cursor_overlay( /* draw textured quad */ immUniform1i("image", 0); - immBegin(GWN_PRIM_TRI_FAN, 4); + immBegin(GPU_PRIM_TRI_FAN, 4); immAttrib2f(texCoord, 0.0f, 0.0f); immVertex2f(pos, quad.xmin, quad.ymin); immAttrib2f(texCoord, 1.0f, 0.0f); @@ -844,7 +844,7 @@ BLI_INLINE void draw_tri_point( {co[0] + w, co[1] - w}, }; - immBegin(GWN_PRIM_LINE_LOOP, 3); + immBegin(GPU_PRIM_LINE_LOOP, 3); immVertex2fv(pos, tri[0]); immVertex2fv(pos, tri[1]); immVertex2fv(pos, tri[2]); @@ -853,7 +853,7 @@ BLI_INLINE void draw_tri_point( immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); GPU_line_width(1.0f); - immBegin(GWN_PRIM_LINE_LOOP, 3); + immBegin(GPU_PRIM_LINE_LOOP, 3); immVertex2fv(pos, tri[0]); immVertex2fv(pos, tri[1]); immVertex2fv(pos, tri[2]); @@ -888,7 +888,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); GPU_line_width(3.0f); - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2fv(pos, bez->vec[0]); immVertex2fv(pos, bez->vec[1]); immVertex2fv(pos, bez->vec[2]); @@ -902,7 +902,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez else { immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); } - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2fv(pos, bez->vec[0]); immVertex2fv(pos, bez->vec[1]); immEnd(); @@ -913,7 +913,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez else { immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); } - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2fv(pos, bez->vec[1]); immVertex2fv(pos, bez->vec[2]); immEnd(); @@ -930,7 +930,7 @@ static void paint_draw_curve_cursor(Brush *brush) GPU_blend(true); /* draw the bezier handles and the curve segment between the current and next point */ - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -961,7 +961,7 @@ static void paint_draw_curve_cursor(Brush *brush) immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); GPU_line_width(3.0f); - immBegin(GWN_PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); + immBegin(GPU_PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); for (j = 0; j <= PAINT_CURVE_NUM_SEGMENTS; j++) { immVertex2fv(pos, v[j]); } @@ -969,7 +969,7 @@ static void paint_draw_curve_cursor(Brush *brush) immUniformColor4f(0.9f, 0.9f, 1.0f, 0.5f); GPU_line_width(1.0f); - immBegin(GWN_PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); + immBegin(GPU_PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); for (j = 0; j <= PAINT_CURVE_NUM_SEGMENTS; j++) { immVertex2fv(pos, v[j]); } @@ -1118,7 +1118,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) GPU_blend(true); /* TODO: also set blend mode? */ GPU_line_smooth(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* set brush color */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 6276a2838f5..897a74eb497 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -419,15 +419,15 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda GPU_line_smooth(true); GPU_blend(true); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_width(4.0); immUniformColor4ub(0, 0, 0, 255); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2i(pos, x, y); immVertex2i(pos, pop->startmouse[0], pop->startmouse[1]); immEnd(); @@ -435,7 +435,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda GPU_line_width(2.0); immUniformColor4ub(255, 255, 255, 255); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2i(pos, x, y); immVertex2i(pos, pop->startmouse[0], pop->startmouse[1]); immEnd(); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 0ef25eb63a1..fc008213ae0 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -155,11 +155,11 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata ARegion *ar = stroke->vc.ar; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(paint->paint_cursor_col); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, x, y); immVertex2f(pos, stroke->last_mouse_position[0] + ar->winrct.xmin, @@ -181,7 +181,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) GPU_line_smooth(true); - uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -194,7 +194,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) immUniformArray4fv("colors", (float *)(float[][4]){{0.0f, 0.0f, 0.0f, alpha}, {1.0f, 1.0f, 1.0f, alpha}}, 2); immUniform1f("dash_width", 6.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); ARegion *ar = stroke->vc.ar; diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index a0ef753e200..8fafc545fa9 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -215,7 +215,7 @@ static void brush_drawcursor_uvsculpt(bContext *C, int x, int y, void *UNUSED(cu alpha *= (size - PX_SIZE_FADE_MIN) / (PX_SIZE_FADE_MAX - PX_SIZE_FADE_MIN); } - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3fvAlpha(brush->add_col, alpha); diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 6ebb04fafc4..e679688f887 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -211,8 +211,8 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) /* first backdrop strips */ y = (float)(-ACHANNEL_HEIGHT(ac)); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -326,7 +326,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) if (saction->flag & SACTION_MOVING) { immUniformColor3f(0.0f, 0.0f, 0.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, saction->timeslide, v2d->cur.ymin - EXTRA_SCROLL_PAD); immVertex2f(pos, saction->timeslide, v2d->cur.ymax); immEnd(); @@ -404,7 +404,7 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene) BKE_ptcache_ids_from_object(&pidlist, ob, scene, 0); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* iterate over pointcaches on the active object, and draw each one's range */ @@ -492,7 +492,7 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene) immUniformColor4fv(col); if (len > 0) { - immBeginAtMost(GWN_PRIM_TRIS, len); + immBeginAtMost(GPU_PRIM_TRIS, len); /* draw a quad for each cached frame */ for (int i = sta; i <= end; i++) { diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index 76450cba3cb..2aa0a3e2b9a 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -130,8 +130,8 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) uint keyframe_len = 0; - Gwn_VertFormat *format = immVertexFormat(); - uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* don't use totrect set, as the width stays the same @@ -215,14 +215,14 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) if (keyframe_len > 0) { /* draw keyframe markers */ format = immVertexFormat(); - pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - uint color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); - uint outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint size_id = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); + uint color_id = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); + uint outline_color_id = GPU_vertformat_attr_add(format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); - immBegin(GWN_PRIM_POINTS, keyframe_len); + immBegin(GPU_PRIM_POINTS, keyframe_len); /* all same size with black outline */ immAttrib1f(size_id, 2.0f * STRIP_HEIGHT_HALF); @@ -315,8 +315,8 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar) */ float y = (float) CHANNEL_FIRST; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 29bc0543426..ebdf5342172 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -80,7 +80,7 @@ static void draw_keyframe(int frame, int cfra, int sfra, float framelen, int wid int x = (frame - sfra) * framelen; if (width == 1) { - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2i(pos, x, 0); immVertex2i(pos, x, height * UI_DPI_FAC); immEnd(); @@ -167,7 +167,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc BKE_movieclip_get_cache_segments(clip, &sc->user, &totseg, &points); ED_region_cache_draw_cached_segments(ar, totseg, points, sfra, efra); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* track */ @@ -248,7 +248,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc ED_region_cache_draw_curfra_label(sc->user.framenr, x, 8.0f * UI_DPI_FAC); - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* solver keyframes */ @@ -290,7 +290,7 @@ static void draw_movieclip_muted(ARegion *ar, int width, int height, float zoomx { int x, y; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* find window pixel coordinates of origin */ @@ -349,7 +349,7 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int /* draw boundary border for frame if stabilization is enabled */ if (sc->flag & SC_SHOW_STABLE && clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) { - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); /* Exclusive OR allows to get orig value when second operand is 0, * and negative of orig value when second operand is 1. */ @@ -452,7 +452,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin i++; } - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -463,7 +463,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - a - 1) >= 1) { GPU_point_size(5.0f); - immBegin(GWN_PRIM_POINTS, b - a - 1); + immBegin(GPU_PRIM_POINTS, b - a - 1); for (i = a; i < b; i++) { if (i != curindex) { @@ -478,7 +478,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - a) >= 2) { GPU_line_width(3.0f); - immBegin(GWN_PRIM_LINE_STRIP, b - a); + immBegin(GPU_PRIM_LINE_STRIP, b - a); for (i = a; i < b; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -494,7 +494,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((curindex - a) >= 1) { immUniformThemeColor(TH_PATH_BEFORE); - immBegin(GWN_PRIM_POINTS, curindex - a); + immBegin(GPU_PRIM_POINTS, curindex - a); for (i = a; i < curindex; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -506,7 +506,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - curindex - 1) >= 1) { immUniformThemeColor(TH_PATH_AFTER); - immBegin(GWN_PRIM_POINTS, b - curindex - 1); + immBegin(GPU_PRIM_POINTS, b - curindex - 1); for (i = curindex + 1; i < b; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -521,7 +521,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((curindex - a + 1) >= 2) { immUniformThemeColor(TH_PATH_BEFORE); - immBegin(GWN_PRIM_LINE_STRIP, curindex - a + 1); + immBegin(GPU_PRIM_LINE_STRIP, curindex - a + 1); for (i = a; i <= curindex; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -533,7 +533,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - curindex) >= 2) { immUniformThemeColor(TH_PATH_AFTER); - immBegin(GWN_PRIM_LINE_STRIP, b - curindex); + immBegin(GPU_PRIM_LINE_STRIP, b - curindex); for (i = curindex; i < b; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -579,12 +579,12 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT { GPU_point_size(tiny ? 3.0f : 4.0f); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex2f(position, pos[0], pos[1]); immEnd(); } else { - immBegin(GWN_PRIM_LINES, 8); + immBegin(GPU_PRIM_LINES, 8); immVertex2f(position, pos[0] + px[0] * 2, pos[1]); immVertex2f(position, pos[0] + px[0] * 8, pos[1]); @@ -607,7 +607,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT GPU_matrix_translate_2fv(marker_pos); if (sc->flag & SC_SHOW_MARKER_PATTERN) { - immBegin(GWN_PRIM_LINE_LOOP, 4); + immBegin(GPU_PRIM_LINE_LOOP, 4); immVertex2fv(position, marker->pattern_corners[0]); immVertex2fv(position, marker->pattern_corners[1]); immVertex2fv(position, marker->pattern_corners[2]); @@ -705,14 +705,14 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra immUniform1f("dash_factor", 2.0f); /* Solid "line" */ - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex2f(shdr_pos, pos[0], pos[1]); immEnd(); } else { immUniform1f("dash_factor", 2.0f); /* Solid line */ - immBegin(GWN_PRIM_LINES, 8); + immBegin(GPU_PRIM_LINES, 8); immVertex2f(shdr_pos, pos[0] + px[0] * 3, pos[1]); immVertex2f(shdr_pos, pos[0] + px[0] * 7, pos[1]); @@ -735,7 +735,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra glEnable(GL_COLOR_LOGIC_OP); glLogicOp(GL_XOR); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2fv(shdr_pos, pos); immVertex2fv(shdr_pos, marker_pos); immEnd(); @@ -783,7 +783,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } if ((track->pat_flag & SELECT) == sel && (sc->flag & SC_SHOW_MARKER_PATTERN)) { - immBegin(GWN_PRIM_LINE_LOOP, 4); + immBegin(GPU_PRIM_LINE_LOOP, 4); immVertex2fv(shdr_pos, marker->pattern_corners[0]); immVertex2fv(shdr_pos, marker->pattern_corners[1]); immVertex2fv(shdr_pos, marker->pattern_corners[2]); @@ -805,7 +805,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra /* Restore default shader */ immUnbindProgram(); - const uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); BLI_assert(pos == shdr_pos); UNUSED_VARS_NDEBUG(pos); @@ -857,7 +857,7 @@ static void draw_marker_slide_triangle(float x, float y, float dx, float dy, int tdy += px[1]; } - immBegin(GWN_PRIM_TRIS, 3); + immBegin(GPU_PRIM_TRIS, 3); immVertex2f(pos, x, y); immVertex2f(pos, x - tdx, y); immVertex2f(pos, x, y + tdy); @@ -935,7 +935,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo GPU_line_width(outline ? 3.0f : 1.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, 0.0f, 0.0f); immVertex2fv(pos, tilt_ctrl); immEnd(); @@ -1144,15 +1144,15 @@ static void draw_plane_marker_image(Scene *scene, GPU_matrix_push(); GPU_matrix_mul(gl_matrix); - Gwn_VertFormat *imm_format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(imm_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint texCoord = GWN_vertformat_attr_add(imm_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *imm_format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(imm_format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint texCoord = GPU_vertformat_attr_add(imm_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); immUniformColor4f(1.0f, 1.0f, 1.0f, plane_track->image_opacity); immUniform1i("image", 0); - immBegin(GWN_PRIM_TRI_FAN, 4); + immBegin(GPU_PRIM_TRI_FAN, 4); immAttrib2f(texCoord, 0.0f, 0.0f); immVertex2f(pos, 0.0f, 0.0f); @@ -1206,7 +1206,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane } if (draw_plane_quad || is_selected_track) { - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -1239,7 +1239,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane } /* Draw rectangle itself. */ - immBegin(GWN_PRIM_LINE_LOOP, 4); + immBegin(GPU_PRIM_LINE_LOOP, 4); immVertex2fv(shdr_pos, plane_marker->corners[0]); immVertex2fv(shdr_pos, plane_marker->corners[1]); immVertex2fv(shdr_pos, plane_marker->corners[2]); @@ -1252,7 +1252,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane immUniformColor3f(1.0f, 0.0f, 0.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); getArrowEndPoint(width, height, sc->zoom, plane_marker->corners[0], plane_marker->corners[1], end_point); immVertex2fv(shdr_pos, plane_marker->corners[0]); @@ -1262,7 +1262,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane immUniformColor3f(0.0f, 1.0f, 0.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); getArrowEndPoint(width, height, sc->zoom, plane_marker->corners[0], plane_marker->corners[3], end_point); immVertex2fv(shdr_pos, plane_marker->corners[0]); @@ -1414,7 +1414,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie } } - uint position = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint position = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1519,7 +1519,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie immUniformColor3f(1.0f, 0.0f, 0.0f); } - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); if (undistort) { immVertex2f(position, pos[0] / width, pos[1] / (height * aspy)); @@ -1598,7 +1598,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, GPU_matrix_mul(sc->stabmat); GPU_matrix_scale_2f(width, height); - uint position = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint position = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1675,7 +1675,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, immUniformColor3f(1.0f, 0.0f, 0.0f); for (i = 0; i <= n; i++) { - immBegin(GWN_PRIM_LINE_STRIP, n + 1); + immBegin(GPU_PRIM_LINE_STRIP, n + 1); for (j = 0; j <= n; j++) { immVertex2fv(position, grid[i][j]); @@ -1685,7 +1685,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, } for (j = 0; j <= n; j++) { - immBegin(GWN_PRIM_LINE_STRIP, n + 1); + immBegin(GPU_PRIM_LINE_STRIP, n + 1); for (i = 0; i <= n; i++) { immVertex2fv(position, grid[i][j]); @@ -1743,7 +1743,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, sub_v2_v2v2(dpos, npos, pos); mul_v2_fl(dpos, 1.0f / steps); - immBegin(GWN_PRIM_LINE_STRIP, steps + 1); + immBegin(GPU_PRIM_LINE_STRIP, steps + 1); for (j = 0; j <= steps; j++) { BKE_tracking_distort_v2(tracking, pos, tpos); @@ -1756,7 +1756,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, } } else if (stroke->totpoints == 1) { - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex2f(position, stroke->points[0].x + offsx, stroke->points[0].y + offsy); immEnd(); } diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index 0bc9c74cd8c..cc8541d9fd7 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -91,11 +91,11 @@ static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, immUniformColor4fv(col); if (is_point) { - immBeginAtMost(GWN_PRIM_POINTS, 1); + immBeginAtMost(GPU_PRIM_POINTS, 1); } else { /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(GWN_PRIM_LINE_STRIP, track->markersnr); + immBeginAtMost(GPU_PRIM_LINE_STRIP, track->markersnr); } } @@ -237,11 +237,11 @@ static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack * immUniformColor4fv(col); if (is_point) { /* This probably never happens here, but just in case... */ - immBeginAtMost(GWN_PRIM_POINTS, 1); + immBeginAtMost(GPU_PRIM_POINTS, 1); } else { /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(GWN_PRIM_LINE_STRIP, track->markersnr); + immBeginAtMost(GPU_PRIM_LINE_STRIP, track->markersnr); } } } @@ -300,7 +300,7 @@ static void draw_frame_curves(SpaceClip *sc, unsigned int pos) } if (!lines) { - immBeginAtMost(GWN_PRIM_LINE_STRIP, reconstruction->camnr); + immBeginAtMost(GPU_PRIM_LINE_STRIP, reconstruction->camnr); lines = 1; } @@ -328,7 +328,7 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene) UI_view2d_grid_free(grid); if (clip) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_point_size(3.0f); diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index c94853d4233..19d321a53bf 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -273,7 +273,7 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); GPU_blend(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); @@ -287,7 +287,7 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) /* thin lines where the actual frames are */ GPU_line_width(1.0f); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, (float)SFRA, v2d->cur.ymin); immVertex2f(pos, (float)SFRA, v2d->cur.ymax); immVertex2f(pos, (float)EFRA, v2d->cur.ymin); diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index 0ffbe451042..789194c21b9 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -158,8 +158,8 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha int offl = 0, offc = 0; int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN}; int pen[2]; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); xy[1] += tvc->lheight / 6; console_cursor_wrap_offset(sc->prompt, tvc->console_width, &offl, &offc, NULL); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 42ad34b659b..4a71afbcf4a 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -402,8 +402,8 @@ static void file_draw_preview( /* border */ if (use_dropshadow) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); @@ -466,7 +466,7 @@ static void draw_background(FileLayout *layout, View2D *v2d) int i; int sy; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, -7); @@ -503,12 +503,12 @@ static void draw_dividers(FileLayout *layout, View2D *v2d) v1[1] = v2d->cur.ymax - layout->tile_border_y; v2[1] = v2d->cur.ymin; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); + uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GWN_PRIM_LINES, vertex_len); + immBegin(GPU_PRIM_LINES, vertex_len); sx = (int)v2d->tot.xmin; while (sx < v2d->cur.xmax) { diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 2b2d404168f..ad9af8cb948 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -86,7 +86,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur); int i; - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); GPU_line_width(1.0f); @@ -103,7 +103,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) /* draw two black lines showing the standard reference levels */ - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(shdr_pos, v2d->cur.xmin, env->midval + env->min); immVertex2f(shdr_pos, v2d->cur.xmax, env->midval + env->min); @@ -122,7 +122,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) /* for now, point color is fixed, and is white */ immUniformColor3f(1.0f, 1.0f, 1.0f); - immBeginAtMost(GWN_PRIM_POINTS, env->totvert * 2); + immBeginAtMost(GPU_PRIM_POINTS, env->totvert * 2); for (i = 0, fed = env->data; i < env->totvert; i++, fed++) { /* only draw if visible @@ -178,7 +178,7 @@ static void draw_fcurve_selected_keyframe_vertices(FCurve *fcu, View2D *v2d, boo set_fcurve_vertex_color(fcu, sel); - immBeginAtMost(GWN_PRIM_POINTS, fcu->totvert); + immBeginAtMost(GPU_PRIM_POINTS, fcu->totvert); BezTriple *bezt = fcu->bezt; for (int i = 0; i < fcu->totvert; i++, bezt++) { @@ -230,7 +230,7 @@ static void draw_fcurve_selected_handle_vertices(FCurve *fcu, View2D *v2d, bool immUniform4f("outlineColor", hcolor[0], hcolor[1], hcolor[2], 1.0f); immUniformColor3fvAlpha(hcolor, 0.01f); /* almost invisible - only keep for smoothness */ - immBeginAtMost(GWN_PRIM_POINTS, fcu->totvert * 2); + immBeginAtMost(GPU_PRIM_POINTS, fcu->totvert * 2); BezTriple *bezt = fcu->bezt; BezTriple *prevbezt = NULL; @@ -286,7 +286,7 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool * - draw handles before keyframes, so that keyframes will overlap handles (keyframes are more important for users) */ - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); GPU_blend(true); GPU_enable_program_point_size(); @@ -330,12 +330,12 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu) { int sel, b; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + 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_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBeginAtMost(GWN_PRIM_LINES, 4 * 2 * fcu->totvert); + immBeginAtMost(GPU_PRIM_LINES, 4 * 2 * fcu->totvert); /* slightly hacky, but we want to draw unselected points before selected ones * so that selected points are clearly visible @@ -427,7 +427,7 @@ static void draw_fcurve_sample_control(float x, float y, float xscale, float ysc GPU_matrix_scale_2f(1.0f / xscale * hsize, 1.0f / yscale * hsize); /* draw X shape */ - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, -0.7f, -0.7f); immVertex2f(pos, +0.7f, +0.7f); @@ -459,7 +459,7 @@ static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu) if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) GPU_line_smooth(true); GPU_blend(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor((fcu->flag & FCURVE_SELECTED) ? TH_TEXT_HI : TH_TEXT); @@ -551,7 +551,7 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d n = (etime - stime) / samplefreq + 0.5f; if (n > 0) { - immBegin(GWN_PRIM_LINE_STRIP, (n + 1)); + immBegin(GPU_PRIM_LINE_STRIP, (n + 1)); for (i = 0; i <= n; i++) { float ctime = stime + i * samplefreq; @@ -590,7 +590,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie GPU_matrix_scale_2f(1.0f, unit_scale); GPU_matrix_translate_2f(0.0f, offset); - immBegin(GWN_PRIM_LINE_STRIP, count); + immBegin(GPU_PRIM_LINE_STRIP, count); /* extrapolate to left? - left-side of view comes before first keyframe? */ if (prevfpt->vec[0] > v2d->cur.xmin) { @@ -687,7 +687,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 /* For now, this assumes the worst case scenario, where all the keyframes have * bezier interpolation, and are drawn at full res. * This is tricky to optimize, but maybe can be improved at some point... */ - immBeginAtMost(GWN_PRIM_LINE_STRIP, (b * 32 + 3)); + immBeginAtMost(GPU_PRIM_LINE_STRIP, (b * 32 + 3)); /* extrapolate to left? */ if (prevbezt->vec[1][0] > v2d->cur.xmin) { @@ -849,7 +849,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) //if ((driver->flag & DRIVER_FLAG_SHOWDEBUG) == 0) // return; - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); float viewport_size[4]; @@ -874,7 +874,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) /* draw 1-1 line, stretching just past the screen limits * NOTE: we need to scale the y-values to be valid for the units */ - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); t = v2d->cur.xmin; immVertex2f(shdr_pos, t, (t + offset) * unitfac); @@ -900,7 +900,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) immUniform1f("dash_width", 10.0f); immUniform1f("dash_factor", 0.5f); - immBegin(GWN_PRIM_LINES, (y >= v2d->cur.ymin) ? 4 : 2); + immBegin(GPU_PRIM_LINES, (y >= v2d->cur.ymin) ? 4 : 2); /* x-axis lookup */ co[0] = x; @@ -926,7 +926,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) immUnbindProgram(); - /* GWN_PRIM_POINTS do not survive dashed line geometry shader... */ + /* GPU_PRIM_POINTS do not survive dashed line geometry shader... */ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* x marks the spot .................................................... */ @@ -934,7 +934,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) immUniformColor3f(0.9f, 0.9f, 0.9f); GPU_point_size(7.0); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex2f(shdr_pos, x, y); immEnd(); @@ -942,7 +942,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) immUniformColor3f(0.9f, 0.0f, 0.0f); GPU_point_size(3.0); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex2f(shdr_pos, x, y); immEnd(); } @@ -969,7 +969,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) } GPU_blend(true); - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -1055,7 +1055,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid } GPU_blend(true); - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 699dc29ff47..fa57df0393a 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -279,7 +279,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) UI_view2d_grid_free(grid); if (((sipo->flag & SIPO_NODRAWCURSOR) == 0) || (sipo->mode == SIPO_MODE_DRIVERS)) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -292,7 +292,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) GPU_blend(true); GPU_line_width(2.0); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, v2d->cur.xmin, y); immVertex2f(pos, v2d->cur.xmax, y); immEnd(); @@ -310,7 +310,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) GPU_blend(true); GPU_line_width(2.0); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, x, v2d->cur.ymin); immVertex2f(pos, x, v2d->cur.ymax); immEnd(); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index ff90e59540e..4cbe25462af 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -127,7 +127,7 @@ static void draw_render_info(const bContext *C, (int)(-rd->border.ymin * rd->ysch * rd->size * 0.01f)); } - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_FACE_SELECT); @@ -174,7 +174,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); GPU_blend(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* noisy, high contrast make impossible to read if lower alpha is used. */ @@ -330,7 +330,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d BLI_rcti_init(&color_rect, dx, dx + (1.5f * UI_UNIT_X), 0.15f * UI_UNIT_Y, 0.85f * UI_UNIT_Y); /* BLF uses immediate mode too, so we must reset our vertex format */ - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); if (channels == 4) { @@ -367,7 +367,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d immUnbindProgram(); /* draw outline */ - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ub(128, 128, 128); imm_draw_box_wire_2d(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); @@ -573,8 +573,8 @@ void draw_image_sample_line(SpaceImage *sima) if (sima->sample_line_hist.flag & HISTO_FLAG_SAMPLELINE) { Histogram *hist = &sima->sample_line_hist; - Gwn_VertFormat *format = immVertexFormat(); - uint shdr_dashed_pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint shdr_dashed_pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -586,7 +586,7 @@ void draw_image_sample_line(SpaceImage *sima) immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2); immUniform1f("dash_width", 2.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2fv(shdr_dashed_pos, hist->co[0]); immVertex2fv(shdr_dashed_pos, hist->co[1]); immEnd(); @@ -779,7 +779,7 @@ void draw_image_cache(const bContext *C, ARegion *ar) /* Draw current frame. */ x = (cfra - sfra) / (efra - sfra + 1) * ar->winx; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_CFRAME); immRecti(pos, x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC); diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index 5c1b23e140c..c94aaf6e861 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -85,8 +85,8 @@ static void console_draw_sel(const char *str, const int sel[2], const int xy[2], GPU_blend(true); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(bg_sel); @@ -191,8 +191,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str cdc->sel[1] = str_len - sel_orig[0]; if (bg) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(bg); @@ -242,8 +242,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str else { /* simple, no wrap */ if (bg) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(bg); diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 5b68c7b6bb7..7dd8c7f2eed 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -120,8 +120,8 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa nla_action_get_color(adt, act, color); color[3] *= 2.5f; - Gwn_VertFormat *format = immVertexFormat(); - uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -142,13 +142,13 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa if (key_len > 0) { format = immVertexFormat(); - pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); - uint color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); - uint outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint size_id = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); + uint color_id = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); + uint outline_color_id = GPU_vertformat_attr_add(format, "outlineColor", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); - immBegin(GWN_PRIM_POINTS, key_len); + immBegin(GPU_PRIM_POINTS, key_len); /* - disregard the selection status of keyframes so they draw a certain way * - size is 6.0f which is smaller than the editable keyframes, so that there is a distinction @@ -177,7 +177,7 @@ static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymax if (ELEM(NULL, act, act->markers.first)) return; - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); if (dashed) { immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -194,7 +194,7 @@ static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymax } immUniformThemeColorShade(TH_STRIP_SELECT, shade); - immBeginAtMost(GWN_PRIM_LINES, BLI_listbase_count(&act->markers) * 2); + immBeginAtMost(GPU_PRIM_LINES, BLI_listbase_count(&act->markers) * 2); for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) { if ((marker->frame > strip->actstart) && (marker->frame < strip->actend)) { float frame = nlastrip_get_frame(strip, marker->frame, NLATIME_CONVERT_MAP); @@ -318,7 +318,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns /* plot the curve (over the strip's main region) */ if (fcu) { - immBegin(GWN_PRIM_LINE_STRIP, abs((int)(strip->end - strip->start) + 1)); + immBegin(GPU_PRIM_LINE_STRIP, abs((int)(strip->end - strip->start) + 1)); /* sample at 1 frame intervals, and draw * - min y-val is yminc, max is y-maxc, so clamp in those regions @@ -335,7 +335,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns else { /* use blend in/out values only if both aren't zero */ if ((IS_EQF(strip->blendin, 0.0f) && IS_EQF(strip->blendout, 0.0f)) == 0) { - immBeginAtMost(GWN_PRIM_LINE_STRIP, 4); + immBeginAtMost(GPU_PRIM_LINE_STRIP, 4); /* start of strip - if no blendin, start straight at 1, otherwise from 0 to 1 over blendin frames */ if (IS_EQF(strip->blendin, 0.0f) == 0) { @@ -366,7 +366,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns static uint nla_draw_use_dashed_outlines(float color[4], bool muted) { /* Note that we use dashed shader here, and make it draw solid lines if not muted... */ - uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); float viewport_size[4]; @@ -403,7 +403,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri /* get color of strip */ nla_strip_get_color_inside(adt, strip, color); - shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw extrapolation info first (as backdrop) @@ -456,7 +456,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri UI_draw_roundbox_shade_x(true, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1, color); /* restore current vertex format & program (roundbox trashes it) */ - shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); } else { @@ -518,7 +518,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri /* only draw lines for whole-numbered repeats, starting from the first full-repeat * up to the last full repeat (but not if it lies on the end of the strip) */ - immBeginAtMost(GWN_PRIM_LINES, 2 * floorf(strip->repeat)); + immBeginAtMost(GPU_PRIM_LINES, 2 * floorf(strip->repeat)); for (int i = 1; i < strip->repeat; i++) { float repeatPos = strip->start + (repeatLen * i); @@ -534,7 +534,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri else if ((strip->type == NLASTRIP_TYPE_META) && (strip->strips.first != strip->strips.last)) { const float y = (ymaxc - yminc) * 0.5f + yminc; - immBeginAtMost(GWN_PRIM_LINES, 4 * BLI_listbase_count(&strip->strips)); /* up to 2 lines per strip */ + immBeginAtMost(GPU_PRIM_LINES, 4 * BLI_listbase_count(&strip->strips)); /* up to 2 lines per strip */ /* only draw first-level of child-strips, but don't draw any lines on the endpoints */ for (NlaStrip *cs = strip->strips.first; cs; cs = cs->next) { @@ -706,7 +706,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) { AnimData *adt = ale->adt; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* just draw a semi-shaded rect spanning the width of the viewable area if there's data, @@ -729,7 +729,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) /* white base-lines */ GPU_line_width(2.0f); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.3f); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, v2d->cur.xmin, yminc + NLACHANNEL_SKIP); immVertex2f(pos, v2d->cur.xmax, yminc + NLACHANNEL_SKIP); immVertex2f(pos, v2d->cur.xmin, ymaxc - NLACHANNEL_SKIP); @@ -739,7 +739,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) /* black top-lines */ GPU_line_width(1.0f); immUniformColor3f(0.0f, 0.0f, 0.0f); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, v2d->cur.xmin, yminc + NLACHANNEL_SKIP); immVertex2f(pos, v2d->cur.xmax, yminc + NLACHANNEL_SKIP); immVertex2f(pos, v2d->cur.xmin, ymaxc - NLACHANNEL_SKIP); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index dfb85d3c8a4..10532f3ac7d 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -2184,14 +2184,14 @@ static void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNo const float cy = y + snode->zoom * backdropHeight * node->custom4; const float cross_size = 12 * U.pixelsize; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(1.0f, 1.0f, 1.0f); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, cx - cross_size, cy - cross_size); immVertex2f(pos, cx + cross_size, cy + cross_size); immVertex2f(pos, cx + cross_size, cy - cross_size); @@ -2229,14 +2229,14 @@ static void node_composit_backdrop_boxmask(SpaceNode *snode, ImBuf *backdrop, bN y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(1.0f, 1.0f, 1.0f); - immBegin(GWN_PRIM_LINE_LOOP, 4); + immBegin(GPU_PRIM_LINE_LOOP, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x2, y2); immVertex2f(pos, x3, y3); @@ -2273,14 +2273,14 @@ static void node_composit_backdrop_ellipsemask(SpaceNode *snode, ImBuf *backdrop y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(1.0f, 1.0f, 1.0f); - immBegin(GWN_PRIM_LINE_LOOP, 4); + immBegin(GPU_PRIM_LINE_LOOP, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x2, y2); immVertex2f(pos, x3, y3); @@ -3267,7 +3267,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b y + snode->zoom * viewer_border->ymin * ibuf->y, y + snode->zoom * viewer_border->ymax * ibuf->y); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_ACTIVE); @@ -3392,50 +3392,50 @@ static float arrow_verts[3][2] = {{-1.0f, 1.0f}, {0.0f, 0.0f}, {-1.0f, -1.0f}}; static float arrow_expand_axis[3][2] = {{0.7071f, 0.7071f}, {M_SQRT2, 0.0f}, {0.7071f, -0.7071f}}; struct { - Gwn_Batch *batch; /* for batching line together */ - Gwn_Batch *batch_single; /* for single line */ - Gwn_VertBuf *inst_vbo; + GPUBatch *batch; /* for batching line together */ + GPUBatch *batch_single; /* for single line */ + GPUVertBuf *inst_vbo; unsigned int p0_id, p1_id, p2_id, p3_id; unsigned int colid_id; - Gwn_VertBufRaw p0_step, p1_step, p2_step, p3_step; - Gwn_VertBufRaw colid_step; + GPUVertBufRaw p0_step, p1_step, p2_step, p3_step; + GPUVertBufRaw colid_step; unsigned int count; bool enabled; } g_batch_link = {0}; static void nodelink_batch_reset(void) { - GWN_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p0_id, &g_batch_link.p0_step); - GWN_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p1_id, &g_batch_link.p1_step); - GWN_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p2_id, &g_batch_link.p2_step); - GWN_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p3_id, &g_batch_link.p3_step); - GWN_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.colid_id, &g_batch_link.colid_step); + GPU_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p0_id, &g_batch_link.p0_step); + GPU_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p1_id, &g_batch_link.p1_step); + GPU_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p2_id, &g_batch_link.p2_step); + GPU_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p3_id, &g_batch_link.p3_step); + GPU_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.colid_id, &g_batch_link.colid_step); g_batch_link.count = 0; } static void set_nodelink_vertex( - Gwn_VertBuf *vbo, + GPUVertBuf *vbo, unsigned int uv_id, unsigned int pos_id, unsigned int exp_id, unsigned int v, const unsigned char uv[2], const float pos[2], const float exp[2]) { - GWN_vertbuf_attr_set(vbo, uv_id, v, uv); - GWN_vertbuf_attr_set(vbo, pos_id, v, pos); - GWN_vertbuf_attr_set(vbo, exp_id, v, exp); + GPU_vertbuf_attr_set(vbo, uv_id, v, uv); + GPU_vertbuf_attr_set(vbo, pos_id, v, pos); + GPU_vertbuf_attr_set(vbo, exp_id, v, exp); } static void nodelink_batch_init(void) { - Gwn_VertFormat format = {0}; - uint uv_id = GWN_vertformat_attr_add(&format, "uv", GWN_COMP_U8, 2, GWN_FETCH_INT_TO_FLOAT_UNIT); - uint pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint expand_id = GWN_vertformat_attr_add(&format, "expand", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format_ex(&format, GWN_USAGE_STATIC); + GPUVertFormat format = {0}; + uint uv_id = GPU_vertformat_attr_add(&format, "uv", GPU_COMP_U8, 2, GPU_FETCH_INT_TO_FLOAT_UNIT); + uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint expand_id = GPU_vertformat_attr_add(&format, "expand", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + GPUVertBuf *vbo = GPU_vertbuf_create_with_format_ex(&format, GPU_USAGE_STATIC); int vcount = LINK_RESOL * 2; /* curve */ vcount += 2; /* restart strip */ vcount += 3 * 2; /* arrow */ vcount *= 2; /* shadow */ vcount += 2; /* restart strip */ - GWN_vertbuf_data_alloc(vbo, vcount); + GPU_vertbuf_data_alloc(vbo, vcount); int v = 0; for (int k = 0; k < 2; ++k) { @@ -3479,23 +3479,23 @@ static void nodelink_batch_init(void) set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp); } - g_batch_link.batch = GWN_batch_create_ex(GWN_PRIM_TRI_STRIP, vbo, NULL, GWN_BATCH_OWNS_VBO); + g_batch_link.batch = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, NULL, GPU_BATCH_OWNS_VBO); gpu_batch_presets_register(g_batch_link.batch); - g_batch_link.batch_single = GWN_batch_create_ex(GWN_PRIM_TRI_STRIP, vbo, NULL, 0); + g_batch_link.batch_single = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, NULL, 0); gpu_batch_presets_register(g_batch_link.batch_single); /* Instances data */ - Gwn_VertFormat format_inst = {0}; - g_batch_link.p0_id = GWN_vertformat_attr_add(&format_inst, "P0", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - g_batch_link.p1_id = GWN_vertformat_attr_add(&format_inst, "P1", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - g_batch_link.p2_id = GWN_vertformat_attr_add(&format_inst, "P2", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - g_batch_link.p3_id = GWN_vertformat_attr_add(&format_inst, "P3", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - g_batch_link.colid_id = GWN_vertformat_attr_add(&format_inst, "colid_doarrow", GWN_COMP_U8, 4, GWN_FETCH_INT); - g_batch_link.inst_vbo = GWN_vertbuf_create_with_format_ex(&format_inst, GWN_USAGE_STREAM); - GWN_vertbuf_data_alloc(g_batch_link.inst_vbo, NODELINK_GROUP_SIZE); /* Alloc max count but only draw the range we need. */ + GPUVertFormat format_inst = {0}; + g_batch_link.p0_id = GPU_vertformat_attr_add(&format_inst, "P0", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + g_batch_link.p1_id = GPU_vertformat_attr_add(&format_inst, "P1", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + g_batch_link.p2_id = GPU_vertformat_attr_add(&format_inst, "P2", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + g_batch_link.p3_id = GPU_vertformat_attr_add(&format_inst, "P3", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + g_batch_link.colid_id = GPU_vertformat_attr_add(&format_inst, "colid_doarrow", GPU_COMP_U8, 4, GPU_FETCH_INT); + g_batch_link.inst_vbo = GPU_vertbuf_create_with_format_ex(&format_inst, GPU_USAGE_STREAM); + GPU_vertbuf_data_alloc(g_batch_link.inst_vbo, NODELINK_GROUP_SIZE); /* Alloc max count but only draw the range we need. */ - GWN_batch_instbuf_set(g_batch_link.batch, g_batch_link.inst_vbo, true); + GPU_batch_instbuf_set(g_batch_link.batch, g_batch_link.inst_vbo, true); nodelink_batch_reset(); } @@ -3526,14 +3526,14 @@ static void nodelink_batch_draw(SpaceNode *snode) UI_GetThemeColor4fv(TH_EDGE_SELECT, colors[nodelink_get_color_id(TH_EDGE_SELECT)]); UI_GetThemeColor4fv(TH_REDALERT, colors[nodelink_get_color_id(TH_REDALERT)]); - GWN_vertbuf_vertex_count_set(g_batch_link.inst_vbo, g_batch_link.count); - GWN_vertbuf_use(g_batch_link.inst_vbo); /* force update. */ + GPU_vertbuf_vertex_count_set(g_batch_link.inst_vbo, g_batch_link.count); + GPU_vertbuf_use(g_batch_link.inst_vbo); /* force update. */ - GWN_batch_program_set_builtin(g_batch_link.batch, GPU_SHADER_2D_NODELINK_INST); - GWN_batch_uniform_4fv_array(g_batch_link.batch, "colors", 6, (float *)colors); - GWN_batch_uniform_1f(g_batch_link.batch, "expandSize", snode->aspect * LINK_WIDTH); - GWN_batch_uniform_1f(g_batch_link.batch, "arrowSize", ARROW_SIZE); - GWN_batch_draw(g_batch_link.batch); + GPU_batch_program_set_builtin(g_batch_link.batch, GPU_SHADER_2D_NODELINK_INST); + GPU_batch_uniform_4fv_array(g_batch_link.batch, "colors", 6, (float *)colors); + GPU_batch_uniform_1f(g_batch_link.batch, "expandSize", snode->aspect * LINK_WIDTH); + GPU_batch_uniform_1f(g_batch_link.batch, "arrowSize", ARROW_SIZE); + GPU_batch_draw(g_batch_link.batch); nodelink_batch_reset(); @@ -3562,11 +3562,11 @@ static void nodelink_batch_add_link( BLI_assert(ELEM(th_col3, TH_WIRE, -1)); g_batch_link.count++; - copy_v2_v2(GWN_vertbuf_raw_step(&g_batch_link.p0_step), p0); - copy_v2_v2(GWN_vertbuf_raw_step(&g_batch_link.p1_step), p1); - copy_v2_v2(GWN_vertbuf_raw_step(&g_batch_link.p2_step), p2); - copy_v2_v2(GWN_vertbuf_raw_step(&g_batch_link.p3_step), p3); - char *colid = GWN_vertbuf_raw_step(&g_batch_link.colid_step); + copy_v2_v2(GPU_vertbuf_raw_step(&g_batch_link.p0_step), p0); + copy_v2_v2(GPU_vertbuf_raw_step(&g_batch_link.p1_step), p1); + copy_v2_v2(GPU_vertbuf_raw_step(&g_batch_link.p2_step), p2); + copy_v2_v2(GPU_vertbuf_raw_step(&g_batch_link.p3_step), p3); + char *colid = GPU_vertbuf_raw_step(&g_batch_link.colid_step); colid[0] = nodelink_get_color_id(th_col1); colid[1] = nodelink_get_color_id(th_col2); colid[2] = nodelink_get_color_id(th_col3); @@ -3604,14 +3604,14 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, UI_GetThemeColor4fv(th_col1, colors[1]); UI_GetThemeColor4fv(th_col2, colors[2]); - Gwn_Batch *batch = g_batch_link.batch_single; - GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_NODELINK); - GWN_batch_uniform_2fv_array(batch, "bezierPts", 4, (float *)vec); - GWN_batch_uniform_4fv_array(batch, "colors", 3, (float *)colors); - GWN_batch_uniform_1f(batch, "expandSize", snode->aspect * LINK_WIDTH); - GWN_batch_uniform_1f(batch, "arrowSize", ARROW_SIZE); - GWN_batch_uniform_1i(batch, "doArrow", drawarrow); - GWN_batch_draw(batch); + GPUBatch *batch = g_batch_link.batch_single; + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_NODELINK); + GPU_batch_uniform_2fv_array(batch, "bezierPts", 4, (float *)vec); + GPU_batch_uniform_4fv_array(batch, "colors", 3, (float *)colors); + GPU_batch_uniform_1f(batch, "expandSize", snode->aspect * LINK_WIDTH); + GPU_batch_uniform_1f(batch, "arrowSize", ARROW_SIZE); + GPU_batch_uniform_1i(batch, "doArrow", drawarrow); + GPU_batch_draw(batch); } } } @@ -3660,7 +3660,7 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) void ED_node_draw_snap(View2D *v2d, const float cent[2], float size, NodeBorder border, unsigned pos) { - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); if (border & (NODE_LEFT | NODE_RIGHT)) { immVertex2f(pos, cent[0], v2d->cur.ymin); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 6976edce563..4b3a3abc642 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -648,8 +648,8 @@ static void node_draw_preview_background(float tile, rctf *rect) { float x, y; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -721,7 +721,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv) GPU_blend(false); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -15, +100); imm_draw_box_wire_2d(pos, draw_rect.xmin, draw_rect.ymin, draw_rect.xmax, draw_rect.ymax); @@ -771,9 +771,9 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * float scale; UI_view2d_scale_get(v2d, &scale, NULL); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); GPU_blend(true); GPU_enable_program_point_size(); @@ -788,7 +788,7 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * immUniform1f("outlineWidth", 1.0f); immUniform4f("outlineColor", 0.0f, 0.0f, 0.0f, 0.6f); - immBeginAtMost(GWN_PRIM_POINTS, total_input_len + total_output_len); + immBeginAtMost(GPU_PRIM_POINTS, total_input_len + total_output_len); } /* socket inputs */ @@ -832,7 +832,7 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * immUniform4f("outlineColor", c[0], c[1], c[2], 1.0f); immUniform1f("outlineWidth", 1.5f); - immBegin(GWN_PRIM_POINTS, selected_input_len + selected_output_len); + immBegin(GPU_PRIM_POINTS, selected_input_len + selected_output_len); if (selected_input_len) { /* socket inputs */ @@ -1102,13 +1102,13 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b } /* scale widget thing */ - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(color_id, -10); dx = 10.0f; - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, rct->xmax - dx, centy - 4.0f); immVertex2f(pos, rct->xmax - dx, centy + 4.0f); @@ -1119,7 +1119,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b immUniformThemeColorShade(color_id, 30); dx -= snode->aspect; - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, rct->xmax - dx, centy - 4.0f); immVertex2f(pos, rct->xmax - dx, centy + 4.0f); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 8a8f4715ea3..783a03f3993 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -742,11 +742,11 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex) GPU_line_width(1.0f); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -15, -200); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, sizex, v2d->cur.ymax); immVertex2f(pos, sizex, miny); @@ -1739,8 +1739,8 @@ static void outliner_draw_tree_element( /* divider */ { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); unsigned char col[4]; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1797,7 +1797,7 @@ static void outliner_draw_tree_element_floating( const TreeElement *te_insert = te_floating->drag_data->insert_handle; const int line_width = 2; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); int coord_y = te_insert->ys; int coord_x = te_insert->xs; float col[4]; @@ -1818,7 +1818,7 @@ static void outliner_draw_tree_element_floating( immUniformColor4fv(col); GPU_line_width(line_width); - immBegin(GWN_PRIM_LINE_STRIP, 2); + immBegin(GPU_PRIM_LINE_STRIP, 2); immVertex2f(pos, coord_x, coord_y); immVertex2f(pos, ar->v2d.cur.xmax, coord_y); immEnd(); @@ -1827,7 +1827,7 @@ static void outliner_draw_tree_element_floating( BLI_assert(te_floating->drag_data->insert_type == TE_INSERT_INTO); immUniformColor3fvAlpha(col, col[3] * 0.5f); - immBegin(GWN_PRIM_TRI_STRIP, 4); + immBegin(GPU_PRIM_TRI_STRIP, 4); immVertex2f(pos, coord_x, coord_y + UI_UNIT_Y); immVertex2f(pos, coord_x, coord_y); immVertex2f(pos, ar->v2d.cur.xmax, coord_y + UI_UNIT_Y); @@ -1901,8 +1901,8 @@ static void outliner_draw_hierarchy_lines_recursive( static void outliner_draw_hierarchy_lines(SpaceOops *soops, ListBase *lb, int startx, int *starty) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); unsigned char col[4]; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1924,8 +1924,8 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * /* selection status */ if (TSELEM_OPEN(tselem, soops)) { if (tselem->type == TSE_RNA_STRUCT) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immThemeColorShadeAlpha(TH_BACK, -15, -200); immRecti(pos, 0, *starty + 1, (int)ar->v2d.cur.xmax, *starty + UI_UNIT_Y - 1); @@ -1937,12 +1937,12 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * if (TSELEM_OPEN(tselem, soops)) { outliner_draw_struct_marks(ar, soops, &te->subtree, starty); if (tselem->type == TSE_RNA_STRUCT) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immThemeColorShadeAlpha(TH_BACK, -15, -200); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, 0, (float)*starty + UI_UNIT_Y); immVertex2f(pos, ar->v2d.cur.xmax, (float)*starty + UI_UNIT_Y); immEnd(); @@ -2007,8 +2007,8 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx, col_searchmatch[3] = 0.5f; GPU_blend(true); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); outliner_draw_highlights_recursive( pos, ar, soops, &soops->tree, col_selection, col_highlight, col_searchmatch, @@ -2082,8 +2082,8 @@ static void outliner_back(ARegion *ar) ystart = (int)ar->v2d.tot.ymax; ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, 6); @@ -2093,7 +2093,7 @@ static void outliner_back(ARegion *ar) int tot = (int)floor(ystart - ar->v2d.cur.ymin + 2 * UI_UNIT_Y) / (2 * UI_UNIT_Y); if (tot > 0) { - immBegin(GWN_PRIM_TRIS, 6 * tot); + immBegin(GPU_PRIM_TRIS, 6 * tot); while (tot--) { y1 -= 2 * UI_UNIT_Y; y2 = y1 + UI_UNIT_Y; @@ -2114,10 +2114,10 @@ static void outliner_draw_restrictcols(ARegion *ar) { GPU_line_width(1.0f); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -15, -200); - immBegin(GWN_PRIM_LINES, 8); + immBegin(GPU_PRIM_LINES, 8); immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), (int)ar->v2d.cur.ymax); immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), (int)ar->v2d.cur.ymin); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 204559ebf4f..47059d65945 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -267,7 +267,7 @@ static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene *s GPU_blend(true); - immBegin(GWN_PRIM_TRI_STRIP, length * 2); + immBegin(GPU_PRIM_TRI_STRIP, length * 2); for (i = 0; i < length; i++) { float sampleoffset = startsample + ((x1_offset - x1) / stepsize + i) * samplestep; @@ -343,7 +343,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, col[3] = 196; /* alpha, used for all meta children */ - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -457,7 +457,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla immUniformColor4ub(0, 0, 0, 50); } - immBegin(GWN_PRIM_TRIS, 3); + immBegin(GPU_PRIM_TRIS, 3); immVertex2fv(pos, v1); immVertex2fv(pos, v2); immVertex2fv(pos, v3); @@ -719,7 +719,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp; y2 = seq->machine + SEQ_STRIP_OFSTOP; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -781,7 +781,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg if (seq->flag & SEQ_LOCK) { GPU_blend(true); - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_DIAG_STRIPES); immUniform4f("color1", 1.0f, 1.0f, 1.0f, 0.125f); @@ -799,7 +799,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg if (!BKE_sequence_is_valid_check(seq)) { GPU_blend(true); - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_DIAG_STRIPES); immUniform4f("color1", 1.0f, 0.0f, 0.0f, 1.0f); @@ -834,7 +834,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg drawmeta_contents(scene, seq, x1, y1, x2, y2); } - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); /* TODO: add back stippled line for muted strips? */ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1040,7 +1040,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons GPU_line_width(1.0f); /* border */ - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -1230,9 +1230,9 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq /* Format needs to be created prior to any immBindProgram call. * Do it here because OCIO binds it's own shader. */ - Gwn_VertFormat *imm_format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(imm_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint texCoord = GWN_vertformat_attr_add(imm_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *imm_format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(imm_format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint texCoord = GPU_vertformat_attr_add(imm_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); if (scope) { IMB_freeImBuf(ibuf); @@ -1331,7 +1331,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq immUniform1i("image", 0); } - immBegin(GWN_PRIM_TRI_FAN, 4); + immBegin(GPU_PRIM_TRI_FAN, 4); if (draw_overlay) { if (sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) { @@ -1514,7 +1514,7 @@ static void draw_seq_backdrop(View2D *v2d) { int i; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* darker gray overlay over the view backdrop */ @@ -1541,7 +1541,7 @@ static void draw_seq_backdrop(View2D *v2d) i = max_ii(1, ((int)v2d->cur.ymin) - 1); int line_len = (int)v2d->cur.ymax - i + 1; immUniformThemeColor(TH_GRID); - immBegin(GWN_PRIM_LINES, line_len * 2); + immBegin(GPU_PRIM_LINES, line_len * 2); while (line_len--) { immVertex2f(pos, v2d->cur.xmax, i); immVertex2f(pos, v2d->cur.xmin, i); @@ -1593,7 +1593,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) const Sequence *seq = special_seq_update; GPU_blend(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(255, 255, 255, 48); @@ -1613,7 +1613,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) GPU_blend(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw darkened area outside of active timeline @@ -1631,7 +1631,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) immUniformThemeColorShade(TH_BACK, -60); /* thin lines where the actual frames are */ - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, frame_sta, v2d->cur.ymin); immVertex2f(pos, frame_sta, v2d->cur.ymax); @@ -1649,7 +1649,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) immUniformThemeColorShade(TH_BACK, -40); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, ms->disp_range[0], v2d->cur.ymin); immVertex2f(pos, ms->disp_range[0], v2d->cur.ymax); @@ -1735,12 +1735,12 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(0.2f, 0.2f, 0.2f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2f(pos, cfra_over, v2d->cur.ymin); immVertex2f(pos, cfra_over, v2d->cur.ymax); immEnd(); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 748a5c05ef1..aa499d52589 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -913,7 +913,7 @@ static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back) float rad; /* background so highlights don't go behind the scrollbar */ - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_BACK); immRecti(pos, back->xmin, back->ymin, back->xmax, back->ymax); @@ -967,24 +967,24 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) boxh = (DOC_HEIGHT + 1) * (st->lheight_dpi + TXT_LINE_SPACING); /* Draw panel */ - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_BACK); immRecti(pos, x, y, x + boxw, y - boxh); immUniformThemeColor(TH_SHADE1); - immBegin(GWN_PRIM_LINE_LOOP, 4); + immBegin(GPU_PRIM_LINE_LOOP, 4); immVertex2i(pos, x, y); immVertex2i(pos, x + boxw, y); immVertex2i(pos, x + boxw, y - boxh); immVertex2i(pos, x, y - boxh); immEnd(); - immBegin(GWN_PRIM_LINE_LOOP, 3); + immBegin(GPU_PRIM_LINE_LOOP, 3); immVertex2i(pos, x + boxw - 10, y - 7); immVertex2i(pos, x + boxw - 4, y - 7); immVertex2i(pos, x + boxw - 7, y - 2); immEnd(); - immBegin(GWN_PRIM_LINE_LOOP, 3); + immBegin(GPU_PRIM_LINE_LOOP, 3); immVertex2i(pos, x + boxw - 10, y - boxh + 7); immVertex2i(pos, x + boxw - 4, y - boxh + 7); immVertex2i(pos, x + boxw - 7, y - boxh + 2); @@ -1066,7 +1066,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc /* not needed but stands out nicer */ UI_draw_box_shadow(220, x, y - boxh, x + boxw, y); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_SHADE1); @@ -1089,7 +1089,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc w = st->cwidth * text_get_char_pos(st, str, len); if (item == sel) { - uint posi = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint posi = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_SHADE2); @@ -1130,7 +1130,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar) return; } - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* Draw the selection */ @@ -1443,7 +1443,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) if (st->showlinenrs) { x = TXT_OFFSET + TEXTXLOC; - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_GRID); immRecti(pos, (TXT_OFFSET - 12), 0, (TXT_OFFSET - 5) + TEXTXLOC, ar->winy - 2); @@ -1502,7 +1502,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) margin_column_x = x + st->cwidth * (st->margin_column - st->left); if (margin_column_x >= x) { - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -1515,7 +1515,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) immUniform1f("dash_width", 2.0f); immUniform1f("dash_factor", 0.5f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2i(shdr_pos, margin_column_x, 0); immVertex2i(shdr_pos, margin_column_x, ar->winy - 2); immEnd(); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index a6714927249..c0abbe636c3 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -244,7 +244,7 @@ void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], un circball_array_fill(verts, cent, rad, tmat); - immBegin(GWN_PRIM_LINE_LOOP, CIRCLE_RESOL); + immBegin(GPU_PRIM_LINE_LOOP, CIRCLE_RESOL); for (int i = 0; i < CIRCLE_RESOL; ++i) { immVertex3fv(pos, verts[i]); } @@ -285,15 +285,15 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset) if (imm_len == 0) return; - Gwn_VertFormat *format = immVertexFormat(); - data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT); + GPUVertFormat *format = immVertexFormat(); + data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(GWN_PRIM_POINTS, imm_len); + immBeginAtMost(GPU_PRIM_POINTS, imm_len); dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -303,9 +303,9 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset) static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *UNUSED(dm), int offset) { Mesh *me = ob->data; - Gwn_Batch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset); - GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); - GWN_batch_draw(batch); + GPUBatch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset); + GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); + GPU_batch_draw(batch); } #endif @@ -328,15 +328,15 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset) drawBMOffset_userData data; data.bm = em->bm; data.offset = offset; - Gwn_VertFormat *format = immVertexFormat(); - data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT); + GPUVertFormat *format = immVertexFormat(); + data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(GWN_PRIM_POINTS, em->bm->totvert); + immBeginAtMost(GPU_PRIM_POINTS, em->bm->totvert); dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -348,9 +348,9 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset) GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE)); Mesh *me = em->ob->data; - Gwn_Batch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset); - GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); - GWN_batch_draw(batch); + GPUBatch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset); + GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); + GPU_batch_draw(batch); } #endif @@ -375,20 +375,20 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset) data.bm = em->bm; data.offset = offset; - Gwn_VertFormat *format = immVertexFormat(); + GPUVertFormat *format = immVertexFormat(); const int imm_len = dm->getNumEdges(dm) * 2; if (imm_len == 0) return; - data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT); + data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); GPU_line_width(1.0f); - immBeginAtMost(GWN_PRIM_LINES, imm_len); + immBeginAtMost(GPU_PRIM_LINES, imm_len); dm->foreachMappedEdge(dm, bbs_mesh_wire__mapFunc, &data); immEnd(); @@ -400,9 +400,9 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset) GPU_line_width(1.0f); Mesh *me = em->ob->data; - Gwn_Batch *batch = DRW_mesh_batch_cache_get_edges_with_select_id(me, offset); - GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); - GWN_batch_draw(batch); + GPUBatch *batch = DRW_mesh_batch_cache_get_edges_with_select_id(me, offset); + GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); + GPU_batch_draw(batch); } #endif @@ -420,13 +420,13 @@ static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *dm, const bool use_select if (imm_len == 0) return; - Gwn_VertFormat *format = immVertexFormat(); - data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT); + GPUVertFormat *format = immVertexFormat(); + data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); - immBeginAtMost(GWN_PRIM_TRIS, imm_len); + immBeginAtMost(GPU_PRIM_TRIS, imm_len); if (use_select == false) { int selcol; @@ -463,20 +463,20 @@ static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *dm, const bool use_select static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *UNUSED(dm), const bool use_select) { Mesh *me = em->ob->data; - Gwn_Batch *batch; + GPUBatch *batch; if (use_select) { batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, true, 1); - GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); - GWN_batch_draw(batch); + GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); + GPU_batch_draw(batch); } else { int selcol; GPU_select_index_get(0, &selcol); batch = DRW_mesh_batch_cache_get_triangles_with_select_mask(me, true); - GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR_U32); - GWN_batch_uniform_1ui(batch, "color", selcol); - GWN_batch_draw(batch); + GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR_U32); + GPU_batch_uniform_1ui(batch, "color", selcol); + GPU_batch_draw(batch); } } #endif @@ -499,15 +499,15 @@ static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *dm) { drawBMOffset_userData data; /* don't use offset */ data.bm = em->bm; - Gwn_VertFormat *format = immVertexFormat(); - data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT); + GPUVertFormat *format = immVertexFormat(); + data.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + data.col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U32, 1, GPU_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); GPU_point_size(UI_GetThemeValuef(TH_FACEDOT_SIZE)); - immBeginAtMost(GWN_PRIM_POINTS, em->bm->totface); + immBeginAtMost(GPU_PRIM_POINTS, em->bm->totface); dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, &data, DM_FOREACH_NOP); immEnd(); @@ -517,9 +517,9 @@ static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *dm) static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *UNUSED(dm)) { Mesh *me = em->ob->data; - Gwn_Batch *batch = DRW_mesh_batch_cache_get_facedots_with_select_id(me, 1); - GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); - GWN_batch_draw(batch); + GPUBatch *batch = DRW_mesh_batch_cache_get_facedots_with_select_id(me, 1); + GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); + GPU_batch_draw(batch); } #endif @@ -583,12 +583,12 @@ static void bbs_mesh_solid_verts(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(sce { int selcol; - Gwn_Batch *batch; + GPUBatch *batch; GPU_select_index_get(0, &selcol); batch = DRW_mesh_batch_cache_get_triangles_with_select_mask(me, true); - GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR_U32); - GWN_batch_uniform_1ui(batch, "color", selcol); - GWN_batch_draw(batch); + GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR_U32); + GPU_batch_uniform_1ui(batch, "color", selcol); + GPU_batch_draw(batch); } G.f |= (G_f_orig & G_BACKBUFSEL); @@ -601,15 +601,15 @@ static void bbs_mesh_solid_verts(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(sce static void bbs_mesh_solid_faces(Scene *UNUSED(scene), Object *ob) { Mesh *me = ob->data; - Gwn_Batch *batch; + GPUBatch *batch; if ((me->editflag & ME_EDIT_PAINT_FACE_SEL)) { batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, true, 1); } else { batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, false, 1); } - GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); - GWN_batch_draw(batch); + GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); + GPU_batch_draw(batch); } void draw_object_backbufsel( @@ -747,8 +747,8 @@ void ED_draw_object_facemap( Mesh *me = ob->data; const int *facemap_data = CustomData_get_layer(&me->pdata, CD_FACEMAP); if (facemap_data) { - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(col); @@ -788,7 +788,7 @@ void ED_draw_object_facemap( /* use gawain immediate mode fore now */ const int looptris_len = poly_to_tri_count(mpoly_len, mloop_len); - immBeginAtMost(GWN_PRIM_TRIS, looptris_len * 3); + immBeginAtMost(GPU_PRIM_TRIS, looptris_len * 3); MPoly *mp; int i; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index e03fe149af6..552d84ebb39 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -365,7 +365,7 @@ static void drawviewborder_grid3(uint shdr_pos, float x1, float x2, float y1, fl x4 = x1 + (1.0f - fac) * (x2 - x1); y4 = y1 + (1.0f - fac) * (y2 - y1); - immBegin(GWN_PRIM_LINES, 8); + immBegin(GPU_PRIM_LINES, 8); immVertex2f(shdr_pos, x1, y3); immVertex2f(shdr_pos, x2, y3); @@ -390,7 +390,7 @@ static void drawviewborder_triangle( float w = x2 - x1; float h = y2 - y1; - immBegin(GWN_PRIM_LINES, 6); + immBegin(GPU_PRIM_LINES, 6); if (w > h) { if (golden) { @@ -467,7 +467,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View x2i = (int)(x2 + (1.0f - 0.0001f)); y2i = (int)(y2 + (1.0f - 0.0001f)); - uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); /* First, solid lines. */ { @@ -559,7 +559,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View x3 = x1 + 0.5f * (x2 - x1); y3 = y1 + 0.5f * (y2 - y1); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(shdr_pos, x1, y3); immVertex2f(shdr_pos, x2, y3); @@ -571,7 +571,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View } if (ca->dtx & CAM_DTX_CENTER_DIAG) { - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); immVertex2f(shdr_pos, x1, y1); immVertex2f(shdr_pos, x2, y2); @@ -674,7 +674,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View static void drawrenderborder(ARegion *ar, View3D *v3d) { /* use the same program for everything */ - uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); GPU_line_width(1.0f); @@ -814,12 +814,12 @@ static void draw_view_axis(RegionView3D *rv3d, const rcti *rect) GPU_blend(true); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GWN_PRIM_LINES, 6); + immBegin(GPU_PRIM_LINES, 6); for (int axis_i = 0; axis_i < 3; axis_i++) { int i = axis_order[axis_i]; @@ -859,9 +859,9 @@ static void UNUSED_FUNCTION(draw_rotation_guide)(RegionView3D *rv3d) GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); glDepthMask(GL_FALSE); /* don't overwrite zbuf */ - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - uint col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); @@ -872,7 +872,7 @@ static void UNUSED_FUNCTION(draw_rotation_guide)(RegionView3D *rv3d) mul_v3_v3fl(scaled_axis, rv3d->rot_axis, scale); - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); color[3] = 0; /* more transparent toward the ends */ immAttrib4ubv(col, color); add_v3_v3v3(end, o, scaled_axis); @@ -911,7 +911,7 @@ static void UNUSED_FUNCTION(draw_rotation_guide)(RegionView3D *rv3d) axis_angle_to_quat(q, vis_axis, vis_angle); } - immBegin(GWN_PRIM_LINE_LOOP, ROT_AXIS_DETAIL); + immBegin(GPU_PRIM_LINE_LOOP, ROT_AXIS_DETAIL); color[3] = 63; /* somewhat faint */ immAttrib4ubv(col, color); float angle = 0.0f; @@ -940,7 +940,7 @@ static void UNUSED_FUNCTION(draw_rotation_guide)(RegionView3D *rv3d) /* -- draw rotation center -- */ immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR); GPU_point_size(5.0f); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immAttrib4ubv(col, color); immVertex3fv(pos, o); immEnd(); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index d1b9f95ca2a..3cf036e1ce1 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -263,14 +263,14 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), x2 = xoff + 0.55f * fly->width; y2 = yoff + 0.55f * fly->height; - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_VIEW_OVERLAY); - immBegin(GWN_PRIM_LINES, 16); + immBegin(GPU_PRIM_LINES, 16); /* bottom left */ immVertex2f(pos, x1, y1); diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c index 6040e21aacb..238a956cf26 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -84,7 +84,7 @@ static void draw_xyz_wire( switch (axis) { case 0: /* x axis */ - line_type = GWN_PRIM_LINES; + line_type = GPU_PRIM_LINES; /* bottom left to top right */ negate_v3_v3(v1, dx); @@ -105,7 +105,7 @@ static void draw_xyz_wire( break; case 1: /* y axis */ - line_type = GWN_PRIM_LINES; + line_type = GPU_PRIM_LINES; /* bottom left to top right */ mul_v3_fl(dx, 0.75f); @@ -127,7 +127,7 @@ static void draw_xyz_wire( break; case 2: /* z axis */ - line_type = GWN_PRIM_LINE_STRIP; + line_type = GPU_PRIM_LINE_STRIP; /* start at top left */ negate_v3_v3(v1, dx); @@ -172,8 +172,8 @@ static void axis_geom_draw(const wmGizmo *gz, const float color[4], const bool U { GPU_line_width(gz->line_width); - Gwn_VertFormat *format = immVertexFormat(); - const uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + const uint pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); struct { @@ -257,7 +257,7 @@ static void axis_geom_draw(const wmGizmo *gz, const float color[4], const bool U float v_start[3]; GPU_line_width(2.0f); immUniformColor4fv(color_current); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); if (axis_align == -1) { zero_v3(v_start); } @@ -280,10 +280,10 @@ static void axis_geom_draw(const wmGizmo *gz, const float color[4], const bool U GPU_matrix_translate_3fv(v_final); GPU_matrix_scale_1f(is_pos ? 0.22f : 0.18f); - Gwn_Batch *sphere = GPU_batch_preset_sphere(0); - GWN_batch_program_set_builtin(sphere, GPU_SHADER_3D_UNIFORM_COLOR); - GWN_batch_uniform_4fv(sphere, "color", is_pos ? color_current : color_current_fade); - GWN_batch_draw(sphere); + GPUBatch *sphere = GPU_batch_preset_sphere(0); + GPU_batch_program_set_builtin(sphere, GPU_SHADER_3D_UNIFORM_COLOR); + GPU_batch_uniform_4fv(sphere, "color", is_pos ? color_current : color_current_fade); + GPU_batch_draw(sphere); GPU_matrix_pop(); } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c index e9a8dd5ee08..c716692eb9b 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c @@ -548,7 +548,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) GPU_blend(true); - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); if (ruler_item->flag & RULERITEM_USE_ANGLE) { immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -562,7 +562,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2); immUniform1f("dash_width", 6.0f); - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2fv(shdr_pos, co_ss[0]); immVertex2fv(shdr_pos, co_ss[1]); @@ -604,7 +604,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) immUniformColor3ubv(color_wire); - immBegin(GWN_PRIM_LINE_STRIP, arc_steps + 1); + immBegin(GPU_PRIM_LINE_STRIP, arc_steps + 1); for (j = 0; j <= arc_steps; j++) { madd_v3_v3v3fl(co_tmp, ruler_item->co[1], dir_tmp, px_scale); @@ -637,7 +637,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) immUniformColor3ubv(color_wire); - immBegin(GWN_PRIM_LINES, 8); + immBegin(GPU_PRIM_LINES, 8); madd_v2_v2v2fl(cap, co_ss[0], rot_90_vec_a, cap_size); immVertex2fv(shdr_pos, cap); @@ -702,7 +702,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2); immUniform1f("dash_width", 6.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2fv(shdr_pos, co_ss[0]); immVertex2fv(shdr_pos, co_ss[2]); @@ -726,7 +726,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) immUniformColor3ubv(color_wire); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); madd_v2_v2v2fl(cap, co_ss[0], rot_90_vec, cap_size); immVertex2fv(shdr_pos, cap); @@ -793,7 +793,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) float co_ss_snap[3]; ED_view3d_project_float_global(ar, ruler_item->co[inter->co_index], co_ss_snap, V3D_PROJ_TEST_NOP); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color_act); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 5796014571a..855ee7bb9fc 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -39,7 +39,7 @@ struct ARegion; struct ARegionType; struct Base; struct BoundBox; -struct Gwn_Batch; +struct GPUBatch; struct Depsgraph; struct Object; struct SmokeDomainSettings; diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index 133af8e6da7..690fc5e3bdb 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -461,7 +461,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a GPU_blend(true); - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); if (ruler_item->flag & RULERITEM_USE_ANGLE) { immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -475,7 +475,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2); immUniform1f("dash_width", 6.0f); - immBegin(GWN_PRIM_LINE_STRIP, 3); + immBegin(GPU_PRIM_LINE_STRIP, 3); immVertex2fv(shdr_pos, co_ss[0]); immVertex2fv(shdr_pos, co_ss[1]); @@ -517,7 +517,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformColor3ubv(color_wire); - immBegin(GWN_PRIM_LINE_STRIP, arc_steps + 1); + immBegin(GPU_PRIM_LINE_STRIP, arc_steps + 1); for (j = 0; j <= arc_steps; j++) { madd_v3_v3v3fl(co_tmp, ruler_item->co[1], dir_tmp, px_scale); @@ -550,7 +550,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformColor3ubv(color_wire); - immBegin(GWN_PRIM_LINES, 8); + immBegin(GPU_PRIM_LINES, 8); madd_v2_v2v2fl(cap, co_ss[0], rot_90_vec_a, cap_size); immVertex2fv(shdr_pos, cap); @@ -614,7 +614,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2); immUniform1f("dash_width", 6.0f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2fv(shdr_pos, co_ss[0]); immVertex2fv(shdr_pos, co_ss[2]); @@ -638,7 +638,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformColor3ubv(color_wire); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); madd_v2_v2v2fl(cap, co_ss[0], rot_90_vec, cap_size); immVertex2fv(shdr_pos, cap); @@ -703,7 +703,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a float co_ss[3]; ED_view3d_project_float_global(ar, ruler_item->co[ruler_item->co_index], co_ss, V3D_PROJ_TEST_NOP); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color_act); diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 4c5150fabdd..e4e12cc3686 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -343,14 +343,14 @@ static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *a yoff = walk->ar->winy / 2; } - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + GPUVertFormat *format = immVertexFormat(); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_VIEW_OVERLAY); - immBegin(GWN_PRIM_LINES, 8); + immBegin(GPU_PRIM_LINES, 8); /* North */ immVertex2i(pos, xoff, yoff + inner_length); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index e9abdd80d20..dab53c04806 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1689,13 +1689,13 @@ typedef enum { } ArrowDirection; #define POS_INDEX 0 -/* NOTE: this --^ is a bit hackish, but simplifies Gwn_VertFormat usage among functions +/* NOTE: this --^ is a bit hackish, but simplifies GPUVertFormat usage among functions * private to this file - merwin */ static void drawArrow(ArrowDirection d, short offset, short length, short size) { - immBegin(GWN_PRIM_LINES, 6); + immBegin(GPU_PRIM_LINES, 6); switch (d) { case LEFT: @@ -1732,7 +1732,7 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size) static void drawArrowHead(ArrowDirection d, short size) { - immBegin(GWN_PRIM_LINES, 4); + immBegin(GPU_PRIM_LINES, 4); switch (d) { case LEFT: @@ -1765,7 +1765,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments float angle; int a; - immBegin(GWN_PRIM_LINE_STRIP, segments + 1); + immBegin(GPU_PRIM_LINE_STRIP, segments + 1); for (angle = angle_start, a = 0; a < segments; angle += delta, a++) { immVertex2f(POS_INDEX, cosf(angle) * size, sinf(angle) * size); @@ -1817,7 +1817,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) /* Dashed lines first. */ if (ELEM(t->helpline, HLP_SPRING, HLP_ANGLE)) { - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); UNUSED_VARS_NDEBUG(shdr_pos); /* silence warning */ BLI_assert(shdr_pos == POS_INDEX); @@ -1835,7 +1835,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2fv(POS_INDEX, cent); immVertex2f(POS_INDEX, tmval[0], tmval[1]); immEnd(); @@ -1844,7 +1844,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) } /* And now, solid lines. */ - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); UNUSED_VARS_NDEBUG(pos); /* silence warning */ BLI_assert(pos == POS_INDEX); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -7052,7 +7052,7 @@ static void drawEdgeSlide(TransInfo *t) GPU_matrix_push(); GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -7069,7 +7069,7 @@ static void drawEdgeSlide(TransInfo *t) GPU_line_width(line_size); immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade); - immBeginAtMost(GWN_PRIM_LINES, 4); + immBeginAtMost(GPU_PRIM_LINES, 4); if (curr_sv->v_side[0]) { immVertex3fv(pos, curr_sv->v_side[0]->co); immVertex3fv(pos, curr_sv->v_co_orig); @@ -7082,7 +7082,7 @@ static void drawEdgeSlide(TransInfo *t) immUniformThemeColorShadeAlpha(TH_SELECT, -30, alpha_shade); GPU_point_size(ctrl_size); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); if (slp->flipped) { if (curr_sv->v_side[1]) immVertex3fv(pos, curr_sv->v_side[1]->co); } @@ -7093,7 +7093,7 @@ static void drawEdgeSlide(TransInfo *t) immUniformThemeColorShadeAlpha(TH_SELECT, 255, alpha_shade); GPU_point_size(guide_size); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); interp_line_v3_v3v3v3(co_mark, co_b, curr_sv->v_co_orig, co_a, fac); immVertex3fv(pos, co_mark); immEnd(); @@ -7107,7 +7107,7 @@ static void drawEdgeSlide(TransInfo *t) GPU_line_width(line_size); immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade); - immBegin(GWN_PRIM_LINES, sld->totsv * 2); + immBegin(GPU_PRIM_LINES, sld->totsv * 2); /* TODO(campbell): Loop over all verts */ sv = sld->sv; @@ -7687,12 +7687,12 @@ static void drawVertSlide(TransInfo *t) GPU_line_width(line_size); - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade); - immBegin(GWN_PRIM_LINES, sld->totsv * 2); + immBegin(GPU_PRIM_LINES, sld->totsv * 2); if (is_clamp) { sv = sld->sv; for (i = 0; i < sld->totsv; i++, sv++) { @@ -7718,7 +7718,7 @@ static void drawVertSlide(TransInfo *t) GPU_point_size(ctrl_size); - immBegin(GWN_PRIM_POINTS, 1); + immBegin(GPU_PRIM_POINTS, 1); immVertex3fv(shdr_pos, (slp->flipped && slp->use_even) ? curr_sv->co_link_orig_3d[curr_sv->co_link_curr] : curr_sv->co_orig_3d); @@ -7761,7 +7761,7 @@ static void drawVertSlide(TransInfo *t) immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex3fv(shdr_pos, curr_sv->co_orig_3d); immVertex3fv(shdr_pos, co_dest_3d); immEnd(); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index a02948a9951..c8f74cbcd4f 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -747,7 +747,7 @@ void drawConstraint(TransInfo *t) if (depth_test_enabled) GPU_depth_test(false); - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR); @@ -760,7 +760,7 @@ void drawConstraint(TransInfo *t) immUniform1f("dash_width", 2.0f); immUniform1f("dash_factor", 0.5f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex3fv(shdr_pos, t->center_global); immVertex3fv(shdr_pos, vec); immEnd(); @@ -823,7 +823,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) if (depth_test_enabled) GPU_depth_test(false); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_GRID); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index c1aa0263ef8..3618d57b3ed 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1132,12 +1132,12 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis } UI_make_axis_color(col, col2, axis); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(col2); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex3fv(pos, v1); immVertex3fv(pos, v2); immEnd(); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index dc922b5c9ba..b67fd22dbff 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -165,7 +165,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) invert_m4_m4(imat, rv3d->viewmat); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -190,7 +190,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) if (usingSnappingNormal(t) && validSnappingNormal(t)) { immUniformColor4ubv(activeCol); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex3f(pos, t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]); immVertex3f(pos, t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0], t->tsnap.snapPoint[1] + t->tsnap.snapNormal[1], @@ -219,7 +219,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) GPU_blend(true); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 65147d53b5d..35a77fcd4c0 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -342,7 +342,7 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info const float mval_dst[2] = {win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin}; - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -355,7 +355,7 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); - immBegin(GWN_PRIM_LINES, 2); + immBegin(GPU_PRIM_LINES, 2); immVertex2fv(shdr_pos, mval_src); immVertex2fv(shdr_pos, mval_dst); immEnd(); diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 5ff008e1de2..616f4eac2ad 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -92,7 +92,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) GPU_matrix_translate_2fv(cursor); - const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -104,7 +104,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2); immUniform1f("dash_width", 8.0f); - immBegin(GWN_PRIM_LINES, 8); + immBegin(GPU_PRIM_LINES, 8); immVertex2f(shdr_pos, -0.05f * x_fac, 0.0f); immVertex2f(shdr_pos, 0.0f, 0.05f * y_fac); @@ -123,7 +123,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2); immUniform1f("dash_width", 2.0f); - immBegin(GWN_PRIM_LINES, 8); + immBegin(GPU_PRIM_LINES, 8); immVertex2f(shdr_pos, -0.020f * x_fac, 0.0f); immVertex2f(shdr_pos, -0.1f * x_fac, 0.0f); @@ -168,7 +168,7 @@ static void draw_uvs_shadow(Object *obedit) const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -229,7 +229,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, Object *obedit, BME } } - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -241,7 +241,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, Object *obedit, BME BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(efa, BM_ELEM_TAG)) { - immBegin(GWN_PRIM_TRI_FAN, efa->len); + immBegin(GPU_PRIM_TRI_FAN, efa->len); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -281,7 +281,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, Object *obedit, BME immUniformColor3fv(col); /* TODO: use editmesh tessface */ - immBegin(GWN_PRIM_TRI_FAN, efa->len); + immBegin(GPU_PRIM_TRI_FAN, efa->len); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -308,9 +308,9 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, Object *obedit, BME col[3] = 0.5f; /* hard coded alpha, not that nice */ - Gwn_VertFormat *format = immVertexFormat(); - uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + 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_2D_SMOOTH_COLOR); @@ -353,7 +353,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, Object *obedit, BME } /* TODO: use editmesh tessface */ - immBegin(GWN_PRIM_TRI_FAN, efa->len); + immBegin(GPU_PRIM_TRI_FAN, efa->len); BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); a = fabsf(uvang[i] - ang[i]) / (float)M_PI; @@ -393,7 +393,7 @@ static void draw_uvs_lineloop_bmfaces(BMesh *bm, const int cd_loop_uv_offset, co MLoopUV *luv; /* For more efficiency first transfer the entire buffer to vram. */ - Gwn_Batch *loop_batch = immBeginBatchAtMost(GWN_PRIM_LINE_LOOP, bm->totloop); + GPUBatch *loop_batch = immBeginBatchAtMost(GPU_PRIM_LINE_LOOP, bm->totloop); BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) @@ -407,17 +407,17 @@ static void draw_uvs_lineloop_bmfaces(BMesh *bm, const int cd_loop_uv_offset, co immEnd(); /* Then draw each face contour separately. */ - GWN_batch_program_use_begin(loop_batch); + GPU_batch_program_use_begin(loop_batch); unsigned int index = 0; BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; - GWN_batch_draw_range_ex(loop_batch, index, efa->len, false); + GPU_batch_draw_range_ex(loop_batch, index, efa->len, false); index += efa->len; } - GWN_batch_program_use_end(loop_batch); - GWN_batch_discard(loop_batch); + GPU_batch_program_use_end(loop_batch); + GPU_batch_discard(loop_batch); } static void draw_uvs_lineloop_mpoly(Mesh *me, MPoly *mpoly, unsigned int pos) @@ -425,7 +425,7 @@ static void draw_uvs_lineloop_mpoly(Mesh *me, MPoly *mpoly, unsigned int pos) MLoopUV *mloopuv; int i; - immBegin(GWN_PRIM_LINE_LOOP, mpoly->totloop); + immBegin(GPU_PRIM_LINE_LOOP, mpoly->totloop); mloopuv = &me->mloopuv[mpoly->loopstart]; for (i = mpoly->totloop; i != 0; i--, mloopuv++) { @@ -495,7 +495,7 @@ static void draw_uvs_other_mesh(Object *ob, const Image *curimage, static void draw_uvs_other(ViewLayer *view_layer, Object *obedit, const Image *curimage, const int other_uv_filter) { - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -536,7 +536,7 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, ViewLayer *view_la mloopuv = me->mloopuv; } - uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -548,7 +548,7 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, ViewLayer *view_la if ((scene->toolsettings->uv_flag & UV_SHOW_SAME_IMAGE) && mpoly->mat_nr != ob->actcol - 1) continue; - immBegin(GWN_PRIM_LINE_LOOP, mpoly->totloop); + immBegin(GPU_PRIM_LINE_LOOP, mpoly->totloop); mloopuv = mloopuv_base + mpoly->loopstart; for (b = 0; b < mpoly->totloop; b++, mloopuv++) { @@ -658,13 +658,13 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); GPU_blend(true); - Gwn_VertFormat *format = immVertexFormat(); - pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - Gwn_Batch *face_batch = immBeginBatch(GWN_PRIM_TRIS, tri_count * 3); + GPUBatch *face_batch = immBeginBatch(GPU_PRIM_TRIS, tri_count * 3); for (unsigned int i = 0; i < em->tottri; i++) { efa = em->looptris[i][0]->f; if (BM_elem_flag_test(efa, BM_ELEM_TAG)) { @@ -686,9 +686,9 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje immEnd(); /* XXX performance: we should not create and throw away result. */ - GWN_batch_draw(face_batch); - GWN_batch_program_use_end(face_batch); - GWN_batch_discard(face_batch); + GPU_batch_draw(face_batch); + GPU_batch_program_use_end(face_batch); + GPU_batch_discard(face_batch); immUnbindProgram(); @@ -712,7 +712,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); } - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); switch (sima->dt_uv) { case SI_UVDT_DASH: @@ -751,8 +751,8 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje } /* For more efficiency first transfer the entire buffer to vram. */ - Gwn_Batch *loop_batch = immBeginBatchAtMost(GWN_PRIM_LINE_LOOP, bm->totloop); - Gwn_VertBuf *loop_vbo = loop_batch->verts[0]; + GPUBatch *loop_batch = immBeginBatchAtMost(GPU_PRIM_LINE_LOOP, bm->totloop); + GPUVertBuf *loop_vbo = loop_batch->verts[0]; BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; @@ -766,17 +766,17 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje /* Then draw each face contour separately. */ if (loop_vbo->vertex_len != 0) { - GWN_batch_program_use_begin(loop_batch); + GPU_batch_program_use_begin(loop_batch); unsigned int index = 0, loop_vbo_count; BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; - GWN_batch_draw_range_ex(loop_batch, index, efa->len, false); + GPU_batch_draw_range_ex(loop_batch, index, efa->len, false); index += efa->len; } loop_vbo_count = index; - GWN_batch_program_use_end(loop_batch); + GPU_batch_program_use_end(loop_batch); immUnbindProgram(); @@ -790,14 +790,14 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje if (interpedges) { /* Create a color buffer. */ - static Gwn_VertFormat format = { 0 }; + static GPUVertFormat format = { 0 }; static uint shdr_col; if (format.attr_len == 0) { - shdr_col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + shdr_col = GPU_vertformat_attr_add(&format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); } - Gwn_VertBuf *vbo_col = GWN_vertbuf_create_with_format(&format); - GWN_vertbuf_data_alloc(vbo_col, loop_vbo_count); + GPUVertBuf *vbo_col = GPU_vertbuf_create_with_format(&format); + GPU_vertbuf_data_alloc(vbo_col, loop_vbo_count); index = 0; BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) { @@ -806,36 +806,36 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje BM_ITER_ELEM(l, &liter, efa, BM_LOOPS_OF_FACE) { sel = uvedit_uv_select_test(scene, l, cd_loop_uv_offset); - GWN_vertbuf_attr_set(vbo_col, shdr_col, index++, sel ? col1 : col2); + GPU_vertbuf_attr_set(vbo_col, shdr_col, index++, sel ? col1 : col2); } } /* Reuse the UV buffer and add the color buffer. */ - GWN_batch_vertbuf_add_ex(loop_batch, vbo_col, true); + GPU_batch_vertbuf_add_ex(loop_batch, vbo_col, true); /* Now draw each face contour separately with another builtin program. */ - GWN_batch_program_set_builtin(loop_batch, GPU_SHADER_2D_SMOOTH_COLOR); + GPU_batch_program_set_builtin(loop_batch, GPU_SHADER_2D_SMOOTH_COLOR); GPU_matrix_bind(loop_batch->interface); - GWN_batch_program_use_begin(loop_batch); + GPU_batch_program_use_begin(loop_batch); index = 0; BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; - GWN_batch_draw_range_ex(loop_batch, index, efa->len, false); + GPU_batch_draw_range_ex(loop_batch, index, efa->len, false); index += efa->len; } - GWN_batch_program_use_end(loop_batch); + GPU_batch_program_use_end(loop_batch); } else { - Gwn_VertFormat *format = immVertexFormat(); - pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); /* Use batch here to avoid problems with `IMM_BUFFER_SIZE`. */ - Gwn_Batch *flat_edges_batch = immBeginBatchAtMost(GWN_PRIM_LINES, loop_vbo_count * 2); + GPUBatch *flat_edges_batch = immBeginBatchAtMost(GPU_PRIM_LINES, loop_vbo_count * 2); BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; @@ -852,27 +852,27 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje } immEnd(); - GWN_batch_draw(flat_edges_batch); - GWN_batch_discard(flat_edges_batch); + GPU_batch_draw(flat_edges_batch); + GPU_batch_discard(flat_edges_batch); immUnbindProgram(); } } else { - GWN_batch_uniform_4fv(loop_batch, "color", col2); + GPU_batch_uniform_4fv(loop_batch, "color", col2); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* no nice edges */ - GWN_batch_program_use_begin(loop_batch); + GPU_batch_program_use_begin(loop_batch); index = 0; BM_ITER_MESH(efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; - GWN_batch_draw_range_ex(loop_batch, index, efa->len, false); + GPU_batch_draw_range_ex(loop_batch, index, efa->len, false); index += efa->len; } - GWN_batch_program_use_end(loop_batch); + GPU_batch_program_use_end(loop_batch); immUnbindProgram(); } } @@ -881,7 +881,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje immUnbindProgram(); } - GWN_batch_discard(loop_batch); + GPU_batch_discard(loop_batch); if (sima->flag & SI_SMOOTH_UV) { GPU_line_smooth(false); @@ -894,16 +894,16 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje float cent[2]; bool col_set = false; - Gwn_VertFormat *format = immVertexFormat(); - pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + GPUVertFormat *format = immVertexFormat(); + pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); pointsize = UI_GetThemeValuef(TH_FACEDOT_SIZE); GPU_point_size(pointsize); - immBeginAtMost(GWN_PRIM_POINTS, bm->totface); + immBeginAtMost(GPU_PRIM_POINTS, bm->totface); /* unselected faces */ @@ -955,7 +955,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje /* 6. draw uv vertices */ if (drawfaces != 2) { /* 2 means Mesh Face Mode */ - pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -964,7 +964,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje pointsize = UI_GetThemeValuef(TH_VERTEX_SIZE); GPU_point_size(pointsize); - immBeginAtMost(GWN_PRIM_POINTS, bm->totloop); + immBeginAtMost(GPU_PRIM_POINTS, bm->totloop); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) @@ -984,7 +984,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje GPU_point_size(pointsize * 2 + (((int)pointsize % 2) ? (-1) : 0)); imm_cpack(0xFF); - immBeginAtMost(GWN_PRIM_POINTS, bm->totloop); + immBeginAtMost(GPU_PRIM_POINTS, bm->totloop); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) @@ -1004,7 +1004,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje immUniformThemeColor(TH_VERTEX_SELECT); GPU_point_size(pointsize); - immBeginAtMost(GWN_PRIM_POINTS, bm->totloop); + immBeginAtMost(GPU_PRIM_POINTS, bm->totloop); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 9265bc05154..18f1bc872c0 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1547,13 +1547,13 @@ static void stitch_calculate_edge_normal(BMEditMesh *em, UvEdge *edge, float *no /** */ -static void stitch_draw_vbo(Gwn_VertBuf *vbo, Gwn_PrimType prim_type, const float col[4]) +static void stitch_draw_vbo(GPUVertBuf *vbo, GPUPrimType prim_type, const float col[4]) { - Gwn_Batch *batch = GWN_batch_create_ex(prim_type, vbo, NULL, GWN_BATCH_OWNS_VBO); - GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR); - GWN_batch_uniform_4fv(batch, "color", col); - GWN_batch_draw(batch); - GWN_batch_discard(batch); + GPUBatch *batch = GPU_batch_create_ex(prim_type, vbo, NULL, GPU_BATCH_OWNS_VBO); + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR); + GPU_batch_uniform_4fv(batch, "color", col); + GPU_batch_draw(batch); + GPU_batch_discard(batch); } /* TODO make things pretier : store batches inside StitchPreviewer instead of the bare verts pos */ @@ -1563,25 +1563,25 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar unsigned int num_line = 0, num_tri, tri_idx = 0, line_idx = 0; StitchState *state = (StitchState *)arg; StitchPreviewer *stitch_preview = state->stitch_preview; - Gwn_VertBuf *vbo, *vbo_line; + GPUVertBuf *vbo, *vbo_line; float col[4]; - static Gwn_VertFormat format = { 0 }; + static GPUVertFormat format = { 0 }; static unsigned int pos_id; if (format.attr_len == 0) { - pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); } GPU_blend(true); /* Static Tris */ UI_GetThemeColor4fv(TH_STITCH_PREVIEW_ACTIVE, col); - vbo = GWN_vertbuf_create_with_format(&format); - GWN_vertbuf_data_alloc(vbo, stitch_preview->num_static_tris * 3); + vbo = GPU_vertbuf_create_with_format(&format); + GPU_vertbuf_data_alloc(vbo, stitch_preview->num_static_tris * 3); for (int i = 0; i < stitch_preview->num_static_tris * 3; i++) { - GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->static_tris[i * 2]); + GPU_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->static_tris[i * 2]); } - stitch_draw_vbo(vbo, GWN_PRIM_TRIS, col); + stitch_draw_vbo(vbo, GPU_PRIM_TRIS, col); /* Preview Polys */ @@ -1591,39 +1591,39 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar num_tri = num_line - 2 * stitch_preview->num_polys; /* we need to convert the polys into triangles / lines */ - vbo = GWN_vertbuf_create_with_format(&format); - vbo_line = GWN_vertbuf_create_with_format(&format); + vbo = GPU_vertbuf_create_with_format(&format); + vbo_line = GPU_vertbuf_create_with_format(&format); - GWN_vertbuf_data_alloc(vbo, num_tri * 3); - GWN_vertbuf_data_alloc(vbo_line, num_line * 2); + GPU_vertbuf_data_alloc(vbo, num_tri * 3); + GPU_vertbuf_data_alloc(vbo_line, num_line * 2); for (int i = 0; i < stitch_preview->num_polys; i++) { BLI_assert(stitch_preview->uvs_per_polygon[i] >= 3); /* Start line */ - GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); - GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + 2]); + GPU_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); + GPU_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + 2]); for (j = 1; j < stitch_preview->uvs_per_polygon[i] - 1; ++j) { - GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index]); - GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j + 0) * 2]); - GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j + 1) * 2]); + GPU_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index]); + GPU_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j + 0) * 2]); + GPU_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j + 1) * 2]); - GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j + 0) * 2]); - GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j + 1) * 2]); + GPU_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j + 0) * 2]); + GPU_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j + 1) * 2]); } /* Closing line */ - GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); + GPU_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); /* j = uvs_per_polygon[i] - 1*/ - GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + j * 2]); + GPU_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + j * 2]); index += stitch_preview->uvs_per_polygon[i] * 2; } UI_GetThemeColor4fv(TH_STITCH_PREVIEW_FACE, col); - stitch_draw_vbo(vbo, GWN_PRIM_TRIS, col); + stitch_draw_vbo(vbo, GPU_PRIM_TRIS, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_EDGE, col); - stitch_draw_vbo(vbo_line, GWN_PRIM_LINES, col); + stitch_draw_vbo(vbo_line, GPU_PRIM_LINES, col); GPU_blend(false); @@ -1633,37 +1633,37 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE) * 2.0f); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_STITCHABLE, col); - vbo = GWN_vertbuf_create_with_format(&format); - GWN_vertbuf_data_alloc(vbo, stitch_preview->num_stitchable); + vbo = GPU_vertbuf_create_with_format(&format); + GPU_vertbuf_data_alloc(vbo, stitch_preview->num_stitchable); for (int i = 0; i < stitch_preview->num_stitchable; i++) { - GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i * 2]); + GPU_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i * 2]); } - stitch_draw_vbo(vbo, GWN_PRIM_POINTS, col); + stitch_draw_vbo(vbo, GPU_PRIM_POINTS, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col); - vbo = GWN_vertbuf_create_with_format(&format); - GWN_vertbuf_data_alloc(vbo, stitch_preview->num_unstitchable); + vbo = GPU_vertbuf_create_with_format(&format); + GPU_vertbuf_data_alloc(vbo, stitch_preview->num_unstitchable); for (int i = 0; i < stitch_preview->num_unstitchable; i++) { - GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i * 2]); + GPU_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i * 2]); } - stitch_draw_vbo(vbo, GWN_PRIM_POINTS, col); + stitch_draw_vbo(vbo, GPU_PRIM_POINTS, col); } else { UI_GetThemeColor4fv(TH_STITCH_PREVIEW_STITCHABLE, col); - vbo = GWN_vertbuf_create_with_format(&format); - GWN_vertbuf_data_alloc(vbo, stitch_preview->num_stitchable * 2); + vbo = GPU_vertbuf_create_with_format(&format); + GPU_vertbuf_data_alloc(vbo, stitch_preview->num_stitchable * 2); for (int i = 0; i < stitch_preview->num_stitchable * 2; i++) { - GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i * 2]); + GPU_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i * 2]); } - stitch_draw_vbo(vbo, GWN_PRIM_LINES, col); + stitch_draw_vbo(vbo, GPU_PRIM_LINES, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col); - vbo = GWN_vertbuf_create_with_format(&format); - GWN_vertbuf_data_alloc(vbo, stitch_preview->num_unstitchable * 2); + vbo = GPU_vertbuf_create_with_format(&format); + GPU_vertbuf_data_alloc(vbo, stitch_preview->num_unstitchable * 2); for (int i = 0; i < stitch_preview->num_unstitchable * 2; i++) { - GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i * 2]); + GPU_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i * 2]); } - stitch_draw_vbo(vbo, GWN_PRIM_LINES, col); + stitch_draw_vbo(vbo, GPU_PRIM_LINES, col); } } |