From 90aa02290ac87a08cef948efb3ee67335276468a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Aug 2017 20:31:32 +1000 Subject: Cleanup: rename GPU gawain functions Were using Batch_ prefix still --- source/blender/draw/intern/draw_cache.c | 2 +- .../blender/editors/armature/editarmature_sketch.c | 4 +- source/blender/editors/curve/editcurve_paint.c | 4 +- source/blender/editors/interface/interface_draw.c | 6 +-- .../manipulator_library/manipulator_draw_utils.c | 2 +- source/blender/editors/space_view3d/drawarmature.c | 24 ++++----- source/blender/editors/space_view3d/drawobject.c | 60 +++++++++++----------- .../blender/editors/uvedit/uvedit_smart_stitch.c | 2 +- source/blender/gpu/GPU_batch.h | 6 +-- source/blender/gpu/intern/gpu_batch.c | 6 +-- source/blender/gpu/intern/gpu_framebuffer.c | 4 +- 11 files changed, 60 insertions(+), 60 deletions(-) diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 453fb2cf41a..bf65d8f879d 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -261,7 +261,7 @@ Gwn_Batch *DRW_cache_fullscreen_quad_get(void) /* Sphere */ Gwn_Batch *DRW_cache_sphere_get(void) { - return Batch_get_sphere(2); + return GPU_batch_preset_sphere(2); } /** \} */ diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index e167d4edb94..b96e04a8a60 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -450,8 +450,8 @@ static void sk_drawPoint(SK_Point *pt, float size, float color[4]) gpuScaleUniform(sk_clampPointSize(pt, size)); - batch = Batch_get_sphere(0); - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + batch = GPU_batch_preset_sphere(0); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4fv(batch, "color", color); GWN_batch_draw(batch); diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index ef708a4edec..f6bbff2f5d4 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -383,8 +383,8 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS float color[3]; UI_GetThemeColor3fv(TH_WIRE, color); - Gwn_Batch *sphere = Batch_get_sphere(0); - Batch_set_builtin_program(sphere, GPU_SHADER_3D_UNIFORM_COLOR); + Gwn_Batch *sphere = GPU_batch_preset_sphere(0); + GWN_batch_program_set_builtin(sphere, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_3fv(sphere, "color", color); /* scale to edit-mode space */ diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index d9175c03e43..bdedb265d73 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -772,7 +772,7 @@ static void waveform_draw_one(float *waveform, int nbr, const float col[3]) /* TODO store the Gwn_Batch inside the scope */ Gwn_Batch *batch = GWN_batch_create_ex(GWN_PRIM_POINTS, vbo, NULL, GWN_BATCH_OWNS_VBO); - Batch_set_builtin_program(batch, GPU_SHADER_2D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR); GWN_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f); GWN_batch_draw(batch); @@ -1443,8 +1443,8 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) gpuTranslate2f(rect->xmin + 0.5f * BLI_rcti_size_x(rect), rect->ymin + 0.5f * BLI_rcti_size_y(rect)); gpuScaleUniform(size); - Gwn_Batch *sphere = Batch_get_sphere(2); - Batch_set_builtin_program(sphere, GPU_SHADER_SIMPLE_LIGHTING); + Gwn_Batch *sphere = GPU_batch_preset_sphere(2); + GWN_batch_program_set_builtin(sphere, GPU_SHADER_SIMPLE_LIGHTING); GWN_batch_uniform_4f(sphere, "color", diffuse[0], diffuse[1], diffuse[2], 1.0f); GWN_batch_uniform_3fv(sphere, "light", light); GWN_batch_draw(sphere); diff --git a/source/blender/editors/manipulator_library/manipulator_draw_utils.c b/source/blender/editors/manipulator_library/manipulator_draw_utils.c index 0fb36bca183..f15cd9c9793 100644 --- a/source/blender/editors/manipulator_library/manipulator_draw_utils.c +++ b/source/blender/editors/manipulator_library/manipulator_draw_utils.c @@ -96,7 +96,7 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo } batch = GWN_batch_create_ex(GWN_PRIM_TRIS, vbo, el, GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX); - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4fv(batch, "color", color); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 6f395e2c761..11aa3476ee1 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -411,11 +411,11 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize) gpuScale3f(xsize, ysize, zsize); if (flat_color) { - Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(&batch, GPU_SHADER_3D_UNIFORM_COLOR); } else { /* TODO replace with good default lighting shader ? */ - Batch_set_builtin_program(&batch, GPU_SHADER_SIMPLE_LIGHTING); + GWN_batch_program_set_builtin(&batch, GPU_SHADER_SIMPLE_LIGHTING); GWN_batch_uniform_3fv(&batch, "light", light_vec); } GWN_batch_uniform_4fv(&batch, "color", fcolor); @@ -451,7 +451,7 @@ static void drawcube_size(float xsize, float ysize, float zsize) } GWN_batch_init(&batch, GWN_PRIM_LINES, &vbo, &el); - Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(&batch, GPU_SHADER_3D_UNIFORM_COLOR); } gpuPushMatrix(); @@ -507,7 +507,7 @@ static void draw_bonevert(void) } GWN_batch_init(&batch, GWN_PRIM_LINES, &vbo, NULL); - Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(&batch, GPU_SHADER_3D_UNIFORM_COLOR); } GWN_batch_program_use_begin(&batch); @@ -517,18 +517,18 @@ static void draw_bonevert(void) static void draw_bonevert_solid(void) { - Gwn_Batch *batch = Batch_get_sphere(0); + Gwn_Batch *batch = GPU_batch_preset_sphere(0); const float light_vec[3] = {0.0f, 0.0f, 1.0f}; gpuPushMatrix(); gpuScaleUniform(0.05); if (flat_color) { - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); } else { /* TODO replace with good default lighting shader ? */ - Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); + GWN_batch_program_set_builtin(batch, GPU_SHADER_SIMPLE_LIGHTING); GWN_batch_uniform_3fv(batch, "light", light_vec); } GWN_batch_uniform_4fv(batch, "color", fcolor); @@ -603,7 +603,7 @@ static void draw_bone_octahedral(void) } GWN_batch_init(&batch, GWN_PRIM_LINES, &vbo, &el); - Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(&batch, GPU_SHADER_3D_UNIFORM_COLOR); } GWN_batch_program_use_begin(&batch); @@ -640,11 +640,11 @@ static void draw_bone_solid_octahedral(void) } if (flat_color) { - Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(&batch, GPU_SHADER_3D_UNIFORM_COLOR); } else { /* TODO replace with good default lighting shader ? */ - Batch_set_builtin_program(&batch, GPU_SHADER_SIMPLE_LIGHTING); + GWN_batch_program_set_builtin(&batch, GPU_SHADER_SIMPLE_LIGHTING); GWN_batch_uniform_3fv(&batch, "light", light_vec); } GWN_batch_uniform_4fv(&batch, "color", fcolor); @@ -993,13 +993,13 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4], static void draw_sphere_bone(const short dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone) { - Gwn_Batch *sphere = Batch_get_sphere(1); + Gwn_Batch *sphere = GPU_batch_preset_sphere(1); float head, tail, length; float fac1, fac2, size1, size2; const float light_vec[3] = {0.0f, 0.0f, 1.0f}; /* dt is always OB_SOlID */ - Batch_set_builtin_program(sphere, GPU_SHADER_SIMPLE_LIGHTING); + GWN_batch_program_set_builtin(sphere, GPU_SHADER_SIMPLE_LIGHTING); GWN_batch_uniform_3fv(sphere, "light", light_vec); gpuPushMatrix(); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 8bddcd43d16..2acc7241f86 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1762,29 +1762,29 @@ static void draw_viewport_object_reconstruction( /* selection outline */ if (selected) { - batch = Batch_get_sphere_wire(1); + batch = GPU_batch_preset_sphere_wire(1); if ((dflag & DRAW_CONSTCOLOR) == 0) { - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4f(batch, "color", ob_wire_col[0] / 255.f, ob_wire_col[1] / 255.f, ob_wire_col[2] / 255.f, 1.0f); } else { - Batch_set_builtin_program(batch, GPU_SHADER_3D_DEPTH_ONLY); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_DEPTH_ONLY); } glLineWidth(2.0f); GWN_batch_draw(batch); } - batch = Batch_get_sphere(0); + batch = GPU_batch_preset_sphere(0); if ((dflag & DRAW_CONSTCOLOR) == 0) { const float light[3] = {0.0f, 0.0f, 1.0f}; float col[3]; - Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); + GWN_batch_program_set_builtin(batch, GPU_SHADER_SIMPLE_LIGHTING); GWN_batch_uniform_3fv(batch, "light", light); if (track->flag & TRACK_CUSTOMCOLOR) copy_v3_v3(col, track->color); @@ -1792,7 +1792,7 @@ static void draw_viewport_object_reconstruction( GWN_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f); } else { - Batch_set_builtin_program(batch, GPU_SHADER_3D_DEPTH_ONLY); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_DEPTH_ONLY); } GWN_batch_draw(batch); @@ -4155,7 +4155,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D /* disable depth writes for transparent surface, so it doesn't interfere with itself */ glDepthMask(GL_FALSE); - Batch_set_builtin_program(surface, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(surface, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4f(surface, "color", 1.0f, 0.5f, 0.0f, 0.5f); GWN_batch_draw(surface); @@ -4163,7 +4163,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D if (finalDM != cageDM) { puts("finalDM != cageDM"); Gwn_Batch *finalSurface = MBC_get_all_triangles(finalDM); - Batch_set_builtin_program(finalSurface, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(finalSurface, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4f(finalSurface, "color", 0.0f, 0.0f, 0.0f, 0.05f); GWN_batch_draw(finalSurface); } @@ -4175,19 +4175,19 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D * NOTE: does not help as much as desired * TODO: draw edit object last to avoid this mess */ - Batch_set_builtin_program(surface, GPU_SHADER_3D_DEPTH_ONLY); + GWN_batch_program_set_builtin(surface, GPU_SHADER_3D_DEPTH_ONLY); GWN_batch_draw(surface); if (GLEW_VERSION_3_2) { #if 0 Gwn_Batch *overlay = DRW_mesh_batch_cache_get_overlay_edges(me); - Batch_set_builtin_program(overlay, GPU_SHADER_EDGES_OVERLAY); + GWN_batch_program_set_builtin(overlay, GPU_SHADER_EDGES_OVERLAY); GWN_batch_uniform_2f(overlay, "viewportSize", ar->winx, ar->winy); GWN_batch_draw(overlay); #endif #if 0 /* TODO: use this SIMPLE variant for pure triangle meshes */ - Batch_set_builtin_program(surface, GPU_SHADER_EDGES_OVERLAY_SIMPLE); + GWN_batch_program_set_builtin(surface, GPU_SHADER_EDGES_OVERLAY_SIMPLE); /* use these defaults: * const float edgeColor[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; * GWN_batch_uniform_4f(surface, "fillColor", edgeColor[0], edgeColor[1], edgeColor[2], 0.0f); @@ -4200,7 +4200,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D } else { Gwn_Batch *edges = DRW_mesh_batch_cache_get_all_edges(me); - Batch_set_builtin_program(edges, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(edges, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4f(edges, "color", 0.0f, 0.0f, 0.0f, 1.0f); glEnable(GL_LINE_SMOOTH); glLineWidth(1.5f); @@ -4212,7 +4212,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D Gwn_Batch *verts = MBC_get_all_verts(me); glEnable(GL_BLEND); - Batch_set_builtin_program(verts, GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); + GWN_batch_program_set_builtin(verts, GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); GWN_batch_uniform_4f(verts, "color", 0.0f, 0.0f, 0.0f, 1.0f); GWN_batch_uniform_1f(verts, "size", UI_GetThemeValuef(TH_VERTEX_SIZE) * 1.5f); GWN_batch_draw(verts); @@ -4264,14 +4264,14 @@ static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object Gwn_Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me); if (rv3d->persp == RV3D_ORTHO) { - Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO); + GWN_batch_program_set_builtin(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO); /* set eye vector, transformed to object coords */ float eye[3] = { 0.0f, 0.0f, 1.0f }; /* looking into the screen */ mul_m3_v3(gpuGetNormalMatrixInverse(NULL), eye); GWN_batch_uniform_3fv(fancy_edges, "eye", eye); } else { - Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP); + GWN_batch_program_set_builtin(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP); } GWN_batch_uniform_1b(fancy_edges, "drawFront", false); @@ -4282,7 +4282,7 @@ static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object GWN_batch_draw(fancy_edges); #else /* alternate version that matches look of old viewport (but more efficient) */ Gwn_Batch *batch = MBC_get_all_edges(dm); - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); GWN_batch_uniform_4fv(batch, "color", outline_color); GWN_batch_draw(batch); #endif @@ -4790,14 +4790,14 @@ static void draw_mesh_fancy_new(EvaluationContext *eval_ctx, Scene *scene, Scene Gwn_Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me); if (rv3d->persp == RV3D_ORTHO) { - Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO); + GWN_batch_program_set_builtin(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_ORTHO); /* set eye vector, transformed to object coords */ float eye[3] = { 0.0f, 0.0f, 1.0f }; /* looking into the screen */ mul_m3_v3(gpuGetNormalMatrixInverse(NULL), eye); GWN_batch_uniform_3fv(fancy_edges, "eye", eye); } else { - Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP); + GWN_batch_program_set_builtin(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP); } float frontColor[4]; @@ -4826,7 +4826,7 @@ static void draw_mesh_fancy_new(EvaluationContext *eval_ctx, Scene *scene, Scene #else /* simple wireframes */ Gwn_Batch *batch = MBC_get_all_edges(dm); - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); float color[4]; rgba_uchar_to_float(color, ob_wire_col); @@ -5141,7 +5141,7 @@ static void drawDispListVerts(Gwn_PrimType prim_type, const void *data, unsigned GWN_vertbuf_attr_fill(vbo, pos_id, data); Gwn_Batch *batch = GWN_batch_create_ex(prim_type, vbo, NULL, GWN_BATCH_OWNS_VBO); - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); if (wire_col) { GWN_batch_uniform_4f(batch, "color", wire_col[0] / 255.0f, wire_col[1] / 255.0f, wire_col[2] / 255.0f, 1.0f); } @@ -5204,7 +5204,7 @@ static void drawDispListElem( Gwn_Batch *batch = GWN_batch_create_ex( GWN_PRIM_TRIS, vbo, GWN_indexbuf_build(&elb), GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX); - Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); + GWN_batch_program_set_builtin(batch, GPU_SHADER_SIMPLE_LIGHTING); if (wire_col) { GWN_batch_uniform_4f(batch, "color", wire_col[0] / 255.0f, wire_col[1] / 255.0f, wire_col[2] / 255.0f, 1.0f); } @@ -5656,19 +5656,19 @@ static void draw_vertex_array(Gwn_PrimType prim_type, const float *vert, const f Gwn_Batch *batch = GWN_batch_create_ex(prim_type, vbo, NULL, GWN_BATCH_OWNS_VBO); if (nor && color) { - Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR); GWN_batch_uniform_3f(batch, "light", 0.0f, 0.0f, 1.0f); } else if (nor) { - Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); + GWN_batch_program_set_builtin(batch, GPU_SHADER_SIMPLE_LIGHTING); GWN_batch_uniform_3f(batch, "light", 0.0f, 0.0f, 1.0f); if (col) GWN_batch_uniform_4fv(batch, "color", col); } else if (color) { - Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_SMOOTH_COLOR); } else { - Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR); if (col) GWN_batch_uniform_4fv(batch, "color", col); } GWN_batch_draw(batch); @@ -6679,7 +6679,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) } Gwn_Batch *batch = GWN_batch_create_ex(GWN_PRIM_LINE_STRIP, vbo, NULL, GWN_BATCH_OWNS_VBO); - Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_SMOOTH_COLOR); GWN_batch_draw(batch); GWN_batch_discard(batch); } @@ -6750,7 +6750,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) GWN_vertbuf_attr_fill(vbo, col_id, cd); Gwn_Batch *batch = GWN_batch_create_ex(GWN_PRIM_POINTS, vbo, NULL, GWN_BATCH_OWNS_VBO); - Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_SMOOTH_COLOR); GWN_batch_draw(batch); GWN_batch_discard(batch); @@ -8085,8 +8085,8 @@ static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos) static void imm_draw_bb(BoundBox *bb, char type, bool around_origin, const unsigned char ob_wire_col[4]) { float size[3], cent[3]; - Gwn_Batch *sphere = Batch_get_sphere_wire(0); - Batch_set_builtin_program(sphere, GPU_SHADER_3D_UNIFORM_COLOR); + Gwn_Batch *sphere = GPU_batch_preset_sphere_wire(0); + GWN_batch_program_set_builtin(sphere, GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) GWN_batch_uniform_4f(sphere, "color", ob_wire_col[0] / 255.0f, ob_wire_col[1] / 255.0f, ob_wire_col[2] / 255.0f, 1.0f); BKE_boundbox_calc_size_aabb(bb, size); @@ -9646,7 +9646,7 @@ static void bbs_mesh_solid_faces(Scene *scene, Object *ob) else { batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, false); } - Batch_set_builtin_program(batch, GPU_SHADER_3D_FLAT_COLOR_U32); + GWN_batch_program_set_builtin(batch, GPU_SHADER_3D_FLAT_COLOR_U32); GWN_batch_draw(batch); } diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index d75822cabe1..55ce45e5e2a 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1546,7 +1546,7 @@ static void stitch_calculate_edge_normal(BMEditMesh *em, UvEdge *edge, float *no static void stitch_draw_vbo(Gwn_VertBuf *vbo, Gwn_PrimType prim_type, const float col[4]) { Gwn_Batch *batch = GWN_batch_create_ex(prim_type, vbo, NULL, GWN_BATCH_OWNS_VBO); - Batch_set_builtin_program(batch, GPU_SHADER_2D_UNIFORM_COLOR); + GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR); GWN_batch_uniform_4fv(batch, "color", col); GWN_batch_draw(batch); GWN_batch_discard(batch); diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h index 966690c19b2..27d1d1f902e 100644 --- a/source/blender/gpu/GPU_batch.h +++ b/source/blender/gpu/GPU_batch.h @@ -39,11 +39,11 @@ #include "GPU_shader.h" /* Extend GWN_batch_program_set to use Blender’s library of built-in shader programs. */ -void Batch_set_builtin_program(Gwn_Batch*, GPUBuiltinShader); +void GWN_batch_program_set_builtin(Gwn_Batch*, GPUBuiltinShader); /* Replacement for gluSphere */ -Gwn_Batch *Batch_get_sphere(int lod); -Gwn_Batch *Batch_get_sphere_wire(int lod); +Gwn_Batch *GPU_batch_preset_sphere(int lod); +Gwn_Batch *GPU_batch_preset_sphere_wire(int lod); void gpu_batch_init(void); void gpu_batch_exit(void); diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c index cb2b65d1a67..5d347fc80e8 100644 --- a/source/blender/gpu/intern/gpu_batch.c +++ b/source/blender/gpu/intern/gpu_batch.c @@ -31,7 +31,7 @@ #include "GPU_batch.h" #include "gpu_shader_private.h" -void Batch_set_builtin_program(Gwn_Batch *batch, GPUBuiltinShader shader_id) +void GWN_batch_program_set_builtin(Gwn_Batch *batch, GPUBuiltinShader shader_id) { GPUShader *shader = GPU_shader_get_builtin_shader(shader_id); GWN_batch_program_set(batch, shader->program, shader->interface); @@ -128,7 +128,7 @@ static Gwn_Batch *batch_sphere_wire(int lat_res, int lon_res) return GWN_batch_create_ex(GWN_PRIM_LINES, vbo, NULL, GWN_BATCH_OWNS_VBO); } -Gwn_Batch *Batch_get_sphere(int lod) +Gwn_Batch *GPU_batch_preset_sphere(int lod) { BLI_assert(lod >= 0 && lod <= 2); @@ -140,7 +140,7 @@ Gwn_Batch *Batch_get_sphere(int lod) return sphere_high; } -Gwn_Batch *Batch_get_sphere_wire(int lod) +Gwn_Batch *GPU_batch_preset_sphere_wire(int lod) { BLI_assert(lod >= 0 && lod <= 1); diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index cfb94cadaa9..48a8267bff2 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -480,7 +480,7 @@ void GPU_framebuffer_blur( GPU_texture_bind(tex, 0); - Batch_set_builtin_program(&batch, GPU_SHADER_SEP_GAUSSIAN_BLUR); + GWN_batch_program_set_builtin(&batch, GPU_SHADER_SEP_GAUSSIAN_BLUR); GWN_batch_uniform_2f(&batch, "ScaleU", scaleh[0], scaleh[1]); GWN_batch_uniform_1i(&batch, "textureSource", GL_TEXTURE0); GWN_batch_draw(&batch); @@ -496,7 +496,7 @@ void GPU_framebuffer_blur( GPU_texture_bind(blurtex, 0); /* Hack to make the following uniform stick */ - Batch_set_builtin_program(&batch, GPU_SHADER_SEP_GAUSSIAN_BLUR); + GWN_batch_program_set_builtin(&batch, GPU_SHADER_SEP_GAUSSIAN_BLUR); GWN_batch_uniform_2f(&batch, "ScaleU", scalev[0], scalev[1]); GWN_batch_uniform_1i(&batch, "textureSource", GL_TEXTURE0); GWN_batch_draw(&batch); -- cgit v1.2.3