diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-06-19 13:18:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-06-19 13:18:04 +0300 |
commit | b4d053efc75424fca4b413ac1bc7a7e826fac629 (patch) | |
tree | 80647d9ca9109e997fce9911f202f98d7f8577d4 /source/blender/editors | |
parent | 349946bd010b1112b13c8594aabfb318c330bc0d (diff) |
Gawain API naming refactor
Use consistent prefix for gawain API names as well as
some abbreviations to avoid over-long names, see: D2678
Diffstat (limited to 'source/blender/editors')
68 files changed, 1286 insertions, 1286 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 0ebd556a0f5..69e8f708e3d 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -142,7 +142,7 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[3]; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); /* set backdrop drawing color */ acf->get_backdrop_color(ac, ale, color); @@ -231,7 +231,7 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, f short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; float color[3]; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); /* set backdrop drawing color */ acf->get_backdrop_color(ac, ale, color); @@ -3862,7 +3862,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float /* for F-Curves, draw color-preview of curve behind checkbox */ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) { FCurve *fcu = (FCurve *)ale->data; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -3918,7 +3918,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float /* draw red underline if channel is disabled */ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE) && (ale->flag & FCURVE_DISABLED)) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -3927,7 +3927,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float glLineWidth(2.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, (float)offset, yminc); immVertex2f(pos, (float)v2d->cur.xmax, yminc); immEnd(); @@ -3946,7 +3946,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float short draw_sliders = 0; float ymin_ofs = 0.0f; float color[3]; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 6127f77d7d6..08851cebf51 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -72,8 +72,8 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const bool time) { const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); unsigned char col[4]; float xscale, x, y; char numstr[32] = " t"; /* t is the character to start replacing from */ @@ -128,15 +128,15 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) glLineWidth((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* Draw a light green line to indicate current frame */ immUniformThemeColor(TH_CFRAME); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */ immVertex2f(pos, x, v2d->cur.ymax); immEnd(); @@ -163,8 +163,8 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index ef67411a48d..064879bdd70 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -351,8 +351,8 @@ static void draw_marker( if (flag & DRAW_MARKERS_LINES) #endif { - VertexFormat *format = immVertexFormat(); - uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -369,7 +369,7 @@ static void draw_marker( immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, xpos + 0.5f, 12.0f); immVertex2f(pos, xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale); immEnd(); @@ -452,7 +452,7 @@ void ED_markers_draw(const bContext *C, int flag) v2d = UI_view2d_fromcontext(C); if (flag & DRAW_MARKERS_MARGIN) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); const unsigned char shade[4] = {0, 0, 0, 16}; diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 5dca4be4de1..97e5597326e 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -585,7 +585,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa copy_v4_v4(unsel_mhcol, unsel_color); unsel_mhcol[3] *= 0.8f; - unsigned int pos_id = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos_id = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* NOTE: the tradeoff for changing colors between each draw is dwarfed by the cost of checking validity */ for (ActKeyBlock *ab = blocks->first; ab; ab = ab->next) { @@ -618,14 +618,14 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa if (key_ct > 0) { /* draw keys */ - VertexFormat *format = immVertexFormat(); - unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size_id = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color_id = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); - unsigned int outline_color_id = VertexFormat_add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); - immBegin(PRIM_POINTS, key_ct); + immBegin(GWN_PRIM_POINTS, key_ct); for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) { if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax)) { diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 957048bcc42..20fb7b5e693 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -440,7 +440,7 @@ static float sk_clampPointSize(SK_Point *pt, float size) static void sk_drawPoint(SK_Point *pt, float size, float color[4]) { - Batch *batch = NULL; + Gwn_Batch *batch = NULL; gpuTranslate3fv(pt->p); @@ -450,9 +450,9 @@ static void sk_drawPoint(SK_Point *pt, float size, float color[4]) batch = Batch_get_sphere(0); Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); - Batch_Uniform4fv(batch, "color", color); + GWN_batch_uniform_4fv(batch, "color", color); - Batch_draw(batch); + GWN_batch_draw(batch); gpuPopMatrix(); } @@ -462,8 +462,8 @@ static void sk_drawEdge(SK_Point *pt0, SK_Point *pt1, float size, float color[4] float vec1[3], vec2[3] = { 0, 0, 1 }, axis[3]; float angle, length; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); sub_v3_v3v3(vec1, pt1->p, pt0->p); length = normalize_v3(vec1); @@ -489,8 +489,8 @@ static void sk_drawNormal(SK_Point *pt, float size, float height) float angle; float color[3] = { 0.0f, 1.0f, 1.0f }; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); gpuPushMatrix(); diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index e9d214157c0..6d29d2def97 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -471,9 +471,9 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS float color[3]; UI_GetThemeColor3fv(TH_WIRE, color); - Batch *sphere = Batch_get_sphere(0); + Gwn_Batch *sphere = Batch_get_sphere(0); Batch_set_builtin_program(sphere, GPU_SHADER_3D_UNIFORM_COLOR); - Batch_Uniform3fv(sphere, "color", color); + GWN_batch_uniform_3fv(sphere, "color", color); /* scale to edit-mode space */ gpuPushMatrix(); @@ -491,7 +491,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS gpuPushMatrix(); gpuScaleUniform(radius); - Batch_draw(sphere); + GWN_batch_draw(sphere); gpuPopMatrix(); location_prev = selem->location_local; @@ -514,15 +514,15 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS } { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); imm_cpack(0x0); - immBegin(PRIM_LINE_STRIP, stroke_len); + immBegin(GWN_PRIM_LINE_STRIP, stroke_len); glLineWidth(3.0f); if (v3d->zbuf) { @@ -536,7 +536,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS immEnd(); imm_cpack(0xffffffff); - immBegin(PRIM_LINE_STRIP, stroke_len); + immBegin(GWN_PRIM_LINE_STRIP, stroke_len); glLineWidth(1.0f); for (int i = 0; i < stroke_len; i++) { diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index a868b47053c..96f9959af02 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -149,14 +149,14 @@ static void gp_draw_stroke_buffer_fill(const tGPspoint *points, int totpoints, f /* draw triangulation data */ if (tot_triangles > 0) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); /* Draw all triangles for filling the polygon */ - immBegin(PRIM_TRIANGLES, tot_triangles * 3); + immBegin(GWN_PRIM_TRIS, tot_triangles * 3); /* TODO: use batch instead of immediate mode, to share vertices */ const tGPspoint *pt; @@ -207,9 +207,9 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short return; } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); const tGPspoint *pt = points; @@ -217,7 +217,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short /* if drawing a single point, draw it larger */ glPointSize((float)(thickness + 2) * points->pressure); immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); gp_set_tpoint_varying_color(pt, ink, color); immVertex2iv(pos, &pt->x); } @@ -227,7 +227,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short /* draw stroke curve */ glLineWidth(max_ff(oldpressure * thickness, 1.0)); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBeginAtMost(PRIM_LINE_STRIP, totpoints); + immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints); /* TODO: implement this with a geometry shader to draw one continuous tapered stroke */ @@ -246,7 +246,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short draw_points = 0; glLineWidth(max_ff(pt->pressure * thickness, 1.0f)); - immBeginAtMost(PRIM_LINE_STRIP, totpoints - i + 1); + immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - i + 1); /* need to roll-back one point to ensure that there are no gaps in the stroke */ if (i != 0) { @@ -318,14 +318,14 @@ static void gp_draw_stroke_volumetric_buffer(const tGPspoint *points, int totpoi if (dflag & (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_ONLYV2D)) return; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(PRIM_POINTS, totpoints); + immBegin(GWN_PRIM_POINTS, totpoints); const tGPspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { @@ -345,14 +345,14 @@ static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, int totpoints int offsx, int offsy, int winx, int winy, const float diff_mat[4][4], const float ink[4]) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(PRIM_POINTS, totpoints); + immBegin(GWN_PRIM_POINTS, totpoints); const bGPDspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { @@ -378,14 +378,14 @@ static void gp_draw_stroke_volumetric_3d( const bGPDspoint *points, int totpoints, short thickness, const float ink[4]) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(PRIM_POINTS, totpoints); + immBegin(GWN_PRIM_POINTS, totpoints); const bGPDspoint *pt = points; for (int i = 0; i < totpoints && pt; i++, pt++) { @@ -521,18 +521,18 @@ static void gp_draw_stroke_fill( unsigned int pos; if (gps->flag & GP_STROKE_3DSPACE) { - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); } else { - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); } immUniformColor4fv(color); /* Draw all triangles for filling the polygon (cache must be calculated before) */ - immBegin(PRIM_TRIANGLES, gps->tot_triangles * 3); + immBegin(GWN_PRIM_TRIS, gps->tot_triangles * 3); /* TODO: use batch instead of immediate mode, to share vertices */ bGPDtriangle *stroke_triangle = gps->triangles; @@ -591,8 +591,8 @@ static void gp_draw_stroke_point( float fpt[3]; mul_v3_m4v3(fpt, diff_mat, &pt->x); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (sflag & GP_STROKE_3DSPACE) { immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); @@ -610,7 +610,7 @@ static void gp_draw_stroke_point( /* set point thickness (since there's only one of these) */ immUniform1f("size", (float)(thickness + 2) * pt->pressure); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, fpt); immEnd(); @@ -633,9 +633,9 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); @@ -643,7 +643,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi /* draw stroke curve */ glLineWidth(max_ff(curpressure * thickness, 1.0f)); - immBeginAtMost(PRIM_LINE_STRIP, totpoints + cyclic_add); + immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints + cyclic_add); const bGPDspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { gp_set_point_varying_color(pt, ink, color); @@ -664,7 +664,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi curpressure = pt->pressure; glLineWidth(max_ff(curpressure * thickness, 1.0f)); - immBeginAtMost(PRIM_LINE_STRIP, totpoints - i + 1 + cyclic_add); + immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - i + 1 + cyclic_add); /* need to roll-back one point to ensure that there are no gaps in the stroke */ if (i != 0) { @@ -732,12 +732,12 @@ static void gp_draw_stroke_2d(const bGPDspoint *points, int totpoints, short thi int i; float fpt[3]; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(PRIM_TRIANGLE_STRIP, totpoints * 2 + 4); + immBegin(GWN_PRIM_TRI_STRIP, totpoints * 2 + 4); /* get x and y coordinates from first point */ mul_v3_m4v3(fpt, diff_mat, &points->x); @@ -1166,21 +1166,21 @@ static void gp_draw_strokes_edit( UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, selectColor); selectColor[3] = alpha; - VertexFormat *format = immVertexFormat(); + Gwn_VertFormat *format = immVertexFormat(); unsigned int pos; /* specified later */ - unsigned int size = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); + unsigned int size = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (gps->flag & GP_STROKE_3DSPACE) { - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); } else { - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR); } - immBegin(PRIM_POINTS, gps->totpoints); + immBegin(GWN_PRIM_POINTS, gps->totpoints); /* Draw start and end point differently if enabled stroke direction hint */ bool show_direction_hint = (gpd->flag & GP_DATA_SHOW_DIRECTION) && (gps->totpoints > 1); diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 1577cb76f99..f478596deec 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -981,8 +981,8 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customda GP_EditBrush_Data *brush = gpsculpt_get_brush(CTX_data_scene(C)); if (brush) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); glEnable(GL_LINE_SMOOTH); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index eb37c3fe629..1b2f35b3fb1 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1849,8 +1849,8 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr) tGPsdata *p = (tGPsdata *)p_ptr; if (p->paintmode == GP_PAINTMODE_ERASER) { - VertexFormat *format = immVertexFormat(); - const uint shdr_pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + const uint shdr_pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); glEnable(GL_LINE_SMOOTH); diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index 8eef016a846..62f1a617fcb 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -109,7 +109,7 @@ typedef enum eKeyframeShapeDrawOpts { } eKeyframeShapeDrawOpts; /* draw simple diamond-shape keyframe */ -/* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND, immBegin(PRIM_POINTS, n), then call this n times */ +/* caller should set up vertex format, bind GPU_SHADER_KEYFRAME_DIAMOND, immBegin(GWN_PRIM_POINTS, n), then call this n times */ void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type, short mode, float alpha, unsigned int pos_id, unsigned int size_id, unsigned int color_id, unsigned int outline_color_id); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 3553b5f4d4b..1baf01b583f 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -107,8 +107,8 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; int a; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); /* mult */ for (a = 0; a < 7; a++) { @@ -124,7 +124,7 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(col); - immBegin(filled ? PRIM_TRIANGLE_FAN : PRIM_LINE_LOOP, vert_ct); + immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_ct); /* start with corner right-bottom */ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) { immVertex2f(pos, maxx - rad, miny); @@ -202,9 +202,9 @@ void UI_draw_roundbox_shade_x( int vert_count = 0; int a; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -226,7 +226,7 @@ void UI_draw_roundbox_shade_x( vert_count += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1; vert_count += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1; - immBegin(filled ? PRIM_TRIANGLE_FAN : PRIM_LINE_LOOP, vert_count); + immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_count); /* start with corner right-bottom */ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) { @@ -327,9 +327,9 @@ void UI_draw_roundbox_shade_y( mul_v2_fl(vec[a], rad); } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -347,7 +347,7 @@ void UI_draw_roundbox_shade_y( vert_count += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1; vert_count += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1; - immBegin(filled ? PRIM_TRIANGLE_FAN : PRIM_LINE_LOOP, vert_count); + immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_count); /* start with corner right-bottom */ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) { @@ -430,8 +430,8 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo { int ofs_y = 4 * U.pixelsize; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color); @@ -445,9 +445,9 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo /* based on UI_draw_roundbox_gl_mode, check on making a version which allows us to skip some sides */ void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highlight[3], unsigned char highlight_fade[3]) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); /* add a 1px offset, looks nicer */ const int minx = rect->xmin + U.pixelsize, maxx = rect->xmax - U.pixelsize; const int miny = rect->ymin + U.pixelsize, maxy = rect->ymax - U.pixelsize; @@ -466,7 +466,7 @@ void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highligh } immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBeginAtMost(PRIM_LINE_STRIP, 25); + immBeginAtMost(GWN_PRIM_LINE_STRIP, 25); immAttrib3ubv(col, highlight); @@ -579,8 +579,8 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w * * \Note This functionn is to be used with the 2D dashed shader enabled. * - * \param pos is a PRIM_FLOAT, 2, KEEP_FLOAT vertex attrib - * \param line_origin is a PRIM_FLOAT, 2, KEEP_FLOAT vertex attrib + * \param pos is a PRIM_FLOAT, 2, GWN_FETCH_FLOAT vertex attrib + * \param line_origin is a PRIM_FLOAT, 2, GWN_FETCH_FLOAT vertex attrib * * The next 4 parameters are the offsets for the view, not the zones. */ @@ -643,7 +643,7 @@ static void histogram_draw_one( /* curve outline */ glLineWidth(1.5); - immBegin(PRIM_LINE_STRIP, res); + immBegin(GWN_PRIM_LINE_STRIP, res); for (int i = 0; i < res; i++) { float x2 = x + i * (w / (float)res); immVertex2f(pos_attrib, x2, y + (data[i] * h)); @@ -652,7 +652,7 @@ static void histogram_draw_one( } else { /* under the curve */ - immBegin(PRIM_TRIANGLE_STRIP, res * 2); + immBegin(GWN_PRIM_TRI_STRIP, res * 2); immVertex2f(pos_attrib, x, y); immVertex2f(pos_attrib, x, y + (data[0] * h)); for (int i = 1; i < res; i++) { @@ -666,7 +666,7 @@ static void histogram_draw_one( immUniformColor4f(0.0f, 0.0f, 0.0f, 0.25f); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - immBegin(PRIM_LINE_STRIP, res); + immBegin(GWN_PRIM_LINE_STRIP, res); for (int i = 0; i < res; i++) { float x2 = x + i * (w / (float)res); immVertex2f(pos_attrib, x2, y + (data[i] * h)); @@ -711,8 +711,8 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -726,7 +726,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); } - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, rect.xmin, rect.ymin + fac * h); immVertex2f(pos, rect.xmax, rect.ymin + fac * h); @@ -762,21 +762,21 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) static void waveform_draw_one(float *waveform, int nbr, const float col[3]) { - VertexFormat format = {0}; - unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat format = {0}; + unsigned int pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - VertexBuffer *vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, nbr); + Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, nbr); - VertexBuffer_fill_attrib(vbo, pos_id, waveform); + GWN_vertbuf_attr_fill(vbo, pos_id, waveform); - /* TODO store the Batch inside the scope */ - Batch *batch = Batch_create(PRIM_POINTS, vbo, NULL); + /* TODO store the Gwn_Batch inside the scope */ + Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_2D_UNIFORM_COLOR); - Batch_Uniform4f(batch, "color", col[0], col[1], col[2], 1.0f); - Batch_draw(batch); + GWN_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f); + GWN_batch_draw(batch); - Batch_discard_all(batch); + GWN_batch_discard_all(batch); } void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) @@ -843,15 +843,15 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f); /* draw grid lines here */ - immBegin(PRIM_LINES, 12); + immBegin(GWN_PRIM_LINES, 12); for (int i = 0; i < 6; i++) { immVertex2f(pos, rect.xmin + 22, yofs + (i * 0.2f) * h); @@ -862,7 +862,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), /* 3 vertical separation */ if (scopes->wavefrm_mode != SCOPES_WAVEFRM_LUMA) { - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); for (int i = 1; i < 3; i++) { immVertex2f(pos, rect.xmin + i * w3, rect.ymin); @@ -873,7 +873,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), } /* separate min max zone on the right */ - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, rect.xmin + w, rect.ymin); immVertex2f(pos, rect.xmin + w, rect.ymax); immEnd(); @@ -881,7 +881,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), /* 16-235-240 level in case of ITU-R BT601/709 */ immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f); if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)) { - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); immVertex2f(pos, rect.xmin + 22, yofs + h * 16.0f / 255.0f); immVertex2f(pos, rect.xmax + 1, yofs + h * 16.0f / 255.0f); @@ -899,7 +899,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), } /* 7.5 IRE black point level for NTSC */ if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) { - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, rect.xmin, yofs + h * 0.075f); immVertex2f(pos, rect.xmax + 1, yofs + h * 0.075f); immEnd(); @@ -928,7 +928,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), CLAMP(min, rect.ymin, rect.ymax); CLAMP(max, rect.ymin, rect.ymax); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, rect.xmax - 3, min); immVertex2f(pos, rect.xmax - 3, max); immEnd(); @@ -982,7 +982,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), CLAMP(min, rect.ymin, rect.ymax); CLAMP(max, rect.ymin, rect.ymax); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, rect.xmin + w + 2 + c * 2, min); immVertex2f(pos, rect.xmin + w + 2 + c * 2, max); immEnd(); @@ -1026,7 +1026,7 @@ static void vectorscope_draw_target(unsigned int pos, float centerx, float cente immUniformColor4f(1.0f, 1.0f, 1.0f, 0.12f); dangle = DEG2RADF(2.5f); dampli = 2.5f / 200.0f; - immBegin(PRIM_LINE_LOOP, 4); + immBegin(GWN_PRIM_LINE_LOOP, 4); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle), polar_to_y(centery, diam, tampli + dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle), polar_to_y(centery, diam, tampli - dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle), polar_to_y(centery, diam, tampli - dampli, tangle - dangle)); @@ -1038,22 +1038,22 @@ static void vectorscope_draw_target(unsigned int pos, float centerx, float cente dampli = 0.2f * tampli; dangle2 = DEG2RADF(5.0f); dampli2 = 0.5f * dampli; - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle + dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle), polar_to_y(centery, diam, tampli + dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle - dangle2), polar_to_y(centery, diam, tampli + dampli, tangle + dangle - dangle2)); immEnd(); - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle + dangle), polar_to_y(centery, diam, tampli - dampli + dampli2, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle), polar_to_y(centery, diam, tampli - dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle - dangle2), polar_to_y(centery, diam, tampli - dampli, tangle + dangle - dangle2)); immEnd(); - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle - dangle), polar_to_y(centery, diam, tampli - dampli + dampli2, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle), polar_to_y(centery, diam, tampli - dampli, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli - dampli, tangle - dangle + dangle2)); immEnd(); - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle - dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle), polar_to_y(centery, diam, tampli + dampli, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli + dampli, tangle - dangle + dangle2)); @@ -1100,15 +1100,15 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f); /* draw grid elements */ /* cross */ - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, centerx - (diam * 0.5f) - 5, centery); immVertex2f(pos, centerx + (diam * 0.5f) + 5, centery); @@ -1121,7 +1121,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco /* circles */ for (int j = 0; j < 5; j++) { const int increment = 15; - immBegin(PRIM_LINE_LOOP, (int)(360 / increment)); + immBegin(GWN_PRIM_LINE_LOOP, (int)(360 / increment)); for (int i = 0; i <= 360 - increment; i += increment) { const float a = DEG2RADF((float)i); const float r = (j + 1) * 0.1f; @@ -1132,7 +1132,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco /* skin tone line */ immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery, diam, 0.5f, skin_rad)); immVertex2f(pos, polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery, diam, 0.1f, skin_rad)); immEnd(); @@ -1169,7 +1169,7 @@ static void ui_draw_colorband_handle_tri_hlight(unsigned int pos, float x1, floa { glEnable(GL_LINE_SMOOTH); - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2f(pos, x1 + halfwidth, y1); immVertex2f(pos, x1, y1 + height); immVertex2f(pos, x1 - halfwidth, y1); @@ -1182,7 +1182,7 @@ static void ui_draw_colorband_handle_tri(unsigned int pos, float x1, float y1, f { glEnable(fill ? GL_POLYGON_SMOOTH : GL_LINE_SMOOTH); - immBegin(fill ? PRIM_TRIANGLES : PRIM_LINE_LOOP, 3); + immBegin(fill ? GWN_PRIM_TRIS : GWN_PRIM_LINE_LOOP, 3); immVertex2f(pos, x1 + halfwidth, y1); immVertex2f(pos, x1, y1 + height); immVertex2f(pos, x1 - halfwidth, y1); @@ -1193,7 +1193,7 @@ static void ui_draw_colorband_handle_tri(unsigned int pos, float x1, float y1, f static void ui_draw_colorband_handle_box(unsigned int pos, float x1, float y1, float x2, float y2, bool fill) { - immBegin(fill ? PRIM_TRIANGLE_FAN : PRIM_LINE_LOOP, 4); + immBegin(fill ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x1, y2); immVertex2f(pos, x2, y2); @@ -1233,7 +1233,7 @@ static void ui_draw_colorband_handle( immUniformArray4fv("colors", (float *)(float[][4]){{0.8f, 0.8f, 0.8f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2); immUniform1f("dash_width", active ? 4.0f : 2.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(shdr_pos, x, y1); immVertex2f(shdr_pos, x, y2); immEnd(); @@ -1304,8 +1304,8 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti float sizey_solid = sizey * 0.25f; float y1 = rect->ymin; - VertexFormat *format = immVertexFormat(); - position = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + position = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_CHECKER); /* Drawing the checkerboard. */ @@ -1317,8 +1317,8 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti /* New format */ format = immVertexFormat(); - position = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - color = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); + position = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); /* layer: color ramp */ @@ -1332,7 +1332,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti v1[1] = y1 + sizey_solid; v2[1] = rect->ymax; - immBegin(PRIM_TRIANGLE_STRIP, (sizex + 1) * 2); + immBegin(GWN_PRIM_TRI_STRIP, (sizex + 1) * 2); for (int a = 0; a <= sizex; a++) { float pos = ((float)a) / sizex; do_colorband(coba, pos, colf); @@ -1351,7 +1351,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti v1[1] = y1; v2[1] = y1 + sizey_solid; - immBegin(PRIM_TRIANGLE_STRIP, (sizex + 1) * 2); + immBegin(GWN_PRIM_TRI_STRIP, (sizex + 1) * 2); for (int a = 0; a <= sizex; a++) { float pos = ((float)a) / sizex; do_colorband(coba, pos, colf); @@ -1372,7 +1372,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti /* New format */ format = immVertexFormat(); - position = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + position = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* layer: box outline */ @@ -1383,14 +1383,14 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti glEnable(GL_BLEND); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(position, x1, y1); immVertex2f(position, x1 + sizex, y1); immEnd(); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.25f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(position, x1, y1 - 1); immVertex2f(position, x1 + sizex, y1 - 1); immEnd(); @@ -1443,18 +1443,18 @@ 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); - Batch *sphere = Batch_get_sphere(2); + Gwn_Batch *sphere = Batch_get_sphere(2); Batch_set_builtin_program(sphere, GPU_SHADER_SIMPLE_LIGHTING); - Batch_Uniform4f(sphere, "color", diffuse[0], diffuse[1], diffuse[2], 1.0f); - Batch_Uniform3fv(sphere, "light", light); - Batch_draw(sphere); + 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); /* restore */ glDisable(GL_CULL_FACE); /* AA circle */ - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv((unsigned char *)wcol->inner); @@ -1483,7 +1483,7 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo float line_count = floorf((rect->xmax - fx) / dx) + 1.0f + floorf((rect->ymax - fy) / dy) + 1.0f; - immBegin(PRIM_LINES, (int)line_count * 2); + immBegin(GWN_PRIM_LINES, (int)line_count * 2); while (fx < rect->xmax) { immVertex2f(pos, fx, rect->ymin); immVertex2f(pos, fx, rect->ymax); @@ -1556,8 +1556,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti glLineWidth(1.0f); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* backdrop */ @@ -1592,7 +1592,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 1.0f); /* axes */ gl_shaded_color((unsigned char *)wcol->inner, -50); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, rect->xmin, rect->ymin + zoomy * (-offsy)); immVertex2f(pos, rect->xmax, rect->ymin + zoomy * (-offsy)); immVertex2f(pos, rect->xmin + zoomx * (-offsx), rect->ymin); @@ -1605,7 +1605,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti #if 0 if (cumap->flag & CUMA_DRAW_CFRA) { immUniformColor3ub(0x60, 0xc0, 0x40); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymin); immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymax); immEnd(); @@ -1614,7 +1614,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti /* sample option */ if (cumap->flag & CUMA_DRAW_SAMPLE) { - immBegin(PRIM_LINES, 2); /* will draw one of the following 3 lines */ + immBegin(GWN_PRIM_LINES, 2); /* will draw one of the following 3 lines */ if (but->a1 == UI_GRAD_H) { float tsample[3]; float hsv[3]; @@ -1650,7 +1650,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti immUniformColor3ubv((unsigned char *)wcol->item); glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - immBegin(PRIM_LINE_STRIP, (CM_TABLE+1) + 2); + immBegin(GWN_PRIM_LINE_STRIP, (CM_TABLE+1) + 2); if (cuma->table == NULL) curvemapping_changed(cumap, false); @@ -1687,13 +1687,13 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti /* the points, use aspect to make them visible on edges */ format = immVertexFormat(); - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int col = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); cmp = cuma->curve; glPointSize(3.0f); - immBegin(PRIM_POINTS, cuma->totpoint); + immBegin(GWN_PRIM_POINTS, cuma->totpoint); for (int a = 0; a < cuma->totpoint; a++) { float color[4]; if (cmp[a].flag & CUMA_SELECT) @@ -1713,7 +1713,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti /* outline */ format = immVertexFormat(); - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv((unsigned char *)wcol->outline); @@ -1803,16 +1803,16 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc BLI_rctf_size_x(&rect), BLI_rctf_size_y(&rect)); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int col = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); UI_GetThemeColor4fv(TH_SEL_MARKER, col_sel); UI_GetThemeColor4fv(TH_MARKER_OUTLINE, col_outline); /* Do stipple cross with geometry */ - immBegin(PRIM_LINES, 7*2*2); + immBegin(GWN_PRIM_LINES, 7*2*2); float pos_sel[8] = {-10.0f, -7.0f, -4.0f, -1.0f, 2.0f, 5.0f, 8.0f, 11.0f}; for (int axe = 0; axe < 2; ++axe) { for (int i = 0; i < 7; ++i) { @@ -1892,13 +1892,13 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol float x = 0.5f * (recti->xmin + recti->xmax); float y = 0.5f * (recti->ymin + recti->ymax); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(but->col); glEnable(GL_BLEND); - immBegin(PRIM_TRIANGLE_FAN, 16); + immBegin(GWN_PRIM_TRI_FAN, 16); for (int a = 0; a < 16; a++) immVertex2f(pos, x + size * si[a], y + size * co[a]); immEnd(); @@ -1906,7 +1906,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol immUniformColor4ub(0, 0, 0, 150); glLineWidth(1); glEnable(GL_LINE_SMOOTH); - immBegin(PRIM_LINE_LOOP, 16); + immBegin(GWN_PRIM_LINE_LOOP, 16); for (int a = 0; a < 16; a++) immVertex2f(pos, x + size * si[a], y + size * co[a]); immEnd(); @@ -1989,13 +1989,13 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, { glEnable(GL_BLEND); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(PRIM_TRIANGLES, 54); + immBegin(GWN_PRIM_TRIS, 54); /* accumulated outline boxes to make shade not linear, is more pleasant */ ui_shadowbox(pos, color, minx, miny, maxx, maxy, 11.0, (20 * alpha) >> 8); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 2548951cb88..ac07756b372 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -223,11 +223,11 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float viconutil_set_point(pts[1], cx - d2, cy - d); viconutil_set_point(pts[2], cx + d2, cy); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.2f, 0.2f, 0.2f, alpha); - immBegin(PRIM_TRIANGLES, 3); + immBegin(GWN_PRIM_TRIS, 3); immVertex2iv(pos, pts[0]); immVertex2iv(pos, pts[1]); immVertex2iv(pos, pts[2]); @@ -253,15 +253,15 @@ static void vicon_keytype_draw_wrapper(int x, int y, int w, int h, float alpha, int xco = x + w / 2; int yco = y + h / 2; - VertexFormat *format = immVertexFormat(); - unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size_id = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color_id = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); - unsigned int outline_color_id = VertexFormat_add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); /* draw keyframe * - size: 0.6 * h (found out experimentally... dunno why!) @@ -316,7 +316,7 @@ static void vicon_colorset_draw(int index, int x, int y, int w, int h, float UNU const int b = x + w / 3 * 2; const int c = x + w; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* XXX: Include alpha into this... */ @@ -1025,9 +1025,9 @@ static void icon_draw_texture( y2 = (iy + ih) * icongltex.invh; glBindTexture(GL_TEXTURE_2D, icongltex.id); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); if (rgb) immUniformColor3fvAlpha(rgb, alpha); @@ -1035,7 +1035,7 @@ static void icon_draw_texture( immUniform1i("image", 0); - immBegin(PRIM_TRIANGLE_STRIP, 4); + immBegin(GWN_PRIM_TRI_STRIP, 4); immAttrib2f(texCoord, x1, y2); immVertex2f(pos, x, y + h); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index d1b4c2cd8fb..cc49eeb5b59 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -436,7 +436,7 @@ static void ui_draw_anti_x(unsigned int pos, float x1, float y1, float x2, float glLineWidth(2.0); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x2, y2); @@ -477,7 +477,7 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect) glEnable(GL_BLEND); immUniformColor4ub(255, 255, 255, 50); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, xmin, ymin); immVertex2f(pos, xmax, ymax); @@ -489,7 +489,7 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect) immUniformColor4ub(0, 0, 0, 50); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, xmin, ymin + 1); immVertex2f(pos, xmax, ymax + 1); @@ -591,7 +591,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con headrect.ymin = headrect.ymax; headrect.ymax = headrect.ymin + floor(PNL_HEADER / block->aspect + 0.001f); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); { @@ -606,7 +606,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con immUniformThemeColor(TH_PANEL_HEADER); immRectf(pos, minx, headrect.ymin + 1, maxx, y); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, minx, y); immVertex2f(pos, maxx, y); @@ -626,14 +626,14 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, minx, y); immVertex2f(pos, maxx, y); immEnd(); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.25f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, minx, y - 1); immVertex2f(pos, maxx, y - 1); immEnd(); @@ -663,7 +663,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con /* horizontal title */ if (is_closed_x == false) { ui_draw_aligned_panel_header(style, block, &headrect, 'h'); - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); /* itemrect smaller */ itemrect.xmax = headrect.xmax - 5.0f / block->aspect; @@ -686,7 +686,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con else if (is_closed_x) { /* draw vertical title */ ui_draw_aligned_panel_header(style, block, &headrect, 'v'); - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } /* an open panel */ else { @@ -1568,9 +1568,9 @@ static void ui_panel_category_draw_tab( {0.98, 0.805}}; int a; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); /* mult */ for (a = 0; a < 4; a++) { @@ -1592,7 +1592,7 @@ static void ui_panel_category_draw_tab( immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(filled ? PRIM_TRIANGLE_FAN : PRIM_LINE_STRIP, vert_ct); + immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_STRIP, vert_ct); immAttrib3ubv(color, col); @@ -1780,7 +1780,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) /* begin drawing */ glEnable(GL_LINE_SMOOTH); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw the background */ @@ -1839,7 +1839,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) /* tab blackline */ if (!is_active) { - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(theme_col_tab_divider); @@ -1869,7 +1869,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) glDisable(GL_BLEND); /* tab blackline remaining (last tab) */ - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); if (pc_dyn->prev == NULL) { immUniformColor3ubv(theme_col_tab_divider); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d0ec40bbb70..8adcca8c7cd 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -197,11 +197,11 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y glEnable(GL_BLEND); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(draw_color); - immBegin(PRIM_TRIANGLES, 3 * WIDGET_AA_JITTER); + immBegin(GWN_PRIM_TRIS, 3 * WIDGET_AA_JITTER); /* for each AA step */ for (int j = 0; j < WIDGET_AA_JITTER; j++) { @@ -549,7 +549,7 @@ static void widget_scroll_circle(uiWidgetTrias *tria, const rcti *rect, float tr static void widget_trias_draw(uiWidgetTrias *tria, unsigned int pos) { - immBegin(PRIM_TRIANGLES, tria->tot * 3); + immBegin(GWN_PRIM_TRIS, tria->tot * 3); for (int i = 0; i < tria->tot; ++i) for (int j = 0; j < 3; ++j) immVertex2fv(pos, tria->vec[tria->index[i][j]]); @@ -677,7 +677,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) float inner_v_half[WIDGET_SIZE_MAX][2]; float x_mid = 0.0f; /* used for dumb clamping of values */ - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_CHECKER); /* checkers */ @@ -716,7 +716,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) } else { /* simple fill */ - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv((unsigned char *)wcol->inner); @@ -730,9 +730,9 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) unsigned char col_array[WIDGET_SIZE_MAX][4]; unsigned char *col_pt = &col_array[0][0]; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -765,7 +765,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) UI_GetThemeColor4ubv(TH_WIDGET_EMBOSS, emboss); } - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); for (j = 0; j < WIDGET_AA_JITTER; j++) { @@ -796,7 +796,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) wcol->item[2], (unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER)}; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(tcol); @@ -1384,7 +1384,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b selwidth_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->selend - but->ofs); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv((unsigned char *)wcol->item); @@ -1416,7 +1416,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b t = 0; } - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(0.2f, 0.6f, 0.9f); @@ -2214,7 +2214,7 @@ static void widget_softshadow(const rcti *rect, int roundboxalign, const float r /* we draw a number of increasing size alpha quad strips */ alphastep = 3.0f * btheme->tui.menu_shadow_fac / radout; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2267,7 +2267,7 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir static void ui_hsv_cursor(float x, float y) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2362,13 +2362,13 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * ui_color_picker_to_rgb(0.0f, 0.0f, hsv[2], colcent, colcent + 1, colcent + 2); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(PRIM_TRIANGLE_FAN, tot + 2); + immBegin(GWN_PRIM_TRI_FAN, tot + 2); immAttrib3fv(color, colcent); immVertex2f(pos, centx, centy); @@ -2389,7 +2389,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * /* fully rounded outline */ format = immVertexFormat(); - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2473,12 +2473,12 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons } /* old below */ - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int col = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(PRIM_TRIANGLES, steps * 3 * 6); + immBegin(GWN_PRIM_TRIS, steps * 3 * 6); for (dx = 0.0f; dx < 0.999f; dx += color_step) { /* 0.999 = prevent float inaccuracy for steps */ const float dx_next = dx + color_step; @@ -2634,7 +2634,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect) ui_hsv_cursor(x, y); /* outline */ - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ub(0, 0, 0); imm_draw_line_box(pos, (rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax)); @@ -2707,14 +2707,14 @@ static void ui_draw_separator(const rcti *rect, uiWidgetColors *wcol) 30 }; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); glEnable(GL_BLEND); immUniformColor4ubv(col); glLineWidth(1.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, rect->xmin, y); immVertex2f(pos, rect->xmax, y); immEnd(); @@ -2798,7 +2798,7 @@ void ui_draw_link_bezier(const rcti *rect, const float color[4]) float coord_array[LINK_RESOL + 1][2]; if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); #if 0 /* unused */ @@ -2810,7 +2810,7 @@ void ui_draw_link_bezier(const rcti *rect, const float color[4]) immUniformColor4fv(color); - immBegin(PRIM_LINE_STRIP, LINK_RESOL + 1); + immBegin(GWN_PRIM_LINE_STRIP, LINK_RESOL + 1); for (int i = 0; i <= LINK_RESOL; ++i) immVertex2fv(pos, coord_array[i]); immEnd(); @@ -3162,11 +3162,11 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat bw += (bw < 0.5f) ? 0.5f : -0.5f; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(bw, bw, bw); - immBegin(PRIM_TRIANGLES, 3); + immBegin(GWN_PRIM_TRIS, 3); immVertex2f(pos, rect->xmin + 0.1f * width, rect->ymin + 0.9f * height); immVertex2f(pos, rect->xmin + 0.1f * width, rect->ymin + 0.5f * height); immVertex2f(pos, rect->xmin + 0.5f * width, rect->ymin + 0.9f * height); @@ -3521,7 +3521,7 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType * /* note: drawextra can change rect +1 or -1, to match round errors of existing previews */ but->block->drawextra(C, but->poin, but->block->drawextra_arg1, but->block->drawextra_arg2, rect); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* make mask to draw over image */ @@ -4083,10 +4083,10 @@ static void draw_disk_shaded( unsigned char r_col[4]; unsigned int pos, col; - VertexFormat *format = immVertexFormat(); - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); if (shaded) { - col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); } else { @@ -4094,7 +4094,7 @@ static void draw_disk_shaded( immUniformColor4ubv((unsigned char *)col1); } - immBegin(PRIM_TRIANGLE_STRIP, subd * 2); + immBegin(GWN_PRIM_TRI_STRIP, subd * 2); for (i = 0; i < subd; i++) { float a; @@ -4163,8 +4163,8 @@ void ui_draw_pie_center(uiBlock *block) } } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv((unsigned char *)btheme->tui.wcol_pie_menu.outline); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index a12b033c936..fb57902d258 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1325,12 +1325,12 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) if (vertex_count == 0) return; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(PRIM_LINES, vertex_count); + immBegin(GWN_PRIM_LINES, vertex_count); /* vertical lines */ if (flag & V2D_VERTICAL_LINES) { @@ -1467,15 +1467,15 @@ void UI_view2d_constant_grid_draw(View2D *v2d) count_y = (v2d->cur.ymax - start_y) / step + 1; if (count_x > 0 || count_y > 0) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); float theme_color[3]; UI_GetThemeColorShade3fv(TH_BACK, -10, theme_color); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(PRIM_LINES, count_x * 2 + count_y * 2 + 4); + immBegin(GWN_PRIM_LINES, count_x * 2 + count_y * 2 + 4); immAttrib3fv(color, theme_color); for (int i = 0; i < count_x ; start_x += step, i++) { @@ -1518,14 +1518,14 @@ void UI_view2d_multi_grid_draw(View2D *v2d, int colorid, float step, int level_s vertex_count += 2 * ((int)((v2d->cur.xmax - v2d->cur.xmin) / lstep) + 1); vertex_count += 2 * ((int)((v2d->cur.ymax - v2d->cur.ymin) / lstep) + 1); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); glLineWidth(1.0f); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBeginAtMost(PRIM_LINES, vertex_count); + immBeginAtMost(GWN_PRIM_LINES, vertex_count); for (int level = 0; level < totlevels; ++level) { UI_GetThemeColorShade3ubv(colorid, offset, grid_line_color); @@ -1839,8 +1839,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v /* clean rect behind slider, but not with transparent background */ if (scrollers_back_color[3] == 255) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1946,8 +1946,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v /* clean rect behind slider, but not with transparent background */ if (scrollers_back_color[3] == 255) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/manipulator_library/arrow2d_manipulator.c b/source/blender/editors/manipulator_library/arrow2d_manipulator.c index 5e7975d05e3..6e263b86bfa 100644 --- a/source/blender/editors/manipulator_library/arrow2d_manipulator.c +++ b/source/blender/editors/manipulator_library/arrow2d_manipulator.c @@ -75,7 +75,7 @@ static void arrow2d_draw_geom(ArrowManipulator2D *arrow, const float matrix[4][4 const float len = arrow->line_len; const float draw_line_ofs = (arrow->manipulator.line_width * 0.5f) / arrow->manipulator.scale; - uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); gpuPushMatrix(); gpuMultMatrix(matrix); @@ -90,12 +90,12 @@ static void arrow2d_draw_geom(ArrowManipulator2D *arrow, const float matrix[4][4 immUniformColor4fv(color); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, 0.0f, 0.0f); immVertex2f(pos, 0.0f, len); immEnd(); - immBegin(PRIM_TRIANGLES, 3); + immBegin(GWN_PRIM_TRIS, 3); immVertex2f(pos, size_h, len); immVertex2f(pos, -size_h, len); immVertex2f(pos, 0.0f, len + size * 1.7f); diff --git a/source/blender/editors/manipulator_library/arrow3d_manipulator.c b/source/blender/editors/manipulator_library/arrow3d_manipulator.c index 41368240f46..6e7fa3a7269 100644 --- a/source/blender/editors/manipulator_library/arrow3d_manipulator.c +++ b/source/blender/editors/manipulator_library/arrow3d_manipulator.c @@ -101,7 +101,7 @@ static void manipulator_arrow_matrix_world_get(wmManipulator *mpr, float r_matri static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, const float color[4]) { - uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); bool unbind_shader = true; immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -109,7 +109,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, if (arrow->style & ED_MANIPULATOR_ARROW_STYLE_CROSS) { immUniformColor4fv(color); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex3f(pos, -1.0f, 0.0f, 0.0f); immVertex3f(pos, 1.0f, 0.0f, 0.0f); immVertex3f(pos, 0.0f, -1.0f, 0.0f); @@ -127,7 +127,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, }; glLineWidth(arrow->manipulator.line_width); - wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, PRIM_LINE_LOOP); + wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_LOOP); } else { #ifdef USE_MANIPULATOR_CUSTOM_ARROWS @@ -140,7 +140,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select, }; glLineWidth(arrow->manipulator.line_width); - wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, PRIM_LINE_STRIP); + wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_STRIP); /* *** draw arrow head *** */ diff --git a/source/blender/editors/manipulator_library/cage2d_manipulator.c b/source/blender/editors/manipulator_library/cage2d_manipulator.c index bf6c23f98e7..07667c70bd4 100644 --- a/source/blender/editors/manipulator_library/cage2d_manipulator.c +++ b/source/blender/editors/manipulator_library/cage2d_manipulator.c @@ -86,12 +86,12 @@ typedef struct Cage2D { static void rect_transform_draw_corners( const rctf *r, const float offsetx, const float offsety, const float color[3]) { - uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3fv(color); - immBegin(PRIM_LINES, 16); + immBegin(GWN_PRIM_LINES, 16); immVertex2f(pos, r->xmin, r->ymin + offsety); immVertex2f(pos, r->xmin, r->ymin); @@ -175,14 +175,14 @@ static void rect_transform_draw_interaction( return; } - VertexFormat *format = immVertexFormat(); - uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - uint color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); glLineWidth(line_width + 3.0); - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immAttrib3f(color, 0.0f, 0.0f, 0.0f); immVertex2fv(pos, verts[0]); immVertex2fv(pos, verts[1]); @@ -191,7 +191,7 @@ static void rect_transform_draw_interaction( glLineWidth(line_width); - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immAttrib3fv(color, col); immVertex2fv(pos, verts[0]); immVertex2fv(pos, verts[1]); diff --git a/source/blender/editors/manipulator_library/dial3d_manipulator.c b/source/blender/editors/manipulator_library/dial3d_manipulator.c index 111ea04cd3b..753cd794fe1 100644 --- a/source/blender/editors/manipulator_library/dial3d_manipulator.c +++ b/source/blender/editors/manipulator_library/dial3d_manipulator.c @@ -130,8 +130,8 @@ static void dial_geom_draw( glLineWidth(dial->manipulator.line_width); - VertexFormat *format = immVertexFormat(); - uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); if (clip_plane) { immBindBuiltinProgram(GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR); @@ -168,13 +168,13 @@ static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[ gpuPushMatrix(); gpuRotate3f(RAD2DEGF(angle), 0.0f, 0.0f, -1.0f); - uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(col); - immBegin(PRIM_LINE_STRIP, 2); + immBegin(GWN_PRIM_LINE_STRIP, 2); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immVertex3fv(pos, co_outer); immEnd(); @@ -189,8 +189,8 @@ static void dial_ghostarc_draw( { const float width_inner = DIAL_WIDTH - dial->manipulator.line_width * 0.5f / U.manipulator_size; - VertexFormat *format = immVertexFormat(); - uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(color); imm_draw_disk_partial_fill( diff --git a/source/blender/editors/manipulator_library/grab3d_manipulator.c b/source/blender/editors/manipulator_library/grab3d_manipulator.c index c794c99160c..995ee4e97c4 100644 --- a/source/blender/editors/manipulator_library/grab3d_manipulator.c +++ b/source/blender/editors/manipulator_library/grab3d_manipulator.c @@ -96,8 +96,8 @@ static void grab_geom_draw( glLineWidth(grab3d->manipulator.line_width); - VertexFormat *format = immVertexFormat(); - uint pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); diff --git a/source/blender/editors/manipulator_library/manipulator_draw_utils.c b/source/blender/editors/manipulator_library/manipulator_draw_utils.c index cfa1bc38ed5..4bd7f74e6e5 100644 --- a/source/blender/editors/manipulator_library/manipulator_draw_utils.c +++ b/source/blender/editors/manipulator_library/manipulator_draw_utils.c @@ -64,52 +64,52 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo * So we don't need to re-created and discard it every time */ const bool use_lighting = true || (!select && ((U.manipulator_flag & USER_MANIPULATOR_SHADED) != 0)); - VertexBuffer *vbo; - ElementList *el; - Batch *batch; - ElementListBuilder elb = {0}; + Gwn_VertBuf *vbo; + Gwn_IndexBuf *el; + Gwn_Batch *batch; + Gwn_IndexBufBuilder elb = {0}; - VertexFormat format = {0}; - uint pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat format = {0}; + uint pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); uint nor_id; if (use_lighting) { - nor_id = VertexFormat_add_attrib(&format, "nor", COMP_I16, 3, NORMALIZE_INT_TO_FLOAT); + nor_id = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I16, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); } /* Elements */ - ElementListBuilder_init(&elb, PRIM_TRIANGLES, info->ntris, info->nverts); + GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, info->ntris, info->nverts); for (int i = 0; i < info->ntris; ++i) { const unsigned short *idx = &info->indices[i * 3]; - add_triangle_vertices(&elb, idx[0], idx[1], idx[2]); + GWN_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]); } - el = ElementList_build(&elb); + el = GWN_indexbuf_build(&elb); - vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, info->nverts); + vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, info->nverts); - VertexBuffer_fill_attrib(vbo, pos_id, info->verts); + GWN_vertbuf_attr_fill(vbo, pos_id, info->verts); if (use_lighting) { /* Normals are expected to be smooth. */ - VertexBuffer_fill_attrib(vbo, nor_id, info->normals); + GWN_vertbuf_attr_fill(vbo, nor_id, info->normals); } - batch = Batch_create(PRIM_TRIANGLES, vbo, el); + batch = GWN_batch_create(GWN_PRIM_TRIS, vbo, el); Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); - Batch_Uniform4fv(batch, "color", color); + GWN_batch_uniform_4fv(batch, "color", color); glEnable(GL_CULL_FACE); // glEnable(GL_DEPTH_TEST); - Batch_draw(batch); + GWN_batch_draw(batch); glDisable(GL_DEPTH_TEST); // glDisable(GL_CULL_FACE); - Batch_discard_all(batch); + GWN_batch_discard_all(batch); } void wm_manipulator_vec_draw( diff --git a/source/blender/editors/manipulator_library/primitive3d_manipulator.c b/source/blender/editors/manipulator_library/primitive3d_manipulator.c index ba728145163..75151830109 100644 --- a/source/blender/editors/manipulator_library/primitive3d_manipulator.c +++ b/source/blender/editors/manipulator_library/primitive3d_manipulator.c @@ -79,10 +79,10 @@ static void manipulator_primitive_draw_geom( } if (vert_count > 0) { - uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - wm_manipulator_vec_draw(col_inner, verts, vert_count, pos, PRIM_TRIANGLE_FAN); - wm_manipulator_vec_draw(col_outer, verts, vert_count, pos, PRIM_LINE_LOOP); + wm_manipulator_vec_draw(col_inner, verts, vert_count, pos, GWN_PRIM_TRI_FAN); + wm_manipulator_vec_draw(col_outer, verts, vert_count, pos, GWN_PRIM_LINE_LOOP); immUnbindProgram(); } } diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index b3e6a369d90..72bc61139c6 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -123,8 +123,8 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin return; } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); const unsigned char rgb_gray[4] = {0x60, 0x60, 0x60, 0xff}; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -133,7 +133,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin /* this could be split into its own loop */ if (draw_type == MASK_DT_OUTLINE) { glLineWidth(3.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(pos, point_pos); immVertex2fv(pos, handle_pos); immEnd(); @@ -153,7 +153,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin } glLineWidth(1.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(pos, point_pos); immVertex2fv(pos, handle_pos); immEnd(); @@ -177,7 +177,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin immUniform4fv("outlineColor", point_color); immUniformColor3fvAlpha(point_color, 0.25f); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex2fv(pos, handle_pos); immEnd(); @@ -211,8 +211,8 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline mask_spline_color_get(masklay, spline, is_spline_sel, rgb_spline); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); immUniform1f("size", 0.7f * handle_size); @@ -250,7 +250,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline immUniformThemeColor(TH_HANDLE_VERTEX); } - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex2fv(pos, feather_point); immEnd(); @@ -319,7 +319,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline else immUniformThemeColor(TH_HANDLE_VERTEX); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex2fv(pos, vert); immEnd(); @@ -349,7 +349,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline immUniform4f("outlineColor", 0.0f, 0.0f, 0.0f, 1.0f); immUniform1f("size", 12.0f); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex2f(pos, x, y); immEnd(); @@ -370,7 +370,7 @@ static void mask_color_active_tint(unsigned char r_rgb[4], const unsigned char r } } -static void mask_draw_array(unsigned int pos, PrimitiveType prim_type, const float (*points)[2], unsigned int vertex_ct) +static void mask_draw_array(unsigned int pos, Gwn_PrimType prim_type, const float (*points)[2], unsigned int vertex_ct) { immBegin(prim_type, vertex_ct); for (unsigned int i = 0; i < vertex_ct; ++i) { @@ -383,7 +383,7 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* const bool is_feather, const bool is_active, const unsigned char rgb_spline[4], const char draw_type) { - const PrimitiveType draw_method = (spline->flag & MASK_SPLINE_CYCLIC) ? PRIM_LINE_LOOP : PRIM_LINE_STRIP; + const Gwn_PrimType draw_method = (spline->flag & MASK_SPLINE_CYCLIC) ? GWN_PRIM_LINE_LOOP : GWN_PRIM_LINE_STRIP; const unsigned char rgb_black[4] = {0x00, 0x00, 0x00, 0xff}; unsigned char rgb_tmp[4]; SpaceClip *sc = CTX_wm_space_clip(C); @@ -401,8 +401,8 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* } } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); switch (draw_type) { @@ -815,12 +815,12 @@ void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra unsigned int num_lines = BLI_listbase_count(&masklay->splines_shapes); if (num_lines > 0) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(255, 175, 0, 255); - immBegin(PRIM_LINES, 2 * num_lines); + immBegin(GWN_PRIM_LINES, 2 * num_lines); for (MaskLayerShape *masklay_shape = masklay->splines_shapes.first; masklay_shape; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 530faffdac1..3c974e4b3b9 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1002,13 +1002,13 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd) copy_v3_v3(v2, ray_hit_best[1]); } - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_TRANSFORM); glLineWidth(2.0); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(pos, v1); immVertex3fv(pos, v2); immEnd(); @@ -1044,7 +1044,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) gpuPushMatrix(); gpuMultMatrix(kcd->ob->obmat); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -1055,7 +1055,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.line); glLineWidth(2.0); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(pos, kcd->prev.cage); immVertex3fv(pos, kcd->curr.cage); immEnd(); @@ -1065,7 +1065,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.point); glPointSize(11); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, kcd->prev.cage); immEnd(); } @@ -1074,7 +1074,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.curpoint); glPointSize(9); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, kcd->prev.cage); immEnd(); } @@ -1083,7 +1083,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.edge); glLineWidth(2.0); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(pos, kcd->curr.edge->v1->cageco); immVertex3fv(pos, kcd->curr.edge->v2->cageco); immEnd(); @@ -1092,7 +1092,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.point); glPointSize(11); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, kcd->curr.cage); immEnd(); } @@ -1101,7 +1101,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.curpoint); glPointSize(9); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, kcd->curr.cage); immEnd(); } @@ -1117,7 +1117,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor4ubv(kcd->colors.point_a); glPointSize(11); - immBeginAtMost(PRIM_POINTS, kcd->totlinehit); + immBeginAtMost(GWN_PRIM_POINTS, kcd->totlinehit); lh = kcd->linehits; for (i = 0; i < kcd->totlinehit; i++, lh++) { @@ -1132,7 +1132,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor4ubv(kcd->colors.curpoint_a); glPointSize(7); - immBeginAtMost(PRIM_POINTS, kcd->totlinehit); + immBeginAtMost(GWN_PRIM_POINTS, kcd->totlinehit); lh = kcd->linehits; for (i = 0; i < kcd->totlinehit; i++, lh++) { @@ -1153,7 +1153,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.line); glLineWidth(1.0); - immBeginAtMost(PRIM_LINES, BLI_mempool_count(kcd->kedges) * 2); + immBeginAtMost(GWN_PRIM_LINES, BLI_mempool_count(kcd->kedges) * 2); BLI_mempool_iternew(kcd->kedges, &iter); for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) { @@ -1174,7 +1174,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.point); glPointSize(5.0); - immBeginAtMost(PRIM_POINTS, BLI_mempool_count(kcd->kverts)); + immBeginAtMost(GWN_PRIM_POINTS, BLI_mempool_count(kcd->kverts)); BLI_mempool_iternew(kcd->kverts, &iter); for (kfv = BLI_mempool_iterstep(&iter); kfv; kfv = BLI_mempool_iterstep(&iter)) { diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index e7a6689b57c..6a656ace09c 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -108,13 +108,13 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) gpuPushMatrix(); gpuMultMatrix(lcd->ob->obmat); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ub(255, 0, 255); if (lcd->totedge > 0) { - immBegin(PRIM_LINES, lcd->totedge * 2); + immBegin(GWN_PRIM_LINES, lcd->totedge * 2); for (int i = 0; i < lcd->totedge; i++) { immVertex3fv(pos, lcd->edges[i][0]); @@ -127,7 +127,7 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) if (lcd->totpoint > 0) { glPointSize(3.0f); - immBegin(PRIM_POINTS, lcd->totpoint); + immBegin(GWN_PRIM_POINTS, lcd->totpoint); for (int i = 0; i < lcd->totpoint; i++) { immVertex3fv(pos, lcd->points[i]); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 27ea7e09fd6..fb3cfdc86b2 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -2712,7 +2712,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) brush = &pset->brush[pset->brushtype]; if (brush) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(255, 255, 255, 128); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 9d3dde06925..c882b1b093e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -92,12 +92,12 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct) glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(PRIM_LINE_STRIP, 5); + immBegin(GWN_PRIM_LINE_STRIP, 5); /* right */ immAttrib4ub(color, 0, 0, 0, 30); @@ -222,16 +222,16 @@ static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, f BLI_rcti_init(&click_rect, x, x + icon_size, y, y + icon_size); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immAttrib4ub(color, 255, 0, 0, alpha_debug); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); imm_draw_line_box(pos, click_rect.xmin, click_rect.ymin, click_rect.xmax, click_rect.ymax); immAttrib4ub(color, 0, 255, 255, alpha_debug); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, click_rect.xmin, click_rect.ymin); immVertex2f(pos, click_rect.xmax, click_rect.ymax); immVertex2f(pos, click_rect.xmin, click_rect.ymax); @@ -255,12 +255,12 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) glEnable(GL_LINE_SMOOTH); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(PRIM_LINES, 12); + immBegin(GWN_PRIM_LINES, 12); immAttrib4ub(col, 255, 255, 255, 180); immVertex2f(pos, x1, y2); @@ -297,8 +297,8 @@ static void region_draw_azone_icon(AZone *az) float midx = az->x1 + (az->x2 - az->x1) * 0.5f; float midy = az->y1 + (az->y2 - az->y1) * 0.5f; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); /* outlined circle */ GPU_enable_program_point_size(); /* TODO: make a fixed-size shader to avoid this */ @@ -307,7 +307,7 @@ static void region_draw_azone_icon(AZone *az) immUniform4f("outlineColor", 0.2f, 0.2f, 0.2f, 0.9f); immUniform1f("outlineWidth", 1.0f); immUniform1f("size", 9.5f); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex2f(pos, midx, midy); immEnd(); immUnbindProgram(); @@ -316,7 +316,7 @@ static void region_draw_azone_icon(AZone *az) /* + */ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.2f, 0.2f, 0.2f, 0.9f); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, midx, midy - 2); immVertex2f(pos, midx, midy + 3); immVertex2f(pos, midx - 2, midy); @@ -330,8 +330,8 @@ static void draw_azone_plus(float x1, float y1, float x2, float y2) float width = 0.1f * U.widget_unit; float pad = 0.2f * U.widget_unit; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); glEnable(GL_BLEND); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -566,8 +566,8 @@ void ED_region_do_draw(bContext *C, ARegion *ar) /* for debugging unneeded area redraws and partial redraw */ #if 0 glEnable(GL_BLEND); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(drand48(), drand48(), drand48(), 0.1f); immRectf(pos, ar->drawrct.xmin - ar->winrct.xmin, ar->drawrct.ymin - ar->winrct.ymin, @@ -2015,8 +2015,8 @@ void ED_region_panels(const bContext *C, ARegion *ar, const char *context, int c /* view should be in pixelspace */ UI_view2d_view_restore(C); glEnable(GL_BLEND); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor((ar->type->regionid == RGN_TYPE_PREVIEW) ? TH_PREVIEW_BACK : TH_BACK); immRecti(pos, 0, 0, BLI_rcti_size_x(&ar->winrct), BLI_rcti_size_y(&ar->winrct) + 1); @@ -2164,8 +2164,8 @@ void ED_region_info_draw_multiline(ARegion *ar, const char *text_array[], float glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(fill_color); immRecti(pos, rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1); @@ -2383,8 +2383,8 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame, /* set up rect */ BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymax, frame->ymax + box_y); /* draw top box */ - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_METADATA_BG); immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); @@ -2408,8 +2408,8 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame, /* set up box rect */ BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymin - box_y, frame->ymin); /* draw top box */ - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_METADATA_BG); immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); @@ -2437,8 +2437,8 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x1, &y1); UI_view2d_view_to_region(&ar->v2d, 1.0f, 1.0f, &x2, &y2); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, 20); @@ -2470,12 +2470,12 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) int count_large = 1.0f / (4.0f * gridstep); if (count_fine > 0) { - VertexFormat_clear(format); - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); + GWN_vertformat_clear(format); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(PRIM_LINES, 4 * count_fine + 4 * count_large); + immBegin(GWN_PRIM_LINES, 4 * count_fine + 4 * count_large); float theme_color[3]; UI_GetThemeColorShade3fv(TH_BACK, (int)(20.0f * (1.0f - blendfac)), theme_color); @@ -2545,7 +2545,7 @@ void ED_region_visible_rect(ARegion *ar, rcti *rect) void ED_region_cache_draw_background(const ARegion *ar) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(128, 128, 255, 64); immRecti(pos, 0, 0, ar->winx, 8 * UI_DPI_FAC); @@ -2565,7 +2565,7 @@ void ED_region_cache_draw_curfra_label(const int framenr, const float x, const f BLF_width_and_height(fontid, numstr, sizeof(numstr), &font_dims[0], &font_dims[1]); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_CFRAME); immRecti(pos, x, y, x + font_dims[0] + 6.0f, y + font_dims[1] + 4.0f); @@ -2579,7 +2579,7 @@ void ED_region_cache_draw_curfra_label(const int framenr, const float x, const f void ED_region_cache_draw_cached_segments(const ARegion *ar, const int num_segments, const int *points, const int sfra, const int efra) { if (num_segments) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(128, 128, 255, 128); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 2eb981467f2..7ce16efdb97 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -139,9 +139,9 @@ static int get_cached_work_texture(int *r_w, int *r_h) static void immDrawPixelsTexSetupAttributes(IMMDrawPixelsTexState *state) { - VertexFormat *vert_format = immVertexFormat(); - state->pos = VertexFormat_add_attrib(vert_format, "pos", COMP_F32, 2, KEEP_FLOAT); - state->texco = VertexFormat_add_attrib(vert_format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *vert_format = immVertexFormat(); + state->pos = GWN_vertformat_attr_add(vert_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + state->texco = GWN_vertformat_attr_add(vert_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } /* To be used before calling immDrawPixelsTex @@ -303,7 +303,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state, glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, format, GL_UNSIGNED_BYTE, &uc_rect[(((size_t)subpart_y) * offset_y + subpart_h - 1) * img_w * components + (subpart_x * offset_x + subpart_w - 1) * components]); } - immBegin(PRIM_TRIANGLE_FAN, 4); + immBegin(GWN_PRIM_TRI_FAN, 4); immAttrib2f(texco, (float)(0 + offset_left) / tex_w, (float)(0 + offset_bot) / tex_h); immVertex2f(pos, rast_x + (float)offset_left * xzoom, rast_y + (float)offset_bot * yzoom); @@ -693,28 +693,28 @@ void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, flo delta_y = min_ff(delta_y, border->ymax - border->ymin); /* left bottom corner */ - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmin, border->ymin + delta_y); immVertex2f(pos, border->xmin, border->ymin); immVertex2f(pos, border->xmin + delta_x, border->ymin); immEnd(); /* left top corner */ - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmin, border->ymax - delta_y); immVertex2f(pos, border->xmin, border->ymax); immVertex2f(pos, border->xmin + delta_x, border->ymax); immEnd(); /* right bottom corner */ - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmax - delta_x, border->ymin); immVertex2f(pos, border->xmax, border->ymin); immVertex2f(pos, border->xmax, border->ymin + delta_y); immEnd(); /* right top corner */ - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmax - delta_x, border->ymax); immVertex2f(pos, border->xmax, border->ymax); immVertex2f(pos, border->xmax, border->ymax - delta_y); diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 52c13871925..5690076fedb 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -94,7 +94,7 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos) } } - immBegin(PRIM_TRIANGLE_FAN, 5); + immBegin(GWN_PRIM_TRI_FAN, 5); for (i = 0; i < 5; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -102,7 +102,7 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos) immEnd(); - immBegin(PRIM_TRIANGLE_FAN, 5); + immBegin(GWN_PRIM_TRI_FAN, 5); for (i = 4; i < 8; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -175,7 +175,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir, unsigned int pos) } } - immBegin(PRIM_TRIANGLE_FAN, 5); + immBegin(GWN_PRIM_TRI_FAN, 5); for (i = 0; i < 5; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -183,7 +183,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir, unsigned int pos) immEnd(); - immBegin(PRIM_TRIANGLE_FAN, 5); + immBegin(GWN_PRIM_TRI_FAN, 5); for (i = 4; i < 8; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -246,7 +246,7 @@ static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, shor return; } - immBegin(PRIM_LINES, count); + immBegin(GWN_PRIM_LINES, count); /* right border area */ if (x2 < sizex - 1) { @@ -304,7 +304,7 @@ void ED_screen_draw(wmWindow *win) wmSubWindowSet(win, screen->mainwin); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* Note: first loop only draws if U.pixelsize > 1, skip otherwise */ @@ -368,7 +368,7 @@ void ED_screen_draw(wmWindow *win) glEnable(GL_BLEND); immUniformColor4ub(255, 255, 255, 100); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); if (sa3->flag & AREA_FLAG_DRAWSPLIT_H) { immVertex2f(pos, sa3->totrct.xmin, win->eventstate->y); @@ -378,7 +378,7 @@ void ED_screen_draw(wmWindow *win) immUniformColor4ub(0, 0, 0, 100); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, sa3->totrct.xmin, win->eventstate->y + 1); immVertex2f(pos, sa3->totrct.xmax, win->eventstate->y + 1); @@ -391,7 +391,7 @@ void ED_screen_draw(wmWindow *win) immUniformColor4ub(0, 0, 0, 100); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, win->eventstate->x + 1, sa3->totrct.ymin); immVertex2f(pos, win->eventstate->x + 1, sa3->totrct.ymax); @@ -433,7 +433,7 @@ static void screen_preview_draw_areas(const bScreen *screen, const float scale[2 const float ofs_between_areas) { const float ofs_h = ofs_between_areas * 0.5f; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(col); @@ -446,7 +446,7 @@ static void screen_preview_draw_areas(const bScreen *screen, const float scale[2 .ymax = sa->totrct.ymax * scale[1] - ofs_h }; - immBegin(PRIM_TRIANGLE_FAN, 4); + immBegin(GWN_PRIM_TRI_FAN, 4); immVertex2f(pos, rect.xmin, rect.ymin); immVertex2f(pos, rect.xmax, rect.ymin); immVertex2f(pos, rect.xmax, rect.ymax); diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index a0b077a6b29..6fa8905293c 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -456,8 +456,8 @@ static void screencast_draw_cursor(bContext *UNUSED(C), int x, int y, void *UNUS glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index d48b6f86831..a9b4df81277 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -660,9 +660,9 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush, } /* set quad color. Colored overlay does not get blending */ - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); if (col) { immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); @@ -676,7 +676,7 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush, /* draw textured quad */ immUniform1i("image", GL_TEXTURE0); - immBegin(PRIM_TRIANGLE_FAN, 4); + immBegin(GWN_PRIM_TRI_FAN, 4); immAttrib2f(texCoord, 0.0f, 0.0f); immVertex2f(pos, quad.xmin, quad.ymin); immAttrib2f(texCoord, 1.0f, 0.0f); @@ -745,9 +745,9 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush, gpuTranslate2f(-center[0], -center[1]); } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); @@ -758,7 +758,7 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush, /* draw textured quad */ immUniform1i("image", GL_TEXTURE0); - immBegin(PRIM_TRIANGLE_FAN, 4); + immBegin(GWN_PRIM_TRI_FAN, 4); immAttrib2f(texCoord, 0.0f, 0.0f); immVertex2f(pos, quad.xmin, quad.ymin); immAttrib2f(texCoord, 1.0f, 0.0f); @@ -819,7 +819,7 @@ BLI_INLINE void draw_tri_point( {co[0] + w, co[1] - w}, }; - immBegin(PRIM_LINE_LOOP, 3); + immBegin(GWN_PRIM_LINE_LOOP, 3); immVertex2fv(pos, tri[0]); immVertex2fv(pos, tri[1]); immVertex2fv(pos, tri[2]); @@ -828,7 +828,7 @@ BLI_INLINE void draw_tri_point( immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); glLineWidth(1.0f); - immBegin(PRIM_LINE_LOOP, 3); + immBegin(GWN_PRIM_LINE_LOOP, 3); immVertex2fv(pos, tri[0]); immVertex2fv(pos, tri[1]); immVertex2fv(pos, tri[2]); @@ -863,7 +863,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); glLineWidth(3.0f); - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2fv(pos, bez->vec[0]); immVertex2fv(pos, bez->vec[1]); immVertex2fv(pos, bez->vec[2]); @@ -877,7 +877,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez else { immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); } - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(pos, bez->vec[0]); immVertex2fv(pos, bez->vec[1]); immEnd(); @@ -888,7 +888,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez else { immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); } - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(pos, bez->vec[1]); immVertex2fv(pos, bez->vec[2]); immEnd(); @@ -905,7 +905,7 @@ static void paint_draw_curve_cursor(Brush *brush) glEnable(GL_BLEND); /* draw the bezier handles and the curve segment between the current and next point */ - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -936,7 +936,7 @@ static void paint_draw_curve_cursor(Brush *brush) immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); glLineWidth(3.0f); - immBegin(PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); + immBegin(GWN_PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); for (j = 0; j <= PAINT_CURVE_NUM_SEGMENTS; j++) { immVertex2fv(pos, v[j]); } @@ -944,7 +944,7 @@ static void paint_draw_curve_cursor(Brush *brush) immUniformColor4f(0.9f, 0.9f, 1.0f, 0.5f); glLineWidth(1.0f); - immBegin(PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); + immBegin(GWN_PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); for (j = 0; j <= PAINT_CURVE_NUM_SEGMENTS; j++) { immVertex2fv(pos, v[j]); } @@ -1089,7 +1089,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) glEnable(GL_BLEND); /* TODO: also set blend mode? */ glEnable(GL_LINE_SMOOTH); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* set brush color */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index f31b5984c61..8c6b3b0106c 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -722,15 +722,15 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); glLineWidth(4.0); immUniformColor4ub(0, 0, 0, 255); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2i(pos, x, y); immVertex2i(pos, pop->startmouse[0], pop->startmouse[1]); immEnd(); @@ -738,7 +738,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda glLineWidth(2.0); immUniformColor4ub(255, 255, 255, 255); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2i(pos, x, y); immVertex2i(pos, pop->startmouse[0], pop->startmouse[1]); immEnd(); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index bc561c345b4..86008ec0308 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -147,11 +147,11 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(paint->paint_cursor_col); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, x, y); immVertex2f(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]); immEnd(); @@ -170,7 +170,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) glEnable(GL_LINE_SMOOTH); - uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -183,7 +183,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) immUniformArray4fv("colors", (float *)(float[][4]){{0.0f, 0.0f, 0.0f, alpha}, {1.0f, 1.0f, 1.0f, alpha}}, 2); immUniform1f("dash_width", 6.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); if (stroke->constrain_line) { immVertex2f(shdr_pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 28beb2c3f8d..ee6f25ee44e 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -213,7 +213,7 @@ static void brush_drawcursor_uvsculpt(bContext *C, int x, int y, void *UNUSED(cu alpha *= (size - PX_SIZE_FADE_MIN) / (PX_SIZE_FADE_MAX - PX_SIZE_FADE_MIN); } - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3fvAlpha(brush->add_col, alpha); diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 1cf97af7a35..11ac1d60f39 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -204,8 +204,8 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) /* first backdrop strips */ y = (float)(-ACHANNEL_HEIGHT(ac)); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -319,7 +319,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) if (saction->flag & SACTION_MOVING) { immUniformColor3f(0.0f, 0.0f, 0.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, saction->timeslide, v2d->cur.ymin - EXTRA_SCROLL_PAD); immVertex2f(pos, saction->timeslide, v2d->cur.ymax); immEnd(); diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index 954b3f2bd1a..0f06d66d033 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -129,8 +129,8 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) unsigned int keyframe_ct = 0; - VertexFormat *format = immVertexFormat(); - unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* don't use totrect set, as the width stays the same @@ -214,14 +214,14 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) if (keyframe_ct > 0) { /* draw keyframe markers */ format = immVertexFormat(); - pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size_id = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color_id = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); - unsigned int outline_color_id = VertexFormat_add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); + unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); - immBegin(PRIM_POINTS, keyframe_ct); + immBegin(GWN_PRIM_POINTS, keyframe_ct); /* all same size with black outline */ immAttrib1f(size_id, 2.0f * STRIP_HEIGHT_HALF); @@ -317,8 +317,8 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar) */ float y = (float) CHANNEL_FIRST; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 0108e23af02..15ec385fd09 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -79,7 +79,7 @@ static void draw_keyframe(int frame, int cfra, int sfra, float framelen, int wid int x = (frame - sfra) * framelen; if (width == 1) { - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2i(pos, x, 0); immVertex2i(pos, x, height * UI_DPI_FAC); immEnd(); @@ -166,7 +166,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc BKE_movieclip_get_cache_segments(clip, &sc->user, &totseg, &points); ED_region_cache_draw_cached_segments(ar, totseg, points, sfra, efra); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* track */ @@ -247,7 +247,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc ED_region_cache_draw_curfra_label(sc->user.framenr, x, 8.0f * UI_DPI_FAC); - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* solver keyframes */ @@ -289,7 +289,7 @@ static void draw_movieclip_muted(ARegion *ar, int width, int height, float zoomx { int x, y; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* find window pixel coordinates of origin */ @@ -348,7 +348,7 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int /* draw boundary border for frame if stabilization is enabled */ if (sc->flag & SC_SHOW_STABLE && clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) { - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); /* Exclusive OR allows to get orig value when second operand is 0, * and negative of orig value when second operand is 1. */ @@ -442,7 +442,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin i++; } - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -453,7 +453,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - a - 1) >= 1) { glPointSize(5.0f); - immBegin(PRIM_POINTS, b - a - 1); + immBegin(GWN_PRIM_POINTS, b - a - 1); for (i = a; i < b; i++) { if (i != curindex) { @@ -468,7 +468,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - a) >= 2) { glLineWidth(3.0f); - immBegin(PRIM_LINE_STRIP, b - a); + immBegin(GWN_PRIM_LINE_STRIP, b - a); for (i = a; i < b; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -484,7 +484,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((curindex - a) >= 1) { immUniformThemeColor(TH_PATH_BEFORE); - immBegin(PRIM_POINTS, curindex - a); + immBegin(GWN_PRIM_POINTS, curindex - a); for (i = a; i < curindex; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -496,7 +496,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - curindex - 1) >= 1) { immUniformThemeColor(TH_PATH_AFTER); - immBegin(PRIM_POINTS, b - curindex - 1); + immBegin(GWN_PRIM_POINTS, b - curindex - 1); for (i = curindex + 1; i < b; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -511,7 +511,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((curindex - a + 1) >= 2) { immUniformThemeColor(TH_PATH_BEFORE); - immBegin(PRIM_LINE_STRIP, curindex - a + 1); + immBegin(GWN_PRIM_LINE_STRIP, curindex - a + 1); for (i = a; i <= curindex; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -523,7 +523,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - curindex) >= 2) { immUniformThemeColor(TH_PATH_AFTER); - immBegin(PRIM_LINE_STRIP, b - curindex); + immBegin(GWN_PRIM_LINE_STRIP, b - curindex); for (i = curindex; i < b; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -564,12 +564,12 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT { glPointSize(tiny ? 3.0f : 4.0f); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex2f(position, pos[0], pos[1]); immEnd(); } else { - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); immVertex2f(position, pos[0] + px[0] * 2, pos[1]); immVertex2f(position, pos[0] + px[0] * 8, pos[1]); @@ -592,7 +592,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT gpuTranslate2fv(marker_pos); if (sc->flag & SC_SHOW_MARKER_PATTERN) { - immBegin(PRIM_LINE_LOOP, 4); + immBegin(GWN_PRIM_LINE_LOOP, 4); immVertex2fv(position, marker->pattern_corners[0]); immVertex2fv(position, marker->pattern_corners[1]); immVertex2fv(position, marker->pattern_corners[2]); @@ -690,14 +690,14 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra immUniform1f("dash_factor", 2.0f); /* Solid "line" */ - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex2f(shdr_pos, pos[0], pos[1]); immEnd(); } else { immUniform1f("dash_factor", 2.0f); /* Solid line */ - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); immVertex2f(shdr_pos, pos[0] + px[0] * 3, pos[1]); immVertex2f(shdr_pos, pos[0] + px[0] * 7, pos[1]); @@ -720,7 +720,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra glEnable(GL_COLOR_LOGIC_OP); glLogicOp(GL_XOR); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(shdr_pos, pos); immVertex2fv(shdr_pos, marker_pos); immEnd(); @@ -768,7 +768,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } if ((track->pat_flag & SELECT) == sel && (sc->flag & SC_SHOW_MARKER_PATTERN)) { - immBegin(PRIM_LINE_LOOP, 4); + immBegin(GWN_PRIM_LINE_LOOP, 4); immVertex2fv(shdr_pos, marker->pattern_corners[0]); immVertex2fv(shdr_pos, marker->pattern_corners[1]); immVertex2fv(shdr_pos, marker->pattern_corners[2]); @@ -790,7 +790,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra /* Restore default shader */ immUnbindProgram(); - const uint pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); BLI_assert(pos == shdr_pos); UNUSED_VARS_NDEBUG(pos); @@ -842,7 +842,7 @@ static void draw_marker_slide_triangle(float x, float y, float dx, float dy, int tdy += px[1]; } - immBegin(PRIM_TRIANGLES, 3); + immBegin(GWN_PRIM_TRIS, 3); immVertex2f(pos, x, y); immVertex2f(pos, x - tdx, y); immVertex2f(pos, x, y + tdy); @@ -920,7 +920,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo glLineWidth(outline ? 3.0f : 1.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, 0.0f, 0.0f); immVertex2fv(pos, tilt_ctrl); immEnd(); @@ -1128,15 +1128,15 @@ static void draw_plane_marker_image(Scene *scene, gpuPushMatrix(); gpuMultMatrix(gl_matrix); - VertexFormat *imm_format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(imm_format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int texCoord = VertexFormat_add_attrib(imm_format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *imm_format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(imm_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int texCoord = GWN_vertformat_attr_add(imm_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); immUniformColor4f(1.0f, 1.0f, 1.0f, plane_track->image_opacity); immUniform1i("image", GL_TEXTURE0); - immBegin(PRIM_TRIANGLE_FAN, 4); + immBegin(GWN_PRIM_TRI_FAN, 4); immAttrib2f(texCoord, 0.0f, 0.0f); immVertex2f(pos, 0.0f, 0.0f); @@ -1190,7 +1190,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane } if (draw_plane_quad || is_selected_track) { - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -1223,7 +1223,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane } /* Draw rectangle itself. */ - immBegin(PRIM_LINE_LOOP, 4); + immBegin(GWN_PRIM_LINE_LOOP, 4); immVertex2fv(shdr_pos, plane_marker->corners[0]); immVertex2fv(shdr_pos, plane_marker->corners[1]); immVertex2fv(shdr_pos, plane_marker->corners[2]); @@ -1236,7 +1236,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane immUniformColor3f(1.0f, 0.0f, 0.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); getArrowEndPoint(width, height, sc->zoom, plane_marker->corners[0], plane_marker->corners[1], end_point); immVertex2fv(shdr_pos, plane_marker->corners[0]); @@ -1246,7 +1246,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane immUniformColor3f(0.0f, 1.0f, 0.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); getArrowEndPoint(width, height, sc->zoom, plane_marker->corners[0], plane_marker->corners[3], end_point); immVertex2fv(shdr_pos, plane_marker->corners[0]); @@ -1398,7 +1398,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie } } - unsigned int position = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int position = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1503,7 +1503,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie immUniformColor3f(1.0f, 0.0f, 0.0f); } - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); if (undistort) { immVertex2f(position, pos[0] / width, pos[1] / (height * aspy)); @@ -1582,7 +1582,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, gpuMultMatrix(sc->stabmat); gpuScale2f(width, height); - unsigned int position = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int position = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1659,7 +1659,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, immUniformColor3f(1.0f, 0.0f, 0.0f); for (i = 0; i <= n; i++) { - immBegin(PRIM_LINE_STRIP, n + 1); + immBegin(GWN_PRIM_LINE_STRIP, n + 1); for (j = 0; j <= n; j++) { immVertex2fv(position, grid[i][j]); @@ -1669,7 +1669,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, } for (j = 0; j <= n; j++) { - immBegin(PRIM_LINE_STRIP, n + 1); + immBegin(GWN_PRIM_LINE_STRIP, n + 1); for (i = 0; i <= n; i++) { immVertex2fv(position, grid[i][j]); @@ -1727,7 +1727,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, sub_v2_v2v2(dpos, npos, pos); mul_v2_fl(dpos, 1.0f / steps); - immBegin(PRIM_LINE_STRIP, steps + 1); + immBegin(GWN_PRIM_LINE_STRIP, steps + 1); for (j = 0; j <= steps; j++) { BKE_tracking_distort_v2(tracking, pos, tpos); @@ -1740,7 +1740,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, } } else if (stroke->totpoints == 1) { - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex2f(position, stroke->points[0].x + offsx, stroke->points[0].y + offsy); immEnd(); } diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index c9db5d4a328..5c2782dc26d 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -90,11 +90,11 @@ static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, immUniformColor4fv(col); if (is_point) { - immBeginAtMost(PRIM_POINTS, 1); + immBeginAtMost(GWN_PRIM_POINTS, 1); } else { /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(PRIM_LINE_STRIP, track->markersnr); + immBeginAtMost(GWN_PRIM_LINE_STRIP, track->markersnr); } } @@ -236,11 +236,11 @@ static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack * immUniformColor4fv(col); if (is_point) { /* This probably never happens here, but just in case... */ - immBeginAtMost(PRIM_POINTS, 1); + immBeginAtMost(GWN_PRIM_POINTS, 1); } else { /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(PRIM_LINE_STRIP, track->markersnr); + immBeginAtMost(GWN_PRIM_LINE_STRIP, track->markersnr); } } } @@ -299,7 +299,7 @@ static void draw_frame_curves(SpaceClip *sc, unsigned int pos) } if (!lines) { - immBeginAtMost(PRIM_LINE_STRIP, reconstruction->camnr); + immBeginAtMost(GWN_PRIM_LINE_STRIP, reconstruction->camnr); lines = 1; } @@ -327,7 +327,7 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene) UI_view2d_grid_free(grid); if (clip) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); glPointSize(3.0f); diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index 5d02f02167b..40661937bae 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -248,13 +248,13 @@ void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene) View2D *v2d = &ar->v2d; float x = (float)(sc->user.framenr * scene->r.framelen); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_CFRAME); glLineWidth(2.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, x, v2d->cur.ymin); immVertex2f(pos, x, v2d->cur.ymax); immEnd(); @@ -283,7 +283,7 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); @@ -297,7 +297,7 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) /* thin lines where the actual frames are */ glLineWidth(1.0f); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, (float)SFRA, v2d->cur.ymin); immVertex2f(pos, (float)SFRA, v2d->cur.ymax); immVertex2f(pos, (float)EFRA, v2d->cur.ymin); diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index e813557f9e8..c8a06545e0f 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -158,8 +158,8 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha int offl = 0, offc = 0; int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN}; int pen[2]; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); xy[1] += tvc->lheight / 6; console_cursor_wrap_offset(sc->prompt, tvc->console_width, &offl, &offc, NULL); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 61f33d72b71..be873358931 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -399,8 +399,8 @@ static void file_draw_preview( /* border */ if (use_dropshadow) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2,KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2,GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); @@ -461,7 +461,7 @@ static void draw_background(FileLayout *layout, View2D *v2d) int i; int sy; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, -7); @@ -498,12 +498,12 @@ static void draw_dividers(FileLayout *layout, View2D *v2d) v1[1] = v2d->cur.ymax - layout->tile_border_y; v2[1] = v2d->cur.ymin; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(PRIM_LINES, vertex_ct); + immBegin(GWN_PRIM_LINES, vertex_ct); sx = (int)v2d->tot.xmin; while (sx < v2d->cur.xmax) { diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index e8d033b7a06..4a1707a3c63 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -85,7 +85,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur); int i; - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); glLineWidth(1.0f); @@ -102,7 +102,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) /* draw two black lines showing the standard reference levels */ - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(shdr_pos, v2d->cur.xmin, env->midval + env->min); immVertex2f(shdr_pos, v2d->cur.xmax, env->midval + env->min); @@ -121,7 +121,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) /* for now, point color is fixed, and is white */ immUniformColor3f(1.0f, 1.0f, 1.0f); - immBeginAtMost(PRIM_POINTS, env->totvert * 2); + immBeginAtMost(GWN_PRIM_POINTS, env->totvert * 2); for (i = 0, fed = env->data; i < env->totvert; i++, fed++) { /* only draw if visible @@ -171,7 +171,7 @@ static void draw_fcurve_selected_keyframe_vertices(FCurve *fcu, View2D *v2d, boo set_fcurve_vertex_color(fcu, sel); - immBeginAtMost(PRIM_POINTS, fcu->totvert); + immBeginAtMost(GWN_PRIM_POINTS, fcu->totvert); BezTriple *bezt = fcu->bezt; for (int i = 0; i < fcu->totvert; i++, bezt++) { @@ -223,7 +223,7 @@ static void draw_fcurve_selected_handle_vertices(FCurve *fcu, View2D *v2d, bool immUniform4f("outlineColor", hcolor[0], hcolor[1], hcolor[2], 1.0f); immUniformColor3fvAlpha(hcolor, 0.4f); - immBeginAtMost(PRIM_POINTS, fcu->totvert * 2); + immBeginAtMost(GWN_PRIM_POINTS, fcu->totvert * 2); BezTriple *bezt = fcu->bezt; BezTriple *prevbezt = NULL; @@ -279,7 +279,7 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool * - draw handles before keyframes, so that keyframes will overlap handles (keyframes are more important for users) */ - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); glEnable(GL_BLEND); GPU_enable_program_point_size(); @@ -323,7 +323,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu) { int sel, b; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* slightly hacky, but we want to draw unselected points before selected ones @@ -354,7 +354,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu) col[3] = fcurve_display_alpha(fcu) * 255; immUniformColor4ubv(col); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(pos, fp); immVertex2fv(pos, fp + 3); immEnd(); @@ -366,7 +366,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu) col[3] = fcurve_display_alpha(fcu) * 255; immUniformColor4ubv(col); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(pos, fp + 3); immVertex2fv(pos, fp + 6); immEnd(); @@ -382,7 +382,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu) col[3] = fcurve_display_alpha(fcu) * 255; immUniformColor4ubv(col); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(pos, fp); immVertex2fv(pos, fp + 3); immEnd(); @@ -397,7 +397,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu) col[3] = fcurve_display_alpha(fcu) * 255; immUniformColor4ubv(col); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(pos, fp); immVertex2fv(pos, fp + 3); immEnd(); @@ -423,7 +423,7 @@ static void draw_fcurve_sample_control(float x, float y, float xscale, float ysc gpuScale2f(1.0f / xscale * hsize, 1.0f / yscale * hsize); /* draw X shape */ - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, -0.7f, -0.7f); immVertex2f(pos, +0.7f, +0.7f); @@ -455,7 +455,7 @@ static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu) if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor((fcu->flag & FCURVE_SELECTED) ? TH_TEXT_HI : TH_TEXT); @@ -547,7 +547,7 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d n = (etime - stime) / samplefreq + 0.5f; if (n > 0) { - immBegin(PRIM_LINE_STRIP, (n + 1)); + immBegin(GWN_PRIM_LINE_STRIP, (n + 1)); for (i = 0; i <= n; i++) { float ctime = stime + i * samplefreq; @@ -586,7 +586,7 @@ static void draw_fcurve_curve_samples(bAnimContext *ac, ID *id, FCurve *fcu, Vie gpuScale2f(1.0f, unit_scale); gpuTranslate2f(0.0f, offset); - immBegin(PRIM_LINE_STRIP, count); + immBegin(GWN_PRIM_LINE_STRIP, count); /* extrapolate to left? - left-side of view comes before first keyframe? */ if (prevfpt->vec[0] > v2d->cur.xmin) { @@ -683,7 +683,7 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2 /* For now, this assumes the worst case scenario, where all the keyframes have * bezier interpolation, and are drawn at full res. * This is tricky to optimize, but maybe can be improved at some point... */ - immBeginAtMost(PRIM_LINE_STRIP, (b * 32 + 3)); + immBeginAtMost(GWN_PRIM_LINE_STRIP, (b * 32 + 3)); /* extrapolate to left? */ if (prevbezt->vec[1][0] > v2d->cur.xmin) { @@ -845,7 +845,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) //if ((driver->flag & DRIVER_FLAG_SHOWDEBUG) == 0) // return; - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); float viewport_size[4]; @@ -870,7 +870,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) /* draw 1-1 line, stretching just past the screen limits * NOTE: we need to scale the y-values to be valid for the units */ - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); t = v2d->cur.xmin; immVertex2f(shdr_pos, t, (t + offset) * unitfac); @@ -896,7 +896,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) immUniform1f("dash_width", 10.0f); immUniform1f("dash_factor", 0.5f); - immBegin(PRIM_LINES, (y >= v2d->cur.ymin) ? 4 : 2); + immBegin(GWN_PRIM_LINES, (y >= v2d->cur.ymin) ? 4 : 2); /* x-axis lookup */ co[0] = x; @@ -922,7 +922,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) immUnbindProgram(); - /* PRIM_POINTS do not survive dashed line geometry shader... */ + /* GWN_PRIM_POINTS do not survive dashed line geometry shader... */ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* x marks the spot .................................................... */ @@ -930,7 +930,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) immUniformColor3f(0.9f, 0.9f, 0.9f); glPointSize(7.0); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex2f(shdr_pos, x, y); immEnd(); @@ -938,7 +938,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) immUniformColor3f(0.9f, 0.0f, 0.0f); glPointSize(3.0); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex2f(shdr_pos, x, y); immEnd(); } @@ -965,7 +965,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) } glEnable(GL_BLEND); - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -1051,7 +1051,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid } glEnable(GL_BLEND); - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index c17b60badae..d2358a494d5 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -267,7 +267,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) UI_view2d_grid_free(grid); if (((sipo->flag & SIPO_NODRAWCURSOR) == 0) || (sipo->mode == SIPO_MODE_DRIVERS)) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -281,7 +281,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) glEnable(GL_BLEND); glLineWidth(2.0); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, v2d->cur.xmin, y); immVertex2f(pos, v2d->cur.xmax, y); immEnd(); @@ -299,7 +299,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) glEnable(GL_BLEND); glLineWidth(2.0); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, x, v2d->cur.ymin); immVertex2f(pos, x, v2d->cur.ymax); immEnd(); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 259dc124d37..733008ee478 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -126,7 +126,7 @@ static void draw_render_info(const bContext *C, (int)(-rd->border.ymin * rd->ysch * rd->size * 0.01f)); } - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_FACE_SELECT); @@ -173,7 +173,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* noisy, high contrast make impossible to read if lower alpha is used. */ @@ -329,7 +329,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d BLI_rcti_init(&color_rect, dx, dx + (1.5f * UI_UNIT_X), 0.15f * UI_UNIT_Y, 0.85f * UI_UNIT_Y); /* BLF uses immediate mode too, so we must reset our vertex format */ - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); if (channels == 4) { @@ -366,7 +366,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d immUnbindProgram(); /* draw outline */ - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ub(128, 128, 128); imm_draw_line_box(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); @@ -686,8 +686,8 @@ void draw_image_sample_line(SpaceImage *sima) if (sima->sample_line_hist.flag & HISTO_FLAG_SAMPLELINE) { Histogram *hist = &sima->sample_line_hist; - VertexFormat *format = immVertexFormat(); - unsigned int shdr_dashed_pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int shdr_dashed_pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -699,7 +699,7 @@ void draw_image_sample_line(SpaceImage *sima) immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2); immUniform1f("dash_width", 2.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(shdr_dashed_pos, hist->co[0]); immVertex2fv(shdr_dashed_pos, hist->co[1]); immEnd(); @@ -898,7 +898,7 @@ void draw_image_cache(const bContext *C, ARegion *ar) /* Draw current frame. */ x = (cfra - sfra) / (efra - sfra + 1) * ar->winx; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_CFRAME); immRecti(pos, x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC); diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index 33c0565c12c..3eb0158e7b5 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -84,8 +84,8 @@ static void console_draw_sel(const char *str, const int sel[2], const int xy[2], glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(bg_sel); @@ -190,8 +190,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str cdc->sel[1] = str_len - sel_orig[0]; if (bg) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(bg); @@ -241,8 +241,8 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str else { /* simple, no wrap */ if (bg) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(bg); diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 561c29b68cc..d87da323b97 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -118,8 +118,8 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa nla_action_get_color(adt, act, color); color[3] *= 2.5f; - VertexFormat *format = immVertexFormat(); - unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -142,13 +142,13 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa if (key_ct > 0) { format = immVertexFormat(); - pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size_id = VertexFormat_add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color_id = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); - unsigned int outline_color_id = VertexFormat_add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT); + unsigned int color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + unsigned int outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); - immBegin(PRIM_POINTS, key_ct); + immBegin(GWN_PRIM_POINTS, key_ct); /* - disregard the selection status of keyframes so they draw a certain way * - size is 6.0f which is smaller than the editable keyframes, so that there is a distinction @@ -177,7 +177,7 @@ static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymax if (!(act && act->markers.first)) return; - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); if (dashed) { immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -194,7 +194,7 @@ static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymax } immUniformThemeColorShade(TH_STRIP_SELECT, shade); - immBeginAtMost(PRIM_LINES, BLI_listbase_count(&act->markers) * 2); + immBeginAtMost(GWN_PRIM_LINES, BLI_listbase_count(&act->markers) * 2); for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) { if ((marker->frame > strip->actstart) && (marker->frame < strip->actend)) { float frame = nlastrip_get_frame(strip, marker->frame, NLATIME_CONVERT_MAP); @@ -315,7 +315,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns float cfra; /* plot the curve (over the strip's main region) */ - immBegin(PRIM_LINE_STRIP, abs((int)(strip->end - strip->start) + 1)); + immBegin(GWN_PRIM_LINE_STRIP, abs((int)(strip->end - strip->start) + 1)); /* sample at 1 frame intervals, and draw * - min y-val is yminc, max is y-maxc, so clamp in those regions @@ -331,7 +331,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns else { /* use blend in/out values only if both aren't zero */ if ((IS_EQF(strip->blendin, 0.0f) && IS_EQF(strip->blendout, 0.0f)) == 0) { - immBeginAtMost(PRIM_LINE_STRIP, 4); + immBeginAtMost(GWN_PRIM_LINE_STRIP, 4); /* start of strip - if no blendin, start straight at 1, otherwise from 0 to 1 over blendin frames */ if (IS_EQF(strip->blendin, 0.0f) == 0) { @@ -367,7 +367,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri /* get color of strip */ nla_strip_get_color_inside(adt, strip, color); - uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw extrapolation info first (as backdrop) @@ -420,7 +420,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri UI_draw_roundbox_shade_x(true, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1, color); /* restore current vertex format & program (roundbox trashes it) */ - shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); } else { @@ -465,7 +465,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri /* restore current vertex format & program (roundbox trashes it) */ /* Note that we use dahsed shader here, and make it draw solid lines if not muted... */ - shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); float viewport_size[4]; @@ -491,7 +491,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri /* only draw lines for whole-numbered repeats, starting from the first full-repeat * up to the last full repeat (but not if it lies on the end of the strip) */ - immBeginAtMost(PRIM_LINES, 2 * (strip->repeat - 1)); + immBeginAtMost(GWN_PRIM_LINES, 2 * (strip->repeat - 1)); for (int i = 1; i < strip->repeat; i++) { float repeatPos = strip->start + (repeatLen * i); @@ -507,7 +507,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri else if ((strip->type == NLASTRIP_TYPE_META) && (strip->strips.first != strip->strips.last)) { float y = (ymaxc - yminc) * 0.5f + yminc; - immBeginAtMost(PRIM_LINES, 4 * BLI_listbase_count(&strip->strips)); /* up to 2 lines per strip */ + immBeginAtMost(GWN_PRIM_LINES, 4 * BLI_listbase_count(&strip->strips)); /* up to 2 lines per strip */ /* only draw first-level of child-strips, but don't draw any lines on the endpoints */ for (NlaStrip *cs = strip->strips.first; cs; cs = cs->next) { @@ -676,7 +676,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) { AnimData *adt = ale->adt; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* just draw a semi-shaded rect spanning the width of the viewable area if there's data, @@ -699,7 +699,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) /* white base-lines */ glLineWidth(2.0f); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.3f); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, v2d->cur.xmin, yminc + NLACHANNEL_SKIP); immVertex2f(pos, v2d->cur.xmax, yminc + NLACHANNEL_SKIP); immVertex2f(pos, v2d->cur.xmin, ymaxc - NLACHANNEL_SKIP); @@ -709,7 +709,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) /* black top-lines */ glLineWidth(1.0f); immUniformColor3f(0.0f, 0.0f, 0.0f); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, v2d->cur.xmin, yminc + NLACHANNEL_SKIP); immVertex2f(pos, v2d->cur.xmax, yminc + NLACHANNEL_SKIP); immVertex2f(pos, v2d->cur.xmin, ymaxc - NLACHANNEL_SKIP); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 500abfe6c63..bee2379cd81 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -2157,14 +2157,14 @@ static void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNo const float cx = x + snode->zoom * backdropWidth * node->custom3; const float cy = y + snode->zoom * backdropHeight * node->custom4; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(1.0f, 1.0f, 1.0f); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, cx - 25, cy - 25); immVertex2f(pos, cx + 25, cy + 25); immVertex2f(pos, cx + 25, cy - 25); @@ -2202,14 +2202,14 @@ static void node_composit_backdrop_boxmask(SpaceNode *snode, ImBuf *backdrop, bN y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(1.0f, 1.0f, 1.0f); - immBegin(PRIM_LINE_LOOP, 4); + immBegin(GWN_PRIM_LINE_LOOP, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x2, y2); immVertex2f(pos, x3, y3); @@ -2246,14 +2246,14 @@ static void node_composit_backdrop_ellipsemask(SpaceNode *snode, ImBuf *backdrop y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(1.0f, 1.0f, 1.0f); - immBegin(PRIM_LINE_LOOP, 4); + immBegin(GWN_PRIM_LINE_LOOP, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x2, y2); immVertex2f(pos, x3, y3); @@ -3258,7 +3258,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b y + snode->zoom * viewer_border->ymin * ibuf->y, y + snode->zoom * viewer_border->ymax * ibuf->y); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_ACTIVE); @@ -3407,7 +3407,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, } if (do_triple || drawarrow || (!do_shaded)) { - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); } @@ -3415,7 +3415,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, immUniformThemeColorShadeAlpha(th_col3, -80, -120); glLineWidth(4.0f); - immBegin(PRIM_LINE_STRIP, (LINK_RESOL + 1)); + immBegin(GWN_PRIM_LINE_STRIP, (LINK_RESOL + 1)); for (i = 0; i <= LINK_RESOL; i++) { immVertex2fv(pos, coord_array[i]); @@ -3424,7 +3424,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, immEnd(); if (drawarrow) { - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2fv(pos, arrow1); immVertex2fv(pos, arrow); immVertex2fv(pos, arrow2); @@ -3437,7 +3437,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, if (drawarrow) { immUniformThemeColorBlend(th_col1, th_col2, 0.5f); - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2fv(pos, arrow1); immVertex2fv(pos, arrow); immVertex2fv(pos, arrow2); @@ -3447,7 +3447,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, if (!do_shaded) { immUniformThemeColor(th_col1); - immBegin(PRIM_LINE_STRIP, (LINK_RESOL + 1)); + immBegin(GWN_PRIM_LINE_STRIP, (LINK_RESOL + 1)); for (i = 0; i <= LINK_RESOL; i++) { immVertex2fv(pos, coord_array[i]); @@ -3463,13 +3463,13 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, if (do_shaded) { unsigned char col[3]; - VertexFormat *format = immVertexFormat(); - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(PRIM_LINE_STRIP, (LINK_RESOL + 1)); + immBegin(GWN_PRIM_LINE_STRIP, (LINK_RESOL + 1)); for (i = 0; i <= LINK_RESOL; i++) { UI_GetThemeColorBlend3ubv(th_col1, th_col2, spline_step, col); @@ -3537,7 +3537,7 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) void ED_node_draw_snap(View2D *v2d, const float cent[2], float size, NodeBorder border, unsigned pos) { - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); if (border & (NODE_LEFT | NODE_RIGHT)) { immVertex2f(pos, cent[0], v2d->cur.ymin); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 02adc064f88..d99d1c97653 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -640,8 +640,8 @@ static void node_draw_preview_background(float tile, rctf *rect) { float x, y; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -713,7 +713,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv) glDisable(GL_BLEND); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -15, +100); imm_draw_line_box(pos, draw_rect.xmin, draw_rect.ymin, draw_rect.xmax, draw_rect.ymax); @@ -763,9 +763,9 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * float scale; UI_view2d_scale_get(v2d, &scale, NULL); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int col = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); glEnable(GL_BLEND); GPU_enable_program_point_size(); @@ -780,7 +780,7 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * immUniform1f("outlineWidth", 1.0f); immUniform4f("outlineColor", 0.0f, 0.0f, 0.0f, 0.6f); - immBeginAtMost(PRIM_POINTS, total_input_ct + total_output_ct); + immBeginAtMost(GWN_PRIM_POINTS, total_input_ct + total_output_ct); } /* socket inputs */ @@ -824,7 +824,7 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * immUniform4f("outlineColor", c[0], c[1], c[2], 1.0f); immUniform1f("outlineWidth", 1.5f); - immBegin(PRIM_POINTS, selected_input_ct + selected_output_ct); + immBegin(GWN_PRIM_POINTS, selected_input_ct + selected_output_ct); if (selected_input_ct) { /* socket inputs */ @@ -1096,13 +1096,13 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b } /* scale widget thing */ - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(color_id, -10); dx = 10.0f; - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, rct->xmax - dx, centy - 4.0f); immVertex2f(pos, rct->xmax - dx, centy + 4.0f); @@ -1113,7 +1113,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b immUniformThemeColorShade(color_id, 30); dx -= snode->aspect; - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, rct->xmax - dx, centy - 4.0f); immVertex2f(pos, rct->xmax - dx, centy + 4.0f); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index b6a2e6f60fb..7a1eca0f179 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -652,11 +652,11 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex) glLineWidth(1.0f); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -15, -200); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, sizex, v2d->cur.ymax); immVertex2f(pos, sizex, miny); @@ -1455,8 +1455,8 @@ static void outliner_draw_tree_element( /* divider */ { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); unsigned char col[4]; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1510,7 +1510,7 @@ static void outliner_draw_tree_element_floating( const TreeElement *te_insert = te_floating->drag_data->insert_handle; const int line_width = 2; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); int coord_y = te_insert->ys; int coord_x = te_insert->xs; float col[4]; @@ -1531,7 +1531,7 @@ static void outliner_draw_tree_element_floating( immUniformColor4fv(col); glLineWidth(line_width); - immBegin(PRIM_LINE_STRIP, 2); + immBegin(GWN_PRIM_LINE_STRIP, 2); immVertex2f(pos, coord_x, coord_y); immVertex2f(pos, ar->v2d.cur.xmax, coord_y); immEnd(); @@ -1540,7 +1540,7 @@ static void outliner_draw_tree_element_floating( BLI_assert(te_floating->drag_data->insert_type == TE_INSERT_INTO); immUniformColor3fvAlpha(col, col[3] * 0.5f); - immBegin(PRIM_TRIANGLE_STRIP, 4); + immBegin(GWN_PRIM_TRI_STRIP, 4); immVertex2f(pos, coord_x, coord_y + UI_UNIT_Y); immVertex2f(pos, coord_x, coord_y); immVertex2f(pos, ar->v2d.cur.xmax, coord_y + UI_UNIT_Y); @@ -1608,8 +1608,8 @@ static void outliner_draw_hierarchy_lines_recursive(unsigned pos, SpaceOops *soo static void outliner_draw_hierarchy_lines(SpaceOops *soops, ListBase *lb, int startx, int *starty) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); unsigned char col[4]; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1634,8 +1634,8 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * /* selection status */ if (TSELEM_OPEN(tselem, soops)) if (tselem->type == TSE_RNA_STRUCT) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immThemeColorShadeAlpha(TH_BACK, -15, -200); immRecti(pos, 0, *starty + 1, (int)ar->v2d.cur.xmax, *starty + UI_UNIT_Y - 1); @@ -1646,12 +1646,12 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * if (TSELEM_OPEN(tselem, soops)) { outliner_draw_struct_marks(ar, soops, &te->subtree, starty); if (tselem->type == TSE_RNA_STRUCT) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immThemeColorShadeAlpha(TH_BACK, -15, -200); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, 0, (float)*starty + UI_UNIT_Y); immVertex2f(pos, ar->v2d.cur.xmax, (float)*starty + UI_UNIT_Y); immEnd(); @@ -1714,8 +1714,8 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx, col_searchmatch[3] = 0.5f; glEnable(GL_BLEND); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); outliner_draw_highlights_recursive(pos, ar, soops, &soops->tree, col_selection, col_highlight, col_searchmatch, startx, starty); @@ -1786,8 +1786,8 @@ static void outliner_back(ARegion *ar) ystart = (int)ar->v2d.tot.ymax; ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, 6); @@ -1797,7 +1797,7 @@ static void outliner_back(ARegion *ar) int tot = (int)floor(ystart - ar->v2d.cur.ymin + 2 * UI_UNIT_Y) / (2 * UI_UNIT_Y); if (tot > 0) { - immBegin(PRIM_TRIANGLES, 6 * tot); + immBegin(GWN_PRIM_TRIS, 6 * tot); while (tot--) { y1 -= 2 * UI_UNIT_Y; y2 = y1 + UI_UNIT_Y; @@ -1818,10 +1818,10 @@ static void outliner_draw_restrictcols(ARegion *ar) { glLineWidth(1.0f); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -15, -200); - immBegin(PRIM_LINES, 6); + immBegin(GWN_PRIM_LINES, 6); /* view */ immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymax); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 4d1e878868a..9cdb74e02f9 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -262,7 +262,7 @@ static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene *s glEnable(GL_BLEND); - immBegin(PRIM_TRIANGLE_STRIP, length * 2); + immBegin(GWN_PRIM_TRI_STRIP, length * 2); for (i = 0; i < length; i++) { float sampleoffset = startsample + ((x1_offset - x1) / stepsize + i) * samplestep; @@ -338,7 +338,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, col[3] = 196; /* alpha, used for all meta children */ - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -452,7 +452,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla immUniformColor4ub(0, 0, 0, 50); } - immBegin(PRIM_TRIANGLES, 3); + immBegin(GWN_PRIM_TRIS, 3); immVertex2fv(pos, v1); immVertex2fv(pos, v2); immVertex2fv(pos, v3); @@ -714,7 +714,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp; y2 = seq->machine + SEQ_STRIP_OFSTOP; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -776,7 +776,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg if (seq->flag & SEQ_LOCK) { glEnable(GL_BLEND); - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_DIAG_STRIPES); immUniform4f("color1", 1.0f, 1.0f, 1.0f, 0.125f); @@ -794,7 +794,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg if (!BKE_sequence_is_valid_check(seq)) { glEnable(GL_BLEND); - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_DIAG_STRIPES); immUniform4f("color1", 1.0f, 0.0f, 0.0f, 1.0f); @@ -829,7 +829,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg drawmeta_contents(scene, seq, x1, y1, x2, y2); } - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); /* TODO: add back stippled line for muted strips? */ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1033,7 +1033,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons glLineWidth(1.0f); /* border */ - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -1224,9 +1224,9 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq /* Format needs to be created prior to any immBindProgram call. * Do it here because OCIO binds it's own shader. */ - VertexFormat *imm_format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(imm_format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int texCoord = VertexFormat_add_attrib(imm_format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *imm_format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(imm_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int texCoord = GWN_vertformat_attr_add(imm_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); if (scope) { IMB_freeImBuf(ibuf); @@ -1324,7 +1324,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq immUniform1i("image", GL_TEXTURE0); } - immBegin(PRIM_TRIANGLE_FAN, 4); + immBegin(GWN_PRIM_TRI_FAN, 4); if (draw_overlay) { if (sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) { @@ -1507,7 +1507,7 @@ static void draw_seq_backdrop(View2D *v2d) { int i; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* darker gray overlay over the view backdrop */ @@ -1534,7 +1534,7 @@ static void draw_seq_backdrop(View2D *v2d) i = max_ii(1, ((int)v2d->cur.ymin) - 1); int line_ct = (int)v2d->cur.ymax - i + 1; immUniformThemeColor(TH_GRID); - immBegin(PRIM_LINES, line_ct * 2); + immBegin(GWN_PRIM_LINES, line_ct * 2); while (line_ct--) { immVertex2f(pos, v2d->cur.xmax, i); immVertex2f(pos, v2d->cur.xmin, i); @@ -1586,7 +1586,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) const Sequence *seq = special_seq_update; glEnable(GL_BLEND); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(255, 255, 255, 48); @@ -1606,7 +1606,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) glEnable(GL_BLEND); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw darkened area outside of active timeline @@ -1624,7 +1624,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) immUniformThemeColorShade(TH_BACK, -60); /* thin lines where the actual frames are */ - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, frame_sta, v2d->cur.ymin); immVertex2f(pos, frame_sta, v2d->cur.ymax); @@ -1642,7 +1642,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) immUniformThemeColorShade(TH_BACK, -40); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, ms->disp_range[0], v2d->cur.ymin); immVertex2f(pos, ms->disp_range[0], v2d->cur.ymax); @@ -1730,12 +1730,12 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(0.2f, 0.2f, 0.2f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, cfra_over, v2d->cur.ymin); immVertex2f(pos, cfra_over, v2d->cur.ymax); immEnd(); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 79607bf88cb..7b4565d8b66 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -912,7 +912,7 @@ static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back) float rad; /* background so highlights don't go behind the scrollbar */ - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_BACK); immRecti(pos, back->xmin, back->ymin, back->xmax, back->ymax); @@ -966,24 +966,24 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) boxh = (DOC_HEIGHT + 1) * (st->lheight_dpi + TXT_LINE_SPACING); /* Draw panel */ - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_BACK); immRecti(pos, x, y, x + boxw, y - boxh); immUniformThemeColor(TH_SHADE1); - immBegin(PRIM_LINE_LOOP, 4); + immBegin(GWN_PRIM_LINE_LOOP, 4); immVertex2i(pos, x, y); immVertex2i(pos, x + boxw, y); immVertex2i(pos, x + boxw, y - boxh); immVertex2i(pos, x, y - boxh); immEnd(); - immBegin(PRIM_LINE_LOOP, 3); + immBegin(GWN_PRIM_LINE_LOOP, 3); immVertex2i(pos, x + boxw - 10, y - 7); immVertex2i(pos, x + boxw - 4, y - 7); immVertex2i(pos, x + boxw - 7, y - 2); immEnd(); - immBegin(PRIM_LINE_LOOP, 3); + immBegin(GWN_PRIM_LINE_LOOP, 3); immVertex2i(pos, x + boxw - 10, y - boxh + 7); immVertex2i(pos, x + boxw - 4, y - boxh + 7); immVertex2i(pos, x + boxw - 7, y - boxh + 2); @@ -1065,7 +1065,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc /* not needed but stands out nicer */ UI_draw_box_shadow(220, x, y - boxh, x + boxw, y); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_SHADE1); @@ -1088,7 +1088,7 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc w = st->cwidth * text_get_char_pos(st, str, len); if (item == sel) { - unsigned int posi = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int posi = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_SHADE2); @@ -1129,7 +1129,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar) return; } - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* Draw the selection */ @@ -1442,7 +1442,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) if (st->showlinenrs) { x = TXT_OFFSET + TEXTXLOC; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_GRID); immRecti(pos, (TXT_OFFSET - 12), 0, (TXT_OFFSET - 5) + TEXTXLOC, ar->winy - 2); @@ -1501,7 +1501,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) margin_column_x = x + st->cwidth * (st->margin_column - st->left); if (margin_column_x >= x) { - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -1514,7 +1514,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) immUniform1f("dash_width", 2.0f); immUniform1f("dash_factor", 0.5f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2i(shdr_pos, margin_column_x, 0); immVertex2i(shdr_pos, margin_column_x, ar->winy - 2); immEnd(); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 283cd6c0e24..4672cc073fc 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -83,8 +83,8 @@ static void time_draw_sfra_efra(Scene *scene, View2D *v2d) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); @@ -102,7 +102,7 @@ static void time_draw_sfra_efra(Scene *scene, View2D *v2d) /* thin lines where the actual frames are */ immUniformThemeColorShade(TH_BACK, -60); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(pos, (float)PSFRA, v2d->cur.ymin); immVertex2f(pos, (float)PSFRA, v2d->cur.ymax); @@ -126,7 +126,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene) BKE_ptcache_ids_from_object(&pidlist, ob, scene, 0); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* iterate over pointcaches on the active object, @@ -215,7 +215,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene) immUniformColor4fv(col); if (len > 0) { - immBeginAtMost(PRIM_TRIANGLES, len); + immBeginAtMost(GWN_PRIM_TRIS, len); /* draw a quad for each cached frame */ for (int i = sta; i <= end; i++) { @@ -323,13 +323,13 @@ static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel, cons if (max_len > 0) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(color); - immBeginAtMost(PRIM_LINES, max_len * 2); + immBeginAtMost(GWN_PRIM_LINES, max_len * 2); for (; (ak) && (ak->cfra <= v2d->cur.xmax); ak = ak->next) diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index c2db34d8d1a..66355a50478 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -238,13 +238,13 @@ void draw_motion_path_instance(Scene *scene, /* set line thickness */ glLineWidth(mpath->line_thickness); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); - immBegin(PRIM_LINE_STRIP, len); + immBegin(GWN_PRIM_LINE_STRIP, len); for (i = 0, mpv = mpv_start; i < len; i++, mpv++) { short sel = (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->flag & SELECT); @@ -264,7 +264,7 @@ void draw_motion_path_instance(Scene *scene, glLineWidth(old_width); } - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -274,7 +274,7 @@ void draw_motion_path_instance(Scene *scene, /* draw little black point at each frame */ immUniformColor3ub(0, 0, 0); - immBegin(PRIM_POINTS, len); + immBegin(GWN_PRIM_POINTS, len); for (i = 0, mpv = mpv_start; i < len; i++, mpv++) { immVertex3fv(pos, mpv->co); @@ -290,7 +290,7 @@ void draw_motion_path_instance(Scene *scene, immUniformThemeColor(TH_TEXT_HI); } - immBegin(PRIM_POINTS, (len + stepsize - 1) / stepsize); + immBegin(GWN_PRIM_POINTS, (len + stepsize - 1) / stepsize); for (i = 0, mpv = mpv_start; i < len; i += stepsize, mpv += stepsize) { immVertex3fv(pos, mpv->co); @@ -307,7 +307,7 @@ void draw_motion_path_instance(Scene *scene, glPointSize(mpath->line_thickness + 5.0); immUniformThemeColor(TH_CFRAME); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); mpv = mpv_start + (CFRA - sfra); immVertex3fv(pos, mpv->co); @@ -388,12 +388,12 @@ void draw_motion_path_instance(Scene *scene, /* point must be bigger than line */ glPointSize(mpath->line_thickness + 3.0); - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(col); - immBeginAtMost(PRIM_POINTS, len); + immBeginAtMost(GWN_PRIM_POINTS, len); for (i = 0, mpv = mpv_start; i < len; i++, mpv++) { int frame = sfra + i; diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 2152d67e447..5845a53055c 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -331,15 +331,15 @@ static void set_ebone_color(const unsigned int boneflag) /* *************** Armature drawing, helper calls for parts ******************* */ -static void add_solid_flat_triangle(VertexBuffer *vbo, unsigned int *vertex, unsigned int pos, unsigned int nor, +static void add_solid_flat_triangle(Gwn_VertBuf *vbo, unsigned int *vertex, unsigned int pos, unsigned int nor, const float p1[3], const float p2[3], const float p3[3], const float n[3]) { - VertexBuffer_set_attrib(vbo, nor, *vertex, n); - VertexBuffer_set_attrib(vbo, pos, (*vertex)++, p1); - VertexBuffer_set_attrib(vbo, nor, *vertex, n); - VertexBuffer_set_attrib(vbo, pos, (*vertex)++, p2); - VertexBuffer_set_attrib(vbo, nor, *vertex, n); - VertexBuffer_set_attrib(vbo, pos, (*vertex)++, p3); + GWN_vertbuf_attr_set(vbo, nor, *vertex, n); + GWN_vertbuf_attr_set(vbo, pos, (*vertex)++, p1); + GWN_vertbuf_attr_set(vbo, nor, *vertex, n); + GWN_vertbuf_attr_set(vbo, pos, (*vertex)++, p2); + GWN_vertbuf_attr_set(vbo, nor, *vertex, n); + GWN_vertbuf_attr_set(vbo, pos, (*vertex)++, p3); } /* half the cube, in Y */ @@ -362,21 +362,21 @@ static const float cube_wire[24] = { static void drawsolidcube_size(float xsize, float ysize, float zsize) { - static VertexFormat format = {0}; - static VertexBuffer vbo = {{0}}; - static Batch batch = {{0}}; + static Gwn_VertFormat format = {0}; + static Gwn_VertBuf vbo = {{0}}; + static Gwn_Batch batch = {{0}}; const float light_vec[3] = {0.0f, 0.0f, 1.0f}; if (format.attrib_ct == 0) { unsigned int i = 0; float n[3] = {0.0f}; /* Vertex format */ - unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); /* Vertices */ - VertexBuffer_init_with_format(&vbo, &format); - VertexBuffer_allocate_data(&vbo, 36); + GWN_vertbuf_init_with_format(&vbo, &format); + GWN_vertbuf_data_alloc(&vbo, 36); n[0] = -1.0; add_solid_flat_triangle(&vbo, &i, pos, nor, cube_vert[0], cube_vert[1], cube_vert[2], n); @@ -401,7 +401,7 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize) add_solid_flat_triangle(&vbo, &i, pos, nor, cube_vert[7], cube_vert[4], cube_vert[0], n); add_solid_flat_triangle(&vbo, &i, pos, nor, cube_vert[0], cube_vert[3], cube_vert[7], n); - Batch_init(&batch, PRIM_TRIANGLES, &vbo, NULL); + GWN_batch_init(&batch, GWN_PRIM_TRIS, &vbo, NULL); } gpuPushMatrix(); @@ -413,50 +413,50 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize) else { /* TODO replace with good default lighting shader ? */ Batch_set_builtin_program(&batch, GPU_SHADER_SIMPLE_LIGHTING); - Batch_Uniform3fv(&batch, "light", light_vec); + GWN_batch_uniform_3fv(&batch, "light", light_vec); } - Batch_Uniform4fv(&batch, "color", fcolor); - Batch_draw(&batch); + GWN_batch_uniform_4fv(&batch, "color", fcolor); + GWN_batch_draw(&batch); gpuPopMatrix(); } static void drawcube_size(float xsize, float ysize, float zsize) { - static VertexFormat format = {0}; - static VertexBuffer vbo = {{0}}; - static ElementListBuilder elb = {0}; - static ElementList el = {0}; - static Batch batch = {{0}}; + static Gwn_VertFormat format = {0}; + static Gwn_VertBuf vbo = {{0}}; + static Gwn_IndexBufBuilder elb = {0}; + static Gwn_IndexBuf el = {0}; + static Gwn_Batch batch = {{0}}; if (format.attrib_ct == 0) { /* Vertex format */ - unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); /* Elements */ - ElementListBuilder_init(&elb, PRIM_LINES, 12, 8); + GWN_indexbuf_init(&elb, GWN_PRIM_LINES, 12, 8); for (int i = 0; i < 12; ++i) { - add_line_vertices(&elb, cube_wire[i*2], cube_wire[i*2+1]); + GWN_indexbuf_add_line_verts(&elb, cube_wire[i*2], cube_wire[i*2+1]); } - ElementList_build_in_place(&elb, &el); + GWN_indexbuf_build_in_place(&elb, &el); /* Vertices */ - VertexBuffer_init_with_format(&vbo, &format); - VertexBuffer_allocate_data(&vbo, 8); + GWN_vertbuf_init_with_format(&vbo, &format); + GWN_vertbuf_data_alloc(&vbo, 8); for (int i = 0; i < 8; ++i) { - VertexBuffer_set_attrib(&vbo, pos, i, cube_vert[i]); + GWN_vertbuf_attr_set(&vbo, pos, i, cube_vert[i]); } - Batch_init(&batch, PRIM_LINES, &vbo, &el); + GWN_batch_init(&batch, GWN_PRIM_LINES, &vbo, &el); Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR); } gpuPushMatrix(); gpuScale3f(xsize, ysize, zsize); - Batch_use_program(&batch); - Batch_Uniform4fv(&batch, "color", fcolor); - Batch_draw(&batch); + GWN_batch_program_use_begin(&batch); + GWN_batch_uniform_4fv(&batch, "color", fcolor); + GWN_batch_draw(&batch); gpuPopMatrix(); } @@ -464,57 +464,57 @@ static void drawcube_size(float xsize, float ysize, float zsize) static void draw_bonevert(void) { - static VertexFormat format = {0}; - static VertexBuffer vbo = {{0}}; - static Batch batch = {{0}}; + static Gwn_VertFormat format = {0}; + static Gwn_VertBuf vbo = {{0}}; + static Gwn_Batch batch = {{0}}; if (format.attrib_ct == 0) { /* Vertex format */ - unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); /* Vertices */ - VertexBuffer_init_with_format(&vbo, &format); - VertexBuffer_allocate_data(&vbo, 96); + GWN_vertbuf_init_with_format(&vbo, &format); + GWN_vertbuf_data_alloc(&vbo, 96); for (int i = 0; i < 16; ++i) { float vert[3] = {0.f, 0.f, 0.f}; const float r = 0.05f; vert[0] = r * cosf(2 * M_PI * i / 16.f); vert[1] = r * sinf(2 * M_PI * i / 16.f); - VertexBuffer_set_attrib(&vbo, pos, i * 6 + 0, vert); + GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 0, vert); vert[0] = r * cosf(2 * M_PI * (i + 1) / 16.f); vert[1] = r * sinf(2 * M_PI * (i + 1) / 16.f); - VertexBuffer_set_attrib(&vbo, pos, i * 6 + 1, vert); + GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 1, vert); vert[0] = 0.f; vert[1] = r * cosf(2 * M_PI * i / 16.f); vert[2] = r * sinf(2 * M_PI * i / 16.f); - VertexBuffer_set_attrib(&vbo, pos, i * 6 + 2, vert); + GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 2, vert); vert[1] = r * cosf(2 * M_PI * (i + 1) / 16.f); vert[2] = r * sinf(2 * M_PI * (i + 1) / 16.f); - VertexBuffer_set_attrib(&vbo, pos, i * 6 + 3, vert); + GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 3, vert); vert[1] = 0.f; vert[0] = r * cosf(2 * M_PI * i / 16.f); vert[2] = r * sinf(2 * M_PI * i / 16.f); - VertexBuffer_set_attrib(&vbo, pos, i * 6 + 4, vert); + GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 4, vert); vert[0] = r * cosf(2 * M_PI * (i + 1) / 16.f); vert[2] = r * sinf(2 * M_PI * (i + 1) / 16.f); - VertexBuffer_set_attrib(&vbo, pos, i * 6 + 5, vert); + GWN_vertbuf_attr_set(&vbo, pos, i * 6 + 5, vert); } - Batch_init(&batch, PRIM_LINES, &vbo, NULL); + GWN_batch_init(&batch, GWN_PRIM_LINES, &vbo, NULL); Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR); } - Batch_use_program(&batch); - Batch_Uniform4fv(&batch, "color", fcolor); - Batch_draw(&batch); + GWN_batch_program_use_begin(&batch); + GWN_batch_uniform_4fv(&batch, "color", fcolor); + GWN_batch_draw(&batch); } static void draw_bonevert_solid(void) { - Batch *batch = Batch_get_sphere(0); + Gwn_Batch *batch = Batch_get_sphere(0); const float light_vec[3] = {0.0f, 0.0f, 1.0f}; gpuPushMatrix(); @@ -526,10 +526,10 @@ static void draw_bonevert_solid(void) else { /* TODO replace with good default lighting shader ? */ Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); - Batch_Uniform3fv(batch, "light", light_vec); + GWN_batch_uniform_3fv(batch, "light", light_vec); } - Batch_Uniform4fv(batch, "color", fcolor); - Batch_draw(batch); + GWN_batch_uniform_4fv(batch, "color", fcolor); + GWN_batch_draw(batch); gpuPopMatrix(); } @@ -575,55 +575,55 @@ static const float bone_octahedral_solid_normals[8][3] = { static void draw_bone_octahedral(void) { - static VertexFormat format = {0}; - static VertexBuffer vbo = {{0}}; - static ElementListBuilder elb = {0}; - static ElementList el = {0}; - static Batch batch = {{0}}; + static Gwn_VertFormat format = {0}; + static Gwn_VertBuf vbo = {{0}}; + static Gwn_IndexBufBuilder elb = {0}; + static Gwn_IndexBuf el = {0}; + static Gwn_Batch batch = {{0}}; if (format.attrib_ct == 0) { /* Vertex format */ - unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); /* Elements */ - ElementListBuilder_init(&elb, PRIM_LINES, 12, 6); + GWN_indexbuf_init(&elb, GWN_PRIM_LINES, 12, 6); for (int i = 0; i < 12; ++i) { - add_line_vertices(&elb, bone_octahedral_wire[i*2], bone_octahedral_wire[i*2+1]); + GWN_indexbuf_add_line_verts(&elb, bone_octahedral_wire[i*2], bone_octahedral_wire[i*2+1]); } - ElementList_build_in_place(&elb, &el); + GWN_indexbuf_build_in_place(&elb, &el); /* Vertices */ - VertexBuffer_init_with_format(&vbo, &format); - VertexBuffer_allocate_data(&vbo, 6); + GWN_vertbuf_init_with_format(&vbo, &format); + GWN_vertbuf_data_alloc(&vbo, 6); for (int i = 0; i < 6; ++i) { - VertexBuffer_set_attrib(&vbo, pos, i, bone_octahedral_verts[i]); + GWN_vertbuf_attr_set(&vbo, pos, i, bone_octahedral_verts[i]); } - Batch_init(&batch, PRIM_LINES, &vbo, &el); + GWN_batch_init(&batch, GWN_PRIM_LINES, &vbo, &el); Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR); } - Batch_use_program(&batch); - Batch_Uniform4fv(&batch, "color", fcolor); - Batch_draw(&batch); + GWN_batch_program_use_begin(&batch); + GWN_batch_uniform_4fv(&batch, "color", fcolor); + GWN_batch_draw(&batch); } static void draw_bone_solid_octahedral(void) { - static VertexFormat format = {0}; - static VertexBuffer vbo = {{0}}; - static Batch batch = {{0}}; + static Gwn_VertFormat format = {0}; + static Gwn_VertBuf vbo = {{0}}; + static Gwn_Batch batch = {{0}}; const float light_vec[3] = {0.0f, 0.0f, 1.0f}; if (format.attrib_ct == 0) { unsigned int v_idx = 0; /* Vertex format */ - unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); /* Vertices */ - VertexBuffer_init_with_format(&vbo, &format); - VertexBuffer_allocate_data(&vbo, 24); + GWN_vertbuf_init_with_format(&vbo, &format); + GWN_vertbuf_data_alloc(&vbo, 24); for (int i = 0; i < 8; i++) { add_solid_flat_triangle(&vbo, &v_idx, pos, nor, @@ -633,7 +633,7 @@ static void draw_bone_solid_octahedral(void) bone_octahedral_solid_normals[i]); } - Batch_init(&batch, PRIM_TRIANGLES, &vbo, NULL); + GWN_batch_init(&batch, GWN_PRIM_TRIS, &vbo, NULL); } if (flat_color) { @@ -642,10 +642,10 @@ static void draw_bone_solid_octahedral(void) else { /* TODO replace with good default lighting shader ? */ Batch_set_builtin_program(&batch, GPU_SHADER_SIMPLE_LIGHTING); - Batch_Uniform3fv(&batch, "light", light_vec); + GWN_batch_uniform_3fv(&batch, "light", light_vec); } - Batch_Uniform4fv(&batch, "color", fcolor); - Batch_draw(&batch); + GWN_batch_uniform_4fv(&batch, "color", fcolor); + GWN_batch_draw(&batch); } /* *************** Armature drawing, bones ******************* */ @@ -810,11 +810,11 @@ static void draw_sphere_bone_dist(float smat[4][4], float imat[4][4], bPoseChann //mul_v3_fl(dirvec, head); cross_v3_v3v3(norvec, dirvec, imat[2]); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - immBegin(PRIM_TRIANGLE_STRIP, 66); + immBegin(GWN_PRIM_TRI_STRIP, 66); immUniformColor4ub(255, 255, 255, 50); for (a = 0; a < 16; a++) { @@ -866,8 +866,8 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4], float head, tail /*, length*/; float *headvec, *tailvec, dirvec[3]; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -966,7 +966,7 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4], if (id != -1) GPU_select_load_id(id | BONESEL_BONE); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); add_v3_v3v3(vec, headvec, norvech); immVertex3fv(pos, vec); @@ -990,14 +990,14 @@ 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) { - Batch *sphere = Batch_get_sphere(1); + Gwn_Batch *sphere = Batch_get_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); - Batch_Uniform3fv(sphere, "light", light_vec); + GWN_batch_uniform_3fv(sphere, "light", light_vec); gpuPushMatrix(); @@ -1040,8 +1040,8 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co GPU_select_load_id(id | BONESEL_ROOT); gpuPushMatrix(); gpuScaleUniform(head); - Batch_Uniform4fv(sphere, "color", fcolor); - Batch_draw(sphere); + GWN_batch_uniform_4fv(sphere, "color", fcolor); + GWN_batch_draw(sphere); gpuPopMatrix(); } @@ -1058,9 +1058,9 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co gpuPushMatrix(); gpuScaleUniform(tail); - Batch_use_program(sphere); /* hack to make the following uniforms stick */ - Batch_Uniform4fv(sphere, "color", fcolor); - Batch_draw(sphere); + GWN_batch_program_use_begin(sphere); /* hack to make the following uniforms stick */ + GWN_batch_uniform_4fv(sphere, "color", fcolor); + GWN_batch_draw(sphere); gpuPopMatrix(); gpuTranslate3f(0.0f, 0.0f, -length); @@ -1075,8 +1075,8 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co else if (dt == OB_SOLID) UI_GetThemeColor4fv(TH_BONE_SOLID, fcolor); - Batch_use_program(sphere); /* hack to make the following uniforms stick */ - Batch_Uniform4fv(sphere, "color", fcolor); + GWN_batch_program_use_begin(sphere); /* hack to make the following uniforms stick */ + GWN_batch_uniform_4fv(sphere, "color", fcolor); fac1 = (length - head) / length; fac2 = (length - tail) / length; @@ -1093,23 +1093,23 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co gpuTranslate3f(0.0f, 0.0f, length - tail); gpuScaleUniform(size1); - Batch_draw(sphere); + GWN_batch_draw(sphere); gpuPopMatrix(); gpuPushMatrix(); gpuTranslate3f(0.0f, 0.0f, head); gpuScaleUniform(size2); - Batch_draw(sphere); + GWN_batch_draw(sphere); gpuPopMatrix(); /* draw cynlinder between spheres */ glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, -1.0f); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int nor = VertexFormat_add_attrib(format, "nor", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int nor = GWN_vertformat_attr_add(format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_SIMPLE_LIGHTING); immUniformColor4fv(fcolor); @@ -1129,7 +1129,7 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co gpuTranslate3f(0.0f, 0.0f, (head + length - tail) / 2.0f); gpuScaleUniform(size1); - Batch_draw(sphere); + GWN_batch_draw(sphere); } gpuPopMatrix(); @@ -1145,8 +1145,8 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned else length = ebone->length; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); gpuPushMatrix(); gpuScaleUniform(length); @@ -1169,7 +1169,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned if (id != -1) GPU_select_load_id(id | BONESEL_BONE); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3f(pos, 0.0f, 1.0f, 0.0f); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immEnd(); @@ -1184,7 +1184,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned if (G.f & G_PICKSEL) GPU_select_load_id(id | BONESEL_ROOT); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immEnd(); } @@ -1193,7 +1193,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned if (G.f & G_PICKSEL) GPU_select_load_id(id | BONESEL_TIP); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3f(pos, 0.0f, 1.0f, 0.0f); immEnd(); @@ -1221,7 +1221,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(fcolor); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3f(pos, 0.0f, 1.0f, 0.0f); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immEnd(); @@ -1237,7 +1237,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned else UI_GetThemeColor4fv(TH_VERTEX, fcolor); } immUniformColor4fv(fcolor); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immEnd(); } @@ -1250,7 +1250,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned else UI_GetThemeColor4fv(TH_VERTEX, fcolor); } immUniformColor4fv(fcolor); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3f(pos, 0.0f, 1.0f, 0.0f); immEnd(); } @@ -1451,8 +1451,8 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float length, int segments) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(fcolor); @@ -1466,7 +1466,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len gpuPushMatrix(); gpuMultMatrix(bbone->mat); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immVertex3f(pos, 0.0f, dlen, 0.0f); immEnd(); @@ -1477,7 +1477,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len else { gpuPushMatrix(); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immVertex3f(pos, 0.0f, length, 0.0f); immEnd(); @@ -1632,7 +1632,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp) bConstraint *con; bPoseChannel *parchan; - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_COLOR); @@ -1677,7 +1677,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp) } if (parchan) { - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(shdr_pos, ik_tip); immVertex3fv(shdr_pos, parchan->pose_head); immEnd(); @@ -1703,7 +1703,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp) } /* Only draw line in case our chain is more than one bone long! */ if (parchan != pchan) { /* XXX revise the breaking conditions to only stop at the tail? */ - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(shdr_pos, ik_tip); immVertex3fv(shdr_pos, parchan->pose_head); immEnd(); @@ -1750,7 +1750,7 @@ static void draw_dof_ellipse(unsigned int pos, float ax, float az) immUniformColor4ub(70, 70, 70, 50); - immBegin(PRIM_TRIANGLES, tri*3); + immBegin(GWN_PRIM_TRIS, tri*3); pz = 0.0f; for (i = 1; i < n; i++) { z = staticSine[i]; @@ -1785,7 +1785,7 @@ static void draw_dof_ellipse(unsigned int pos, float ax, float az) immUniformColor3ub(0, 0, 0); - immBegin(PRIM_LINE_STRIP, n); + immBegin(GWN_PRIM_LINE_STRIP, n); for (i = 0; i < n; i++) imm_sphere_project(pos, staticSine[n - i - 1] * ax, staticSine[i] * az); immEnd(); @@ -1797,8 +1797,8 @@ static void draw_pose_dofs(Object *ob) bPoseChannel *pchan; Bone *bone; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -1863,7 +1863,7 @@ static void draw_pose_dofs(Object *ob) gpuRotateAxis(theta, 'Z'); immUniformColor3ub(50, 50, 255); /* blue, Z axis limit */ - immBegin(PRIM_LINE_STRIP, 33); + immBegin(GWN_PRIM_LINE_STRIP, 33); for (a = -16; a <= 16; a++) { /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */ float fac = ((float)a) / 16.0f * 0.5f; @@ -1888,7 +1888,7 @@ static void draw_pose_dofs(Object *ob) gpuRotateAxis(theta, 'X'); immUniformColor3ub(255, 50, 50); /* Red, X axis limit */ - immBegin(PRIM_LINE_STRIP, 33); + immBegin(GWN_PRIM_LINE_STRIP, 33); for (a = -16; a <= 16; a++) { /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */ float fac = ((float)a) / 16.0f * 0.5f; @@ -2207,7 +2207,7 @@ static void draw_pose_bones(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion * * - only if V3D_HIDE_HELPLINES is enabled... */ if ((do_dashed & DASH_HELP_LINES) && ((bone->flag & BONE_CONNECTED) == 0)) { - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_COLOR); @@ -2225,7 +2225,7 @@ static void draw_pose_bones(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion * immUniformThemeColor(TH_WIRE); } - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(shdr_pos, pchan->parent->pose_tail); immVertex3fv(shdr_pos, pchan->pose_head); immEnd(); @@ -2512,7 +2512,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt) /* offset to parent */ if (eBone->parent) { - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); GPU_select_load_id(-1); /* -1 here is OK! */ @@ -2527,7 +2527,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt) immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(shdr_pos, eBone->parent->tail); immVertex3fv(shdr_pos, eBone->head); immEnd(); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 126217057e5..f41602f7899 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -429,7 +429,7 @@ static const float cosval[CIRCLE_RESOL] = { */ static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3], float size, int axis, unsigned pos) { - PrimitiveType line_type = PRIM_LINES; + Gwn_PrimType line_type = GWN_PRIM_LINES; float buffer[4][3]; int n = 0; @@ -481,7 +481,7 @@ static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3] break; case 2: /* z axis */ - line_type = PRIM_LINE_STRIP; + line_type = GWN_PRIM_LINE_STRIP; /* start at top left */ negate_v3_v3(v1, dx); @@ -530,7 +530,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const glLineWidth(1.0f); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (color) { immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4ubv(color); @@ -541,7 +541,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const switch (drawtype) { case OB_PLAINAXES: - immBegin(PRIM_LINES, 6); + immBegin(GWN_PRIM_LINES, 6); for (axis = 0; axis < 3; axis++) { v1[axis] = size; v2[axis] = -size; @@ -555,7 +555,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const break; case OB_SINGLE_ARROW: - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); /* in positive z direction only */ v1[2] = size; immVertex3fv(pos, v1); @@ -563,7 +563,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const immEnd(); /* square pyramid */ - immBegin(PRIM_TRIANGLES, 12); + immBegin(GWN_PRIM_TRIS, 12); v2[0] = size * 0.035f; v2[1] = size * 0.035f; v3[0] = size * -0.035f; v3[1] = size * 0.035f; @@ -613,7 +613,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const for (axis = 0; axis < 3; axis++) { const int arrow_axis = (axis == 0) ? 1 : 0; - immBegin(PRIM_LINES, 6); + immBegin(GWN_PRIM_LINES, 6); v2[axis] = size; immVertex3fv(pos, v1); @@ -725,14 +725,14 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int texCoord = GWN_vertformat_attr_add(format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_MODULATE_ALPHA); immUniform1f("alpha", ob_alpha); immUniform1i("image", 0); /* default GL_TEXTURE0 unit */ - immBegin(PRIM_TRIANGLE_FAN, 4); + immBegin(GWN_PRIM_TRI_FAN, 4); immAttrib2f(texCoord, 0.0f, 0.0f); immVertex2f(pos, rect.xmin, rect.ymin); @@ -753,7 +753,7 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char /* Draw the image outline */ glLineWidth(1.5f); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); const bool picking = dflag & DRAW_CONSTCOLOR; if (picking) { @@ -805,7 +805,7 @@ void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], un circball_array_fill(verts, cent, rad, tmat); - immBegin(PRIM_LINE_LOOP, CIRCLE_RESOL); + immBegin(GWN_PRIM_LINE_LOOP, CIRCLE_RESOL); for (int i = 0; i < CIRCLE_RESOL; ++i) { immVertex3fv(pos, verts[i]); } @@ -826,7 +826,7 @@ static void drawcentercircle(View3D *v3d, RegionView3D *UNUSED(rv3d), const floa glEnable(GL_BLEND); GPU_enable_program_point_size(); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA); immUniform1f("size", size); @@ -846,7 +846,7 @@ static void drawcentercircle(View3D *v3d, RegionView3D *UNUSED(rv3d), const floa immUniform4fv("outlineColor", outlineColor); immUniform1f("outlineWidth", outlineWidth); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, co); immEnd(); @@ -1039,7 +1039,7 @@ static void drawcube_size(float size, unsigned pos) glDrawRangeElements(GL_LINES, 0, 7, 24, GL_UNSIGNED_BYTE, indices); glDisableClientState(GL_VERTEX_ARRAY); #else - immBegin(PRIM_LINES, 24); + immBegin(GWN_PRIM_LINES, 24); for (int i = 0; i < 24; ++i) { immVertex3fv(pos, verts[indices[i]]); } @@ -1057,13 +1057,13 @@ static void drawshadbuflimits(const Lamp *la, const float mat[4][4], unsigned po madd_v3_v3v3fl(sta, mat[3], lavec, la->clipsta); madd_v3_v3v3fl(end, mat[3], lavec, la->clipend); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(pos, sta); immVertex3fv(pos, end); immEnd(); glPointSize(3.0f); - immBegin(PRIM_POINTS, 2); + immBegin(GWN_PRIM_POINTS, 2); immVertex3fv(pos, sta); immVertex3fv(pos, end); immEnd(); @@ -1138,7 +1138,7 @@ static void draw_spot_cone(Lamp *la, float x, float z, unsigned pos) const bool square = (la->mode & LA_SQUARE); - immBegin(PRIM_TRIANGLE_FAN, square ? 6 : 34); + immBegin(GWN_PRIM_TRI_FAN, square ? 6 : 34); immVertex3f(pos, 0.0f, 0.0f, -x); if (square) { @@ -1285,7 +1285,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, normalize_v3(imat[0]); normalize_v3(imat[1]); - const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + const unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); /* lamp center */ copy_v3_v3(vec, ob->obmat[3]); @@ -1329,7 +1329,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, immUniformColor3fvAlpha(color, 0.3f); immUniform4fv("outlineColor", color); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, vec); immEnd(); @@ -1345,7 +1345,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, /* color doesn't matter, so don't set */ glPointSize(lampdot_size); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, vec); immEnd(); @@ -1400,7 +1400,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, setlinestyle(3); - immBegin(PRIM_LINES, 16); + immBegin(GWN_PRIM_LINES, 16); for (axis = 0; axis < 8; axis++) { immVertex3fv(pos, v1); immVertex3fv(pos, v2); @@ -1453,7 +1453,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, {-z_abs, z_abs, x}, }; - immBegin(PRIM_LINES, 16); + immBegin(GWN_PRIM_LINES, 16); for (int i = 1; i <= 4; ++i) { immVertex3fv(pos, vertices[0]); /* apex to corner */ immVertex3fv(pos, vertices[i]); @@ -1479,7 +1479,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, } else { /* draw the angled sides of the cone */ - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex3fv(pos, vvec); immVertex3fv(pos, vec); immVertex3fv(pos, lvec); @@ -1507,7 +1507,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, /* draw clip start, useful for wide cones where its not obvious where the start is */ gpuTranslate3f(0.0f, 0.0f, -x); /* reverse translation above */ - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); if (la->type == LA_SPOT && (la->mode & LA_SHAD_BUF)) { float lvec_clip[3]; float vvec_clip[3]; @@ -1528,7 +1528,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, } else if (ELEM(la->type, LA_HEMI, LA_SUN)) { /* draw the line from the circle along the dist */ - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); vec[2] = -circrad; immVertex3fv(pos, vec); vec[2] = -la->dist; @@ -1548,7 +1548,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, float v[3] = {0.0f, 0.0f, 0.0f}; zdist = 0.02f; - immBegin(PRIM_LINE_STRIP, 6); + immBegin(GWN_PRIM_LINE_STRIP, 6); for (steps = 0; steps < 6; steps++) { if (axis == 0 || axis == 1) { /* x axis up, x axis down */ @@ -1587,7 +1587,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, else if (la->area_shape == LA_AREA_RECT) imm_draw_line_box_3d(pos, -la->area_size * 0.5f, -la->area_sizey * 0.5f, la->area_size * 0.5f, la->area_sizey * 0.5f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3f(pos, 0.0f, 0.0f, -circrad); immVertex3f(pos, 0.0f, 0.0f, -la->dist); immEnd(); @@ -1613,14 +1613,14 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, if (vec[2] > 0) vec[2] -= circrad; else vec[2] += circrad; - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(pos, vec); vec[2] = 0; immVertex3fv(pos, vec); immEnd(); glPointSize(2.0f); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, vec); immEnd(); @@ -1632,7 +1632,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, static void draw_limit_line(float sta, float end, const short dflag, const unsigned char col[3], unsigned pos) { - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3f(pos, 0.0f, 0.0f, -sta); immVertex3f(pos, 0.0f, 0.0f, -end); immEnd(); @@ -1641,7 +1641,7 @@ static void draw_limit_line(float sta, float end, const short dflag, const unsig glPointSize(3.0f); /* would like smooth round points here, but that means binding another shader... * if it's really desired, pull these points into their own function to be called after */ - immBegin(PRIM_POINTS, 2); + immBegin(GWN_PRIM_POINTS, 2); if ((dflag & DRAW_CONSTCOLOR) == 0) { immUniformColor3ubv(col); } @@ -1656,7 +1656,7 @@ static void draw_limit_line(float sta, float end, const short dflag, const unsig /* qdn: now also enabled for Blender to set focus point for defocus composite node */ static void draw_focus_cross(float dist, float size, unsigned pos) { - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex3f(pos, -size, 0.0f, -dist); immVertex3f(pos, size, 0.0f, -dist); immVertex3f(pos, 0.0f, -size, -dist); @@ -1753,7 +1753,7 @@ static void draw_viewport_object_reconstruction( } else if (v3d_drawtype > OB_WIRE) { if (v3d->bundle_drawtype == OB_EMPTY_SPHERE) { - Batch *batch; + Gwn_Batch *batch; gpuScaleUniform(0.05f); @@ -1763,17 +1763,17 @@ static void draw_viewport_object_reconstruction( if ((dflag & DRAW_CONSTCOLOR) == 0) { Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); - Batch_Uniform4f(batch, "color", - ob_wire_col[0]/255.f, - ob_wire_col[1]/255.f, - ob_wire_col[2]/255.f, 1.0f); + 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); } glLineWidth(2.0f); - Batch_draw(batch); + GWN_batch_draw(batch); } batch = Batch_get_sphere(0); @@ -1782,17 +1782,17 @@ static void draw_viewport_object_reconstruction( const float light[3] = {0.0f, 0.0f, 1.0f}; float col[3]; Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); - Batch_Uniform3fv(batch, "light", light); + GWN_batch_uniform_3fv(batch, "light", light); if (track->flag & TRACK_CUSTOMCOLOR) copy_v3_v3(col, track->color); else UI_GetThemeColor3fv(TH_BUNDLE_SOLID, col); - Batch_Uniform4f(batch, "color", col[0], col[1], col[2], 1.0f); + 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); } - Batch_draw(batch); + GWN_batch_draw(batch); } else { unsigned char color[4]; @@ -1835,14 +1835,14 @@ static void draw_viewport_object_reconstruction( if (reconstruction->camnr >= 2) { MovieReconstructedCamera *camera = reconstruction->cameras; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_CAMERA_PATH); glLineWidth(2.0f); - immBegin(PRIM_LINE_STRIP, reconstruction->camnr); + immBegin(GWN_PRIM_LINE_STRIP, reconstruction->camnr); for (int a = 0; a < reconstruction->camnr; a++, camera++) { immVertex3fv(pos, camera->mat[3]); } @@ -1895,7 +1895,7 @@ static void draw_viewport_reconstruction( /* camera frame */ static void drawcamera_frame(float vec[4][3], bool filled, unsigned pos) { - immBegin(filled ? PRIM_TRIANGLE_FAN : PRIM_LINE_LOOP, 4); + immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, 4); immVertex3fv(pos, vec[0]); immVertex3fv(pos, vec[1]); immVertex3fv(pos, vec[2]); @@ -1906,7 +1906,7 @@ static void drawcamera_frame(float vec[4][3], bool filled, unsigned pos) /* center point to camera frame */ static void drawcamera_framelines(float vec[4][3], float origin[3], unsigned pos) { - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); immVertex3fv(pos, origin); immVertex3fv(pos, vec[0]); immVertex3fv(pos, origin); @@ -1924,7 +1924,7 @@ static void drawcamera_volume(float near_plane[4][3], float far_plane[4][3], boo drawcamera_frame(far_plane, filled, pos); if (filled) { - immBegin(PRIM_TRIANGLE_STRIP, 10); + immBegin(GWN_PRIM_TRI_STRIP, 10); immVertex3fv(pos, near_plane[0]); immVertex3fv(pos, far_plane[0]); @@ -1940,7 +1940,7 @@ static void drawcamera_volume(float near_plane[4][3], float far_plane[4][3], boo immEnd(); } else { - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); for (int i = 0; i < 4; ++i) { immVertex3fv(pos, near_plane[i]); immVertex3fv(pos, far_plane[i]); @@ -2024,7 +2024,7 @@ static void drawcamera_stereo3d( glLineStipple(2, 0xAAAA); glEnable(GL_LINE_STIPPLE); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(pos, origin[0]); immVertex3fv(pos, origin[1]); immEnd(); @@ -2180,7 +2180,7 @@ void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, BKE_camera_view_frame_ex(scene, cam, cam->drawsize, is_view, scale, asp, shift, &drawsize, vec); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) { immUniformColor3ubv(ob_wire_col); @@ -2225,10 +2225,10 @@ void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, * for active cameras. We actually draw both outline+filled * for active cameras so the wire can be seen side-on */ for (int i = 0; i < 2; i++) { - if (i == 0) immBegin(PRIM_LINE_LOOP, 3); + if (i == 0) immBegin(GWN_PRIM_LINE_LOOP, 3); else if (i == 1 && is_active) { glDisable(GL_CULL_FACE); /* TODO: declarative state tracking */ - immBegin(PRIM_TRIANGLES, 3); + immBegin(GWN_PRIM_TRIS, 3); } else break; @@ -2288,8 +2288,8 @@ void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* flag similar to draw_object() */ void drawspeaker(const unsigned char ob_wire_col[3]) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -2304,7 +2304,7 @@ void drawspeaker(const unsigned char ob_wire_col[3]) for (int j = 0; j < 3; j++) { float z = 0.25f * j - 0.125f; - immBegin(PRIM_LINE_LOOP, segments); + immBegin(GWN_PRIM_LINE_LOOP, segments); for (int i = 0; i < segments; i++) { float x = cosf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); float y = sinf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); @@ -2316,7 +2316,7 @@ void drawspeaker(const unsigned char ob_wire_col[3]) for (int j = 0; j < 4; j++) { float x = (((j + 1) % 2) * (j - 1)) * 0.5f; float y = ((j % 2) * (j - 2)) * 0.5f; - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); for (int i = 0; i < 3; i++) { if (i == 1) { x *= 0.5f; @@ -2343,7 +2343,7 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, BPoint *actbp, short s UI_GetThemeColor4fv(TH_ACTIVE_VERT, active_color); glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(PRIM_POINTS, lt->pntsw * lt->pntsv * lt->pntsu); + immBeginAtMost(GWN_PRIM_POINTS, lt->pntsw * lt->pntsv * lt->pntsu); for (int w = 0; w < lt->pntsw; w++) { int wxt = (w == 0 || w == lt->pntsw - 1); @@ -2453,11 +2453,11 @@ static void drawlattice(View3D *v3d, Object *ob, const short dflag, const unsign } } - VertexFormat *format = immVertexFormat(); - unsigned int color, pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int color, pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (actdef_wcol) { - color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); + color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); } else { @@ -2477,7 +2477,7 @@ static void drawlattice(View3D *v3d, Object *ob, const short dflag, const unsign } glLineWidth(1.0f); - immBeginAtMost(PRIM_LINES, lt->pntsw * lt->pntsv * lt->pntsu * 6); + immBeginAtMost(GWN_PRIM_LINES, lt->pntsw * lt->pntsv * lt->pntsu * 6); for (w = 0; w < lt->pntsw; w++) { int wxt = (w == 0 || w == lt->pntsw - 1); @@ -2510,9 +2510,9 @@ static void drawlattice(View3D *v3d, Object *ob, const short dflag, const unsign if (v3d->zbuf) glDisable(GL_DEPTH_TEST); - VertexFormat *v_format = immVertexFormat(); - unsigned int v_pos = VertexFormat_add_attrib(v_format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int v_color = VertexFormat_add_attrib(v_format, "color", COMP_F32, 4, KEEP_FLOAT); + Gwn_VertFormat *v_format = immVertexFormat(); + unsigned int v_pos = GWN_vertformat_attr_add(v_format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int v_color = GWN_vertformat_attr_add(v_format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR); @@ -2557,7 +2557,7 @@ static void drawSelectedVertices__mapFunc(void *userData, int index, const float static void drawSelectedVertices(DerivedMesh *dm, Mesh *me) { drawDMVertSel_userData data; - VertexFormat *format = immVertexFormat(); + Gwn_VertFormat *format = immVertexFormat(); /* TODO define selected color */ unsigned char base_col[3] = {0x0, 0x0, 0x0}; @@ -2572,14 +2572,14 @@ static void drawSelectedVertices(DerivedMesh *dm, Mesh *me) data.col[1] = sel_col; data.col[2] = act_col; - data.color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); - data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + data.color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); + data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (dm->getNumVerts(dm) == 0) return; immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBeginAtMost(PRIM_POINTS, dm->getNumVerts(dm)); + immBeginAtMost(GWN_PRIM_POINTS, dm->getNumVerts(dm)); dm->foreachMappedVert(dm, drawSelectedVertices__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -2639,12 +2639,12 @@ static void draw_dm_face_normals__mapFunc(void *userData, int index, const float static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, Object *ob, DerivedMesh *dm, int theme_id) { - VertexFormat *format = immVertexFormat(); + Gwn_VertFormat *format = immVertexFormat(); drawDMNormal_userData data; data.bm = em->bm; data.normalsize = scene->toolsettings->normalsize; - data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); calcDrawDMNormalScale(ob, &data); @@ -2653,7 +2653,7 @@ static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(theme_id); - immBeginAtMost(PRIM_LINES, dm->getNumPolys(dm) * 2); + immBeginAtMost(GWN_PRIM_LINES, dm->getNumPolys(dm) * 2); dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, &data, DM_FOREACH_USE_NORMAL); immEnd(); @@ -2673,19 +2673,19 @@ static void draw_dm_face_centers__mapFunc(void *userData, int index, const float } static void draw_dm_face_centers(BMEditMesh *em, DerivedMesh *dm, bool select, const unsigned char fcol[3]) { - VertexFormat *format = immVertexFormat(); + Gwn_VertFormat *format = immVertexFormat(); drawBMSelect_userData data; data.bm = em->bm; data.select = select; - data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (dm->getNumPolys(dm) == 0) return; immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(fcol); - immBeginAtMost(PRIM_POINTS, dm->getNumPolys(dm)); + immBeginAtMost(GWN_PRIM_POINTS, dm->getNumPolys(dm)); dm->foreachMappedFaceCenter(dm, draw_dm_face_centers__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -2726,11 +2726,11 @@ static void draw_dm_vert_normals__mapFunc(void *userData, int index, const float static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, Object *ob, DerivedMesh *dm, int theme_id) { drawDMNormal_userData data; - VertexFormat *format = immVertexFormat(); + Gwn_VertFormat *format = immVertexFormat(); data.bm = em->bm; data.normalsize = scene->toolsettings->normalsize; - data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); calcDrawDMNormalScale(ob, &data); @@ -2739,7 +2739,7 @@ static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(theme_id); - immBeginAtMost(PRIM_LINES, dm->getNumVerts(dm) * 2); + immBeginAtMost(GWN_PRIM_LINES, dm->getNumVerts(dm) * 2); dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, &data, DM_FOREACH_USE_NORMAL); immEnd(); @@ -2785,14 +2785,14 @@ static void draw_dm_verts__mapFunc(void *userData, int index, const float co[3], static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVert *eve_act, RegionView3D *rv3d, const unsigned char col[4]) { - VertexFormat *format = immVertexFormat(); + Gwn_VertFormat *format = immVertexFormat(); drawDMVerts_userData data; data.sel = sel; data.eve_act = eve_act; data.bm = em->bm; - data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - data.color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + data.color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); /* Cache theme values */ UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, data.th_editmesh_active); @@ -2813,7 +2813,7 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(PRIM_POINTS, dm->getNumVerts(dm)); + immBeginAtMost(GWN_PRIM_POINTS, dm->getNumVerts(dm)); dm->foreachMappedVert(dm, draw_dm_verts__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -2823,7 +2823,7 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer data.cd_vskin_offset = CustomData_get_offset(&em->bm->vdata, CD_MVERT_SKIN); if (data.cd_vskin_offset != -1) { - data.pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + data.pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4ubv(data.th_skin_root); @@ -3148,7 +3148,7 @@ static void draw_dm_loop_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv data.bm = em->bm; data.normalsize = scene->toolsettings->normalsize; - data.pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + data.pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (dm->getNumLoops(dm) == 0) return; @@ -3157,7 +3157,7 @@ static void draw_dm_loop_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv calcDrawDMNormalScale(ob, &data); - immBeginAtMost(PRIM_LINES, dm->getNumLoops(dm) * 2); + immBeginAtMost(GWN_PRIM_LINES, dm->getNumLoops(dm) * 2); dm->foreachMappedLoop(dm, draw_dm_loop_normals__mapFunc, &data, DM_FOREACH_USE_NORMAL); immEnd(); @@ -3327,15 +3327,15 @@ static void draw_dm_bweights(BMEditMesh *em, Scene *scene, DerivedMesh *dm) /* is that ever true? */ if (data.cd_layer_offset != -1) { - VertexFormat *format = immVertexFormat(); - data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - data.col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) + 2.0f); - immBeginAtMost(PRIM_POINTS, dm->getNumVerts(dm)); + immBeginAtMost(GWN_PRIM_POINTS, dm->getNumVerts(dm)); dm->foreachMappedVert(dm, draw_dm_bweights__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -4141,7 +4141,7 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D Object *UNUSED(ob), Mesh *me, BMEditMesh *UNUSED(em), DerivedMesh *UNUSED(cageDM), DerivedMesh *UNUSED(finalDM), const char UNUSED(dt)) { /* for now... something simple! */ - Batch *surface = DRW_mesh_batch_cache_get_all_triangles(me); + Gwn_Batch *surface = DRW_mesh_batch_cache_get_all_triangles(me); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); @@ -4152,16 +4152,16 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D glDepthMask(GL_FALSE); Batch_set_builtin_program(surface, GPU_SHADER_3D_UNIFORM_COLOR); - Batch_Uniform4f(surface, "color", 1.0f, 0.5f, 0.0f, 0.5f); - Batch_draw(surface); + GWN_batch_uniform_4f(surface, "color", 1.0f, 0.5f, 0.0f, 0.5f); + GWN_batch_draw(surface); #if 0 /* until I understand finalDM better */ if (finalDM != cageDM) { puts("finalDM != cageDM"); - Batch *finalSurface = MBC_get_all_triangles(finalDM); + Gwn_Batch *finalSurface = MBC_get_all_triangles(finalDM); Batch_set_builtin_program(finalSurface, GPU_SHADER_3D_UNIFORM_COLOR); - Batch_Uniform4f(finalSurface, "color", 0.0f, 0.0f, 0.0f, 0.05f); - Batch_draw(finalSurface); + GWN_batch_uniform_4f(finalSurface, "color", 0.0f, 0.0f, 0.0f, 0.05f); + GWN_batch_draw(finalSurface); } #endif @@ -4172,46 +4172,46 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D * TODO: draw edit object last to avoid this mess */ Batch_set_builtin_program(surface, GPU_SHADER_3D_DEPTH_ONLY); - Batch_draw(surface); + GWN_batch_draw(surface); if (GLEW_VERSION_3_2) { #if 0 - Batch *overlay = DRW_mesh_batch_cache_get_overlay_edges(me); + Gwn_Batch *overlay = DRW_mesh_batch_cache_get_overlay_edges(me); Batch_set_builtin_program(overlay, GPU_SHADER_EDGES_OVERLAY); - Batch_Uniform2f(overlay, "viewportSize", ar->winx, ar->winy); - Batch_draw(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); /* use these defaults: * const float edgeColor[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; - * Batch_Uniform4f(surface, "fillColor", edgeColor[0], edgeColor[1], edgeColor[2], 0.0f); - * Batch_Uniform4fv(surface, "outlineColor", edgeColor); - * Batch_Uniform1f(surface, "outlineWidth", 1.0f); + * GWN_batch_uniform_4f(surface, "fillColor", edgeColor[0], edgeColor[1], edgeColor[2], 0.0f); + * GWN_batch_uniform_4fv(surface, "outlineColor", edgeColor); + * GWN_batch_uniform_1f(surface, "outlineWidth", 1.0f); */ - Batch_Uniform2f(surface, "viewportSize", ar->winx, ar->winy); - Batch_draw(surface); + GWN_batch_uniform_2f(surface, "viewportSize", ar->winx, ar->winy); + GWN_batch_draw(surface); #endif } else { - Batch *edges = DRW_mesh_batch_cache_get_all_edges(me); + Gwn_Batch *edges = DRW_mesh_batch_cache_get_all_edges(me); Batch_set_builtin_program(edges, GPU_SHADER_3D_UNIFORM_COLOR); - Batch_Uniform4f(edges, "color", 0.0f, 0.0f, 0.0f, 1.0f); + GWN_batch_uniform_4f(edges, "color", 0.0f, 0.0f, 0.0f, 1.0f); glEnable(GL_LINE_SMOOTH); glLineWidth(1.5f); - Batch_draw(edges); + GWN_batch_draw(edges); glDisable(GL_LINE_SMOOTH); } #if 0 /* looks good even without points */ - Batch *verts = MBC_get_all_verts(me); + 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); - Batch_Uniform4f(verts, "color", 0.0f, 0.0f, 0.0f, 1.0f); - Batch_Uniform1f(verts, "size", UI_GetThemeValuef(TH_VERTEX_SIZE) * 1.5f); - Batch_draw(verts); + 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); glDisable(GL_BLEND); #endif @@ -4257,30 +4257,30 @@ static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object UI_GetThemeColor4fv((is_active ? TH_ACTIVE : TH_SELECT), outline_color); #if 1 /* new version that draws only silhouette edges */ - Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me); + 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); /* 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); - Batch_Uniform3fv(fancy_edges, "eye", eye); + GWN_batch_uniform_3fv(fancy_edges, "eye", eye); } else { Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP); } - Batch_Uniform1b(fancy_edges, "drawFront", false); - Batch_Uniform1b(fancy_edges, "drawBack", false); - Batch_Uniform1b(fancy_edges, "drawSilhouette", true); - Batch_Uniform4fv(fancy_edges, "silhouetteColor", outline_color); + GWN_batch_uniform_1b(fancy_edges, "drawFront", false); + GWN_batch_uniform_1b(fancy_edges, "drawBack", false); + GWN_batch_uniform_1b(fancy_edges, "drawSilhouette", true); + GWN_batch_uniform_4fv(fancy_edges, "silhouetteColor", outline_color); - Batch_draw(fancy_edges); + GWN_batch_draw(fancy_edges); #else /* alternate version that matches look of old viewport (but more efficient) */ - Batch *batch = MBC_get_all_edges(dm); + Gwn_Batch *batch = MBC_get_all_edges(dm); Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); - Batch_Uniform4fv(batch, "color", outline_color); - Batch_draw(batch); + GWN_batch_uniform_4fv(batch, "color", outline_color); + GWN_batch_draw(batch); #endif glDepthMask(GL_TRUE); @@ -4781,14 +4781,14 @@ static void draw_mesh_fancy_new(Scene *scene, SceneLayer *sl, ARegion *ar, View3 #if 1 /* fancy wireframes */ - Batch *fancy_edges = DRW_mesh_batch_cache_get_fancy_edges(me); + 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); /* 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); - Batch_Uniform3fv(fancy_edges, "eye", eye); + GWN_batch_uniform_3fv(fancy_edges, "eye", eye); } else { Batch_set_builtin_program(fancy_edges, GPU_SHADER_EDGES_FRONT_BACK_PERSP); @@ -4799,35 +4799,35 @@ static void draw_mesh_fancy_new(Scene *scene, SceneLayer *sl, ARegion *ar, View3 float outlineColor[4]; make_color_variations(ob_wire_col, backColor, frontColor, outlineColor, other_obedit); - Batch_Uniform4fv(fancy_edges, "frontColor", frontColor); - Batch_Uniform4fv(fancy_edges, "backColor", backColor); - Batch_Uniform1b(fancy_edges, "drawFront", true); - Batch_Uniform1b(fancy_edges, "drawBack", true); /* false here = backface cull */ - Batch_Uniform1b(fancy_edges, "drawSilhouette", false); + GWN_batch_uniform_4fv(fancy_edges, "frontColor", frontColor); + GWN_batch_uniform_4fv(fancy_edges, "backColor", backColor); + GWN_batch_uniform_1b(fancy_edges, "drawFront", true); + GWN_batch_uniform_1b(fancy_edges, "drawBack", true); /* false here = backface cull */ + GWN_batch_uniform_1b(fancy_edges, "drawSilhouette", false); - Batch_draw(fancy_edges); + GWN_batch_draw(fancy_edges); /* extra oomph for the silhouette contours */ glLineWidth(2.0f); - Batch_use_program(fancy_edges); /* hack to make the following uniforms stick */ - Batch_Uniform1b(fancy_edges, "drawFront", false); - Batch_Uniform1b(fancy_edges, "drawBack", false); - Batch_Uniform1b(fancy_edges, "drawSilhouette", true); - Batch_Uniform4fv(fancy_edges, "silhouetteColor", outlineColor); + GWN_batch_program_use_begin(fancy_edges); /* hack to make the following uniforms stick */ + GWN_batch_uniform_1b(fancy_edges, "drawFront", false); + GWN_batch_uniform_1b(fancy_edges, "drawBack", false); + GWN_batch_uniform_1b(fancy_edges, "drawSilhouette", true); + GWN_batch_uniform_4fv(fancy_edges, "silhouetteColor", outlineColor); - Batch_draw(fancy_edges); + GWN_batch_draw(fancy_edges); #else /* simple wireframes */ - Batch *batch = MBC_get_all_edges(dm); + Gwn_Batch *batch = MBC_get_all_edges(dm); Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); float color[4]; rgba_uchar_to_float(color, ob_wire_col); - Batch_Uniform4fv(batch, "color", color); + GWN_batch_uniform_4fv(batch, "color", color); - Batch_draw(batch); + GWN_batch_draw(batch); #endif } else if (((is_obact && ob->mode & OB_MODE_TEXTURE_PAINT)) || @@ -5121,23 +5121,23 @@ static bool UNUSED_FUNCTION(draw_mesh_object_new)(Scene *scene, SceneLayer *sl, /* ************** DRAW DISPLIST ****************** */ -static void drawDispListVerts(PrimitiveType prim_type, const void *data, unsigned int vert_ct, const unsigned char wire_col[3]) +static void drawDispListVerts(Gwn_PrimType prim_type, const void *data, unsigned int vert_ct, const unsigned char wire_col[3]) { - VertexFormat format = {0}; - unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat format = {0}; + unsigned int pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - VertexBuffer *vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, vert_ct); + Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, vert_ct); - VertexBuffer_fill_attrib(vbo, pos_id, data); + GWN_vertbuf_attr_fill(vbo, pos_id, data); - Batch *batch = Batch_create(prim_type, vbo, NULL); + Gwn_Batch *batch = GWN_batch_create(prim_type, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); if (wire_col) { - Batch_Uniform4f(batch, "color", wire_col[0]/255.0f, wire_col[1]/255.0f, wire_col[2]/255.0f, 1.0f); + GWN_batch_uniform_4f(batch, "color", wire_col[0] / 255.0f, wire_col[1] / 255.0f, wire_col[2] / 255.0f, 1.0f); } - Batch_draw(batch); - Batch_discard_all(batch); + GWN_batch_draw(batch); + GWN_batch_discard_all(batch); } /* convert dispList with elem indices to batch, only support triangles and quads @@ -5149,59 +5149,59 @@ static void drawDispListElem( const float *data, const float *ndata, unsigned int data_len, const int *elem, unsigned int elem_len, const unsigned char wire_col[3]) { - VertexFormat format = {0}; + Gwn_VertFormat format = {0}; int i; const int *idx = elem; unsigned int pos_id, nor_id; - pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (ndata) { if (ndata_is_single) { /* pass */ } else { - nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT); + nor_id = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } } - ElementListBuilder elb; - ElementListBuilder_init(&elb, PRIM_TRIANGLES, (quads) ? elem_len * 2 : elem_len, 0xffffffff); + Gwn_IndexBufBuilder elb; + GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, (quads) ? elem_len * 2 : elem_len, 0xffffffff); if (quads) { for (i = elem_len; i; --i, idx += 4) { - add_triangle_vertices(&elb, idx[0], idx[1], idx[2]); - add_triangle_vertices(&elb, idx[0], idx[2], idx[3]); + GWN_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]); + GWN_indexbuf_add_tri_verts(&elb, idx[0], idx[2], idx[3]); } } else { for (i = elem_len; i; --i, idx += 3) { - add_triangle_vertices(&elb, idx[0], idx[1], idx[2]); + GWN_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]); } } - VertexBuffer *vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, data_len); + Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, data_len); - VertexBuffer_fill_attrib(vbo, pos_id, data); + GWN_vertbuf_attr_fill(vbo, pos_id, data); if (ndata) { if (ndata_is_single) { /* TODO: something like glNormal for a single value */ } else { - VertexBuffer_fill_attrib(vbo, nor_id, ndata); + GWN_vertbuf_attr_fill(vbo, nor_id, ndata); } } - Batch *batch = Batch_create(PRIM_TRIANGLES, vbo, ElementList_build(&elb)); + Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_TRIS, vbo, GWN_indexbuf_build(&elb)); Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); if (wire_col) { - Batch_Uniform4f(batch, "color", wire_col[0]/255.0f, wire_col[1]/255.0f, wire_col[2]/255.0f, 1.0f); + GWN_batch_uniform_4f(batch, "color", wire_col[0] / 255.0f, wire_col[1] / 255.0f, wire_col[2] / 255.0f, 1.0f); } - Batch_Uniform4f(batch, "color", 0.8f, 0.8f, 0.8f, 1.0f); - Batch_Uniform3f(batch, "light", 0.0f, 0.0f, 1.0f); - Batch_draw(batch); - Batch_discard_all(batch); + GWN_batch_uniform_4f(batch, "color", 0.8f, 0.8f, 0.8f, 1.0f); + GWN_batch_uniform_3f(batch, "light", 0.0f, 0.0f, 1.0f); + GWN_batch_draw(batch); + GWN_batch_discard_all(batch); } /** @@ -5229,20 +5229,20 @@ static bool drawDispListwire_ex(ListBase *dlbase, unsigned int dl_type_mask, con switch (dl->type) { case DL_SEGM: for (parts = 0; parts < dl->parts; parts++) - drawDispListVerts(PRIM_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col); + drawDispListVerts(GWN_PRIM_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col); break; case DL_POLY: for (parts = 0; parts < dl->parts; parts++) - drawDispListVerts(PRIM_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col); + drawDispListVerts(GWN_PRIM_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col); break; case DL_SURF: for (parts = 0; parts < dl->parts; parts++) { if (dl->flag & DL_CYCL_U) - drawDispListVerts(PRIM_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col); + drawDispListVerts(GWN_PRIM_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col); else - drawDispListVerts(PRIM_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col); + drawDispListVerts(GWN_PRIM_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col); } float *data_aligned = MEM_mallocN(sizeof(float) * 3 * dl->parts, "aligned data"); @@ -5260,9 +5260,9 @@ static bool drawDispListwire_ex(ListBase *dlbase, unsigned int dl_type_mask, con } if (dl->flag & DL_CYCL_V) - drawDispListVerts(PRIM_LINE_LOOP, data_aligned, dl->parts, wire_col); + drawDispListVerts(GWN_PRIM_LINE_LOOP, data_aligned, dl->parts, wire_col); else - drawDispListVerts(PRIM_LINE_STRIP, data_aligned, dl->parts, wire_col); + drawDispListVerts(GWN_PRIM_LINE_STRIP, data_aligned, dl->parts, wire_col); } if (data_aligned) @@ -5328,7 +5328,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, const short UNUSED(dflag col = -1; } - drawDispListVerts(PRIM_LINE_STRIP, data, dl->nr, ob_wire_col); + drawDispListVerts(GWN_PRIM_LINE_STRIP, data, dl->nr, ob_wire_col); } break; case DL_POLY: @@ -5338,7 +5338,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, const short UNUSED(dflag col = -1; } - drawDispListVerts(PRIM_LINE_LOOP, data, dl->nr, ob_wire_col); + drawDispListVerts(GWN_PRIM_LINE_LOOP, data, dl->nr, ob_wire_col); } break; case DL_SURF: @@ -5621,47 +5621,47 @@ static bool drawDispList(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D /* *********** drawing for particles ************* */ /* stride : offset size in bytes * col[4] : the color to use when *color is NULL, can be also NULL */ -static void draw_vertex_array(PrimitiveType prim_type, const float *vert, const float *nor, const float *color, int stride, int vert_ct, float col[4]) +static void draw_vertex_array(Gwn_PrimType prim_type, const float *vert, const float *nor, const float *color, int stride, int vert_ct, float col[4]) { - VertexFormat format = {0}; + Gwn_VertFormat format = {0}; unsigned int pos_id, nor_id, col_id; - pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); - if (nor) nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT); - if (color) col_id = VertexFormat_add_attrib(&format, "color", COMP_F32, 3, KEEP_FLOAT); + pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + if (nor) nor_id = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + if (color) col_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - VertexBuffer *vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, vert_ct); + Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, vert_ct); if (stride == 0) { - VertexBuffer_fill_attrib(vbo, pos_id, vert); - if (nor) VertexBuffer_fill_attrib(vbo, nor_id, nor); - if (color) VertexBuffer_fill_attrib(vbo, col_id, color); + GWN_vertbuf_attr_fill(vbo, pos_id, vert); + if (nor) GWN_vertbuf_attr_fill(vbo, nor_id, nor); + if (color) GWN_vertbuf_attr_fill(vbo, col_id, color); } else { - VertexBuffer_fill_attrib_stride(vbo, pos_id, stride, vert); - if (nor) VertexBuffer_fill_attrib_stride(vbo, nor_id, stride, nor); - if (color) VertexBuffer_fill_attrib_stride(vbo, col_id, stride, color); + GWN_vertbuf_attr_fill_stride(vbo, pos_id, stride, vert); + if (nor) GWN_vertbuf_attr_fill_stride(vbo, nor_id, stride, nor); + if (color) GWN_vertbuf_attr_fill_stride(vbo, col_id, stride, color); } - Batch *batch = Batch_create(prim_type, vbo, NULL); + Gwn_Batch *batch = GWN_batch_create(prim_type, vbo, NULL); if (nor && color) { Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR); - Batch_Uniform3f(batch, "light", 0.0f, 0.0f, 1.0f); + GWN_batch_uniform_3f(batch, "light", 0.0f, 0.0f, 1.0f); } else if (nor) { Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); - Batch_Uniform3f(batch, "light", 0.0f, 0.0f, 1.0f); - if (col) Batch_Uniform4fv(batch, "color", col); + 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); } else { Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); - if (col) Batch_Uniform4fv(batch, "color", col); + if (col) GWN_batch_uniform_4fv(batch, "color", col); } - Batch_draw(batch); - Batch_discard_all(batch); + GWN_batch_draw(batch); + GWN_batch_discard_all(batch); } static void draw_particle_arrays_new(int draw_as, int ob_dt, int select, @@ -5672,10 +5672,10 @@ static void draw_particle_arrays_new(int draw_as, int ob_dt, int select, switch (draw_as) { case PART_DRAW_AXIS: case PART_DRAW_CROSS: - draw_vertex_array(PRIM_LINES, vert, nor, color, 0, 6 * totpoint, col); + draw_vertex_array(GWN_PRIM_LINES, vert, nor, color, 0, 6 * totpoint, col); break; case PART_DRAW_LINE: - draw_vertex_array(PRIM_LINES, vert, nor, color, 0, 2 * totpoint, col); + draw_vertex_array(GWN_PRIM_LINES, vert, nor, color, 0, 2 * totpoint, col); break; case PART_DRAW_BB: if (ob_dt <= OB_WIRE || select) @@ -5683,10 +5683,10 @@ static void draw_particle_arrays_new(int draw_as, int ob_dt, int select, else glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - draw_vertex_array(PRIM_TRIANGLES, vert, nor, color, 0, 6 * totpoint, col); + draw_vertex_array(GWN_PRIM_TRIS, vert, nor, color, 0, 6 * totpoint, col); break; default: - draw_vertex_array(PRIM_POINTS, vert, nor, color, 0, totpoint, col); + draw_vertex_array(GWN_PRIM_POINTS, vert, nor, color, 0, totpoint, col); break; } } @@ -6160,7 +6160,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv } else { if ((draw_as == PART_DRAW_CIRC) || (part->draw & PART_DRAW_SIZE)) { - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); imm_cpack(0xFFFFFF); } @@ -6329,12 +6329,12 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv path = cache[a]; if (path->segments > 0) { if (((dflag & DRAW_CONSTCOLOR) == 0) && (part->draw_col == PART_DRAW_COL_MAT)) { - draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL); + draw_vertex_array(GWN_PRIM_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL); } else { float color[4]; rgba_uchar_to_float(color, tcol); - draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color); + draw_vertex_array(GWN_PRIM_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color); } } } @@ -6349,7 +6349,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv /* XXX use proper theme color here */ float color[4] = {0.58f, 0.67f, 1.0f, 1.0f}; - draw_vertex_array(PRIM_LINE_STRIP, hkey->world_co, NULL, NULL, sizeof(HairKey), pa->totkey, color); + draw_vertex_array(GWN_PRIM_LINE_STRIP, hkey->world_co, NULL, NULL, sizeof(HairKey), pa->totkey, color); } } @@ -6357,7 +6357,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv MVert *mvert = hair_dm->getVertArray(hair_dm); int i; - unsigned int pos_id = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos_id = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3f(0.9f, 0.4f, 0.4f); @@ -6367,7 +6367,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv } if (count > 0) { - immBegin(PRIM_LINES, count * 2); + immBegin(GWN_PRIM_LINES, count * 2); for (a = 0, pa = psys->particles; a < totpart; a++, pa++) { for (i = 1; i < pa->totkey; ++i) { float v1[3], v2[3]; @@ -6397,14 +6397,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv int *res = clmd->hair_grid_res; int i; - unsigned int pos_id = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos_id = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (select) immUniformThemeColor(TH_ACTIVE); else immUniformThemeColor(TH_WIRE); - immBegin(PRIM_LINES, 24); + immBegin(GWN_PRIM_LINES, 24); immVertex3f(pos_id, gmin[0], gmin[1], gmin[2]); immVertex3f(pos_id, gmax[0], gmin[1], gmin[2]); immVertex3f(pos_id, gmax[0], gmin[1], gmin[2]); immVertex3f(pos_id, gmax[0], gmax[1], gmin[2]); immVertex3f(pos_id, gmax[0], gmax[1], gmin[2]); immVertex3f(pos_id, gmin[0], gmax[1], gmin[2]); @@ -6433,7 +6433,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if (count >= 2) { glEnable(GL_BLEND); - immBegin(PRIM_LINES, count); + immBegin(GWN_PRIM_LINES, count); for (i = 1; i < res[0] - 1; ++i) { float f = interpf(gmax[0], gmin[0], (float)i / (float)(res[0] - 1)); immVertex3f(pos_id, f, gmin[1], gmin[2]); immVertex3f(pos_id, f, gmax[1], gmin[2]); @@ -6470,11 +6470,11 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv path = cache[a]; if (((dflag & DRAW_CONSTCOLOR) == 0) && (part->draw_col == PART_DRAW_COL_MAT)) { - draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL); + draw_vertex_array(GWN_PRIM_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL); } else { float color[4] = {0.0f, 0.0f, 0.0f, 1.0f}; - draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color); + draw_vertex_array(GWN_PRIM_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color); } } @@ -6543,7 +6543,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if (pdd && pdd->vedata) { float color[4] = {0.75f, 0.75f, 0.75f, 1.0f}; - draw_vertex_array(PRIM_LINES, pdd->vedata, NULL, NULL, 0, 2 * totve, color); + draw_vertex_array(GWN_PRIM_LINES, pdd->vedata, NULL, NULL, 0, 2 * totve, color); } glPolygonMode(GL_FRONT, polygonmode[0]); @@ -6625,18 +6625,18 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) for (i = 0, point = edit->points; i < totpoint; i++, point++) { ParticleCacheKey *path = cache[i]; - VertexFormat format = {0}; + Gwn_VertFormat format = {0}; unsigned int pos_id, col_id, col_comp; col_comp = ((point->flag & PEP_HIDE) || timed) ? 4 : 3; - pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); - col_id = VertexFormat_add_attrib(&format, "color", COMP_F32, col_comp, KEEP_FLOAT); + pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + col_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, col_comp, GWN_FETCH_FLOAT); - VertexBuffer *vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, path->segments + 1); + Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, path->segments + 1); - VertexBuffer_fill_attrib_stride(vbo, pos_id, sizeof(ParticleCacheKey), path->co); + GWN_vertbuf_attr_fill_stride(vbo, pos_id, sizeof(ParticleCacheKey), path->co); float *pcol = pathcol; @@ -6646,7 +6646,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) pcol[3] = 0.25f; } - VertexBuffer_fill_attrib(vbo, col_id, pathcol); + GWN_vertbuf_attr_fill(vbo, col_id, pathcol); } else if (timed) { ParticleCacheKey *pkey = path; @@ -6655,18 +6655,18 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) pcol[3] = 1.0f - fabsf((float)(CFRA) -pkey->time) / (float)pset->fade_frames; } - VertexBuffer_fill_attrib(vbo, col_id, pathcol); + GWN_vertbuf_attr_fill(vbo, col_id, pathcol); } else { /* FIXME: shader wants 4 color components but the cache only contains ParticleCacheKey * So alpha is random */ - VertexBuffer_fill_attrib_stride(vbo, col_id, sizeof(ParticleCacheKey), path->col); + GWN_vertbuf_attr_fill_stride(vbo, col_id, sizeof(ParticleCacheKey), path->col); } - Batch *batch = Batch_create(PRIM_LINE_STRIP, vbo, NULL); + Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_LINE_STRIP, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR); - Batch_draw(batch); - Batch_discard_all(batch); + GWN_batch_draw(batch); + GWN_batch_discard_all(batch); } if (pathcol) { MEM_freeN(pathcol); pathcol = NULL; } @@ -6680,9 +6680,9 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) float *cd = NULL, *cdata = NULL; int totkeys_visible = 0; - VertexFormat format = {0}; - unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int col_id = VertexFormat_add_attrib(&format, "color", COMP_F32, (timed ? 4 : 3), KEEP_FLOAT); + Gwn_VertFormat format = {0}; + unsigned int pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int col_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, (timed ? 4 : 3), GWN_FETCH_FLOAT); for (i = 0, point = edit->points; i < totpoint; i++, point++) if (!(point->flag & PEP_HIDE)) @@ -6724,20 +6724,20 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) if (point->flag & PEP_HIDE || point->totkey == 0) continue; - VertexBuffer *vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, point->totkey); + Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, point->totkey); if (point->keys->flag & PEK_USE_WCO) - VertexBuffer_fill_attrib_stride(vbo, pos_id, sizeof(PTCacheEditKey), point->keys->world_co); + GWN_vertbuf_attr_fill_stride(vbo, pos_id, sizeof(PTCacheEditKey), point->keys->world_co); else - VertexBuffer_fill_attrib(vbo, pos_id, pd); + GWN_vertbuf_attr_fill(vbo, pos_id, pd); - VertexBuffer_fill_attrib(vbo, col_id, cd); + GWN_vertbuf_attr_fill(vbo, col_id, cd); - Batch *batch = Batch_create(PRIM_POINTS, vbo, NULL); + Gwn_Batch *batch = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR); - Batch_draw(batch); - Batch_discard_all(batch); + GWN_batch_draw(batch); + GWN_batch_discard_all(batch); pd += pd ? 3 * point->totkey : 0; cd += (timed ? 4 : 3) * point->totkey; @@ -6746,11 +6746,11 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) if (cdata) { MEM_freeN(cdata); cd = cdata = NULL; } } else if (pset->selectmode == SCE_SELECT_END) { - VertexFormat *format = immVertexFormat(); - unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int col_id = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int col_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBeginAtMost(PRIM_POINTS, totpoint); + immBeginAtMost(GWN_PRIM_POINTS, totpoint); for (i = 0, point = edit->points; i < totpoint; i++, point++) { if ((point->flag & PEP_HIDE) == 0 && point->totkey) { PTCacheEditKey *key = point->keys + point->totkey - 1; @@ -6782,12 +6782,12 @@ static void ob_draw_RE_motion(float com[3], float rotscale[3][3], float itw, flo float tw = itw * drw_size; float th = ith * drw_size; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBegin(PRIM_LINES, 30); + immBegin(GWN_PRIM_LINES, 30); immAttrib4ub(col, 0x7F, 0x00, 0x00, 155); root[1] = root[2] = 0.0f; @@ -6934,14 +6934,14 @@ static void drawhandlesN(Nurb *nu, const char sel, const bool hide_handles) UI_GetThemeColor3ubv(basecol + a, handle_cols[a]); } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); glLineWidth(1.0f); - immBeginAtMost(PRIM_LINES, nu->pntsu * 4); + immBeginAtMost(GWN_PRIM_LINES, nu->pntsu * 4); BezTriple *bezt = nu->bezt; int a = nu->pntsu; @@ -6990,12 +6990,12 @@ static void drawhandlesN_active(Nurb *nu) if (nu->hide) return; if (nu->type == CU_BEZIER && nu->pntsu > 0) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_ACTIVE_SPLINE); glLineWidth(2.0f); - immBeginAtMost(PRIM_LINES, nu->pntsu * 4); + immBeginAtMost(GWN_PRIM_LINES, nu->pntsu * 4); BezTriple *bezt = nu->bezt; int a = nu->pntsu; while (a--) { @@ -7033,9 +7033,9 @@ static void drawvertsN(const Nurb *nurb, const bool hide_handles, const void *ve } if (count == 0) return; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); unsigned char vert_color[3]; @@ -7047,7 +7047,7 @@ static void drawvertsN(const Nurb *nurb, const bool hide_handles, const void *ve glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(PRIM_POINTS, count); + immBeginAtMost(GWN_PRIM_POINTS, count); for (nu = nurb; nu; nu = nu->next) { @@ -7107,8 +7107,8 @@ static void drawvertsN(const Nurb *nurb, const bool hide_handles, const void *ve static void editnurb_draw_active_poly(Nurb *nu) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_ACTIVE_SPLINE); @@ -7117,8 +7117,8 @@ static void editnurb_draw_active_poly(Nurb *nu) BPoint *bp = nu->bp; for (int b = 0; b < nu->pntsv; b++) { if (nu->pntsu >= 2) { - if (nu->flagu & 1) immBegin(PRIM_LINE_LOOP, nu->pntsu); - else immBegin(PRIM_LINE_STRIP, nu->pntsu); + if (nu->flagu & 1) immBegin(GWN_PRIM_LINE_LOOP, nu->pntsu); + else immBegin(GWN_PRIM_LINE_STRIP, nu->pntsu); for (int a = 0; a < nu->pntsu; a++, bp++) { immVertex3fv(pos, bp->vec); @@ -7134,8 +7134,8 @@ static void editnurb_draw_active_poly(Nurb *nu) static void editnurb_draw_active_nurbs(Nurb *nu) { if (nu->pntsv > 0) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_ACTIVE_SPLINE); @@ -7145,7 +7145,7 @@ static void editnurb_draw_active_nurbs(Nurb *nu) if (nu->pntsv > 1) count += (nu->pntsv - 1) * nu->pntsu * 2; if (count < 2) return; - immBeginAtMost(PRIM_LINES, count); + immBeginAtMost(GWN_PRIM_LINES, count); BPoint *bp = nu->bp; for (int b = 0; b < nu->pntsv; b++) { BPoint *bp1 = bp; @@ -7186,7 +7186,7 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel) BPoint *bp, *bp1; int a, b; Curve *cu = ob->data; - VertexFormat *format; + Gwn_VertFormat *format; unsigned int pos, col; unsigned char color[3]; @@ -7203,7 +7203,7 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel) } format = immVertexFormat(); - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); glLineWidth(1.0f); @@ -7212,8 +7212,8 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel) bp = nu->bp; for (b = 0; b < nu->pntsv; b++) { if (nu->pntsu >= 2) { - if (nu->flagu & 1) immBegin(PRIM_LINE_LOOP, nu->pntsu); - else immBegin(PRIM_LINE_STRIP, nu->pntsu); + if (nu->flagu & 1) immBegin(GWN_PRIM_LINE_LOOP, nu->pntsu); + else immBegin(GWN_PRIM_LINE_STRIP, nu->pntsu); for (a = 0; a < nu->pntsu; a++, bp++) { immVertex3fv(pos, bp->vec); @@ -7233,8 +7233,8 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel) } format = immVertexFormat(); - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); // just quick guesstimate of how many verts to draw @@ -7244,7 +7244,7 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel) glLineWidth(1.0f); - immBeginAtMost(PRIM_LINES, count); + immBeginAtMost(GWN_PRIM_LINES, count); bp = nu->bp; for (b = 0; b < nu->pntsv; b++) { @@ -7367,8 +7367,8 @@ static void draw_editnurb( if ((cu->flag & CU_3D) && (ts->normalsize > 0.0015f) && (cu->drawflag & CU_HIDE_NORMALS) == 0) { BevList *bl; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_WIRE_EDIT); @@ -7392,7 +7392,7 @@ static void draw_editnurb( } if (count > 2) { - immBegin(PRIM_LINES, count); + immBegin(GWN_PRIM_LINES, count); for (bl = ob->curve_cache->bev.first, nu = nurb; nu && bl; bl = bl->next, nu = nu->next) { BevPoint *bevp = bl->bevpoints; int nr = bl->nr; @@ -7443,12 +7443,12 @@ static void draw_editnurb( static void draw_editfont_textcurs(RegionView3D *rv3d, float textcurs[4][2]) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); ED_view3d_polygon_offset(rv3d, -1.0); set_inverted_drawing(1); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); imm_cpack(0); - immBegin(PRIM_TRIANGLE_FAN, 4); + immBegin(GWN_PRIM_TRI_FAN, 4); immVertex2fv(pos, textcurs[0]); immVertex2fv(pos, textcurs[1]); immVertex2fv(pos, textcurs[2]); @@ -7480,7 +7480,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3 } if (cu->linewidth != 0.0f) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_WIRE_EDIT); copy_v3_v3(vec1, ob->orig); @@ -7490,7 +7490,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3 vec1[1] += cu->linedist * cu->fsize; vec2[1] -= cu->lines * cu->linedist * cu->fsize; setlinestyle(3); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(pos, vec1); immVertex2fv(pos, vec2); immEnd(); @@ -7501,13 +7501,13 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3 setlinestyle(3); for (int i = 0; i < cu->totbox; i++) { if (cu->tb[i].w != 0.0f) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(i == (cu->actbox - 1) ? TH_ACTIVE : TH_WIRE); vec1[0] = cu->xof + cu->tb[i].x; vec1[1] = cu->yof + cu->tb[i].y + cu->fsize; vec1[2] = 0.001; - immBegin(PRIM_LINE_STRIP, 5); + immBegin(GWN_PRIM_LINE_STRIP, 5); immVertex3fv(pos, vec1); vec1[0] += cu->tb[i].w; immVertex3fv(pos, vec1); @@ -7527,7 +7527,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3 if (ef->selboxes && ef->selboxes_len) { float selboxw; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); imm_cpack(0xffffff); set_inverted_drawing(1); @@ -7548,7 +7548,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3 /* fill in xy below */ tvec[2] = 0.001; - immBegin(PRIM_TRIANGLE_FAN, 4); + immBegin(GWN_PRIM_TRI_FAN, 4); if (sb->rot == 0.0f) { copy_v2_fl2(tvec, sb->x, sb->y); @@ -7606,15 +7606,15 @@ static void draw_empty_sphere(float size, unsigned pos) p[i][1] = size * sinf(angle); } - immBegin(PRIM_LINE_LOOP, NSEGMENTS); + immBegin(GWN_PRIM_LINE_LOOP, NSEGMENTS); for (int i = 0; i < NSEGMENTS; ++i) immVertex3f(pos, p[i][0], p[i][1], 0.0f); immEnd(); - immBegin(PRIM_LINE_LOOP, NSEGMENTS); + immBegin(GWN_PRIM_LINE_LOOP, NSEGMENTS); for (int i = 0; i < NSEGMENTS; ++i) immVertex3f(pos, p[i][0], 0.0f, p[i][1]); immEnd(); - immBegin(PRIM_LINE_LOOP, NSEGMENTS); + immBegin(GWN_PRIM_LINE_LOOP, NSEGMENTS); for (int i = 0; i < NSEGMENTS; ++i) immVertex3f(pos, 0.0f, p[i][0], p[i][1]); immEnd(); @@ -7634,7 +7634,7 @@ static void draw_empty_cone(float size, unsigned pos) } /* cone sides */ - immBegin(PRIM_LINES, NSEGMENTS * 2); + immBegin(GWN_PRIM_LINES, NSEGMENTS * 2); for (int i = 0; i < NSEGMENTS; ++i) { immVertex3f(pos, 0.0f, 2.0f * size, 0.0f); immVertex3f(pos, p[i][0], 0.0f, p[i][1]); @@ -7642,7 +7642,7 @@ static void draw_empty_cone(float size, unsigned pos) immEnd(); /* end ring */ - immBegin(PRIM_LINE_LOOP, NSEGMENTS); + immBegin(GWN_PRIM_LINE_LOOP, NSEGMENTS); for (int i = 0; i < NSEGMENTS; ++i) immVertex3f(pos, p[i][0], 0.0f, p[i][1]); immEnd(); @@ -7665,7 +7665,7 @@ static void drawspiral(unsigned int pos, const float cent[3], float rad, float t mul_v3_v3fl(vx, tmat[0], rad); mul_v3_v3fl(vy, tmat[1], rad); - immBegin(PRIM_LINE_STRIP, CIRCLE_RESOL + 1); + immBegin(GWN_PRIM_LINE_STRIP, CIRCLE_RESOL + 1); if (inverse == 0) { copy_v3_v3(vec, cent); @@ -7719,7 +7719,7 @@ static void drawspiral(unsigned int pos, const float cent[3], float rad, float t * all required matrices have been set (used for drawing empties) */ static void drawcircle_size(float size, unsigned pos) { - immBegin(PRIM_LINE_LOOP, CIRCLE_RESOL); + immBegin(GWN_PRIM_LINE_LOOP, CIRCLE_RESOL); /* coordinates are: cos(degrees * 11.25) = x, sin(degrees * 11.25) = y, 0.0f = z */ for (short degrees = 0; degrees < CIRCLE_RESOL; degrees++) { @@ -7743,7 +7743,7 @@ static void imm_drawtube(const float vec[3], float radius, float height, float t imm_drawcircball(cur, radius, tmat, pos); - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); immVertex3f(pos, vec[0] + radius, vec[1], vec[2]); immVertex3f(pos, cur[0] + radius, cur[1], cur[2]); immVertex3f(pos, vec[0] - radius, vec[1], vec[2]); @@ -7765,7 +7765,7 @@ static void imm_drawcone(const float vec[3], float radius, float height, float t imm_drawcircball(cur, radius, tmat, pos); - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); immVertex3f(pos, vec[0], vec[1], vec[2]); immVertex3f(pos, cur[0] + radius, cur[1], cur[2]); immVertex3f(pos, vec[0], vec[1], vec[2]); @@ -7825,7 +7825,7 @@ static bool drawmball(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *r glLineWidth(1.0f); - const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + const unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); while (ml) { @@ -7881,7 +7881,7 @@ static void draw_forcefield(Object *ob, RegionView3D *rv3d, normalize_v3(imat[1]); #endif - const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + const unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3fv(draw_color); @@ -8047,7 +8047,7 @@ static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos) /* Adpated from "Optimizing Triangle Strips for Fast Rendering" by F. Evans, S. Skiena and A. Varshney * (http://www.cs.umd.edu/gvil/papers/av_ts.pdf). */ static const GLubyte tris_strip_indices[14] = {0,1,3,2,6,1,5,0,4,3,7,6,4,5}; - immBegin(PRIM_TRIANGLE_STRIP, 14); + immBegin(GWN_PRIM_TRI_STRIP, 14); for (int i = 0; i < 14; ++i) { immVertex3fv(pos, vec[tris_strip_indices[i]]); } @@ -8055,7 +8055,7 @@ static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos) } else { static const GLubyte line_indices[24] = {0,1,1,2,2,3,3,0,0,4,4,5,5,6,6,7,7,4,1,5,2,6,3,7}; - immBegin(PRIM_LINES, 24); + immBegin(GWN_PRIM_LINES, 24); for (int i = 0; i < 24; ++i) { immVertex3fv(pos, vec[line_indices[i]]); } @@ -8067,9 +8067,9 @@ 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]; - Batch *sphere = Batch_get_sphere_wire(0); + Gwn_Batch *sphere = Batch_get_sphere_wire(0); Batch_set_builtin_program(sphere, GPU_SHADER_3D_UNIFORM_COLOR); - if (ob_wire_col) Batch_Uniform4f(sphere, "color", ob_wire_col[0]/255.0f, ob_wire_col[1]/255.0f, ob_wire_col[2]/255.0f, 1.0f); + 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); @@ -8082,7 +8082,7 @@ static void imm_draw_bb(BoundBox *bb, char type, bool around_origin, const unsig gpuPushMatrix(); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -8091,7 +8091,7 @@ static void imm_draw_bb(BoundBox *bb, char type, bool around_origin, const unsig gpuTranslate3fv(cent); gpuRotateAxis(90, 'X'); gpuScaleUniform(scale); - Batch_draw(sphere); + GWN_batch_draw(sphere); } else if (type == OB_BOUND_CYLINDER) { float radius = size[0] > size[1] ? size[0] : size[1]; @@ -8114,10 +8114,10 @@ static void imm_draw_bb(BoundBox *bb, char type, bool around_origin, const unsig gpuRotateAxis(90, 'X'); gpuScaleUniform(radius); - Batch_draw(sphere); + GWN_batch_draw(sphere); gpuTranslate3f(0.0f, length / radius, 0.0f); - Batch_draw(sphere); + GWN_batch_draw(sphere); } gpuPopMatrix(); @@ -8160,7 +8160,7 @@ void draw_bounding_volume(Object *ob, char type, const unsigned char ob_wire_col if (type == OB_BOUND_BOX) { float vec[8][3], size[3]; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -8183,7 +8183,7 @@ void draw_bounding_volume(Object *ob, char type, const unsigned char ob_wire_col } else { if (type == OB_BOUND_BOX) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -8227,7 +8227,7 @@ static void drawtexspace(Object *ob, const unsigned char ob_wire_col[3]) setlinestyle(2); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); if (ob_wire_col) { immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -8346,7 +8346,7 @@ static void draw_hooks(Object *ob, unsigned int pos) if (hmd->object) { setlinestyle(3); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(pos, hmd->object->obmat[3]); immVertex3fv(pos, vec); immEnd(); @@ -8354,7 +8354,7 @@ static void draw_hooks(Object *ob, unsigned int pos) } glPointSize(3.0f); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, vec); immEnd(); } @@ -8367,7 +8367,7 @@ static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data, const char *axis_str[3] = {"px", "py", "pz"}; float mat[4][4]; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -8376,7 +8376,7 @@ static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data, glLineWidth(4.0f); setlinestyle(2); - immBegin(PRIM_LINES, 6); + immBegin(GWN_PRIM_LINES, 6); for (int axis = 0; axis < 3; axis++) { float dir[3] = {0, 0, 0}; float v[3]; @@ -8514,7 +8514,7 @@ void draw_rigidbody_shape(Object *ob, const unsigned char ob_wire_col[4]) case RB_SHAPE_BOX: BKE_boundbox_calc_size_aabb(bb, size); - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -8963,7 +8963,7 @@ afterdraw: if (!render_override) { BoundBox bb; float p0[3], p1[3]; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -9101,7 +9101,7 @@ afterdraw: { float imat[4][4], vec[3] = {0.0f, 0.0f, 0.0f}; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); invert_m4_m4(imat, rv3d->viewmatob); @@ -9156,12 +9156,12 @@ afterdraw: if ((base->sx != IS_CLIPPED) && (U.obcenter_dia != 0.0)) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR); /* TODO: short term, use DEPTH_ONLY shader or set appropriate color */ /* TODO: long term, solve picking & selection problem better */ glPointSize(U.obcenter_dia); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(pos, ob->obmat[3]); immEnd(); immUnbindProgram(); @@ -9185,7 +9185,7 @@ afterdraw: ListBase *list; RigidBodyCon *rbc = ob->rigidbody_constraint; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(ob_wire_col); @@ -9198,7 +9198,7 @@ afterdraw: Base *base_parent = BKE_scene_layer_base_find(sl, ob->parent); if ((base_parent->flag & BASE_VISIBLED) != 0) { setlinestyle(3); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(pos, ob->obmat[3]); immVertex3fv(pos, ob->orig); immEnd(); @@ -9241,7 +9241,7 @@ afterdraw: if (camob) { setlinestyle(3); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(pos, camob->obmat[3]); immVertex3fv(pos, ob->obmat[3]); immEnd(); @@ -9265,7 +9265,7 @@ afterdraw: unit_m4(ct->matrix); setlinestyle(3); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(pos, ct->matrix[3]); immVertex3fv(pos, ob->obmat[3]); immEnd(); @@ -9285,7 +9285,7 @@ afterdraw: immUniformThemeColor(TH_WIRE); setlinestyle(3); - immBegin(PRIM_LINES, ((int)((bool)rbc->ob1) + (int)((bool)rbc->ob2)) * 2); + immBegin(GWN_PRIM_LINES, ((int)((bool)rbc->ob1) + (int)((bool)rbc->ob2)) * 2); if (rbc->ob1) { immVertex3fv(pos, ob->obmat[3]); immVertex3fv(pos, rbc->ob1->obmat[3]); @@ -9374,15 +9374,15 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset) if (imm_len == 0) return; - VertexFormat *format = immVertexFormat(); - data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - data.col = VertexFormat_add_attrib(format, "color", COMP_U32, 1, KEEP_INT); + Gwn_VertFormat *format = immVertexFormat(); + data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(PRIM_POINTS, imm_len); + immBeginAtMost(GWN_PRIM_POINTS, imm_len); dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -9407,15 +9407,15 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset) drawBMOffset_userData data; data.bm = em->bm; data.offset = offset; - VertexFormat *format = immVertexFormat(); - data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - data.col = VertexFormat_add_attrib(format, "color", COMP_U32, 1, KEEP_INT); + Gwn_VertFormat *format = immVertexFormat(); + data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(PRIM_POINTS, em->bm->totvert); + immBeginAtMost(GWN_PRIM_POINTS, em->bm->totvert); dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -9442,20 +9442,20 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset) data.bm = em->bm; data.offset = offset; - VertexFormat *format = immVertexFormat(); + Gwn_VertFormat *format = immVertexFormat(); const int imm_len = dm->getNumEdges(dm) * 2; if (imm_len == 0) return; - data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - data.col = VertexFormat_add_attrib(format, "color", COMP_U32, 1, KEEP_INT); + data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(PRIM_LINES, imm_len); + immBeginAtMost(GWN_PRIM_LINES, imm_len); dm->foreachMappedEdge(dm, bbs_mesh_wire__mapFunc, &data); immEnd(); @@ -9475,13 +9475,13 @@ static void bbs_mesh_face(BMEditMesh *em, DerivedMesh *dm, const bool use_select if (imm_len == 0) return; - VertexFormat *format = immVertexFormat(); - data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - data.col = VertexFormat_add_attrib(format, "color", COMP_U32, 1, KEEP_INT); + Gwn_VertFormat *format = immVertexFormat(); + data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); - immBeginAtMost(PRIM_TRIANGLES, imm_len); + immBeginAtMost(GWN_PRIM_TRIS, imm_len); if (use_select == false) { int selcol; @@ -9532,15 +9532,15 @@ static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *dm) { drawBMOffset_userData data; /* don't use offset */ data.bm = em->bm; - VertexFormat *format = immVertexFormat(); - data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - data.col = VertexFormat_add_attrib(format, "color", COMP_U32, 1, KEEP_INT); + Gwn_VertFormat *format = immVertexFormat(); + data.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + data.col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U32, 1, GWN_FETCH_INT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE)); - immBeginAtMost(PRIM_POINTS, em->bm->totface); + immBeginAtMost(GWN_PRIM_POINTS, em->bm->totface); dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, &data, DM_FOREACH_NOP); immEnd(); @@ -9614,7 +9614,7 @@ static void bbs_mesh_solid_faces(Scene *scene, Object *ob) { Mesh *me = ob->data; UNUSED_VARS(scene, bbs_mesh_solid_hide__setDrawOpts, bbs_mesh_solid__setDrawOpts); - Batch *batch; + Gwn_Batch *batch; if ((me->editflag & ME_EDIT_PAINT_FACE_SEL)) { batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, true); } @@ -9622,7 +9622,7 @@ static void bbs_mesh_solid_faces(Scene *scene, Object *ob) batch = DRW_mesh_batch_cache_get_triangles_with_select_id(me, false); } Batch_set_builtin_program(batch, GPU_SHADER_3D_FLAT_COLOR_U32); - Batch_draw(batch); + GWN_batch_draw(batch); } void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob) @@ -9816,8 +9816,8 @@ void ED_draw_object_facemap(Scene *scene, Object *ob, const float col[4], const Mesh *me = ob->data; const int *facemap_data = CustomData_get_layer(&me->pdata, CD_FACEMAP); if (facemap_data) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(col); @@ -9857,7 +9857,7 @@ void ED_draw_object_facemap(Scene *scene, Object *ob, const float col[4], const /* use gawain immediate mode fore now */ const int looptris_len = poly_to_tri_count(mpoly_len, mloop_len); - immBeginAtMost(PRIM_TRIANGLES, looptris_len * 3); + immBeginAtMost(GWN_PRIM_TRIS, looptris_len * 3); MPoly *mp; int i; diff --git a/source/blender/editors/space_view3d/drawsimdebug.c b/source/blender/editors/space_view3d/drawsimdebug.c index 24ac1c5b4db..14708ca67bc 100644 --- a/source/blender/editors/space_view3d/drawsimdebug.c +++ b/source/blender/editors/space_view3d/drawsimdebug.c @@ -48,9 +48,9 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) { - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); @@ -73,7 +73,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) /**** dots ****/ glPointSize(3.0f); - immBegin(PRIM_POINTS, num_dots); + immBegin(GWN_PRIM_POINTS, num_dots); for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); if (elem->type != SIM_DEBUG_ELEM_DOT) @@ -94,7 +94,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) {-0.000000, -1.000000}, {-0.382683, -0.923880}, {-0.707107, -0.707107}, {-0.923879, -0.382684}, {-1.000000, 0.000000}, {-0.923879, 0.382684}, {-0.707107, 0.707107}, {-0.382683, 0.923880} }; - immBegin(PRIM_LINES, num_circles * CIRCLERES * 2); + immBegin(GWN_PRIM_LINES, num_circles * CIRCLERES * 2); for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); @@ -130,7 +130,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) /**** lines ****/ - immBegin(PRIM_LINES, num_lines * 2); + immBegin(GWN_PRIM_LINES, num_lines * 2); for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); if (elem->type != SIM_DEBUG_ELEM_LINE) @@ -145,7 +145,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) /**** vectors ****/ glPointSize(2.0f); - immBegin(PRIM_POINTS, num_vectors); + immBegin(GWN_PRIM_POINTS, num_vectors); for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); if (elem->type != SIM_DEBUG_ELEM_VECTOR) @@ -156,7 +156,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) } immEnd(); - immBegin(PRIM_LINES, num_vectors * 2); + immBegin(GWN_PRIM_LINES, num_vectors * 2); for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); float t[3]; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index b1938054944..7c057723b72 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -364,7 +364,7 @@ static void drawviewborder_grid3(uint shdr_pos, float x1, float x2, float y1, fl x4 = x1 + (1.0f - fac) * (x2 - x1); y4 = y1 + (1.0f - fac) * (y2 - y1); - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); immVertex2f(shdr_pos, x1, y3); immVertex2f(shdr_pos, x2, y3); @@ -389,7 +389,7 @@ static void drawviewborder_triangle( float w = x2 - x1; float h = y2 - y1; - immBegin(PRIM_LINES, 6); + immBegin(GWN_PRIM_LINES, 6); if (w > h) { if (golden) { @@ -466,7 +466,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) x2i = (int)(x2 + (1.0f - 0.0001f)); y2i = (int)(y2 + (1.0f - 0.0001f)); - uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); /* First, solid lines. */ { @@ -558,7 +558,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) x3 = x1 + 0.5f * (x2 - x1); y3 = y1 + 0.5f * (y2 - y1); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(shdr_pos, x1, y3); immVertex2f(shdr_pos, x2, y3); @@ -570,7 +570,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) } if (ca->dtx & CAM_DTX_CENTER_DIAG) { - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); immVertex2f(shdr_pos, x1, y1); immVertex2f(shdr_pos, x2, y2); @@ -673,7 +673,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) static void drawrenderborder(ARegion *ar, View3D *v3d) { /* use the same program for everything */ - uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); glLineWidth(1.0f); @@ -755,9 +755,9 @@ static void view3d_draw_background_gradient(void) { /* TODO: finish 2D API & draw background with that */ - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); unsigned char col_hi[3], col_lo[3]; immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -765,7 +765,7 @@ static void view3d_draw_background_gradient(void) UI_GetThemeColor3ubv(TH_LOW_GRAD, col_lo); UI_GetThemeColor3ubv(TH_HIGH_GRAD, col_hi); - immBegin(PRIM_TRIANGLE_FAN, 4); + immBegin(GWN_PRIM_TRI_FAN, 4); immAttrib3ubv(color, col_lo); immVertex2f(pos, -1.0f, -1.0f); immVertex2f(pos, 1.0f, -1.0f); @@ -978,9 +978,9 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** glDepthMask(GL_FALSE); /* disable write in zbuffer */ #endif - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); @@ -1017,7 +1017,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** if (gridline_ct == 0) goto drawgrid_cleanup; /* nothing to draw */ - immBegin(PRIM_LINES, gridline_ct * 2); + immBegin(GWN_PRIM_LINES, gridline_ct * 2); } float blend_fac = 1.0f - ((GRID_MIN_PX_F * 2.0f) / (float)dx_scalar); @@ -1077,7 +1077,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** if (gridline_ct == 0) goto drawgrid_cleanup; /* nothing to draw */ - immBegin(PRIM_LINES, gridline_ct * 2); + immBegin(GWN_PRIM_LINES, gridline_ct * 2); if (grids_to_draw == 2) { UI_GetThemeColorBlend3ubv(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0), col2); @@ -1154,13 +1154,13 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr unsigned char col_bg[3], col_grid_emphasise[3], col_grid_light[3]; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBegin(PRIM_LINES, vertex_ct); + immBegin(GWN_PRIM_LINES, vertex_ct); /* draw normal grid lines */ UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10); @@ -1242,12 +1242,12 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr if (show_axis_x || show_axis_y || show_axis_z) { /* draw axis lines -- sometimes grid floor is off, other times we still need to draw the Z axis */ - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBegin(PRIM_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2); + immBegin(GWN_PRIM_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2); if (show_axis_x) { UI_make_axis_color(col_grid, col_axis, 'X'); @@ -1347,15 +1347,15 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) glLineWidth(1.0f); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); const int segments = 16; - immBegin(PRIM_LINE_LOOP, segments); + immBegin(GWN_PRIM_LINE_LOOP, segments); for (int i = 0; i < segments; ++i) { float angle = 2 * M_PI * ((float)i / (float)segments); @@ -1373,8 +1373,8 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) immUnbindProgram(); - VertexFormat_clear(format); - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + GWN_vertformat_clear(format); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1382,7 +1382,7 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) UI_GetThemeColor3ubv(TH_VIEW_OVERLAY, crosshair_color); immUniformColor3ubv(crosshair_color); - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); immVertex2f(pos, co[0] - f20, co[1]); immVertex2f(pos, co[0] - f5, co[1]); immVertex2f(pos, co[0] + f5, co[1]); @@ -1432,12 +1432,12 @@ static void draw_view_axis(RegionView3D *rv3d, rcti *rect) glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(PRIM_LINES, 6); + immBegin(GWN_PRIM_LINES, 6); for (int axis_i = 0; axis_i < 3; axis_i++) { int i = axis_order[axis_i]; @@ -1476,9 +1476,9 @@ static void draw_rotation_guide(RegionView3D *rv3d) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDepthMask(GL_FALSE); /* don't overwrite zbuf */ - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); + unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); @@ -1489,7 +1489,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) mul_v3_v3fl(scaled_axis, rv3d->rot_axis, scale); - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); color[3] = 0; /* more transparent toward the ends */ immAttrib4ubv(col, color); add_v3_v3v3(end, o, scaled_axis); @@ -1528,7 +1528,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) axis_angle_to_quat(q, vis_axis, vis_angle); } - immBegin(PRIM_LINE_LOOP, ROT_AXIS_DETAIL); + immBegin(GWN_PRIM_LINE_LOOP, ROT_AXIS_DETAIL); color[3] = 63; /* somewhat faint */ immAttrib4ubv(col, color); float angle = 0.0f; @@ -1557,7 +1557,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) /* -- draw rotation center -- */ immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR); glPointSize(5.0f); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immAttrib4ubv(col, color); immVertex3fv(pos, o); immEnd(); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 1a8ac374e75..85f44b528bc 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -259,14 +259,14 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), x2 = xoff + 0.55f * fly->width; y2 = yoff + 0.55f * fly->height; - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_VIEW_OVERLAY); - immBegin(PRIM_LINES, 16); + immBegin(GWN_PRIM_LINES, 16); /* bottom left */ immVertex2f(pos, x1, y1); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 99449a40a8c..3428af3f560 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -38,7 +38,7 @@ struct ARegion; struct ARegionType; struct BoundBox; -struct Batch; +struct Gwn_Batch; struct DerivedMesh; struct Object; struct SmokeDomainSettings; diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index aecde1b1657..550a0ee4186 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -458,7 +458,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a glEnable(GL_BLEND); - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); if (ruler_item->flag & RULERITEM_USE_ANGLE) { immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -472,7 +472,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2); immUniform1f("dash_width", 6.0f); - immBegin(PRIM_LINE_STRIP, 3); + immBegin(GWN_PRIM_LINE_STRIP, 3); immVertex2fv(shdr_pos, co_ss[0]); immVertex2fv(shdr_pos, co_ss[1]); @@ -514,7 +514,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformColor3ubv(color_wire); - immBegin(PRIM_LINE_STRIP, arc_steps + 1); + immBegin(GWN_PRIM_LINE_STRIP, arc_steps + 1); for (j = 0; j <= arc_steps; j++) { madd_v3_v3v3fl(co_tmp, ruler_item->co[1], dir_tmp, px_scale); @@ -547,7 +547,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformColor3ubv(color_wire); - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); madd_v2_v2v2fl(cap, co_ss[0], rot_90_vec_a, cap_size); immVertex2fv(shdr_pos, cap); @@ -611,7 +611,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2); immUniform1f("dash_width", 6.0f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(shdr_pos, co_ss[0]); immVertex2fv(shdr_pos, co_ss[2]); @@ -635,7 +635,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformColor3ubv(color_wire); - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); madd_v2_v2v2fl(cap, co_ss[0], rot_90_vec, cap_size); immVertex2fv(shdr_pos, cap); @@ -700,7 +700,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a float co_ss[3]; ED_view3d_project_float_global(ar, ruler_item->co[ruler_item->co_index], co_ss, V3D_PROJ_TEST_NOP); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color_act); diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index e0c8ad2ed6b..71a4980d4a6 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -341,14 +341,14 @@ static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *a yoff = walk->ar->winy / 2; } - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_VIEW_OVERLAY); - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); /* North */ immVertex2i(pos, xoff, yoff + inner_length); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 4727986fdb4..81d8f64045f 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1605,13 +1605,13 @@ typedef enum { } ArrowDirection; #define POS_INDEX 0 -/* NOTE: this --^ is a bit hackish, but simplifies VertexFormat usage among functions +/* NOTE: this --^ is a bit hackish, but simplifies Gwn_VertFormat usage among functions * private to this file - merwin */ static void drawArrow(ArrowDirection d, short offset, short length, short size) { - immBegin(PRIM_LINES, 6); + immBegin(GWN_PRIM_LINES, 6); switch (d) { case LEFT: @@ -1648,7 +1648,7 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size) static void drawArrowHead(ArrowDirection d, short size) { - immBegin(PRIM_LINES, 4); + immBegin(GWN_PRIM_LINES, 4); switch (d) { case LEFT: @@ -1681,7 +1681,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments float angle; int a; - immBegin(PRIM_LINE_STRIP, segments + 1); + immBegin(GWN_PRIM_LINE_STRIP, segments + 1); for (angle = angle_start, a = 0; a < segments; angle += delta, a++) { immVertex2f(POS_INDEX, cosf(angle) * size, sinf(angle) * size); @@ -1724,7 +1724,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) /* Dashed lines first. */ if (ELEM(t->helpline, HLP_SPRING, HLP_ANGLE)) { - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); UNUSED_VARS_NDEBUG(shdr_pos); /* silence warning */ BLI_assert(shdr_pos == POS_INDEX); @@ -1742,7 +1742,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(POS_INDEX, cent); immVertex2f(POS_INDEX, (float)t->mval[0], (float)t->mval[1]); immEnd(); @@ -1751,7 +1751,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) } /* And now, solid lines. */ - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); UNUSED_VARS_NDEBUG(pos); /* silence warning */ BLI_assert(pos == POS_INDEX); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -6879,7 +6879,7 @@ static void drawEdgeSlide(TransInfo *t) gpuPushMatrix(); gpuMultMatrix(t->obedit->obmat); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -6896,7 +6896,7 @@ static void drawEdgeSlide(TransInfo *t) glLineWidth(line_size); immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade); - immBeginAtMost(PRIM_LINES, 4); + immBeginAtMost(GWN_PRIM_LINES, 4); if (curr_sv->v_side[0]) { immVertex3fv(pos, curr_sv->v_side[0]->co); immVertex3fv(pos, curr_sv->v_co_orig); @@ -6909,7 +6909,7 @@ static void drawEdgeSlide(TransInfo *t) immUniformThemeColorShadeAlpha(TH_SELECT, -30, alpha_shade); glPointSize(ctrl_size); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); if (sld->flipped) { if (curr_sv->v_side[1]) immVertex3fv(pos, curr_sv->v_side[1]->co); } @@ -6920,7 +6920,7 @@ static void drawEdgeSlide(TransInfo *t) immUniformThemeColorShadeAlpha(TH_SELECT, 255, alpha_shade); glPointSize(guide_size); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); interp_line_v3_v3v3v3(co_mark, co_b, curr_sv->v_co_orig, co_a, fac); immVertex3fv(pos, co_mark); immEnd(); @@ -6934,7 +6934,7 @@ static void drawEdgeSlide(TransInfo *t) glLineWidth(line_size); immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade); - immBegin(PRIM_LINES, sld->totsv * 2); + immBegin(GWN_PRIM_LINES, sld->totsv * 2); sv = sld->sv; for (i = 0; i < sld->totsv; i++, sv++) { @@ -7493,12 +7493,12 @@ static void drawVertSlide(TransInfo *t) glLineWidth(line_size); - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade); - immBegin(PRIM_LINES, sld->totsv * 2); + immBegin(GWN_PRIM_LINES, sld->totsv * 2); if (is_clamp) { sv = sld->sv; for (i = 0; i < sld->totsv; i++, sv++) { @@ -7524,7 +7524,7 @@ static void drawVertSlide(TransInfo *t) glPointSize(ctrl_size); - immBegin(PRIM_POINTS, 1); + immBegin(GWN_PRIM_POINTS, 1); immVertex3fv(shdr_pos, (sld->flipped && sld->use_even) ? curr_sv->co_link_orig_3d[curr_sv->co_link_curr] : curr_sv->co_orig_3d); @@ -7567,7 +7567,7 @@ static void drawVertSlide(TransInfo *t) immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(shdr_pos, curr_sv->co_orig_3d); immVertex3fv(shdr_pos, co_dest_3d); immEnd(); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 9360727e9cf..654072766a8 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -733,7 +733,7 @@ void drawConstraint(TransInfo *t) if (depth_test_enabled) glDisable(GL_DEPTH_TEST); - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_COLOR); @@ -746,7 +746,7 @@ void drawConstraint(TransInfo *t) immUniform1f("dash_width", 2.0f); immUniform1f("dash_factor", 0.5f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(shdr_pos, t->center_global); immVertex3fv(shdr_pos, vec); immEnd(); @@ -809,7 +809,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) if (depth_test_enabled) glDisable(GL_DEPTH_TEST); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_GRID); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 3d80ac11ec9..ca9e15f5de4 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1054,12 +1054,12 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis } UI_make_axis_color(col, col2, axis); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(col2); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3fv(pos, v1); immVertex3fv(pos, v2); immEnd(); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 18996de068b..1181f584313 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -164,7 +164,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) invert_m4_m4(imat, rv3d->viewmat); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -189,7 +189,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) if (usingSnappingNormal(t) && validSnappingNormal(t)) { immUniformColor4ubv(activeCol); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex3f(pos, t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]); immVertex3f(pos, t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0], t->tsnap.snapPoint[1] + t->tsnap.snapNormal[1], @@ -219,7 +219,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) glEnable(GL_BLEND); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 6ae1de3fead..f028293d219 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -321,7 +321,7 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info const float mval_dst[2] = {win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin}; - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -334,7 +334,7 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); - immBegin(PRIM_LINES, 2); + immBegin(GWN_PRIM_LINES, 2); immVertex2fv(shdr_pos, mval_src); immVertex2fv(shdr_pos, mval_dst); immEnd(); diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 8ef287b7f4d..f8c0e24c061 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -87,7 +87,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) gpuTranslate2fv(cursor); - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -99,7 +99,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2); immUniform1f("dash_width", 8.0f); - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); immVertex2f(shdr_pos, -0.05f * x_fac, 0.0f); immVertex2f(shdr_pos, 0.0f, 0.05f * y_fac); @@ -118,7 +118,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2); immUniform1f("dash_width", 2.0f); - immBegin(PRIM_LINES, 8); + immBegin(GWN_PRIM_LINES, 8); immVertex2f(shdr_pos, -0.020f * x_fac, 0.0f); immVertex2f(shdr_pos, -0.1f * x_fac, 0.0f); @@ -165,7 +165,7 @@ static void draw_uvs_shadow(Object *obedit) const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -228,7 +228,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, con } } - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -240,7 +240,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, con BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(efa, BM_ELEM_TAG)) { - immBegin(PRIM_TRIANGLE_FAN, efa->len); + immBegin(GWN_PRIM_TRI_FAN, efa->len); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -280,7 +280,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, con immUniformColor3fv(col); /* TODO: use editmesh tessface */ - immBegin(PRIM_TRIANGLE_FAN, efa->len); + immBegin(GWN_PRIM_TRI_FAN, efa->len); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -307,9 +307,9 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, con col[3] = 0.5f; /* hard coded alpha, not that nice */ - VertexFormat *format = immVertexFormat(); - unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -352,7 +352,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, con } /* TODO: use editmesh tessface */ - immBegin(PRIM_TRIANGLE_FAN, efa->len); + immBegin(GWN_PRIM_TRI_FAN, efa->len); BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); a = fabsf(uvang[i] - ang[i]) / (float)M_PI; @@ -390,7 +390,7 @@ static void draw_uvs_lineloop_bmface(BMFace *efa, const int cd_loop_uv_offset, c BMLoop *l; MLoopUV *luv; - immBegin(PRIM_LINE_LOOP, efa->len); + immBegin(GWN_PRIM_LINE_LOOP, efa->len); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -405,7 +405,7 @@ static void draw_uvs_lineloop_mpoly(Mesh *me, MPoly *mpoly, unsigned int pos) MLoopUV *mloopuv; int i; - immBegin(PRIM_LINE_LOOP, mpoly->totloop); + immBegin(GWN_PRIM_LINE_LOOP, mpoly->totloop); mloopuv = &me->mloopuv[mpoly->loopstart]; for (i = mpoly->totloop; i != 0; i--, mloopuv++) { @@ -520,7 +520,7 @@ static void draw_uvs_other_mesh(Object *ob, const Image *curimage, const bool ne static void draw_uvs_other(SceneLayer *sl, Object *obedit, const Image *curimage, const bool new_shading_nodes, const int other_uv_filter) { - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -562,7 +562,7 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, SceneLayer *sl, Ob mloopuv = me->mloopuv; } - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -574,7 +574,7 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, SceneLayer *sl, Ob if ((scene->toolsettings->uv_flag & UV_SHOW_SAME_IMAGE) && mpoly->mat_nr != ob->actcol - 1) continue; - immBegin(PRIM_LINE_LOOP, mpoly->totloop); + immBegin(GWN_PRIM_LINE_LOOP, mpoly->totloop); mloopuv = mloopuv_base + mpoly->loopstart; for (b = 0; b < mpoly->totloop; b++, mloopuv++) { @@ -678,7 +678,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -696,7 +696,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe immUniformColor4ubv(is_select ? col2 : col1); } - immBegin(PRIM_TRIANGLES, (em->looptris[i][0]->f->len - 2) * 3); + immBegin(GWN_PRIM_TRIS, (em->looptris[i][0]->f->len - 2) * 3); draw_uvs_looptri(em, &i, cd_loop_uv_offset, pos); immEnd(); } @@ -741,7 +741,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe switch (sima->dt_uv) { case SI_UVDT_DASH: { - const uint shdr_pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -766,7 +766,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe } case SI_UVDT_BLACK: /* black/white */ case SI_UVDT_WHITE: - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -788,7 +788,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe break; case SI_UVDT_OUTLINE: - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -811,9 +811,9 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe int sel; UI_GetThemeColor4ubv(TH_EDGE_SELECT, col1); - VertexFormat *format = immVertexFormat(); - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); if (interpedges) { immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -822,7 +822,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; - immBegin(PRIM_LINE_LOOP, efa->len); + immBegin(GWN_PRIM_LINE_LOOP, efa->len); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { sel = uvedit_uv_select_test(scene, l, cd_loop_uv_offset); @@ -846,7 +846,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; - immBegin(PRIM_LINES, efa->len * 2); + immBegin(GWN_PRIM_LINES, efa->len * 2); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { sel = uvedit_edge_select_test(scene, l, cd_loop_uv_offset); @@ -868,7 +868,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe } } else { - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(col2); @@ -898,16 +898,16 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe float cent[2]; bool col_set = false; - VertexFormat *format = immVertexFormat(); - pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + Gwn_VertFormat *format = immVertexFormat(); + pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); pointsize = UI_GetThemeValuef(TH_FACEDOT_SIZE); glPointSize(pointsize); - immBeginAtMost(PRIM_POINTS, bm->totface); + immBeginAtMost(GWN_PRIM_POINTS, bm->totface); /* unselected faces */ @@ -959,7 +959,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe /* 6. draw uv vertices */ if (drawfaces != 2) { /* 2 means Mesh Face Mode */ - pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -968,7 +968,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe pointsize = UI_GetThemeValuef(TH_VERTEX_SIZE); glPointSize(pointsize); - immBeginAtMost(PRIM_POINTS, bm->totloop); + immBeginAtMost(GWN_PRIM_POINTS, bm->totloop); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) @@ -988,7 +988,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe glPointSize(pointsize * 2 + (((int)pointsize % 2) ? (-1) : 0)); imm_cpack(0xFF); - immBeginAtMost(PRIM_POINTS, bm->totloop); + immBeginAtMost(GWN_PRIM_POINTS, bm->totloop); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) @@ -1008,7 +1008,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe immUniformThemeColor(TH_VERTEX_SELECT); glPointSize(pointsize); - immBeginAtMost(PRIM_POINTS, bm->totloop); + immBeginAtMost(GWN_PRIM_POINTS, bm->totloop); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index f3191581d49..55c439924cd 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1541,13 +1541,13 @@ static void stitch_calculate_edge_normal(BMEditMesh *em, UvEdge *edge, float *no normalize_v2(normal); } -static void stitch_draw_vbo(VertexBuffer *vbo, PrimitiveType prim_type, const float col[4]) +static void stitch_draw_vbo(Gwn_VertBuf *vbo, Gwn_PrimType prim_type, const float col[4]) { - Batch *batch = Batch_create(prim_type, vbo, NULL); + Gwn_Batch *batch = GWN_batch_create(prim_type, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_2D_UNIFORM_COLOR); - Batch_Uniform4fv(batch, "color", col); - Batch_draw(batch); - Batch_discard_all(batch); + GWN_batch_uniform_4fv(batch, "color", col); + GWN_batch_draw(batch); + GWN_batch_discard_all(batch); } /* TODO make things pretier : store batches inside StitchPreviewer instead of the bare verts pos */ @@ -1557,24 +1557,24 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar unsigned int num_line = 0, num_tri, tri_idx = 0, line_idx = 0; StitchState *state = (StitchState *)arg; StitchPreviewer *stitch_preview = state->stitch_preview; - VertexBuffer *vbo, *vbo_line; + Gwn_VertBuf *vbo, *vbo_line; float col[4]; - static VertexFormat format = { 0 }; + static Gwn_VertFormat format = { 0 }; static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT); + pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } glEnable(GL_BLEND); /* Static Tris */ UI_GetThemeColor4fv(TH_STITCH_PREVIEW_ACTIVE, col); - vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, stitch_preview->num_static_tris * 3); + vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, stitch_preview->num_static_tris * 3); for (int i = 0; i < stitch_preview->num_static_tris * 3; i++) - VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->static_tris[i*2]); - stitch_draw_vbo(vbo, PRIM_TRIANGLES, col); + GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->static_tris[i*2]); + stitch_draw_vbo(vbo, GWN_PRIM_TRIS, col); /* Preview Polys */ @@ -1584,38 +1584,38 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar num_tri = num_line - 2 * stitch_preview->num_polys; /* we need to convert the polys into triangles / lines */ - vbo = VertexBuffer_create_with_format(&format); - vbo_line = VertexBuffer_create_with_format(&format); + vbo = GWN_vertbuf_create_with_format(&format); + vbo_line = GWN_vertbuf_create_with_format(&format); - VertexBuffer_allocate_data(vbo, num_tri * 3); - VertexBuffer_allocate_data(vbo_line, num_line * 2); + GWN_vertbuf_data_alloc(vbo, num_tri * 3); + GWN_vertbuf_data_alloc(vbo_line, num_line * 2); for (int i = 0; i < stitch_preview->num_polys; i++) { BLI_assert(stitch_preview->uvs_per_polygon[i] >= 3); /* Start line */ - VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); - VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + 2]); + GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); + GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + 2]); for (j = 1; j < stitch_preview->uvs_per_polygon[i] - 1; ++j) { - VertexBuffer_set_attrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index]); - VertexBuffer_set_attrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+0)*2]); - VertexBuffer_set_attrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+1)*2]); + GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index]); + GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+0)*2]); + GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+1)*2]); - VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+0)*2]); - VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+1)*2]); + GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+0)*2]); + GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+1)*2]); } /* Closing line */ - VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); - VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + j*2]); /* j = uvs_per_polygon[i] - 1*/ + GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); + GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + j*2]); /* j = uvs_per_polygon[i] - 1*/ index += stitch_preview->uvs_per_polygon[i] * 2; } UI_GetThemeColor4fv(TH_STITCH_PREVIEW_FACE, col); - stitch_draw_vbo(vbo, PRIM_TRIANGLES, col); + stitch_draw_vbo(vbo, GWN_PRIM_TRIS, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_EDGE, col); - stitch_draw_vbo(vbo_line, PRIM_LINES, col); + stitch_draw_vbo(vbo_line, GWN_PRIM_LINES, col); glDisable(GL_BLEND); @@ -1625,33 +1625,33 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) * 2.0f); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_STITCHABLE, col); - vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, stitch_preview->num_stitchable); + vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, stitch_preview->num_stitchable); for (int i = 0; i < stitch_preview->num_stitchable; i++) - VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); - stitch_draw_vbo(vbo, PRIM_POINTS, col); + GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); + stitch_draw_vbo(vbo, GWN_PRIM_POINTS, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col); - vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, stitch_preview->num_unstitchable); + vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, stitch_preview->num_unstitchable); for (int i = 0; i < stitch_preview->num_unstitchable; i++) - VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); - stitch_draw_vbo(vbo, PRIM_POINTS, col); + GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); + stitch_draw_vbo(vbo, GWN_PRIM_POINTS, col); } else { UI_GetThemeColor4fv(TH_STITCH_PREVIEW_STITCHABLE, col); - vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, stitch_preview->num_stitchable * 2); + vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, stitch_preview->num_stitchable * 2); for (int i = 0; i < stitch_preview->num_stitchable * 2; i++) - VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); - stitch_draw_vbo(vbo, PRIM_LINES, col); + GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); + stitch_draw_vbo(vbo, GWN_PRIM_LINES, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col); - vbo = VertexBuffer_create_with_format(&format); - VertexBuffer_allocate_data(vbo, stitch_preview->num_unstitchable * 2); + vbo = GWN_vertbuf_create_with_format(&format); + GWN_vertbuf_data_alloc(vbo, stitch_preview->num_unstitchable * 2); for (int i = 0; i < stitch_preview->num_unstitchable * 2; i++) - VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); - stitch_draw_vbo(vbo, PRIM_LINES, col); + GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); + stitch_draw_vbo(vbo, GWN_PRIM_LINES, col); } } |