From 57ab7daa2aee436b0b0acfa00b2e2b1d28b55b2c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 15 Jul 2018 15:27:15 +0200 Subject: GPU_matrix: use Blender's naming conventions Thanks to @sergey for review --- source/blender/editors/animation/anim_draw.c | 6 +- source/blender/editors/animation/anim_markers.c | 6 +- source/blender/editors/curve/editcurve_paint.c | 14 ++--- .../editors/gizmo_library/gizmo_library_presets.c | 12 ++-- .../gizmo_library/gizmo_types/arrow2d_gizmo.c | 8 +-- .../gizmo_library/gizmo_types/arrow3d_gizmo.c | 22 +++---- .../gizmo_library/gizmo_types/button2d_gizmo.c | 14 ++--- .../gizmo_library/gizmo_types/cage2d_gizmo.c | 6 +- .../gizmo_library/gizmo_types/cage3d_gizmo.c | 6 +- .../gizmo_library/gizmo_types/dial3d_gizmo.c | 12 ++-- .../gizmo_library/gizmo_types/grab3d_gizmo.c | 16 ++--- .../gizmo_library/gizmo_types/primitive3d_gizmo.c | 12 ++-- source/blender/editors/interface/interface.c | 12 ++-- source/blender/editors/interface/interface_draw.c | 50 ++++++++-------- source/blender/editors/interface/interface_icons.c | 2 +- .../blender/editors/interface/interface_widgets.c | 8 +-- source/blender/editors/interface/view2d.c | 2 +- source/blender/editors/mask/mask_draw.c | 22 +++---- source/blender/editors/mesh/editmesh_knife.c | 6 +- source/blender/editors/mesh/editmesh_loopcut.c | 6 +- source/blender/editors/render/render_opengl.c | 2 +- source/blender/editors/screen/area.c | 16 ++--- source/blender/editors/screen/glutil.c | 4 +- source/blender/editors/screen/screen_draw.c | 8 +-- source/blender/editors/sculpt_paint/paint_cursor.c | 36 +++++------ source/blender/editors/sculpt_paint/paint_utils.c | 4 +- source/blender/editors/space_action/action_draw.c | 8 +-- source/blender/editors/space_clip/clip_draw.c | 70 +++++++++++----------- .../blender/editors/space_clip/clip_graph_draw.c | 8 +-- source/blender/editors/space_clip/space_clip.c | 12 ++-- source/blender/editors/space_graph/graph_draw.c | 32 +++++----- source/blender/editors/space_image/image_draw.c | 10 ++-- source/blender/editors/space_node/drawnode.c | 8 +-- source/blender/editors/space_node/node_draw.c | 10 ++-- .../editors/space_sequencer/sequencer_draw.c | 6 +- source/blender/editors/space_view3d/drawobject.c | 4 +- source/blender/editors/space_view3d/space_view3d.c | 2 +- source/blender/editors/space_view3d/view3d_draw.c | 16 ++--- .../editors/space_view3d/view3d_draw_legacy.c | 14 ++--- .../space_view3d/view3d_gizmo_navigate_type.c | 26 ++++---- .../blender/editors/space_view3d/view3d_project.c | 4 +- .../blender/editors/space_view3d/view3d_select.c | 4 +- source/blender/editors/space_view3d/view3d_utils.c | 4 +- source/blender/editors/space_view3d/view3d_view.c | 6 +- source/blender/editors/transform/transform.c | 40 ++++++------- .../editors/transform/transform_constraints.c | 8 +-- .../blender/editors/transform/transform_generics.c | 4 +- source/blender/editors/uvedit/uvedit_draw.c | 6 +- 48 files changed, 307 insertions(+), 307 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 51ba7d9c269..129cf07b7c4 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -87,8 +87,8 @@ void ANIM_draw_cfra_number(const bContext *C, View2D *v2d, short flag) /* because the frame number text is subject to the same scaling as the contents of the view */ UI_view2d_scale_get(v2d, &xscale, NULL); - gpuPushMatrix(); - gpuScale2f(1.0f / xscale, 1.0f); + GPU_matrix_push(); + GPU_matrix_scale_2f(1.0f / xscale, 1.0f); /* get timecode string * - padding on str-buf passed so that it doesn't sit on the frame indicator @@ -128,7 +128,7 @@ void ANIM_draw_cfra_number(const bContext *C, View2D *v2d, short flag) numstr, col); /* restore view transform */ - gpuPopMatrix(); + GPU_matrix_pop(); } /* General call for drawing current frame indicator in animation editor */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index c5f7782dcee..f809bff536f 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -505,8 +505,8 @@ void ED_markers_draw(const bContext *C, int flag) /* no time correction for framelen! space is drawn with old values */ ypixels = BLI_rcti_size_y(&v2d->mask); UI_view2d_scale_get(v2d, &xscale, &yscale); - gpuPushMatrix(); - gpuScale2f(1.0f / xscale, 1.0f); + GPU_matrix_push(); + GPU_matrix_scale_2f(1.0f / xscale, 1.0f); /* x-bounds with offset for text (adjust for long string, avoid checking string width) */ font_width_max = (10 * UI_DPI_FAC) / xscale; @@ -529,7 +529,7 @@ void ED_markers_draw(const bContext *C, int flag) } } - gpuPopMatrix(); + GPU_matrix_pop(); } /* ************************ Marker Wrappers API ********************* */ diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 90f9b2e0569..130e3cc5475 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -392,12 +392,12 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS GWN_batch_uniform_3fv(sphere, "color", color); /* scale to edit-mode space */ - gpuPushMatrix(); - gpuMultMatrix(obedit->obmat); + GPU_matrix_push(); + GPU_matrix_mul(obedit->obmat); BLI_mempool_iternew(cdd->stroke_elem_pool, &iter); for (selem = BLI_mempool_iterstep(&iter); selem; selem = BLI_mempool_iterstep(&iter)) { - gpuTranslate3f( + GPU_matrix_translate_3f( selem->location_local[0] - location_prev[0], selem->location_local[1] - location_prev[1], selem->location_local[2] - location_prev[2]); @@ -405,15 +405,15 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS const float radius = stroke_elem_radius(cdd, selem); - gpuPushMatrix(); - gpuScaleUniform(radius); + GPU_matrix_push(); + GPU_matrix_scale_1f(radius); GWN_batch_draw(sphere); - gpuPopMatrix(); + GPU_matrix_pop(); location_prev = selem->location_local; } - gpuPopMatrix(); + GPU_matrix_pop(); } if (stroke_len > 1) { diff --git a/source/blender/editors/gizmo_library/gizmo_library_presets.c b/source/blender/editors/gizmo_library/gizmo_library_presets.c index e16f8ed21bf..ab92905192b 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_presets.c +++ b/source/blender/editors/gizmo_library/gizmo_library_presets.c @@ -94,10 +94,10 @@ static void ed_gizmo_draw_preset_geometry( GPU_select_load_id(select_id); } - gpuPushMatrix(); - gpuMultMatrix(mat); + GPU_matrix_push(); + GPU_matrix_mul(mat); wm_gizmo_geometryinfo_draw(info, is_select, color); - gpuPopMatrix(); + GPU_matrix_pop(); if (is_select) { GPU_select_load_id(-1); @@ -139,10 +139,10 @@ void ED_gizmo_draw_preset_facemap( GPU_select_load_id(select_id); } - gpuPushMatrix(); - gpuMultMatrix(ob->obmat); + GPU_matrix_push(); + GPU_matrix_mul(ob->obmat); ED_draw_object_facemap(CTX_data_depsgraph(C), scene, ob, color, facemap); - gpuPopMatrix(); + GPU_matrix_pop(); if (is_select) { GPU_select_load_id(-1); 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 0faeeefb4a3..673e38e4a1a 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c @@ -72,9 +72,9 @@ static void arrow2d_draw_geom(wmGizmo *gz, const float matrix[4][4], const float uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - gpuPushMatrix(); - gpuMultMatrix(matrix); - gpuRotate2D(RAD2DEGF(arrow_angle)); + GPU_matrix_push(); + GPU_matrix_mul(matrix); + GPU_matrix_rotate_2d(RAD2DEGF(arrow_angle)); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -93,7 +93,7 @@ static void arrow2d_draw_geom(wmGizmo *gz, const float matrix[4][4], const float immUnbindProgram(); - gpuPopMatrix(); + GPU_matrix_pop(); } static void gizmo_arrow2d_draw(const bContext *UNUSED(C), wmGizmo *gz) 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 09c6485c29e..da4bce680b8 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c @@ -143,15 +143,15 @@ static void arrow_draw_geom(const ArrowGizmo3D *arrow, const bool select, const /* *** draw arrow head *** */ - gpuPushMatrix(); + GPU_matrix_push(); if (draw_style == ED_GIZMO_ARROW_STYLE_BOX) { const float size = 0.05f; /* translate to line end with some extra offset so box starts exactly where line ends */ - gpuTranslate3f(0.0f, 0.0f, arrow_length + size); + GPU_matrix_translate_3f(0.0f, 0.0f, arrow_length + size); /* scale down to box size */ - gpuScale3f(size, size, size); + GPU_matrix_scale_3f(size, size, size); /* draw cube */ immUnbindProgram(); @@ -165,13 +165,13 @@ static void arrow_draw_geom(const ArrowGizmo3D *arrow, const bool select, const const float width = 0.06f; /* translate to line end */ - gpuTranslate3f(0.0f, 0.0f, arrow_length); + GPU_matrix_translate_3f(0.0f, 0.0f, arrow_length); imm_draw_circle_fill_3d(pos, 0.0, 0.0, width, 8); imm_draw_cylinder_fill_3d(pos, width, 0.0, len, 8, 1); } - gpuPopMatrix(); + GPU_matrix_pop(); #endif /* USE_GIZMO_CUSTOM_ARROWS */ } @@ -190,26 +190,26 @@ static void arrow_draw_intern(ArrowGizmo3D *arrow, const bool select, const bool WM_gizmo_calc_matrix_final(gz, matrix_final); - gpuPushMatrix(); - gpuMultMatrix(matrix_final); + GPU_matrix_push(); + GPU_matrix_mul(matrix_final); GPU_blend(true); arrow_draw_geom(arrow, select, color); GPU_blend(false); - gpuPopMatrix(); + GPU_matrix_pop(); if (gz->interaction_data) { GizmoInteraction *inter = gz->interaction_data; - gpuPushMatrix(); - gpuMultMatrix(inter->init_matrix_final); + GPU_matrix_push(); + GPU_matrix_mul(inter->init_matrix_final); GPU_blend(true); arrow_draw_geom(arrow, select, (const float[4]){0.5f, 0.5f, 0.5f, 0.5f}); GPU_blend(false); - gpuPopMatrix(); + GPU_matrix_pop(); } } 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 dfe2c8b2413..13711325038 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c @@ -150,8 +150,8 @@ static void button2d_draw_intern( } bool need_to_pop = true; - gpuPushMatrix(); - gpuMultMatrix(matrix_final); + GPU_matrix_push(); + GPU_matrix_mul(matrix_final); if (is_3d) { RegionView3D *rv3d = CTX_wm_region_view3d(C); @@ -161,7 +161,7 @@ static void button2d_draw_intern( mul_m4_m4m4(matrix_align, rv3d->viewmat, matrix_final_unit); zero_v3(matrix_align[3]); transpose_m4(matrix_align); - gpuMultMatrix(matrix_align); + GPU_matrix_mul(matrix_align); } if (select) { @@ -195,15 +195,15 @@ static void button2d_draw_intern( float size[2]; if (is_3d) { const float fac = 2.0f; - gpuTranslate2f(-(fac / 2), -(fac / 2)); - gpuScale2f(fac / (ICON_DEFAULT_WIDTH * UI_DPI_FAC), fac / (ICON_DEFAULT_HEIGHT * UI_DPI_FAC)); + GPU_matrix_translate_2f(-(fac / 2), -(fac / 2)); + GPU_matrix_scale_2f(fac / (ICON_DEFAULT_WIDTH * UI_DPI_FAC), fac / (ICON_DEFAULT_HEIGHT * UI_DPI_FAC)); size[0] = 1.0f; size[1] = 1.0f; } else { size[0] = gz->matrix_basis[3][0] - (ICON_DEFAULT_WIDTH / 2.0) * UI_DPI_FAC; size[1] = gz->matrix_basis[3][1] - (ICON_DEFAULT_HEIGHT / 2.0) * UI_DPI_FAC; - gpuPopMatrix(); + GPU_matrix_pop(); need_to_pop = false; } UI_icon_draw(size[0], size[1], button->icon); @@ -212,7 +212,7 @@ static void button2d_draw_intern( } if (need_to_pop) { - gpuPopMatrix(); + GPU_matrix_pop(); } } 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 8a830302f51..5e3b7bb21c6 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c @@ -551,8 +551,8 @@ static void gizmo_cage2d_draw_intern( WM_gizmo_calc_matrix_final(gz, matrix_final); - gpuPushMatrix(); - gpuMultMatrix(matrix_final); + GPU_matrix_push(); + GPU_matrix_mul(matrix_final); float margin[2]; gizmo_calc_rect_view_margin(gz, dims, margin); @@ -668,7 +668,7 @@ static void gizmo_cage2d_draw_intern( } GPU_line_width(1.0); - gpuPopMatrix(); + GPU_matrix_pop(); } /** 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 c3fb5a08cdb..9cad82619ba 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c @@ -296,8 +296,8 @@ static void gizmo_cage3d_draw_intern( WM_gizmo_calc_matrix_final(gz, matrix_final); - gpuPushMatrix(); - gpuMultMatrix(matrix_final); + GPU_matrix_push(); + GPU_matrix_mul(matrix_final); float margin[3]; gizmo_calc_rect_view_margin(gz, dims, margin); @@ -412,7 +412,7 @@ static void gizmo_cage3d_draw_intern( } GPU_line_width(1.0); - gpuPopMatrix(); + GPU_matrix_pop(); } /** 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 b45f3d8a242..300ae222189 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c @@ -161,8 +161,8 @@ static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[ { GPU_line_width(1.0f); - gpuPushMatrix(); - gpuRotate3f(RAD2DEGF(angle), 0.0f, 0.0f, -1.0f); + 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); @@ -177,7 +177,7 @@ static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[ immUnbindProgram(); - gpuPopMatrix(); + GPU_matrix_pop(); } static void dial_ghostarc_draw( @@ -292,8 +292,8 @@ static void dial_draw_intern( .matrix_basis = (void *)matrix_basis_adjust, }), matrix_final); - gpuPushMatrix(); - gpuMultMatrix(matrix_final); + GPU_matrix_push(); + GPU_matrix_mul(matrix_final); /* draw rotation indicator arc first */ if ((gz->flag & WM_GIZMO_DRAW_VALUE) && @@ -335,7 +335,7 @@ static void dial_draw_intern( /* draw actual dial gizmo */ dial_geom_draw(gz, color, select, matrix_basis_adjust, clip_plane); - gpuPopMatrix(); + GPU_matrix_pop(); } static void gizmo_dial_draw_select(const bContext *C, wmGizmo *gz, int select_id) 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 c6d11347e9f..840ea793b89 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c @@ -176,8 +176,8 @@ static void grab3d_draw_intern( gizmo_color_get(gz, highlight, color); WM_gizmo_calc_matrix_final(gz, matrix_final); - gpuPushMatrix(); - gpuMultMatrix(matrix_final); + GPU_matrix_push(); + GPU_matrix_mul(matrix_final); if (align_view) { float matrix_final_unit[4][4]; @@ -186,26 +186,26 @@ static void grab3d_draw_intern( mul_m4_m4m4(matrix_align, rv3d->viewmat, matrix_final_unit); zero_v3(matrix_align[3]); transpose_m4(matrix_align); - gpuMultMatrix(matrix_align); + GPU_matrix_mul(matrix_align); } GPU_blend(true); grab_geom_draw(gz, color, select, draw_options); GPU_blend(false); - gpuPopMatrix(); + GPU_matrix_pop(); if (gz->interaction_data) { - gpuPushMatrix(); - gpuMultMatrix(inter->init_matrix_final); + GPU_matrix_push(); + GPU_matrix_mul(inter->init_matrix_final); if (align_view) { - gpuMultMatrix(matrix_align); + GPU_matrix_mul(matrix_align); } GPU_blend(true); grab_geom_draw(gz, (const float[4]){0.5f, 0.5f, 0.5f, 0.5f}, select, draw_options); GPU_blend(false); - gpuPopMatrix(); + GPU_matrix_pop(); } } 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 be2bf7d2c56..b61c16b8d65 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c @@ -99,14 +99,14 @@ static void gizmo_primitive_draw_intern( WM_gizmo_calc_matrix_final(gz, matrix_final); - gpuPushMatrix(); - gpuMultMatrix(matrix_final); + GPU_matrix_push(); + GPU_matrix_mul(matrix_final); GPU_blend(true); gizmo_primitive_draw_geom(color_inner, color_outer, draw_style); GPU_blend(false); - gpuPopMatrix(); + GPU_matrix_pop(); if (gz->interaction_data) { GizmoInteraction *inter = gz->interaction_data; @@ -115,14 +115,14 @@ static void gizmo_primitive_draw_intern( copy_v3_fl(color_outer, 0.5f); color_outer[3] = 0.8f; - gpuPushMatrix(); - gpuMultMatrix(inter->init_matrix_final); + GPU_matrix_push(); + GPU_matrix_mul(inter->init_matrix_final); GPU_blend(true); gizmo_primitive_draw_geom(color_inner, color_outer, draw_style); GPU_blend(false); - gpuPopMatrix(); + GPU_matrix_pop(); } } diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 3e01c5f356f..37c56d454bb 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -280,7 +280,7 @@ static void ui_update_window_matrix(const wmWindow *window, const ARegion *regio /* window matrix and aspect */ if (region && region->visible) { /* Get projection matrix which includes View2D translation and zoom. */ - gpuGetProjectionMatrix(block->winmat); + GPU_matrix_projection_get(block->winmat); block->aspect = 2.0f / fabsf(region->winx * block->winmat[0][0]); } else { @@ -1448,9 +1448,9 @@ void UI_block_draw(const bContext *C, uiBlock *block) ui_but_to_pixelrect(&rect, ar, block, NULL); /* pixel space for AA widgets */ - gpuPushProjectionMatrix(); - gpuPushMatrix(); - gpuLoadIdentity(); + GPU_matrix_push_projection(); + GPU_matrix_push(); + GPU_matrix_identity_set(); wmOrtho2_region_pixelspace(ar); @@ -1485,8 +1485,8 @@ void UI_block_draw(const bContext *C, uiBlock *block) BLF_batch_draw_end(); /* restore matrix */ - gpuPopProjectionMatrix(); - gpuPopMatrix(); + GPU_matrix_pop_projection(); + GPU_matrix_pop(); } static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlock *block) diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 51f2c7e8ece..b1c3795b1af 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1027,13 +1027,13 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) { float col[3] = {alpha, alpha, alpha}; - gpuPushMatrix(); - gpuTranslate2f(rect.xmin, yofs); - gpuScale2f(w, h); + GPU_matrix_push(); + GPU_matrix_translate_2f(rect.xmin, yofs); + GPU_matrix_scale_2f(w, h); waveform_draw_one(scopes->waveform_1, scopes->waveform_tot, col); - gpuPopMatrix(); + GPU_matrix_pop(); /* min max */ immUniformColor3f(0.5f, 0.5f, 0.5f); @@ -1049,15 +1049,15 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE } /* RGB (3 channel) */ else if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB) { - gpuPushMatrix(); - gpuTranslate2f(rect.xmin, yofs); - gpuScale2f(w, h); + GPU_matrix_push(); + GPU_matrix_translate_2f(rect.xmin, yofs); + GPU_matrix_scale_2f(w, h); waveform_draw_one(scopes->waveform_1, scopes->waveform_tot, colors_alpha[0]); waveform_draw_one(scopes->waveform_2, scopes->waveform_tot, colors_alpha[1]); waveform_draw_one(scopes->waveform_3, scopes->waveform_tot, colors_alpha[2]); - gpuPopMatrix(); + GPU_matrix_pop(); } /* PARADE / YCC (3 channels) */ else if (ELEM(scopes->wavefrm_mode, @@ -1069,19 +1069,19 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE { int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB_PARADE); - gpuPushMatrix(); - gpuTranslate2f(rect.xmin, yofs); - gpuScale2f(w3, h); + GPU_matrix_push(); + GPU_matrix_translate_2f(rect.xmin, yofs); + GPU_matrix_scale_2f(w3, h); waveform_draw_one(scopes->waveform_1, scopes->waveform_tot, (rgb) ? colors_alpha[0] : colorsycc_alpha[0]); - gpuTranslate2f(1.0f, 0.0f); + GPU_matrix_translate_2f(1.0f, 0.0f); waveform_draw_one(scopes->waveform_2, scopes->waveform_tot, (rgb) ? colors_alpha[1] : colorsycc_alpha[1]); - gpuTranslate2f(1.0f, 0.0f); + GPU_matrix_translate_2f(1.0f, 0.0f); waveform_draw_one(scopes->waveform_3, scopes->waveform_tot, (rgb) ? colors_alpha[2] : colorsycc_alpha[2]); - gpuPopMatrix(); + GPU_matrix_pop(); } /* min max */ @@ -1263,13 +1263,13 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN glBlendFunc(GL_ONE, GL_ONE); GPU_point_size(1.0); - gpuPushMatrix(); - gpuTranslate2f(centerx, centery); - gpuScaleUniform(diam); + GPU_matrix_push(); + GPU_matrix_translate_2f(centerx, centery); + GPU_matrix_scale_1f(diam); waveform_draw_one(scopes->vecscope, scopes->waveform_tot, col); - gpuPopMatrix(); + GPU_matrix_pop(); } immUnbindProgram(); @@ -1548,15 +1548,15 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) ui_but_v3_get(but, light); /* transform to button */ - gpuPushMatrix(); + GPU_matrix_push(); if (BLI_rcti_size_x(rect) < BLI_rcti_size_y(rect)) size = 0.5f * BLI_rcti_size_x(rect); else size = 0.5f * BLI_rcti_size_y(rect); - gpuTranslate2f(rect->xmin + 0.5f * BLI_rcti_size_x(rect), rect->ymin + 0.5f * BLI_rcti_size_y(rect)); - gpuScaleUniform(size); + 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); @@ -1580,7 +1580,7 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) GPU_line_smooth(false); /* matrix after circle */ - gpuPopMatrix(); + GPU_matrix_pop(); immUnbindProgram(); } @@ -1900,7 +1900,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U } if (!ok && scopes->track_preview) { - gpuPushMatrix(); + GPU_matrix_push(); /* draw content of pattern area */ GPU_scissor(rect.xmin, rect.ymin, scissor[2], scissor[3]); @@ -1919,7 +1919,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U immDrawPixelsTex(&state, rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, drawibuf->rect, 1.0f, 1.0f, NULL); /* draw cross for pixel position */ - gpuTranslate2f(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1]); + GPU_matrix_translate_2f(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1]); GPU_scissor( rect.xmin, rect.ymin, @@ -1958,7 +1958,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U immUnbindProgram(); } - gpuPopMatrix(); + GPU_matrix_pop(); ok = true; } diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 62413e2434c..b9183461b4c 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1292,7 +1292,7 @@ static void icon_draw_texture_cached( { float mvp[4][4]; - gpuGetModelViewProjectionMatrix(mvp); + GPU_matrix_model_view_projection_get(mvp); IconDrawCall *call = &g_icon_draw_cache.drawcall_cache[g_icon_draw_cache.calls]; g_icon_draw_cache.calls++; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index fea88388be7..aa3106b135b 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1110,7 +1110,7 @@ void UI_widgetbase_draw_cache_flush(void) GWN_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); - gpuBindMatrices(batch->interface); + GPU_matrix_bind(batch->interface); GWN_batch_draw_range_ex(batch, 0, g_widget_base_batch.count, true); GWN_batch_program_use_end(batch); } @@ -4532,8 +4532,8 @@ void ui_draw_pie_center(uiBlock *block) float angle = atan2f(pie_dir[1], pie_dir[0]); float range = (block->pie_data.flags & UI_PIE_DEGREES_RANGE_LARGE) ? M_PI_2 : M_PI_4; - gpuPushMatrix(); - gpuTranslate2f(cx, cy); + GPU_matrix_push(); + GPU_matrix_translate_2f(cx, cy); GPU_blend(true); if (btheme->tui.wcol_pie_menu.shaded) { @@ -4579,7 +4579,7 @@ void ui_draw_pie_center(uiBlock *block) } GPU_blend(false); - gpuPopMatrix(); + GPU_matrix_pop(); } diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 1b449877abe..7d9eb1181ed 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1151,7 +1151,7 @@ void UI_view2d_view_restore(const bContext *C) int height = BLI_rcti_size_y(&ar->winrct) + 1; wmOrtho2(0.0f, (float)width, 0.0f, (float)height); - gpuLoadIdentity(); + GPU_matrix_identity_set(); // ED_region_pixelspace(CTX_wm_region(C)); } diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 4717ef309f3..14cec724168 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -695,17 +695,17 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, GPU_blend_set_func(GPU_DST_COLOR, GPU_ZERO); } - gpuPushMatrix(); - gpuTranslate2f(x, y); - gpuScale2f(zoomx, zoomy); + GPU_matrix_push(); + GPU_matrix_translate_2f(x, y); + GPU_matrix_scale_2f(zoomx, zoomy); if (stabmat) { - gpuMultMatrix(stabmat); + GPU_matrix_mul(stabmat); } IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR); GPU_shader_uniform_vector(state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red); immDrawPixelsTex(&state, 0.0f, 0.0f, width, height, GL_RED, GL_FLOAT, GL_NEAREST, buffer, 1.0f, 1.0f, NULL); - gpuPopMatrix(); + GPU_matrix_pop(); if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) { GPU_blend(false); @@ -715,13 +715,13 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, } /* apply transformation so mask editing tools will assume drawing from the origin in normalized space */ - gpuPushMatrix(); - gpuTranslate2f(x + xofs, y + yofs); - gpuScale2f(zoomx, zoomy); + GPU_matrix_push(); + GPU_matrix_translate_2f(x + xofs, y + yofs); + GPU_matrix_scale_2f(zoomx, zoomy); if (stabmat) { - gpuMultMatrix(stabmat); + GPU_matrix_mul(stabmat); } - gpuScale2f(maxdim, maxdim); + GPU_matrix_scale_2f(maxdim, maxdim); if (do_draw_cb) { ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); @@ -734,7 +734,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); } - gpuPopMatrix(); + GPU_matrix_pop(); } void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra, const int efra) diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 8a9a5eadbdd..a2717e53358 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1045,8 +1045,8 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void glPolygonOffset(1.0f, 1.0f); - gpuPushMatrix(); - gpuMultMatrix(kcd->ob->obmat); + GPU_matrix_push(); + GPU_matrix_mul(kcd->ob->obmat); uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); @@ -1193,7 +1193,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void immUnbindProgram(); - gpuPopMatrix(); + GPU_matrix_pop(); /* Reset default */ GPU_depth_test(true); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 87c006095ed..9a58f1dcd08 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -113,8 +113,8 @@ static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *a if ((lcd->totedge > 0) || (lcd->totpoint > 0)) { GPU_depth_test(false); - gpuPushMatrix(); - gpuMultMatrix(lcd->ob->obmat); + GPU_matrix_push(); + GPU_matrix_mul(lcd->ob->obmat); uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); @@ -146,7 +146,7 @@ static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *a immUnbindProgram(); - gpuPopMatrix(); + GPU_matrix_pop(); /* Reset default */ GPU_depth_test(true); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index b5c1ffc64dd..1b8d8cf7af2 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -326,7 +326,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT); wmOrtho2(0, sizex, 0, sizey); - gpuTranslate2f(sizex / 2, sizey / 2); + GPU_matrix_translate_2f(sizex / 2, sizey / 2); G.f |= G_RENDER_OGL; ED_gpencil_draw_ex(scene, gpd, sizex, sizey, scene->r.cfra, SPACE_SEQ); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 41c3209dbb1..cb8fdba0ae1 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -146,7 +146,7 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct, int sides) void ED_region_pixelspace(ARegion *ar) { wmOrtho2_region_pixelspace(ar); - gpuLoadIdentity(); + GPU_matrix_identity_set(); } /* only exported for WM */ @@ -352,8 +352,8 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar) GPU_blend(true); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); - gpuPushMatrix(); - gpuTranslate2f(-ar->winrct.xmin, -ar->winrct.ymin); + GPU_matrix_push(); + GPU_matrix_translate_2f(-ar->winrct.xmin, -ar->winrct.ymin); for (az = sa->actionzones.first; az; az = az->next) { /* test if action zone is over this region */ @@ -388,7 +388,7 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar) } } - gpuPopMatrix(); + GPU_matrix_pop(); GPU_blend(false); } @@ -2674,11 +2674,11 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame, return; /* find window pixel coordinates of origin */ - gpuPushMatrix(); + GPU_matrix_push(); /* offset and zoom using ogl */ - gpuTranslate2f(x, y); - gpuScale2f(zoomx, zoomy); + GPU_matrix_translate_2f(x, y); + GPU_matrix_scale_2f(zoomx, zoomy); BLF_size(blf_mono_font, style->widgetlabel.points * 1.5f * U.pixelsize, U.dpi); @@ -2732,7 +2732,7 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame, BLF_disable(blf_mono_font, BLF_CLIPPING); } - gpuPopMatrix(); + GPU_matrix_pop(); } void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 6cff82295f0..41404aee9c9 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -364,7 +364,7 @@ void bglPolygonOffset(float viewdist, float dist) // glPolygonOffset(-1.0, -1.0); /* hack below is to mimic polygon offset */ - gpuGetProjectionMatrix(winmat); + GPU_matrix_projection_get(winmat); /* dist is from camera to center point */ @@ -401,7 +401,7 @@ void bglPolygonOffset(float viewdist, float dist) offset = 0.0; } - gpuLoadProjectionMatrix(winmat); + GPU_matrix_projection_set(winmat); } /* **** Color management helper functions for GLSL display/transform ***** */ diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 9c46938a90f..6e512d6d4df 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -627,14 +627,14 @@ static void screen_preview_draw(const bScreen *screen, int size_x, int size_y) wmOrtho2(0.0f, size_x, 0.0f, size_y); /* center */ - gpuPushMatrix(); - gpuLoadIdentity(); - gpuTranslate2f(size_x * (1.0f - asp[0]) * 0.5f, size_y * (1.0f - asp[1]) * 0.5f); + GPU_matrix_push(); + GPU_matrix_identity_set(); + GPU_matrix_translate_2f(size_x * (1.0f - asp[0]) * 0.5f, size_y * (1.0f - asp[1]) * 0.5f); screen_preview_scale_get(screen, size_x, size_y, asp, scale); screen_preview_draw_areas(screen, scale, col, 1.5f); - gpuPopMatrix(); + GPU_matrix_pop(); } /** diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 6b3c358d2ac..e1de86910ff 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -618,19 +618,19 @@ static void paint_draw_tex_overlay( glDepthFunc(GL_ALWAYS); if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) { - gpuPushMatrix(); + GPU_matrix_push(); /* brush rotation */ - gpuTranslate2f(x, y); - gpuRotate2D(-RAD2DEGF(primary ? ups->brush_rotation : ups->brush_rotation_sec)); - gpuTranslate2f(-x, -y); + GPU_matrix_translate_2f(x, y); + GPU_matrix_rotate_2d(-RAD2DEGF(primary ? ups->brush_rotation : ups->brush_rotation_sec)); + GPU_matrix_translate_2f(-x, -y); /* scale based on tablet pressure */ if (primary && ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush)) { const float scale = ups->size_pressure_value; - gpuTranslate2f(x, y); - gpuScale2f(scale, scale); - gpuTranslate2f(-x, -y); + GPU_matrix_translate_2f(x, y); + GPU_matrix_scale_2f(scale, scale); + GPU_matrix_translate_2f(-x, -y); } if (ups->draw_anchored) { @@ -671,12 +671,12 @@ static void paint_draw_tex_overlay( quad.xmax = brush->mask_stencil_dimension[0]; quad.ymax = brush->mask_stencil_dimension[1]; } - gpuPushMatrix(); + GPU_matrix_push(); if (primary) - gpuTranslate2fv(brush->stencil_pos); + GPU_matrix_translate_2fv(brush->stencil_pos); else - gpuTranslate2fv(brush->mask_stencil_pos); - gpuRotate2D(RAD2DEGF(mtex->rot)); + GPU_matrix_translate_2fv(brush->mask_stencil_pos); + GPU_matrix_rotate_2d(RAD2DEGF(mtex->rot)); } /* set quad color. Colored overlay does not get blending */ @@ -710,7 +710,7 @@ static void paint_draw_tex_overlay( immUnbindProgram(); if (ELEM(mtex->brush_map_mode, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_VIEW)) { - gpuPopMatrix(); + GPU_matrix_pop(); } } } @@ -762,11 +762,11 @@ static void paint_draw_cursor_overlay( /* scale based on tablet pressure */ if (ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush)) { do_pop = true; - gpuPushMatrix(); - gpuLoadIdentity(); - gpuTranslate2fv(center); - gpuScaleUniform(ups->size_pressure_value); - gpuTranslate2f(-center[0], -center[1]); + GPU_matrix_push(); + GPU_matrix_identity_set(); + GPU_matrix_translate_2fv(center); + GPU_matrix_scale_1f(ups->size_pressure_value); + GPU_matrix_translate_2f(-center[0], -center[1]); } Gwn_VertFormat *format = immVertexFormat(); @@ -796,7 +796,7 @@ static void paint_draw_cursor_overlay( immUnbindProgram(); if (do_pop) - gpuPopMatrix(); + GPU_matrix_pop(); } } diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 697ffc32759..e914a24092e 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -299,8 +299,8 @@ static void imapaint_pick_uv(Mesh *me_eval, Scene *scene, Object *ob_eval, unsig /* get the needed opengl matrices */ GPU_viewport_size_get_i(view); - gpuGetModelViewMatrix(matrix); - gpuGetProjectionMatrix(proj); + GPU_matrix_model_view_get(matrix); + GPU_matrix_projection_get(proj); view[0] = view[1] = 0; mul_m4_m4m4(matrix, matrix, ob_eval->obmat); mul_m4_m4m4(matrix, proj, matrix); diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 8e521c997fd..6ebb04fafc4 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -436,9 +436,9 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene) if (pid->cache->cached_frames == NULL) continue; - gpuPushMatrix(); - gpuTranslate2f(0.0, (float)V2D_SCROLL_HEIGHT_TEXT + yoffs); - gpuScale2f(1.0, cache_draw_height); + GPU_matrix_push(); + GPU_matrix_translate_2f(0.0, (float)V2D_SCROLL_HEIGHT_TEXT + yoffs); + GPU_matrix_scale_2f(1.0, cache_draw_height); switch (pid->type) { case PTCACHE_TYPE_SOFTBODY: @@ -512,7 +512,7 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene) GPU_blend(false); - gpuPopMatrix(); + GPU_matrix_pop(); yoffs += cache_draw_height; } diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 164565192fd..29bc0543426 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -356,11 +356,11 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int glEnable(GL_COLOR_LOGIC_OP); glLogicOp(GL_XOR); - gpuPushMatrix(); - gpuTranslate2f(x, y); + GPU_matrix_push(); + GPU_matrix_translate_2f(x, y); - gpuScale2f(zoomx, zoomy); - gpuMultMatrix(sc->stabmat); + GPU_matrix_scale_2f(zoomx, zoomy); + GPU_matrix_mul(sc->stabmat); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -377,7 +377,7 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int immUnbindProgram(); - gpuPopMatrix(); + GPU_matrix_pop(); glDisable(GL_COLOR_LOGIC_OP); } @@ -603,8 +603,8 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT } /* pattern and search outline */ - gpuPushMatrix(); - gpuTranslate2fv(marker_pos); + GPU_matrix_push(); + GPU_matrix_translate_2fv(marker_pos); if (sc->flag & SC_SHOW_MARKER_PATTERN) { immBegin(GWN_PRIM_LINE_LOOP, 4); @@ -625,7 +625,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT marker->search_max[1]); } - gpuPopMatrix(); + GPU_matrix_pop(); } static void track_colors(MovieTrackingTrack *track, int act, float col[3], float scol[3]) @@ -745,8 +745,8 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } /* pattern */ - gpuPushMatrix(); - gpuTranslate2fv(marker_pos); + GPU_matrix_push(); + GPU_matrix_translate_2fv(marker_pos); if (track->flag & TRACK_LOCKED) { if (act) { @@ -800,7 +800,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra marker->search_max[0], marker->search_max[1]); } - gpuPopMatrix(); + GPU_matrix_pop(); /* Restore default shader */ immUnbindProgram(); @@ -884,8 +884,8 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo immUniformThemeColor(TH_MARKER_OUTLINE); } - gpuPushMatrix(); - gpuTranslate2fv(marker_pos); + GPU_matrix_push(); + GPU_matrix_translate_2fv(marker_pos); dx = 6.0f / width / sc->zoom; dy = 6.0f / height / sc->zoom; @@ -944,7 +944,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo draw_marker_slide_square(tilt_ctrl[0], tilt_ctrl[1], patdx, patdy, outline, px, pos); } - gpuPopMatrix(); + GPU_matrix_pop(); } static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, @@ -1141,8 +1141,8 @@ static void draw_plane_marker_image(Scene *scene, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, display_buffer); - gpuPushMatrix(); - gpuMultMatrix(gl_matrix); + 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); @@ -1170,7 +1170,7 @@ static void draw_plane_marker_image(Scene *scene, immUnbindProgram(); - gpuPopMatrix(); + GPU_matrix_pop(); glBindTexture(GL_TEXTURE_2D, 0); @@ -1342,13 +1342,13 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie UI_view2d_view_to_region_fl(&ar->v2d, 0.0f, 0.0f, &x, &y); - gpuPushMatrix(); - gpuTranslate2f(x, y); + GPU_matrix_push(); + GPU_matrix_translate_2f(x, y); - gpuPushMatrix(); - gpuScale2f(zoomx, zoomy); - gpuMultMatrix(sc->stabmat); - gpuScale2f(width, height); + GPU_matrix_push(); + GPU_matrix_scale_2f(zoomx, zoomy); + GPU_matrix_mul(sc->stabmat); + GPU_matrix_scale_2f(width, height); act_track = BKE_tracking_track_get_active(tracking); @@ -1539,7 +1539,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie immUnbindProgram(); - gpuPopMatrix(); + GPU_matrix_pop(); if (sc->flag & SC_SHOW_NAMES) { /* scaling should be cleared before drawing texts, otherwise font would also be scaled */ @@ -1565,7 +1565,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie } } - gpuPopMatrix(); + GPU_matrix_pop(); if (marker_pos) MEM_freeN(marker_pos); @@ -1592,11 +1592,11 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, UI_view2d_view_to_region_fl(&ar->v2d, 0.0f, 0.0f, &x, &y); - gpuPushMatrix(); - gpuTranslate2f(x, y); - gpuScale2f(zoomx, zoomy); - gpuMultMatrix(sc->stabmat); - gpuScale2f(width, height); + GPU_matrix_push(); + GPU_matrix_translate_2f(x, y); + GPU_matrix_scale_2f(zoomx, zoomy); + 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); @@ -1774,7 +1774,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, immUnbindProgram(); - gpuPopMatrix(); + GPU_matrix_pop(); } void clip_draw_main(const bContext *C, SpaceClip *sc, ARegion *ar) @@ -1871,8 +1871,8 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d) * associated with the clip is already drawn in draw_distortion */ if ((sc->flag & SC_MANUAL_CALIBRATION) == 0 || is_track_source) { - gpuPushMatrix(); - gpuMultMatrix(sc->unistabmat); + GPU_matrix_push(); + GPU_matrix_mul(sc->unistabmat); if (is_track_source) { MovieTrackingTrack *track = BKE_tracking_track_get_active(&sc->clip->tracking); @@ -1881,13 +1881,13 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d) int framenr = ED_space_clip_get_clip_frame_number(sc); MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr); - gpuTranslate2fv(marker->pos); + GPU_matrix_translate_2fv(marker->pos); } } ED_gpencil_draw_2dimage(C); - gpuPopMatrix(); + GPU_matrix_pop(); } } else { diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index 34720b3a627..0bc9c74cd8c 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -119,13 +119,13 @@ static void tracking_segment_knot_cb(void *userdata, MovieTrackingTrack *track, if (sel == data->sel) { immUniformThemeColor(sel ? TH_HANDLE_VERTEX_SELECT : TH_HANDLE_VERTEX); - gpuPushMatrix(); - gpuTranslate2f(scene_framenr, val); - gpuScale2f(1.0f / data->xscale * data->hsize, 1.0f / data->yscale * data->hsize); + GPU_matrix_push(); + GPU_matrix_translate_2f(scene_framenr, val); + GPU_matrix_scale_2f(1.0f / data->xscale * data->hsize, 1.0f / data->yscale * data->hsize); imm_draw_circle_wire_2d(data->pos, 0, 0, 0.7, 8); - gpuPopMatrix(); + GPU_matrix_pop(); } } diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 4ac9010d3b5..2b98ff43c5f 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1185,13 +1185,13 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar) show_cursor |= sc->around == V3D_AROUND_CURSOR; if (show_cursor) { - gpuPushMatrix(); - gpuTranslate2f(x, y); - gpuScale2f(zoomx, zoomy); - gpuMultMatrix(sc->stabmat); - gpuScale2f(width, height); + GPU_matrix_push(); + GPU_matrix_translate_2f(x, y); + GPU_matrix_scale_2f(zoomx, zoomy); + GPU_matrix_mul(sc->stabmat); + GPU_matrix_scale_2f(width, height); ED_image_draw_cursor(ar, sc->cursor); - gpuPopMatrix(); + GPU_matrix_pop(); } clip_draw_cache_and_notes(C, sc, ar); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 16658c0d8db..2b2d404168f 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -422,9 +422,9 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu) static void draw_fcurve_sample_control(float x, float y, float xscale, float yscale, float hsize, unsigned int pos) { /* adjust view transform before starting */ - gpuPushMatrix(); - gpuTranslate2f(x, y); - gpuScale2f(1.0f / xscale * hsize, 1.0f / yscale * hsize); + GPU_matrix_push(); + GPU_matrix_translate_2f(x, y); + GPU_matrix_scale_2f(1.0f / xscale * hsize, 1.0f / yscale * hsize); /* draw X shape */ immBegin(GWN_PRIM_LINES, 4); @@ -436,7 +436,7 @@ static void draw_fcurve_sample_control(float x, float y, float xscale, float ysc immEnd(); /* restore view transform */ - gpuPopMatrix(); + GPU_matrix_pop(); } /* helper func - draw keyframe vertices only for an F-Curve */ @@ -585,10 +585,10 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie } /* apply unit mapping */ - gpuPushMatrix(); + GPU_matrix_push(); unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset); - gpuScale2f(1.0f, unit_scale); - gpuTranslate2f(0.0f, offset); + GPU_matrix_scale_2f(1.0f, unit_scale); + GPU_matrix_translate_2f(0.0f, offset); immBegin(GWN_PRIM_LINE_STRIP, count); @@ -645,7 +645,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie immEnd(); - gpuPopMatrix(); + GPU_matrix_pop(); } /* helper func - check if the F-Curve only contains easily drawable segments @@ -679,10 +679,10 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 short mapping_flag = ANIM_get_normalization_flags(ac); /* apply unit mapping */ - gpuPushMatrix(); + GPU_matrix_push(); unit_scale = ANIM_unit_mapping_get_factor(ac->scene, id, fcu, mapping_flag, &offset); - gpuScale2f(1.0f, unit_scale); - gpuTranslate2f(0.0f, offset); + GPU_matrix_scale_2f(1.0f, unit_scale); + GPU_matrix_translate_2f(0.0f, offset); /* For now, this assumes the worst case scenario, where all the keyframes have * bezier interpolation, and are drawn at full res. @@ -827,7 +827,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 immEnd(); - gpuPopMatrix(); + GPU_matrix_pop(); } /* Debugging -------------------------------- */ @@ -1136,9 +1136,9 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid float unit_scale = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, mapping_flag, &offset); /* apply unit-scaling to all values via OpenGL */ - gpuPushMatrix(); - gpuScale2f(1.0f, unit_scale); - gpuTranslate2f(0.0f, offset); + GPU_matrix_push(); + GPU_matrix_scale_2f(1.0f, unit_scale); + GPU_matrix_translate_2f(0.0f, offset); /* set this once and for all - all handles and handle-verts should use the same thickness */ GPU_line_width(1.0); @@ -1160,7 +1160,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid draw_fcurve_samples(sipo, ar, fcu); } - gpuPopMatrix(); + GPU_matrix_pop(); } } diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 24b02106021..ff90e59540e 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -117,13 +117,13 @@ static void draw_render_info(const bContext *C, int x, y; UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x, &y); - gpuPushMatrix(); - gpuTranslate2f(x, y); - gpuScale2f(zoomx, zoomy); + GPU_matrix_push(); + GPU_matrix_translate_2f(x, y); + GPU_matrix_scale_2f(zoomx, zoomy); if (rd->mode & R_BORDER) { /* TODO: round or floor instead of casting to int */ - gpuTranslate2f((int)(-rd->border.xmin * rd->xsch * rd->size * 0.01f), + GPU_matrix_translate_2f((int)(-rd->border.xmin * rd->xsch * rd->size * 0.01f), (int)(-rd->border.ymin * rd->ysch * rd->size * 0.01f)); } @@ -144,7 +144,7 @@ static void draw_render_info(const bContext *C, MEM_freeN(tiles); } - gpuPopMatrix(); + GPU_matrix_pop(); } } } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 97b112ebbd1..dfb85d3c8a4 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -3193,8 +3193,8 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b if (ibuf) { float x, y; - gpuPushProjectionMatrix(); - gpuPushMatrix(); + GPU_matrix_push_projection(); + GPU_matrix_push(); /* somehow the offset has to be calculated inverse */ wmOrtho2_region_pixelspace(ar); @@ -3277,8 +3277,8 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b } } - gpuPopProjectionMatrix(); - gpuPopMatrix(); + GPU_matrix_pop_projection(); + GPU_matrix_pop(); } BKE_image_release_ibuf(ima, ibuf, lock); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index c632b354440..6976edce563 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1405,17 +1405,17 @@ void drawnodespace(const bContext *C, ARegion *ar) { float original_proj[4][4]; - gpuGetProjectionMatrix(original_proj); + GPU_matrix_projection_get(original_proj); - gpuPushMatrix(); - gpuLoadIdentity(); + GPU_matrix_push(); + GPU_matrix_identity_set(); wmOrtho2_pixelspace(ar->winx, ar->winy); WM_gizmomap_draw(ar->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D); - gpuPopMatrix(); - gpuLoadProjectionMatrix(original_proj); + GPU_matrix_pop(); + GPU_matrix_projection_set(original_proj); } draw_nodetree(C, ar, ntree, path->parent_key); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index a10eda5c3e6..204559ebf4f 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1308,8 +1308,8 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq if (draw_backdrop) { /* XXX: need to load identity projection too? */ - gpuPushMatrix(); - gpuLoadIdentity(); + GPU_matrix_push(); + GPU_matrix_identity_set(); } glGenTextures(1, (GLuint *)&texid); @@ -1439,7 +1439,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq } if (draw_backdrop) { - gpuPopMatrix(); + GPU_matrix_pop(); return; } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index beb323fb21c..f48d7ef578f 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -621,7 +621,7 @@ void draw_object_backbufsel( select_mode = ts->selectmode; } - gpuMultMatrix(ob->obmat); + GPU_matrix_mul(ob->obmat); glClearDepth(1.0); GPU_clear(GPU_DEPTH_BIT); GPU_depth_test(true); @@ -688,7 +688,7 @@ void draw_object_backbufsel( break; } - gpuLoadMatrix(rv3d->viewmat); + GPU_matrix_set(rv3d->viewmat); } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index dca4b3f4f76..75c9b4a050f 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -251,7 +251,7 @@ void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d) /* we have to multiply instead of loading viewmatob to make * it work with duplis using displists, otherwise it will * override the dupli-matrix */ - gpuMultMatrix(ob->obmat); + GPU_matrix_mul(ob->obmat); } #ifdef DEBUG diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 89d01727d9b..4928f6e1f28 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -184,8 +184,8 @@ static void view3d_main_region_setup_view( ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, viewmat, winmat, rect); /* set for opengl */ - gpuLoadProjectionMatrix(rv3d->winmat); - gpuLoadMatrix(rv3d->viewmat); + GPU_matrix_projection_set(rv3d->winmat); + GPU_matrix_set(rv3d->viewmat); } static bool view3d_stereo3d_active(wmWindow *win, Scene *scene, View3D *v3d, RegionView3D *rv3d) @@ -1355,10 +1355,10 @@ void ED_view3d_draw_offscreen( GPU_free_images_anim(G.main); /* XXX :((( */ } - gpuPushProjectionMatrix(); - gpuLoadIdentity(); - gpuPushMatrix(); - gpuLoadIdentity(); + GPU_matrix_push_projection(); + GPU_matrix_identity_set(); + GPU_matrix_push(); + GPU_matrix_identity_set(); if ((viewname != NULL && viewname[0] != '\0') && (viewmat == NULL) && rv3d->persp == RV3D_CAMOB && v3d->camera) view3d_stereo3d_setup_offscreen(depsgraph, scene, v3d, ar, winmat, viewname); @@ -1375,8 +1375,8 @@ void ED_view3d_draw_offscreen( ar->winy = bwiny; ar->winrct = brect; - gpuPopProjectionMatrix(); - gpuPopMatrix(); + GPU_matrix_pop_projection(); + GPU_matrix_pop(); UI_Theme_Restore(&theme_state); diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index cfeb199de15..cc7f23e2c18 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -685,13 +685,13 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph, GPU_blend(true); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); - gpuPushProjectionMatrix(); - gpuPushMatrix(); + GPU_matrix_push_projection(); + GPU_matrix_push(); ED_region_pixelspace(ar); - gpuTranslate2f(centx, centy); - gpuScaleUniform(bgpic->scale); - gpuRotate2D(RAD2DEGF(-bgpic->rotation)); + GPU_matrix_translate_2f(centx, centy); + GPU_matrix_scale_1f(bgpic->scale); + GPU_matrix_rotate_2d(RAD2DEGF(-bgpic->rotation)); if (bgpic->flag & CAM_BGIMG_FLAG_FLIP_X) { zoomx *= -1.0f; @@ -707,8 +707,8 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph, immDrawPixelsTex(&state, x1 - centx, y1 - centy, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, ibuf->rect, zoomx, zoomy, col); - gpuPopProjectionMatrix(); - gpuPopMatrix(); + GPU_matrix_pop_projection(); + GPU_matrix_pop(); GPU_blend(false); 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 f296c2ee874..6040e21aacb 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -195,8 +195,8 @@ static void axis_geom_draw(const wmGizmo *gz, const float color[4], const bool U static const float axis_highlight[4] = {1, 1, 1, 1}; static const float axis_black[4] = {0, 0, 0, 1}; static float axis_color[3][4]; - gpuPushMatrix(); - gpuMultMatrix(gz->matrix_offset); + GPU_matrix_push(); + GPU_matrix_mul(gz->matrix_offset); bool draw_center_done = false; @@ -219,11 +219,11 @@ static void axis_geom_draw(const wmGizmo *gz, const float color[4], const bool U /* Circle defining active area (revert back to 2D space). */ { - gpuPopMatrix(); + GPU_matrix_pop(); immUniformColor4fv(color); imm_draw_circle_fill_3d(pos_id, 0, 0, 1.0f, DIAL_RESOLUTION); - gpuPushMatrix(); - gpuMultMatrix(gz->matrix_offset); + GPU_matrix_push(); + GPU_matrix_mul(gz->matrix_offset); } draw_center_done = true; } @@ -276,15 +276,15 @@ static void axis_geom_draw(const wmGizmo *gz, const float color[4], const bool U /* Axis Ball. */ { - gpuPushMatrix(); - gpuTranslate3fv(v_final); - gpuScaleUniform(is_pos ? 0.22f : 0.18f); + GPU_matrix_push(); + 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); - gpuPopMatrix(); + GPU_matrix_pop(); } /* Axis XYZ Character. */ @@ -298,7 +298,7 @@ static void axis_geom_draw(const wmGizmo *gz, const float color[4], const bool U } } - gpuPopMatrix(); + GPU_matrix_pop(); immUnbindProgram(); } @@ -318,13 +318,13 @@ static void axis3d_draw_intern( .matrix_offset = matrix_unit, }), matrix_final); - gpuPushMatrix(); - gpuMultMatrix(matrix_final); + GPU_matrix_push(); + GPU_matrix_mul(matrix_final); GPU_blend(true); axis_geom_draw(gz, color, select); GPU_blend(false); - gpuPopMatrix(); + GPU_matrix_pop(); } static void gizmo_axis_draw(const bContext *C, wmGizmo *gz) diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index 30b91c1a8ee..91e255aec82 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -677,7 +677,7 @@ void ED_view3d_project(const struct ARegion *ar, const float world[3], float reg RegionView3D *rv3d = ar->regiondata; int viewport[4] = {0, 0, ar->winx, ar->winy}; - gpuProject(world, rv3d->viewmat, rv3d->winmat, viewport, region); + GPU_matrix_project(world, rv3d->viewmat, rv3d->winmat, viewport, region); } bool ED_view3d_unproject(const struct ARegion *ar, float regionx, float regiony, float regionz, float world[3]) @@ -686,5 +686,5 @@ bool ED_view3d_unproject(const struct ARegion *ar, float regionx, float regiony, int viewport[4] = {0, 0, ar->winx, ar->winy}; float region[3] = {regionx, regiony, regionz}; - return gpuUnProject(region, rv3d->viewmat, rv3d->winmat, viewport, world); + return GPU_matrix_unproject(region, rv3d->viewmat, rv3d->winmat, viewport, world); } diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 0f82dfa775c..3175075e9c3 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -510,7 +510,7 @@ static void do_lasso_select_mesh( /* for non zbuf projections, don't change the GL state */ ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); - gpuLoadMatrix(vc->rv3d->viewmat); + GPU_matrix_set(vc->rv3d->viewmat); bbsel = EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); if (ts->selectmode & SCE_SELECT_VERTEX) { @@ -1936,7 +1936,7 @@ static int do_mesh_box_select( /* for non zbuf projections, don't change the GL state */ ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); - gpuLoadMatrix(vc->rv3d->viewmat); + GPU_matrix_set(vc->rv3d->viewmat); bbsel = EDBM_backbuf_border_init(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax); if (ts->selectmode & SCE_SELECT_VERTEX) { diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index ca5375b6b54..9b006bf4d9b 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -189,8 +189,8 @@ void view3d_region_operator_needs_opengl(wmWindow *UNUSED(win), ARegion *ar) RegionView3D *rv3d = ar->regiondata; wmViewport(&ar->winrct); // TODO: bad - gpuLoadProjectionMatrix(rv3d->winmat); - gpuLoadMatrix(rv3d->viewmat); + GPU_matrix_projection_set(rv3d->winmat); + GPU_matrix_set(rv3d->viewmat); } } diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index c9e915a6415..bb0745b1998 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -721,14 +721,14 @@ void view3d_winmatrix_set(Depsgraph *depsgraph, ARegion *ar, const View3D *v3d, } if (is_ortho) { - gpuOrtho(viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend); + GPU_matrix_ortho_set(viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend); } else { - gpuFrustum(viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend); + GPU_matrix_frustum_set(viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend); } /* update matrix in 3d view region */ - gpuGetProjectionMatrix(rv3d->winmat); + GPU_matrix_projection_get(rv3d->winmat); } static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index ad7b5d55ba5..c49c9a8706c 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1813,7 +1813,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) tmval[i] += offset[i]; } - gpuPushMatrix(); + GPU_matrix_push(); /* Dashed lines first. */ if (ELEM(t->helpline, HLP_SPRING, HLP_ANGLE)) { @@ -1853,8 +1853,8 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) case HLP_SPRING: immUniformThemeColor(TH_VIEW_OVERLAY); - gpuTranslate3fv(mval); - gpuRotateAxis(-RAD2DEGF(atan2f(cent[0] - tmval[0], cent[1] - tmval[1])), 'Z'); + GPU_matrix_translate_3fv(mval); + GPU_matrix_rotate_axis(-RAD2DEGF(atan2f(cent[0] - tmval[0], cent[1] - tmval[1])), 'Z'); GPU_line_width(3.0f); drawArrow(UP, 5, 10, 5); @@ -1862,7 +1862,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) break; case HLP_HARROW: immUniformThemeColor(TH_VIEW_OVERLAY); - gpuTranslate3fv(mval); + GPU_matrix_translate_3fv(mval); GPU_line_width(3.0f); drawArrow(RIGHT, 5, 10, 5); @@ -1871,7 +1871,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) case HLP_VARROW: immUniformThemeColor(TH_VIEW_OVERLAY); - gpuTranslate3fv(mval); + GPU_matrix_translate_3fv(mval); GPU_line_width(3.0f); drawArrow(UP, 5, 10, 5); @@ -1887,23 +1887,23 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) immUniformThemeColor(TH_VIEW_OVERLAY); - gpuTranslate3f(cent[0] - tmval[0] + mval[0], cent[1] - tmval[1] + mval[1], 0); + GPU_matrix_translate_3f(cent[0] - tmval[0] + mval[0], cent[1] - tmval[1] + mval[1], 0); GPU_line_width(3.0f); drawArc(dist, angle - delta_angle, angle - spacing_angle, 10); drawArc(dist, angle + spacing_angle, angle + delta_angle, 10); - gpuPushMatrix(); + GPU_matrix_push(); - gpuTranslate3f(cosf(angle - delta_angle) * dist, sinf(angle - delta_angle) * dist, 0); - gpuRotateAxis(RAD2DEGF(angle - delta_angle), 'Z'); + GPU_matrix_translate_3f(cosf(angle - delta_angle) * dist, sinf(angle - delta_angle) * dist, 0); + GPU_matrix_rotate_axis(RAD2DEGF(angle - delta_angle), 'Z'); drawArrowHead(DOWN, 5); - gpuPopMatrix(); + GPU_matrix_pop(); - gpuTranslate3f(cosf(angle + delta_angle) * dist, sinf(angle + delta_angle) * dist, 0); - gpuRotateAxis(RAD2DEGF(angle + delta_angle), 'Z'); + GPU_matrix_translate_3f(cosf(angle + delta_angle) * dist, sinf(angle + delta_angle) * dist, 0); + GPU_matrix_rotate_axis(RAD2DEGF(angle + delta_angle), 'Z'); drawArrowHead(UP, 5); break; @@ -1913,7 +1913,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) unsigned char col[3], col2[3]; UI_GetThemeColor3ubv(TH_GRID, col); - gpuTranslate3fv(mval); + GPU_matrix_translate_3fv(mval); GPU_line_width(3.0f); @@ -1933,7 +1933,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) } immUnbindProgram(); - gpuPopMatrix(); + GPU_matrix_pop(); } } @@ -7049,8 +7049,8 @@ static void drawEdgeSlide(TransInfo *t) GPU_blend(true); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); - gpuPushMatrix(); - gpuMultMatrix(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat); + 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); @@ -7138,7 +7138,7 @@ static void drawEdgeSlide(TransInfo *t) immUnbindProgram(); - gpuPopMatrix(); + GPU_matrix_pop(); GPU_blend(false); @@ -7682,8 +7682,8 @@ static void drawVertSlide(TransInfo *t) GPU_blend(true); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); - gpuPushMatrix(); - gpuMultMatrix(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat); + GPU_matrix_push(); + GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat); GPU_line_width(line_size); @@ -7769,7 +7769,7 @@ static void drawVertSlide(TransInfo *t) immUnbindProgram(); } - gpuPopMatrix(); + GPU_matrix_pop(); GPU_depth_test(true); } diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index d40602f8d43..a02948a9951 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -800,13 +800,13 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) unit_m4(imat); } - gpuPushMatrix(); + GPU_matrix_push(); if (t->spacetype == SPACE_VIEW3D) { /* pass */ } else if (t->spacetype == SPACE_IMAGE) { - gpuScale2f(1.0f / t->aspect[0], 1.0f / t->aspect[1]); + GPU_matrix_scale_2f(1.0f / t->aspect[0], 1.0f / t->aspect[1]); } else if (ELEM(t->spacetype, SPACE_IPO, SPACE_ACTION)) { /* only scale y */ @@ -816,7 +816,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) float ysize = BLI_rctf_size_y(datamask); float xmask = BLI_rcti_size_x(mask); float ymask = BLI_rcti_size_y(mask); - gpuScale2f(1.0f, (ysize / xsize) * (xmask / ymask)); + GPU_matrix_scale_2f(1.0f, (ysize / xsize) * (xmask / ymask)); } depth_test_enabled = GPU_depth_test_enabled(); @@ -837,7 +837,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) if (depth_test_enabled) GPU_depth_test(true); - gpuPopMatrix(); + GPU_matrix_pop(); } } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index e54b154ee0d..c1aa0263ef8 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1116,7 +1116,7 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis if (t->spacetype == SPACE_VIEW3D) { View3D *v3d = t->view; - gpuPushMatrix(); + GPU_matrix_push(); copy_v3_v3(v3, dir); mul_v3_fl(v3, v3d->far); @@ -1144,7 +1144,7 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis immUnbindProgram(); - gpuPopMatrix(); + GPU_matrix_pop(); } } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index f0d6b5c2a71..5ff008e1de2 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -90,7 +90,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) GPU_line_width(1.0f); - gpuTranslate2fv(cursor); + GPU_matrix_translate_2fv(cursor); const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); @@ -141,7 +141,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) immUnbindProgram(); - gpuTranslate2f(-cursor[0], -cursor[1]); + GPU_matrix_translate_2f(-cursor[0], -cursor[1]); } static int draw_uvs_face_check(Scene *scene) @@ -814,7 +814,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje /* Now draw each face contour separately with another builtin program. */ GWN_batch_program_set_builtin(loop_batch, GPU_SHADER_2D_SMOOTH_COLOR); - gpuBindMatrices(loop_batch->interface); + GPU_matrix_bind(loop_batch->interface); GWN_batch_program_use_begin(loop_batch); index = 0; -- cgit v1.2.3