Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-07-15 16:27:15 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-15 16:34:13 +0300
commit57ab7daa2aee436b0b0acfa00b2e2b1d28b55b2c (patch)
tree377218e81452e4e0d3f8ca3cf3c3ac5148f237b8 /source
parentb457cae397054a1be4e60f3007995f97c198b2b6 (diff)
GPU_matrix: use Blender's naming conventions
Thanks to @sergey for review
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/intern/blf.c12
-rw-r--r--source/blender/blenfont/intern/blf_font.c8
-rw-r--r--source/blender/draw/engines/external/external_engine.c4
-rw-r--r--source/blender/draw/intern/draw_manager.c18
-rw-r--r--source/blender/draw/intern/draw_manager_text.c10
-rw-r--r--source/blender/draw/intern/draw_view.c16
-rw-r--r--source/blender/editors/animation/anim_draw.c6
-rw-r--r--source/blender/editors/animation/anim_markers.c6
-rw-r--r--source/blender/editors/curve/editcurve_paint.c14
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_presets.c12
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c8
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c22
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c14
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c6
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c6
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c12
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c16
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c12
-rw-r--r--source/blender/editors/interface/interface.c12
-rw-r--r--source/blender/editors/interface/interface_draw.c50
-rw-r--r--source/blender/editors/interface/interface_icons.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c8
-rw-r--r--source/blender/editors/interface/view2d.c2
-rw-r--r--source/blender/editors/mask/mask_draw.c22
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c6
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c6
-rw-r--r--source/blender/editors/render/render_opengl.c2
-rw-r--r--source/blender/editors/screen/area.c16
-rw-r--r--source/blender/editors/screen/glutil.c4
-rw-r--r--source/blender/editors/screen/screen_draw.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c36
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c4
-rw-r--r--source/blender/editors/space_action/action_draw.c8
-rw-r--r--source/blender/editors/space_clip/clip_draw.c70
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c8
-rw-r--r--source/blender/editors/space_clip/space_clip.c12
-rw-r--r--source/blender/editors/space_graph/graph_draw.c32
-rw-r--r--source/blender/editors/space_image/image_draw.c10
-rw-r--r--source/blender/editors/space_node/drawnode.c8
-rw-r--r--source/blender/editors/space_node/node_draw.c10
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c6
-rw-r--r--source/blender/editors/space_view3d/drawobject.c4
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c26
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_utils.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c6
-rw-r--r--source/blender/editors/transform/transform.c40
-rw-r--r--source/blender/editors/transform/transform_constraints.c8
-rw-r--r--source/blender/editors/transform/transform_generics.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c6
-rw-r--r--source/blender/gpu/GPU_matrix.h90
-rw-r--r--source/blender/gpu/intern/gpu_matrix.c118
-rw-r--r--source/blender/gpu/intern/gpu_shader.c2
-rw-r--r--source/blender/python/intern/gpu_py_matrix.c40
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c18
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c16
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c8
61 files changed, 487 insertions, 487 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 5dd692d3855..b0e0cdac407 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -594,24 +594,24 @@ static void blf_draw_gl__start(FontBLF *font)
if ((font->flags & (BLF_ROTATION | BLF_MATRIX | BLF_ASPECT)) == 0)
return; /* glyphs will be translated individually and batched. */
- gpuPushMatrix();
+ GPU_matrix_push();
if (font->flags & BLF_MATRIX)
- gpuMultMatrix(font->m);
+ GPU_matrix_mul(font->m);
- gpuTranslate3fv(font->pos);
+ GPU_matrix_translate_3fv(font->pos);
if (font->flags & BLF_ASPECT)
- gpuScale3fv(font->aspect);
+ GPU_matrix_scale_3fv(font->aspect);
if (font->flags & BLF_ROTATION)
- gpuRotate2D(RAD2DEG(font->angle));
+ GPU_matrix_rotate_2d(RAD2DEG(font->angle));
}
static void blf_draw_gl__end(FontBLF *font)
{
if ((font->flags & (BLF_ROTATION | BLF_MATRIX | BLF_ASPECT)) != 0)
- gpuPopMatrix();
+ GPU_matrix_pop();
}
void BLF_draw_ex(
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index b3ab36f7bcc..3f4c430ee4b 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -142,15 +142,15 @@ void blf_batch_draw_begin(FontBLF *font)
if (g_batch.active) {
float gpumat[4][4];
- gpuGetModelViewMatrix(gpumat);
+ GPU_matrix_model_view_get(gpumat);
bool mat_changed = (memcmp(gpumat, g_batch.mat, sizeof(g_batch.mat)) != 0);
if (mat_changed) {
/* Modelviewmat is no longer the same.
* Flush cache but with the previous mat. */
- gpuPushMatrix();
- gpuLoadMatrix(g_batch.mat);
+ GPU_matrix_push();
+ GPU_matrix_set(g_batch.mat);
}
/* flush cache if config is not the same. */
@@ -165,7 +165,7 @@ void blf_batch_draw_begin(FontBLF *font)
}
if (mat_changed) {
- gpuPopMatrix();
+ GPU_matrix_pop();
/* Save for next memcmp. */
memcpy(g_batch.mat, gpumat, sizeof(g_batch.mat));
}
diff --git a/source/blender/draw/engines/external/external_engine.c b/source/blender/draw/engines/external/external_engine.c
index 2917805d233..35ff777b885 100644
--- a/source/blender/draw/engines/external/external_engine.c
+++ b/source/blender/draw/engines/external/external_engine.c
@@ -165,14 +165,14 @@ static void external_draw_scene_do(void *vedata)
}
/* Rendered draw. */
- gpuPushProjectionMatrix();
+ GPU_matrix_push_projection();
ED_region_pixelspace(ar);
/* Render result draw. */
type = rv3d->render_engine->type;
type->view_draw(rv3d->render_engine, draw_ctx->evil_C);
- gpuPopProjectionMatrix();
+ GPU_matrix_pop_projection();
/* Set render info. */
EXTERNAL_Data *data = vedata;
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index a16d0bab104..1460f9a88f2 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -120,16 +120,16 @@ void DRW_draw_callbacks_pre_scene(void)
{
RegionView3D *rv3d = DST.draw_ctx.rv3d;
- gpuLoadProjectionMatrix(rv3d->winmat);
- gpuLoadMatrix(rv3d->viewmat);
+ GPU_matrix_projection_set(rv3d->winmat);
+ GPU_matrix_set(rv3d->viewmat);
}
void DRW_draw_callbacks_post_scene(void)
{
RegionView3D *rv3d = DST.draw_ctx.rv3d;
- gpuLoadProjectionMatrix(rv3d->winmat);
- gpuLoadMatrix(rv3d->viewmat);
+ GPU_matrix_projection_set(rv3d->winmat);
+ GPU_matrix_set(rv3d->viewmat);
}
struct DRWTextStore *DRW_text_cache_ensure(void)
@@ -2074,18 +2074,18 @@ void DRW_draw_depth_loop(
DRW_opengl_context_disable();
/* XXX Drawing the resulting buffer to the BACK_BUFFER */
- gpuPushMatrix();
- gpuPushProjectionMatrix();
+ GPU_matrix_push();
+ GPU_matrix_push_projection();
wmOrtho2_region_pixelspace(ar);
- gpuLoadIdentity();
+ GPU_matrix_identity_set();
glEnable(GL_DEPTH_TEST); /* Cannot write to depth buffer without testing */
glDepthFunc(GL_ALWAYS);
draw_depth_texture_to_screen(g_select_buffer.texture_depth);
glDepthFunc(GL_LEQUAL);
- gpuPopMatrix();
- gpuPopProjectionMatrix();
+ GPU_matrix_pop();
+ GPU_matrix_pop_projection();
}
/** \} */
diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c
index 977374a00c5..b32853959c8 100644
--- a/source/blender/draw/intern/draw_manager_text.c
+++ b/source/blender/draw/intern/draw_manager_text.c
@@ -141,11 +141,11 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar)
}
float original_proj[4][4];
- gpuGetProjectionMatrix(original_proj);
+ GPU_matrix_projection_get(original_proj);
wmOrtho2_region_pixelspace(ar);
- gpuPushMatrix();
- gpuLoadIdentity();
+ GPU_matrix_push();
+ GPU_matrix_identity_set();
const int font_id = BLF_default();
@@ -173,8 +173,8 @@ void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar)
}
}
- gpuPopMatrix();
- gpuLoadProjectionMatrix(original_proj);
+ GPU_matrix_pop();
+ GPU_matrix_projection_set(original_proj);
if (rv3d->rflag & RV3D_CLIPPING) {
ED_view3d_clipping_enable();
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index 75a7d567d5c..688712a97b6 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -548,8 +548,8 @@ void DRW_draw_grid(void)
*(&grid_unit) = NULL; /* drawgrid need this to detect/affect smallest valid unit... */
drawgrid(&scene->unit, ar, v3d, &grid_unit);
- gpuLoadProjectionMatrix(rv3d->winmat);
- gpuLoadMatrix(rv3d->viewmat);
+ GPU_matrix_projection_set(rv3d->winmat);
+ GPU_matrix_set(rv3d->viewmat);
}
else {
glDepthMask(GL_TRUE);
@@ -587,9 +587,9 @@ void DRW_draw_background(void)
uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
uchar col_hi[3], col_lo[3];
- gpuPushMatrix();
- gpuLoadIdentity();
- gpuLoadProjectionMatrix(m);
+ GPU_matrix_push();
+ GPU_matrix_identity_set();
+ GPU_matrix_projection_set(m);
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR_DITHER);
@@ -608,7 +608,7 @@ void DRW_draw_background(void)
immUnbindProgram();
- gpuPopMatrix();
+ GPU_matrix_pop();
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@@ -724,8 +724,8 @@ void DRW_draw_cursor(void)
}
ED_region_pixelspace(ar);
- gpuTranslate2f(co[0] + 0.5f, co[1] + 0.5f);
- gpuScale2f(U.widget_unit, U.widget_unit);
+ GPU_matrix_translate_2f(co[0] + 0.5f, co[1] + 0.5f);
+ GPU_matrix_scale_2f(U.widget_unit, U.widget_unit);
Gwn_Batch *cursor_batch = DRW_cache_cursor_get(is_aligned);
GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_FLAT_COLOR);
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;
diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h
index f22c0cd5c4d..f5e34bd4c90 100644
--- a/source/blender/gpu/GPU_matrix.h
+++ b/source/blender/gpu/GPU_matrix.h
@@ -40,79 +40,79 @@ extern "C" {
struct Gwn_ShaderInterface;
-void gpuMatrixReset(void); /* to Identity transform & empty stack */
+void GPU_matrix_reset(void); /* to Identity transform & empty stack */
/* ModelView Matrix (2D or 3D) */
-void gpuPushMatrix(void); /* TODO: PushCopy vs PushIdentity? */
-void gpuPopMatrix(void);
+void GPU_matrix_push(void); /* TODO: PushCopy vs PushIdentity? */
+void GPU_matrix_pop(void);
-void gpuLoadIdentity(void);
+void GPU_matrix_identity_set(void);
-void gpuScaleUniform(float factor);
+void GPU_matrix_scale_1f(float factor);
/* 3D ModelView Matrix */
-void gpuLoadMatrix(const float m[4][4]);
-void gpuMultMatrix(const float m[4][4]);
+void GPU_matrix_set(const float m[4][4]);
+void GPU_matrix_mul(const float m[4][4]);
-void gpuTranslate3f(float x, float y, float z);
-void gpuTranslate3fv(const float vec[3]);
-void gpuScale3f(float x, float y, float z);
-void gpuScale3fv(const float vec[3]);
-void gpuRotate3f(float deg, float x, float y, float z); /* axis of rotation should be a unit vector */
-void gpuRotate3fv(float deg, const float axis[3]); /* axis of rotation should be a unit vector */
-void gpuRotateAxis(float deg, char axis); /* TODO: enum for axis? */
+void GPU_matrix_translate_3f(float x, float y, float z);
+void GPU_matrix_translate_3fv(const float vec[3]);
+void GPU_matrix_scale_3f(float x, float y, float z);
+void GPU_matrix_scale_3fv(const float vec[3]);
+void GPU_matrix_rotate_3f(float deg, float x, float y, float z); /* axis of rotation should be a unit vector */
+void GPU_matrix_rotate_3fv(float deg, const float axis[3]); /* axis of rotation should be a unit vector */
+void GPU_matrix_rotate_axis(float deg, char axis); /* TODO: enum for axis? */
-void gpuLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ);
+void GPU_matrix_look_at(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ);
/* TODO: variant that takes eye[3], center[3], up[3] */
/* 2D ModelView Matrix */
-void gpuTranslate2f(float x, float y);
-void gpuTranslate2fv(const float vec[2]);
-void gpuScale2f(float x, float y);
-void gpuScale2fv(const float vec[2]);
-void gpuRotate2D(float deg);
+void GPU_matrix_translate_2f(float x, float y);
+void GPU_matrix_translate_2fv(const float vec[2]);
+void GPU_matrix_scale_2f(float x, float y);
+void GPU_matrix_scale_2fv(const float vec[2]);
+void GPU_matrix_rotate_2d(float deg);
/* Projection Matrix (2D or 3D) */
-void gpuPushProjectionMatrix(void);
-void gpuPopProjectionMatrix(void);
+void GPU_matrix_push_projection(void);
+void GPU_matrix_pop_projection(void);
/* 3D Projection Matrix */
-void gpuLoadIdentityProjectionMatrix(void);
-void gpuLoadProjectionMatrix(const float m[4][4]);
+void GPU_matrix_identity_projection_set(void);
+void GPU_matrix_projection_set(const float m[4][4]);
-void gpuOrtho(float left, float right, float bottom, float top, float near, float far);
-void gpuFrustum(float left, float right, float bottom, float top, float near, float far);
-void gpuPerspective(float fovy, float aspect, float near, float far);
+void GPU_matrix_ortho_set(float left, float right, float bottom, float top, float near, float far);
+void GPU_matrix_frustum_set(float left, float right, float bottom, float top, float near, float far);
+void GPU_matrix_perspective_set(float fovy, float aspect, float near, float far);
/* 3D Projection between Window and World Space */
-void gpuProject(const float world[3], const float model[4][4], const float proj[4][4], const int view[4], float win[3]);
-bool gpuUnProject(const float win[3], const float model[4][4], const float proj[4][4], const int view[4], float world[3]);
+void GPU_matrix_project(const float world[3], const float model[4][4], const float proj[4][4], const int view[4], float win[3]);
+bool GPU_matrix_unproject(const float win[3], const float model[4][4], const float proj[4][4], const int view[4], float world[3]);
/* 2D Projection Matrix */
-void gpuOrtho2D(float left, float right, float bottom, float top);
+void GPU_matrix_ortho_2d_set(float left, float right, float bottom, float top);
/* functions to get matrix values */
-const float (*gpuGetModelViewMatrix(float m[4][4]))[4];
-const float (*gpuGetProjectionMatrix(float m[4][4]))[4];
-const float (*gpuGetModelViewProjectionMatrix(float m[4][4]))[4];
+const float (*GPU_matrix_model_view_get(float m[4][4]))[4];
+const float (*GPU_matrix_projection_get(float m[4][4]))[4];
+const float (*GPU_matrix_model_view_projection_get(float m[4][4]))[4];
-const float (*gpuGetNormalMatrix(float m[3][3]))[3];
-const float (*gpuGetNormalMatrixInverse(float m[3][3]))[3];
+const float (*GPU_matrix_normal_get(float m[3][3]))[3];
+const float (*GPU_matrix_normal_inverse_get(float m[3][3]))[3];
/* set uniform values for currently bound shader */
-void gpuBindMatrices(const struct Gwn_ShaderInterface *);
-bool gpuMatricesDirty(void); /* since last bind */
+void GPU_matrix_bind(const struct Gwn_ShaderInterface *);
+bool GPU_matrix_dirty_get(void); /* since last bind */
/* Python API needs to be able to inspect the stack so errors raise exceptions instead of crashing. */
@@ -177,14 +177,14 @@ int GPU_matrix_stack_level_get_projection(void);
#endif /* C11 */
/* make matrix inputs generic, to avoid warnings */
-# define gpuMultMatrix(x) gpuMultMatrix(_GPU_MAT4_CONST_CAST(x))
-# define gpuLoadMatrix(x) gpuLoadMatrix(_GPU_MAT4_CONST_CAST(x))
-# define gpuLoadProjectionMatrix(x) gpuLoadProjectionMatrix(_GPU_MAT4_CONST_CAST(x))
-# define gpuGetModelViewMatrix(x) gpuGetModelViewMatrix(_GPU_MAT4_CAST(x))
-# define gpuGetProjectionMatrix(x) gpuGetProjectionMatrix(_GPU_MAT4_CAST(x))
-# define gpuGetModelViewProjectionMatrix(x) gpuGetModelViewProjectionMatrix(_GPU_MAT4_CAST(x))
-# define gpuGetNormalMatrix(x) gpuGetNormalMatrix(_GPU_MAT3_CAST(x))
-# define gpuGetNormalMatrixInverse(x) gpuGetNormalMatrixInverse(_GPU_MAT3_CAST(x))
+# define GPU_matrix_mul(x) GPU_matrix_mul(_GPU_MAT4_CONST_CAST(x))
+# define GPU_matrix_set(x) GPU_matrix_set(_GPU_MAT4_CONST_CAST(x))
+# define GPU_matrix_projection_set(x) GPU_matrix_projection_set(_GPU_MAT4_CONST_CAST(x))
+# define GPU_matrix_model_view_get(x) GPU_matrix_model_view_get(_GPU_MAT4_CAST(x))
+# define GPU_matrix_projection_get(x) GPU_matrix_projection_get(_GPU_MAT4_CAST(x))
+# define GPU_matrix_model_view_projection_get(x) GPU_matrix_model_view_projection_get(_GPU_MAT4_CAST(x))
+# define GPU_matrix_normal_get(x) GPU_matrix_normal_get(_GPU_MAT3_CAST(x))
+# define GPU_matrix_normal_inverse_get(x) GPU_matrix_normal_inverse_get(_GPU_MAT3_CAST(x))
#endif /* SUPPRESS_GENERIC_MATRIX_API */
#endif /* __GPU_MATRIX_H__ */
diff --git a/source/blender/gpu/intern/gpu_matrix.c b/source/blender/gpu/intern/gpu_matrix.c
index b6214f2778b..2af1375a620 100644
--- a/source/blender/gpu/intern/gpu_matrix.c
+++ b/source/blender/gpu/intern/gpu_matrix.c
@@ -86,7 +86,7 @@ static MatrixState state = {
#define ProjectionStack state.projection_stack
#define Projection ProjectionStack.stack[ProjectionStack.top]
-void gpuMatrixReset(void)
+void GPU_matrix_reset(void)
{
state.model_view_stack.top = 0;
state.projection_stack.top = 0;
@@ -119,76 +119,76 @@ static void checkmat(cosnt float *m)
#endif
-void gpuPushMatrix(void)
+void GPU_matrix_push(void)
{
BLI_assert(ModelViewStack.top + 1 < MATRIX_STACK_DEPTH);
ModelViewStack.top++;
copy_m4_m4(ModelView, ModelViewStack.stack[ModelViewStack.top - 1]);
}
-void gpuPopMatrix(void)
+void GPU_matrix_pop(void)
{
BLI_assert(ModelViewStack.top > 0);
ModelViewStack.top--;
state.dirty = true;
}
-void gpuPushProjectionMatrix(void)
+void GPU_matrix_push_projection(void)
{
BLI_assert(ProjectionStack.top + 1 < MATRIX_STACK_DEPTH);
ProjectionStack.top++;
copy_m4_m4(Projection, ProjectionStack.stack[ProjectionStack.top - 1]);
}
-void gpuPopProjectionMatrix(void)
+void GPU_matrix_pop_projection(void)
{
BLI_assert(ProjectionStack.top > 0);
ProjectionStack.top--;
state.dirty = true;
}
-void gpuLoadMatrix(const float m[4][4])
+void GPU_matrix_set(const float m[4][4])
{
copy_m4_m4(ModelView, m);
CHECKMAT(ModelView3D);
state.dirty = true;
}
-void gpuLoadIdentityProjectionMatrix(void)
+void GPU_matrix_identity_projection_set(void)
{
unit_m4(Projection);
CHECKMAT(Projection3D);
state.dirty = true;
}
-void gpuLoadProjectionMatrix(const float m[4][4])
+void GPU_matrix_projection_set(const float m[4][4])
{
copy_m4_m4(Projection, m);
CHECKMAT(Projection3D);
state.dirty = true;
}
-void gpuLoadIdentity(void)
+void GPU_matrix_identity_set(void)
{
unit_m4(ModelView);
state.dirty = true;
}
-void gpuTranslate2f(float x, float y)
+void GPU_matrix_translate_2f(float x, float y)
{
Mat4 m;
unit_m4(m);
m[3][0] = x;
m[3][1] = y;
- gpuMultMatrix(m);
+ GPU_matrix_mul(m);
}
-void gpuTranslate2fv(const float vec[2])
+void GPU_matrix_translate_2fv(const float vec[2])
{
- gpuTranslate2f(vec[0], vec[1]);
+ GPU_matrix_translate_2f(vec[0], vec[1]);
}
-void gpuTranslate3f(float x, float y, float z)
+void GPU_matrix_translate_3f(float x, float y, float z)
{
#if 1
translate_m4(ModelView, x, y, z);
@@ -199,61 +199,61 @@ void gpuTranslate3f(float x, float y, float z)
m[3][0] = x;
m[3][1] = y;
m[3][2] = z;
- gpuMultMatrix(m);
+ GPU_matrix_mul(m);
#endif
state.dirty = true;
}
-void gpuTranslate3fv(const float vec[3])
+void GPU_matrix_translate_3fv(const float vec[3])
{
- gpuTranslate3f(vec[0], vec[1], vec[2]);
+ GPU_matrix_translate_3f(vec[0], vec[1], vec[2]);
}
-void gpuScaleUniform(float factor)
+void GPU_matrix_scale_1f(float factor)
{
Mat4 m;
scale_m4_fl(m, factor);
- gpuMultMatrix(m);
+ GPU_matrix_mul(m);
}
-void gpuScale2f(float x, float y)
+void GPU_matrix_scale_2f(float x, float y)
{
Mat4 m = {{0.0f}};
m[0][0] = x;
m[1][1] = y;
m[2][2] = 1.0f;
m[3][3] = 1.0f;
- gpuMultMatrix(m);
+ GPU_matrix_mul(m);
}
-void gpuScale2fv(const float vec[2])
+void GPU_matrix_scale_2fv(const float vec[2])
{
- gpuScale2f(vec[0], vec[1]);
+ GPU_matrix_scale_2f(vec[0], vec[1]);
}
-void gpuScale3f(float x, float y, float z)
+void GPU_matrix_scale_3f(float x, float y, float z)
{
Mat4 m = {{0.0f}};
m[0][0] = x;
m[1][1] = y;
m[2][2] = z;
m[3][3] = 1.0f;
- gpuMultMatrix(m);
+ GPU_matrix_mul(m);
}
-void gpuScale3fv(const float vec[3])
+void GPU_matrix_scale_3fv(const float vec[3])
{
- gpuScale3f(vec[0], vec[1], vec[2]);
+ GPU_matrix_scale_3f(vec[0], vec[1], vec[2]);
}
-void gpuMultMatrix(const float m[4][4])
+void GPU_matrix_mul(const float m[4][4])
{
mul_m4_m4_post(ModelView, m);
CHECKMAT(ModelView);
state.dirty = true;
}
-void gpuRotate2D(float deg)
+void GPU_matrix_rotate_2d(float deg)
{
/* essentially RotateAxis('Z')
* TODO: simpler math for 2D case
@@ -261,20 +261,20 @@ void gpuRotate2D(float deg)
rotate_m4(ModelView, 'Z', DEG2RADF(deg));
}
-void gpuRotate3f(float deg, float x, float y, float z)
+void GPU_matrix_rotate_3f(float deg, float x, float y, float z)
{
const float axis[3] = {x, y, z};
- gpuRotate3fv(deg, axis);
+ GPU_matrix_rotate_3fv(deg, axis);
}
-void gpuRotate3fv(float deg, const float axis[3])
+void GPU_matrix_rotate_3fv(float deg, const float axis[3])
{
Mat4 m;
axis_angle_to_mat4(m, axis, DEG2RADF(deg));
- gpuMultMatrix(m);
+ GPU_matrix_mul(m);
}
-void gpuRotateAxis(float deg, char axis)
+void GPU_matrix_rotate_axis(float deg, char axis)
{
/* rotate_m4 works in place */
rotate_m4(ModelView, axis, DEG2RADF(deg));
@@ -398,14 +398,14 @@ static void mat4_look_from_origin(float m[4][4], float lookdir[3], float camup[3
state.dirty = true;
}
-void gpuOrtho(float left, float right, float bottom, float top, float near, float far)
+void GPU_matrix_ortho_set(float left, float right, float bottom, float top, float near, float far)
{
mat4_ortho_set(Projection, left, right, bottom, top, near, far);
CHECKMAT(Projection);
state.dirty = true;
}
-void gpuOrtho2D(float left, float right, float bottom, float top)
+void GPU_matrix_ortho_2d_set(float left, float right, float bottom, float top)
{
Mat4 m;
mat4_ortho_set(m, left, right, bottom, top, -1.0f, 1.0f);
@@ -413,21 +413,21 @@ void gpuOrtho2D(float left, float right, float bottom, float top)
state.dirty = true;
}
-void gpuFrustum(float left, float right, float bottom, float top, float near, float far)
+void GPU_matrix_frustum_set(float left, float right, float bottom, float top, float near, float far)
{
mat4_frustum_set(Projection, left, right, bottom, top, near, far);
CHECKMAT(Projection);
state.dirty = true;
}
-void gpuPerspective(float fovy, float aspect, float near, float far)
+void GPU_matrix_perspective_set(float fovy, float aspect, float near, float far)
{
float half_height = tanf(fovy * (float)(M_PI / 360.0)) * near;
float half_width = half_height * aspect;
- gpuFrustum(-half_width, +half_width, -half_height, +half_height, near, far);
+ GPU_matrix_frustum_set(-half_width, +half_width, -half_height, +half_height, near, far);
}
-void gpuLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
+void GPU_matrix_look_at(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
{
Mat4 cm;
float lookdir[3];
@@ -439,11 +439,11 @@ void gpuLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY,
mat4_look_from_origin(cm, lookdir, camup);
- gpuMultMatrix(cm);
- gpuTranslate3f(-eyeX, -eyeY, -eyeZ);
+ GPU_matrix_mul(cm);
+ GPU_matrix_translate_3f(-eyeX, -eyeY, -eyeZ);
}
-void gpuProject(const float world[3], const float model[4][4], const float proj[4][4], const int view[4], float win[3])
+void GPU_matrix_project(const float world[3], const float model[4][4], const float proj[4][4], const int view[4], float win[3])
{
float v[4];
@@ -459,7 +459,7 @@ void gpuProject(const float world[3], const float model[4][4], const float proj[
win[2] = (v[2] + 1) * 0.5f;
}
-bool gpuUnProject(const float win[3], const float model[4][4], const float proj[4][4], const int view[4], float world[3])
+bool GPU_matrix_unproject(const float win[3], const float model[4][4], const float proj[4][4], const int view[4], float world[3])
{
float pm[4][4];
float in[4];
@@ -497,7 +497,7 @@ bool gpuUnProject(const float win[3], const float model[4][4], const float proj[
return true;
}
-const float (*gpuGetModelViewMatrix(float m[4][4]))[4]
+const float (*GPU_matrix_model_view_get(float m[4][4]))[4]
{
if (m) {
copy_m4_m4(m, ModelView);
@@ -508,7 +508,7 @@ const float (*gpuGetModelViewMatrix(float m[4][4]))[4]
}
}
-const float (*gpuGetProjectionMatrix(float m[4][4]))[4]
+const float (*GPU_matrix_projection_get(float m[4][4]))[4]
{
if (m) {
copy_m4_m4(m, Projection);
@@ -519,7 +519,7 @@ const float (*gpuGetProjectionMatrix(float m[4][4]))[4]
}
}
-const float (*gpuGetModelViewProjectionMatrix(float m[4][4]))[4]
+const float (*GPU_matrix_model_view_projection_get(float m[4][4]))[4]
{
if (m == NULL) {
static Mat4 temp;
@@ -530,14 +530,14 @@ const float (*gpuGetModelViewProjectionMatrix(float m[4][4]))[4]
return m;
}
-const float (*gpuGetNormalMatrix(float m[3][3]))[3]
+const float (*GPU_matrix_normal_get(float m[3][3]))[3]
{
if (m == NULL) {
static Mat3 temp3;
m = temp3;
}
- copy_m3_m4(m, (const float (*)[4])gpuGetModelViewMatrix(NULL));
+ copy_m3_m4(m, (const float (*)[4])GPU_matrix_model_view_get(NULL));
invert_m3(m);
transpose_m3(m);
@@ -545,20 +545,20 @@ const float (*gpuGetNormalMatrix(float m[3][3]))[3]
return m;
}
-const float (*gpuGetNormalMatrixInverse(float m[3][3]))[3]
+const float (*GPU_matrix_normal_inverse_get(float m[3][3]))[3]
{
if (m == NULL) {
static Mat3 temp3;
m = temp3;
}
- gpuGetNormalMatrix(m);
+ GPU_matrix_normal_get(m);
invert_m3(m);
return m;
}
-void gpuBindMatrices(const Gwn_ShaderInterface *shaderface)
+void GPU_matrix_bind(const Gwn_ShaderInterface *shaderface)
{
/* set uniform values to matrix stack values
* call this before a draw call if desired matrices are dirty
@@ -578,7 +578,7 @@ void gpuBindMatrices(const Gwn_ShaderInterface *shaderface)
puts("setting MV matrix");
#endif
- glUniformMatrix4fv(MV->location, 1, GL_FALSE, (const float *)gpuGetModelViewMatrix(NULL));
+ glUniformMatrix4fv(MV->location, 1, GL_FALSE, (const float *)GPU_matrix_model_view_get(NULL));
}
if (P) {
@@ -586,7 +586,7 @@ void gpuBindMatrices(const Gwn_ShaderInterface *shaderface)
puts("setting P matrix");
#endif
- glUniformMatrix4fv(P->location, 1, GL_FALSE, (const float *)gpuGetProjectionMatrix(NULL));
+ glUniformMatrix4fv(P->location, 1, GL_FALSE, (const float *)GPU_matrix_projection_get(NULL));
}
if (MVP) {
@@ -594,7 +594,7 @@ void gpuBindMatrices(const Gwn_ShaderInterface *shaderface)
puts("setting MVP matrix");
#endif
- glUniformMatrix4fv(MVP->location, 1, GL_FALSE, (const float *)gpuGetModelViewProjectionMatrix(NULL));
+ glUniformMatrix4fv(MVP->location, 1, GL_FALSE, (const float *)GPU_matrix_model_view_projection_get(NULL));
}
if (N) {
@@ -602,19 +602,19 @@ void gpuBindMatrices(const Gwn_ShaderInterface *shaderface)
puts("setting normal matrix");
#endif
- glUniformMatrix3fv(N->location, 1, GL_FALSE, (const float *)gpuGetNormalMatrix(NULL));
+ glUniformMatrix3fv(N->location, 1, GL_FALSE, (const float *)GPU_matrix_normal_get(NULL));
}
if (MV_inv) {
Mat4 m;
- gpuGetModelViewMatrix(m);
+ GPU_matrix_model_view_get(m);
invert_m4(m);
glUniformMatrix4fv(MV_inv->location, 1, GL_FALSE, (const float *)m);
}
if (P_inv) {
Mat4 m;
- gpuGetProjectionMatrix(m);
+ GPU_matrix_projection_get(m);
invert_m4(m);
glUniformMatrix4fv(P_inv->location, 1, GL_FALSE, (const float *)m);
}
@@ -622,7 +622,7 @@ void gpuBindMatrices(const Gwn_ShaderInterface *shaderface)
state.dirty = false;
}
-bool gpuMatricesDirty(void)
+bool GPU_matrix_dirty_get(void)
{
return state.dirty;
}
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index 8c978be81c1..99baaa1164f 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -532,7 +532,7 @@ void GPU_shader_bind(GPUShader *shader)
BLI_assert(shader && shader->program);
glUseProgram(shader->program);
- gpuBindMatrices(shader->interface);
+ GPU_matrix_bind(shader->interface);
}
void GPU_shader_unbind(void)
diff --git a/source/blender/python/intern/gpu_py_matrix.c b/source/blender/python/intern/gpu_py_matrix.c
index 68b08dfb324..2ab6fd864eb 100644
--- a/source/blender/python/intern/gpu_py_matrix.c
+++ b/source/blender/python/intern/gpu_py_matrix.c
@@ -102,7 +102,7 @@ static PyObject *pygpu_matrix_push(PyObject *UNUSED(self))
if (!pygpu_stack_is_push_model_view_ok_or_error()) {
return NULL;
}
- gpuPushMatrix();
+ GPU_matrix_push();
Py_RETURN_NONE;
}
@@ -116,7 +116,7 @@ static PyObject *pygpu_matrix_pop(PyObject *UNUSED(self))
if (!pygpu_stack_is_pop_model_view_ok_or_error()) {
return NULL;
}
- gpuPopMatrix();
+ GPU_matrix_pop();
Py_RETURN_NONE;
}
@@ -130,7 +130,7 @@ static PyObject *pygpu_matrix_push_projection(PyObject *UNUSED(self))
if (!pygpu_stack_is_push_projection_ok_or_error()) {
return NULL;
}
- gpuPushProjectionMatrix();
+ GPU_matrix_push_projection();
Py_RETURN_NONE;
}
@@ -144,7 +144,7 @@ static PyObject *pygpu_matrix_pop_projection(PyObject *UNUSED(self))
if (!pygpu_stack_is_pop_projection_ok_or_error()) {
return NULL;
}
- gpuPopProjectionMatrix();
+ GPU_matrix_pop_projection();
Py_RETURN_NONE;
}
@@ -197,14 +197,14 @@ static PyObject *pygpu_matrix_stack_context_enter(BPy_GPU_MatrixStackContext *se
if (!pygpu_stack_is_push_model_view_ok_or_error()) {
return NULL;
}
- gpuPushMatrix();
+ GPU_matrix_push();
self->level = GPU_matrix_stack_level_get_model_view();
}
else if (self->type == PYGPU_MATRIX_TYPE_PROJECTION) {
if (!pygpu_stack_is_push_projection_ok_or_error()) {
return NULL;
}
- gpuPushProjectionMatrix();
+ GPU_matrix_push_projection();
self->level = GPU_matrix_stack_level_get_projection();
}
else {
@@ -227,7 +227,7 @@ static PyObject *pygpu_matrix_stack_context_exit(BPy_GPU_MatrixStackContext *sel
fprintf(stderr, "Level push/pop mismatch, expected %d, got %d\n", self->level, level);
}
if (level != 0) {
- gpuPopMatrix();
+ GPU_matrix_pop();
}
}
else if (self->type == PYGPU_MATRIX_TYPE_PROJECTION) {
@@ -236,7 +236,7 @@ static PyObject *pygpu_matrix_stack_context_exit(BPy_GPU_MatrixStackContext *sel
fprintf(stderr, "Level push/pop mismatch, expected %d, got %d", self->level, level);
}
if (level != 0) {
- gpuPopProjectionMatrix();
+ GPU_matrix_pop_projection();
}
}
else {
@@ -294,7 +294,7 @@ static PyObject *pygpu_matrix_multiply_matrix(PyObject *UNUSED(self), PyObject *
if (!Matrix_Parse4x4(value, &pymat)) {
return NULL;
}
- gpuMultMatrix(pymat->matrix);
+ GPU_matrix_mul(pymat->matrix);
Py_RETURN_NONE;
}
@@ -314,10 +314,10 @@ static PyObject *pygpu_matrix_scale(PyObject *UNUSED(self), PyObject *value)
return NULL;
}
if (len == 2) {
- gpuScale2fv(scale);
+ GPU_matrix_scale_2fv(scale);
}
else {
- gpuScale3fv(scale);
+ GPU_matrix_scale_3fv(scale);
}
Py_RETURN_NONE;
}
@@ -337,7 +337,7 @@ static PyObject *pygpu_matrix_scale_uniform(PyObject *UNUSED(self), PyObject *va
Py_TYPE(value)->tp_name);
return NULL;
}
- gpuScaleUniform(scalar);
+ GPU_matrix_scale_1f(scalar);
Py_RETURN_NONE;
}
@@ -357,10 +357,10 @@ static PyObject *pygpu_matrix_translate(PyObject *UNUSED(self), PyObject *value)
return NULL;
}
if (len == 2) {
- gpuTranslate2fv(offset);
+ GPU_matrix_translate_2fv(offset);
}
else {
- gpuTranslate3fv(offset);
+ GPU_matrix_translate_3fv(offset);
}
Py_RETURN_NONE;
}
@@ -378,7 +378,7 @@ PyDoc_STRVAR(pygpu_matrix_reset_doc,
);
static PyObject *pygpu_matrix_reset(PyObject *UNUSED(self))
{
- gpuMatrixReset();
+ GPU_matrix_reset();
Py_RETURN_NONE;
}
@@ -389,7 +389,7 @@ PyDoc_STRVAR(pygpu_matrix_load_identity_doc,
);
static PyObject *pygpu_matrix_load_identity(PyObject *UNUSED(self))
{
- gpuLoadIdentity();
+ GPU_matrix_identity_set();
Py_RETURN_NONE;
}
@@ -407,7 +407,7 @@ static PyObject *pygpu_matrix_load_matrix(PyObject *UNUSED(self), PyObject *valu
if (!Matrix_Parse4x4(value, &pymat)) {
return NULL;
}
- gpuLoadMatrix(pymat->matrix);
+ GPU_matrix_set(pymat->matrix);
Py_RETURN_NONE;
}
@@ -428,7 +428,7 @@ PyDoc_STRVAR(pygpu_matrix_get_projection_matrix_doc,
static PyObject *pygpu_matrix_get_projection_matrix(PyObject *UNUSED(self))
{
float matrix[4][4];
- gpuGetModelViewMatrix(matrix);
+ GPU_matrix_model_view_get(matrix);
return Matrix_CreatePyObject(&matrix[0][0], 4, 4, NULL);
}
@@ -444,7 +444,7 @@ PyDoc_STRVAR(pygpu_matrix_get_modal_view_matrix_doc,
static PyObject *pygpu_matrix_get_modal_view_matrix(PyObject *UNUSED(self))
{
float matrix[4][4];
- gpuGetProjectionMatrix(matrix);
+ GPU_matrix_projection_get(matrix);
return Matrix_CreatePyObject(&matrix[0][0], 4, 4, NULL);
}
@@ -459,7 +459,7 @@ PyDoc_STRVAR(pygpu_matrix_get_normal_matrix_doc,
static PyObject *pygpu_matrix_get_normal_matrix(PyObject *UNUSED(self))
{
float matrix[3][3];
- gpuGetNormalMatrix(matrix);
+ GPU_matrix_normal_get(matrix);
return Matrix_CreatePyObject(&matrix[0][0], 3, 3, NULL);
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 5cf9ac625c3..64aa64e1478 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2118,8 +2118,8 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
/* set up rotation if available */
if (rc->rot_prop) {
rot = RNA_property_float_get(&rc->rot_ptr, rc->rot_prop);
- gpuPushMatrix();
- gpuRotate2D(RAD2DEGF(rot));
+ GPU_matrix_push();
+ GPU_matrix_rotate_2d(RAD2DEGF(rot));
}
/* draw textured quad */
@@ -2141,7 +2141,7 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
/* undo rotation */
if (rc->rot_prop)
- gpuPopMatrix();
+ GPU_matrix_pop();
}
else {
/* flat color if no texture available */
@@ -2208,7 +2208,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
/* Keep cursor in the original place */
x = rc->initial_mouse[0];
y = rc->initial_mouse[1];
- gpuTranslate2f((float)x, (float)y);
+ GPU_matrix_translate_2f((float)x, (float)y);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
@@ -2216,7 +2216,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
/* apply zoom if available */
if (rc->zoom_prop) {
RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
- gpuScale2fv(zoom);
+ GPU_matrix_scale_2fv(zoom);
}
/* draw rotated texture */
@@ -2233,23 +2233,23 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
immUniformColor3fvAlpha(col, 0.5f);
if (rc->subtype == PROP_ANGLE) {
- gpuPushMatrix();
+ GPU_matrix_push();
/* draw original angle line */
- gpuRotate2D(RAD2DEGF(rc->initial_value));
+ GPU_matrix_rotate_2d(RAD2DEGF(rc->initial_value));
immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
immEnd();
/* draw new angle line */
- gpuRotate2D(RAD2DEGF(rc->current_value - rc->initial_value));
+ GPU_matrix_rotate_2d(RAD2DEGF(rc->current_value - rc->initial_value));
immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f);
immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f);
immEnd();
- gpuPopMatrix();
+ GPU_matrix_pop();
}
/* draw circles on top */
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 003932930ed..7ddc87a2524 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -201,8 +201,8 @@ static void playanim_window_get_size(int *r_width, int *r_height)
static void playanim_gl_matrix(void)
{
/* unified matrix, note it affects offset for drawing */
- /* note! cannot use gpuOrtho2D here because shader ignores. */
- gpuOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0, 1.0f);
+ /* note! cannot use GPU_matrix_ortho_2d_set here because shader ignores. */
+ GPU_matrix_ortho_set(0.0f, 1.0f, 0.0f, 1.0f, -1.0, 1.0f);
}
/* implementation */
@@ -366,10 +366,10 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
float fac = ps->picture->frame / (double)(((PlayAnimPict *)picsbase.last)->frame - ((PlayAnimPict *)picsbase.first)->frame);
fac = 2.0f * fac - 1.0f;
- gpuPushProjectionMatrix();
- gpuLoadIdentityProjectionMatrix();
- gpuPushMatrix();
- gpuLoadIdentity();
+ GPU_matrix_push_projection();
+ GPU_matrix_identity_projection_set();
+ GPU_matrix_push();
+ GPU_matrix_identity_set();
uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -383,8 +383,8 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
immUnbindProgram();
- gpuPopMatrix();
- gpuPopProjectionMatrix();
+ GPU_matrix_pop();
+ GPU_matrix_pop_projection();
}
GHOST_SwapWindowBuffers(g_WS.ghost_window);
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index f55eee69f71..ff3c712dae0 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -50,7 +50,7 @@ void wmViewport(const rcti *winrct)
glScissor(winrct->xmin, winrct->ymin, width, height);
wmOrtho2_pixelspace(width, height);
- gpuLoadIdentity();
+ GPU_matrix_identity_set();
}
void wmPartialViewport(rcti *drawrct, const rcti *winrct, const rcti *partialrct)
@@ -89,7 +89,7 @@ void wmPartialViewport(rcti *drawrct, const rcti *winrct, const rcti *partialrct
glScissor(x, y, scissor_width, scissor_height);
wmOrtho2_pixelspace(width, height);
- gpuLoadIdentity();
+ GPU_matrix_identity_set();
}
void wmWindowViewport(wmWindow *win)
@@ -101,7 +101,7 @@ void wmWindowViewport(wmWindow *win)
glScissor(0, 0, width, height);
wmOrtho2_pixelspace(width, height);
- gpuLoadIdentity();
+ GPU_matrix_identity_set();
}
void wmOrtho2(float x1, float x2, float y1, float y2)
@@ -110,7 +110,7 @@ void wmOrtho2(float x1, float x2, float y1, float y2)
if (x1 == x2) x2 += 1.0f;
if (y1 == y2) y2 += 1.0f;
- gpuOrtho(x1, x2, y1, y2, -100, 100);
+ GPU_matrix_ortho_set(x1, x2, y1, y2, -100, 100);
}
static void wmOrtho2_offset(const float x, const float y, const float ofs)