[Bf-blender-cvs] [57ab7daa2ae] blender2.8: GPU_matrix: use Blender's naming conventions
Campbell Barton
noreply at git.blender.org
Sun Jul 15 15:34:59 CEST 2018
Commit: 57ab7daa2aee436b0b0acfa00b2e2b1d28b55b2c
Author: Campbell Barton
Date: Sun Jul 15 15:27:15 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB57ab7daa2aee436b0b0acfa00b2e2b1d28b55b2c
GPU_matrix: use Blender's naming conventions
Thanks to @sergey for review
===================================================================
M intern/gawain/gawain/gwn_batch.h
M intern/gawain/src/gwn_batch.c
M intern/gawain/src/gwn_immediate.c
M source/blender/blenfont/intern/blf.c
M source/blender/blenfont/intern/blf_font.c
M source/blender/draw/engines/external/external_engine.c
M source/blender/draw/intern/draw_manager.c
M source/blender/draw/intern/draw_manager_text.c
M source/blender/draw/intern/draw_view.c
M source/blender/editors/animation/anim_draw.c
M source/blender/editors/animation/anim_markers.c
M source/blender/editors/curve/editcurve_paint.c
M source/blender/editors/gizmo_library/gizmo_library_presets.c
M source/blender/editors/gizmo_library/gizmo_types/arrow2d_gizmo.c
M source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
M source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
M source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
M source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
M source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c
M source/blender/editors/gizmo_library/gizmo_types/grab3d_gizmo.c
M source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c
M source/blender/editors/interface/interface.c
M source/blender/editors/interface/interface_draw.c
M source/blender/editors/interface/interface_icons.c
M source/blender/editors/interface/interface_widgets.c
M source/blender/editors/interface/view2d.c
M source/blender/editors/mask/mask_draw.c
M source/blender/editors/mesh/editmesh_knife.c
M source/blender/editors/mesh/editmesh_loopcut.c
M source/blender/editors/render/render_opengl.c
M source/blender/editors/screen/area.c
M source/blender/editors/screen/glutil.c
M source/blender/editors/screen/screen_draw.c
M source/blender/editors/sculpt_paint/paint_cursor.c
M source/blender/editors/sculpt_paint/paint_utils.c
M source/blender/editors/space_action/action_draw.c
M source/blender/editors/space_clip/clip_draw.c
M source/blender/editors/space_clip/clip_graph_draw.c
M source/blender/editors/space_clip/space_clip.c
M source/blender/editors/space_graph/graph_draw.c
M source/blender/editors/space_image/image_draw.c
M source/blender/editors/space_node/drawnode.c
M source/blender/editors/space_node/node_draw.c
M source/blender/editors/space_sequencer/sequencer_draw.c
M source/blender/editors/space_view3d/drawobject.c
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/editors/space_view3d/view3d_draw.c
M source/blender/editors/space_view3d/view3d_draw_legacy.c
M source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c
M source/blender/editors/space_view3d/view3d_project.c
M source/blender/editors/space_view3d/view3d_select.c
M source/blender/editors/space_view3d/view3d_utils.c
M source/blender/editors/space_view3d/view3d_view.c
M source/blender/editors/transform/transform.c
M source/blender/editors/transform/transform_constraints.c
M source/blender/editors/transform/transform_generics.c
M source/blender/editors/uvedit/uvedit_draw.c
M source/blender/gpu/GPU_matrix.h
M source/blender/gpu/intern/gpu_matrix.c
M source/blender/gpu/intern/gpu_shader.c
M source/blender/python/intern/gpu_py_matrix.c
M source/blender/windowmanager/intern/wm_operators.c
M source/blender/windowmanager/intern/wm_playanim.c
M source/blender/windowmanager/intern/wm_subwindow.c
===================================================================
diff --git a/intern/gawain/gawain/gwn_batch.h b/intern/gawain/gawain/gwn_batch.h
index cf7b0c9f1b5..734df3c91b6 100644
--- a/intern/gawain/gawain/gwn_batch.h
+++ b/intern/gawain/gawain/gwn_batch.h
@@ -119,7 +119,7 @@ void GWN_batch_uniform_mat4(Gwn_Batch*, const char* name, const float data[4][4]
void GWN_batch_draw(Gwn_Batch*);
-// This does not bind/unbind shader and does not call gpuBindMatrices()
+// This does not bind/unbind shader and does not call GPU_matrix_bind()
void GWN_batch_draw_range_ex(Gwn_Batch*, int v_first, int v_count, bool force_instance);
// Does not even need batch
diff --git a/intern/gawain/src/gwn_batch.c b/intern/gawain/src/gwn_batch.c
index 62342cfc42f..4979d93b15e 100644
--- a/intern/gawain/src/gwn_batch.c
+++ b/intern/gawain/src/gwn_batch.c
@@ -18,7 +18,7 @@
#include <string.h>
// necessary functions from matrix API
-extern void gpuBindMatrices(const Gwn_ShaderInterface* shaderface);
+extern void GPU_matrix_bind(const Gwn_ShaderInterface* shaderface);
static void batch_update_program_bindings(Gwn_Batch* batch, unsigned int v_first);
@@ -537,7 +537,7 @@ void GWN_batch_draw(Gwn_Batch* batch)
assert(batch->verts[0]->vbo_id != 0);
#endif
GWN_batch_program_use_begin(batch);
- gpuBindMatrices(batch->interface); // external call.
+ GPU_matrix_bind(batch->interface); // external call.
GWN_batch_draw_range_ex(batch, 0, 0, false);
diff --git a/intern/gawain/src/gwn_immediate.c b/intern/gawain/src/gwn_immediate.c
index d43e52cc525..f6760b0e9da 100644
--- a/intern/gawain/src/gwn_immediate.c
+++ b/intern/gawain/src/gwn_immediate.c
@@ -19,8 +19,8 @@
#include <string.h>
// necessary functions from matrix API
-extern void gpuBindMatrices(const Gwn_ShaderInterface*);
-extern bool gpuMatricesDirty(void);
+extern void GPU_matrix_bind(const Gwn_ShaderInterface*);
+extern bool GPU_matrix_dirty_get(void);
typedef struct {
// TODO: organize this struct by frequency of change (run-time)
@@ -129,7 +129,7 @@ void immBindProgram(GLuint program, const Gwn_ShaderInterface* shaderface)
glUseProgram(program);
get_attrib_locations(&imm.vertex_format, &imm.attrib_binding, shaderface);
- gpuBindMatrices(shaderface);
+ GPU_matrix_bind(shaderface);
}
void immUnbindProgram(void)
@@ -341,8 +341,8 @@ static void immDrawSetup(void)
}
}
- if (gpuMatricesDirty())
- gpuBindMatrices(imm.shader_interface);
+ if (GPU_matrix_dirty_get())
+ GPU_matrix_bind(imm.shader_interface);
}
void immEnd(void)
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/a
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list