From 0debbe2b7f7177678c9bce9046c1499b698ac969 Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Thu, 6 Apr 2017 00:59:04 -0400 Subject: Gawain: VertexFormat_add_attrib (function name change) See intern/gawain for the API change. Other files are updated to use the new name. Also updated every call site to the recommended style: unsigned int foo = VertexFormat_add_attrib(format, "foo", COMP_ ... ) --- source/blender/blenfont/intern/blf.c | 6 +- source/blender/blenkernel/intern/DerivedMesh.c | 4 +- source/blender/blenkernel/intern/mesh_render.c | 28 ++-- source/blender/blenkernel/intern/pbvh.c | 2 +- source/blender/draw/intern/draw_cache.c | 110 +++++++-------- source/blender/draw/intern/draw_manager.c | 4 +- source/blender/draw/intern/draw_view.c | 22 +-- .../editors/animation/anim_channels_defines.c | 10 +- source/blender/editors/animation/anim_draw.c | 6 +- source/blender/editors/animation/anim_markers.c | 4 +- source/blender/editors/animation/keyframes_draw.c | 10 +- .../blender/editors/armature/editarmature_sketch.c | 4 +- source/blender/editors/curve/editcurve_paint.c | 2 +- source/blender/editors/gpencil/drawgpencil.c | 52 +++---- source/blender/editors/gpencil/gpencil_brush.c | 2 +- source/blender/editors/gpencil/gpencil_paint.c | 2 +- source/blender/editors/interface/interface_draw.c | 52 +++---- source/blender/editors/interface/interface_icons.c | 16 +-- source/blender/editors/interface/interface_panel.c | 16 +-- .../blender/editors/interface/interface_widgets.c | 48 +++---- source/blender/editors/interface/view2d.c | 16 +-- source/blender/editors/mask/mask_draw.c | 8 +- source/blender/editors/mesh/editmesh_knife.c | 4 +- source/blender/editors/mesh/editmesh_loopcut.c | 2 +- source/blender/editors/physics/particle_edit.c | 2 +- source/blender/editors/screen/area.c | 38 +++--- source/blender/editors/screen/glutil.c | 4 +- source/blender/editors/screen/screen_draw.c | 4 +- source/blender/editors/screen/screendump.c | 2 +- source/blender/editors/sculpt_paint/paint_cursor.c | 12 +- source/blender/editors/sculpt_paint/paint_image.c | 2 +- source/blender/editors/sculpt_paint/paint_stroke.c | 4 +- source/blender/editors/sculpt_paint/sculpt_uv.c | 2 +- source/blender/editors/space_action/action_draw.c | 2 +- .../editors/space_clip/clip_dopesheet_draw.c | 12 +- source/blender/editors/space_clip/clip_draw.c | 20 +-- .../blender/editors/space_clip/clip_graph_draw.c | 2 +- source/blender/editors/space_clip/clip_utils.c | 4 +- .../blender/editors/space_console/console_draw.c | 2 +- source/blender/editors/space_file/file_draw.c | 8 +- source/blender/editors/space_graph/graph_draw.c | 14 +- source/blender/editors/space_graph/space_graph.c | 2 +- source/blender/editors/space_image/image_draw.c | 12 +- source/blender/editors/space_info/textview.c | 6 +- source/blender/editors/space_nla/nla_draw.c | 18 +-- source/blender/editors/space_node/drawnode.c | 14 +- source/blender/editors/space_node/node_draw.c | 10 +- .../blender/editors/space_outliner/outliner_draw.c | 18 +-- .../editors/space_sequencer/sequencer_draw.c | 24 ++-- source/blender/editors/space_text/text_draw.c | 14 +- source/blender/editors/space_time/space_time.c | 6 +- source/blender/editors/space_view3d/drawanimviz.c | 8 +- source/blender/editors/space_view3d/drawarmature.c | 34 ++--- source/blender/editors/space_view3d/drawobject.c | 149 ++++++++++----------- source/blender/editors/space_view3d/drawsimdebug.c | 4 +- source/blender/editors/space_view3d/view3d_draw.c | 34 ++--- source/blender/editors/space_view3d/view3d_fly.c | 2 +- source/blender/editors/space_view3d/view3d_ruler.c | 6 +- source/blender/editors/space_view3d/view3d_walk.c | 2 +- source/blender/editors/transform/transform.c | 6 +- .../editors/transform/transform_constraints.c | 4 +- .../blender/editors/transform/transform_generics.c | 2 +- .../editors/transform/transform_manipulator.c | 8 +- source/blender/editors/transform/transform_snap.c | 4 +- source/blender/editors/util/ed_util.c | 2 +- source/blender/editors/uvedit/uvedit_draw.c | 34 ++--- .../blender/editors/uvedit/uvedit_smart_stitch.c | 2 +- source/blender/gpu/intern/gpu_batch.c | 8 +- source/blender/gpu/intern/gpu_compositing.c | 6 +- source/blender/gpu/intern/gpu_framebuffer.c | 4 +- source/blender/gpu/intern/gpu_immediate_util.c | 2 +- source/blender/gpu/intern/gpu_viewport.c | 8 +- source/blender/windowmanager/intern/wm_draw.c | 4 +- source/blender/windowmanager/intern/wm_gesture.c | 24 ++-- source/blender/windowmanager/intern/wm_operators.c | 6 +- source/blender/windowmanager/intern/wm_stereo.c | 12 +- 76 files changed, 531 insertions(+), 532 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index d4bd1502417..663be49c71e 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -567,9 +567,9 @@ static void blf_draw_gl__start(FontBLF *font) #ifndef BLF_STANDALONE VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); + unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); BLI_assert(pos == BLF_POS_ID); BLI_assert(texCoord == BLF_COORD_ID); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index b9cc9540cf7..724f596a452 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -3953,8 +3953,8 @@ static void navmesh_drawColored(DerivedMesh *dm) #endif VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); diff --git a/source/blender/blenkernel/intern/mesh_render.c b/source/blender/blenkernel/intern/mesh_render.c index ecd2c6ea28e..d6cf70af1ab 100644 --- a/source/blender/blenkernel/intern/mesh_render.c +++ b/source/blender/blenkernel/intern/mesh_render.c @@ -903,8 +903,8 @@ static VertexBuffer *mesh_batch_cache_get_pos_and_normals(MeshRenderData *mrdata static unsigned int pos_id, nor_id; if (format.attrib_ct == 0) { /* initialize vertex format */ - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - nor_id = add_attrib(&format, "nor", GL_SHORT, 3, NORMALIZE_INT_TO_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + nor_id = VertexFormat_add_attrib(&format, "nor", COMP_I16, 3, NORMALIZE_INT_TO_FLOAT); } const int tottri = mesh_render_data_looptri_num_get(mrdata); @@ -945,8 +945,8 @@ static VertexBuffer *mesh_batch_cache_get_pos_and_nor_in_order(MeshRenderData *m static unsigned pos_id, nor_id; if (format.attrib_ct == 0) { /* initialize vertex format */ - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - nor_id = add_attrib(&format, "nor", GL_SHORT, 3, NORMALIZE_INT_TO_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + nor_id = VertexFormat_add_attrib(&format, "nor", COMP_I16, 3, NORMALIZE_INT_TO_FLOAT); } const int vertex_ct = mesh_render_data_verts_num_get(mrdata); @@ -1096,14 +1096,14 @@ Batch *BKE_mesh_batch_cache_get_fancy_edges(Mesh *me) static unsigned int pos_id, n1_id, n2_id; if (format.attrib_ct == 0) { /* initialize vertex format */ - pos_id = add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); #if USE_10_10_10 /* takes 1/3 the space */ - n1_id = add_attrib(&format, "N1", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT); - n2_id = add_attrib(&format, "N2", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT); + n1_id = VertexFormat_add_attrib(&format, "N1", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT); + n2_id = VertexFormat_add_attrib(&format, "N2", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT); #else - n1_id = add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT); - n2_id = add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT); + n1_id = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT); + n2_id = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT); #endif } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -1167,8 +1167,8 @@ static void mesh_batch_cache_create_overlay_batches(Mesh *me) static unsigned pos_id, data_id; if (format.attrib_ct == 0) { /* initialize vertex format */ - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - data_id = add_attrib(&format, "data", GL_UNSIGNED_BYTE, 4, KEEP_INT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + data_id = VertexFormat_add_attrib(&format, "data", COMP_U8, 4, KEEP_INT); } const int tri_ct = mesh_render_data_looptri_num_get(mrdata); @@ -1266,11 +1266,11 @@ Batch *BKE_mesh_batch_cache_get_overlay_facedots(Mesh *me) static unsigned pos_id, data_id; if (format.attrib_ct == 0) { /* initialize vertex format */ - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); #if USE_10_10_10 - data_id = add_attrib(&format, "norAndFlag", COMP_I10, 4, NORMALIZE_INT_TO_FLOAT); + data_id = VertexFormat_add_attrib(&format, "norAndFlag", COMP_I10, 4, NORMALIZE_INT_TO_FLOAT); #else - data_id = add_attrib(&format, "norAndFlag", GL_FLOAT, 4, KEEP_FLOAT); + data_id = VertexFormat_add_attrib(&format, "norAndFlag", COMP_F32, 4, KEEP_FLOAT); #endif } diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index b0f9875eaac..6bfb9d779c2 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1157,7 +1157,7 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode) static void pbvh_draw_BB(PBVH *bvh) { - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); for (int a = 0; a < bvh->totnode; a++) { diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index fe09c6d8f06..e8d2f1b83fe 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -160,9 +160,9 @@ static VertexBuffer *fill_arrows_vbo(const float scale) { /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } /* Line */ @@ -207,9 +207,9 @@ static VertexBuffer *sphere_wire_vbo(const float rad) #define NSEGMENTS 16 /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -256,10 +256,10 @@ Batch *DRW_cache_fullscreen_quad_get(void) /* Position Only 2D format */ static VertexFormat format = { 0 }; - static unsigned pos_id, uvs_id; + static unsigned int pos_id, uvs_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - uvs_id = add_attrib(&format, "uvs", GL_FLOAT, 2, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT); + uvs_id = VertexFormat_add_attrib(&format, "uvs", COMP_F32, 2, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -295,9 +295,9 @@ Batch *DRW_cache_cube_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -320,9 +320,9 @@ Batch *DRW_cache_circle_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -356,9 +356,9 @@ Batch *DRW_cache_square_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -383,9 +383,9 @@ Batch *DRW_cache_single_line_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -409,9 +409,9 @@ Batch *DRW_cache_single_line_endpoints_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -435,9 +435,9 @@ Batch *DRW_cache_plain_axes_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -466,9 +466,9 @@ Batch *DRW_cache_single_arrow_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } /* Square Pyramid */ @@ -522,9 +522,9 @@ Batch *DRW_cache_empty_cone_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -574,10 +574,10 @@ Batch *DRW_cache_axis_names_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { /* Using 3rd component as axis indicator */ - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } /* Line */ @@ -636,9 +636,9 @@ Batch *DRW_cache_lamp_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -667,9 +667,9 @@ Batch *DRW_cache_lamp_sunrays_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -698,9 +698,9 @@ Batch *DRW_cache_lamp_area_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -734,9 +734,9 @@ Batch *DRW_cache_lamp_hemi_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -814,9 +814,9 @@ Batch *DRW_cache_lamp_spot_get(void) static VertexFormat format = { 0 }; static unsigned int pos_id, n1_id, n2_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - n1_id = add_attrib(&format, "N1", GL_FLOAT, 3, KEEP_FLOAT); - n2_id = add_attrib(&format, "N2", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + n1_id = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT); + n2_id = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -873,7 +873,7 @@ Batch *DRW_cache_lamp_spot_square_get(void) static VertexFormat format = { 0 }; static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -903,9 +903,9 @@ Batch *DRW_cache_speaker_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); @@ -1005,10 +1005,10 @@ Batch *DRW_cache_bone_octahedral_get(void) unsigned int v_idx = 0; static VertexFormat format = { 0 }; - static unsigned pos_id, nor_id; + static unsigned int pos_id, nor_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - nor_id = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT); } /* Vertices */ @@ -1035,11 +1035,11 @@ Batch *DRW_cache_bone_octahedral_wire_outline_get(void) unsigned int v_idx = 0; static VertexFormat format = { 0 }; - static unsigned pos_id, n1_id, n2_id; + static unsigned int pos_id, n1_id, n2_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - n1_id = add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT); - n2_id = add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + n1_id = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT); + n2_id = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT); } /* Vertices */ @@ -1070,10 +1070,10 @@ Batch *DRW_cache_bone_point_get(void) unsigned int v_idx = 0; static VertexFormat format = { 0 }; - static unsigned pos_id, nor_id; + static unsigned int pos_id, nor_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - nor_id = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT); } /* Vertices */ @@ -1136,12 +1136,12 @@ Batch *DRW_cache_camera_get(void) int v_idx = 0; static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { /* use x coordinate to identify the vertex * the vertex shader take care to place it * appropriatelly */ - pos_id = add_attrib(&format, "pos", GL_FLOAT, 1, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 1, KEEP_FLOAT); } /* Vertices */ @@ -1197,12 +1197,12 @@ Batch *DRW_cache_camera_tria_get(void) int v_idx = 0; static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { /* use x coordinate to identify the vertex * the vertex shader take care to place it * appropriatelly */ - pos_id = add_attrib(&format, "pos", GL_FLOAT, 1, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 1, KEEP_FLOAT); } /* Vertices */ @@ -1227,9 +1227,9 @@ Batch *DRW_cache_single_vert_get(void) /* Position Only 3D format */ static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 44fc2f96b8b..939c1050141 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -671,10 +671,10 @@ static void shgroup_dynamic_batch(DRWShadingGroup *shgroup) for (DRWAttrib *attrib = interface->attribs.first; attrib; attrib = attrib->next) { BLI_assert(attrib->size <= 4); /* matrices have no place here for now */ if (attrib->type == DRW_ATTRIB_FLOAT) { - attrib->format_id = add_attrib(&interface->vbo_format, attrib->name, GL_FLOAT, attrib->size, KEEP_FLOAT); + attrib->format_id = VertexFormat_add_attrib(&interface->vbo_format, attrib->name, COMP_F32, attrib->size, KEEP_FLOAT); } else if (attrib->type == DRW_ATTRIB_INT) { - attrib->format_id = add_attrib(&interface->vbo_format, attrib->name, GL_BYTE, attrib->size, KEEP_INT); + attrib->format_id = VertexFormat_add_attrib(&interface->vbo_format, attrib->name, COMP_I8, attrib->size, KEEP_INT); } else { BLI_assert(false); diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c index 3ce1d92ed3a..eba72fac958 100644 --- a/source/blender/draw/intern/draw_view.c +++ b/source/blender/draw/intern/draw_view.c @@ -199,8 +199,8 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** #endif VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); @@ -365,8 +365,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) unsigned char col_bg[3], col_grid_emphasise[3], col_grid_light[3]; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); @@ -453,8 +453,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) /* draw axis lines -- sometimes grid floor is off, other times we still need to draw the Z axis */ VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); immBegin(GL_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2); @@ -556,8 +556,8 @@ void DRW_draw_background(void) glDisable(GL_DEPTH_TEST); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + unsigned pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); unsigned char col_hi[3], col_lo[3]; immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -642,9 +642,9 @@ void DRW_draw_cursor(void) const float f20 = 1.0f; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); - unsigned int wpos = add_attrib(format, "world_pos", COMP_F32, 3, KEEP_FLOAT); + 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); + unsigned int wpos = VertexFormat_add_attrib(format, "world_pos", COMP_F32, 3, KEEP_FLOAT); /* XXX Using instance shader without instance */ immBindBuiltinProgram(GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR); diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index fa0aeefc53c..c8ece34cb3c 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 pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -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 pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 caa4a6e31f3..398bb225fbf 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -73,7 +73,7 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const { const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); unsigned char col[4]; float xscale, x, y; char numstr[32] = " t"; /* t is the character to start replacing from */ @@ -129,7 +129,7 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) glLineWidth((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -164,7 +164,7 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width) glEnable(GL_BLEND); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_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 9d7d1535eb3..6f61ce3cf25 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -350,7 +350,7 @@ static void draw_marker( if (flag & DRAW_MARKERS_LINES) #endif { - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); setlinestyle(3); @@ -445,7 +445,7 @@ void ED_markers_draw(const bContext *C, int flag) v2d = UI_view2d_fromcontext(C); if (flag & DRAW_MARKERS_MARGIN) { - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 5f96f95e95b..5dca4be4de1 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 = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos_id = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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) { @@ -619,10 +619,10 @@ 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 = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size_id = add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color_id = add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); - unsigned int outline_color_id = add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); immBegin(PRIM_POINTS, key_ct); diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index cfc8ce81373..b53bba8db32 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -463,7 +463,7 @@ static void sk_drawEdge(SK_Point *pt0, SK_Point *pt1, float size, float color[4] float angle, length; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); sub_v3_v3v3(vec1, pt1->p, pt0->p); length = normalize_v3(vec1); @@ -490,7 +490,7 @@ static void sk_drawNormal(SK_Point *pt, float size, float height) float color[3] = { 0.0f, 1.0f, 1.0f }; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); gpuPushMatrix(); diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 4c9bbe6e6bb..60e2440bcc5 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -514,7 +514,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); glEnable(GL_BLEND); diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 7e37d0a5a83..229aecc21ae 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -150,8 +150,8 @@ static void gp_draw_stroke_buffer_fill(const tGPspoint *points, int totpoints, f /* draw triangulation data */ if (tot_triangles > 0) { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -208,8 +208,8 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short } VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); const tGPspoint *pt = points; @@ -323,9 +323,9 @@ static void gp_draw_stroke_volumetric_buffer(const tGPspoint *points, int totpoi return; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned size = add_attrib(format, "size", GL_FLOAT, 1, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); @@ -350,9 +350,9 @@ static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, int totpoints const float diff_mat[4][4], const float ink[4]) { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned size = add_attrib(format, "size", GL_FLOAT, 1, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); @@ -383,9 +383,9 @@ static void gp_draw_stroke_volumetric_3d( const float ink[4]) { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned size = add_attrib(format, "size", GL_FLOAT, 1, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); @@ -523,13 +523,13 @@ static void gp_draw_stroke_fill( } BLI_assert(gps->tot_triangles >= 1); - unsigned pos; + unsigned int pos; if (gps->flag & GP_STROKE_3DSPACE) { - pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); } else { - pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); } @@ -596,7 +596,7 @@ static void gp_draw_stroke_point( mul_v3_m4v3(fpt, diff_mat, &pt->x); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); if (sflag & GP_STROKE_3DSPACE) { immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); @@ -638,8 +638,8 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); @@ -736,8 +736,8 @@ static void gp_draw_stroke_2d(const bGPDspoint *points, int totpoints, short thi float fpt[3]; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GL_QUADS, (totpoints - 2) * 4 + 12); @@ -1172,16 +1172,16 @@ static void gp_draw_strokes_edit( selectColor[3] = alpha; VertexFormat *format = immVertexFormat(); - unsigned pos; /* specified later */ - unsigned size = add_attrib(format, "size", GL_FLOAT, 1, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT); + 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); if (gps->flag & GP_STROKE_3DSPACE) { - pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); } else { - pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR); } diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 5e72ec5f39f..c834b503cd1 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -961,7 +961,7 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customda if (brush) { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_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 db1a51ea4e6..c39516ff6ef 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1846,7 +1846,7 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr) if (p->paintmode == GP_PAINTMODE_ERASER) { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); glEnable(GL_LINE_SMOOTH); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 5f5598f79d8..4f056589867 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -107,7 +107,7 @@ void UI_draw_roundbox_gl_mode(int mode, float minx, float miny, float maxx, floa int a; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); /* mult */ for (a = 0; a < 7; a++) { @@ -198,8 +198,8 @@ void UI_draw_roundbox_shade_x( int a; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_FLOAT, 4, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -326,8 +326,8 @@ void UI_draw_roundbox_shade_y( BLI_assert(mode != GL_POLYGON); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_FLOAT, 4, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -454,7 +454,7 @@ 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 pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(color); @@ -469,8 +469,8 @@ void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const flo 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 = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + 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); /* 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; @@ -737,7 +737,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) (rect.ymax + 1) - (rect.ymin - 1)); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -788,7 +788,7 @@ 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 = add_attrib(&format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT); VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, nbr); @@ -869,7 +869,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1126,7 +1126,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco (rect.ymax + 1) - (rect.ymin - 1)); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1323,7 +1323,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti float y1 = rect->ymin; VertexFormat *format = immVertexFormat(); - position = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + position = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_CHECKER); /* Drawing the checkerboard. */ @@ -1335,8 +1335,8 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti /* New format */ format = immVertexFormat(); - position = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - color = add_attrib(format, "color", GL_FLOAT, 4, KEEP_FLOAT); + position = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + color = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); /* layer: color ramp */ @@ -1390,7 +1390,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti /* New format */ format = immVertexFormat(); - position = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + position = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* layer: box outline */ @@ -1472,7 +1472,7 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) /* AA circle */ VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv((unsigned char *)wcol->inner); @@ -1575,7 +1575,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti glLineWidth(1.0f); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* backdrop */ @@ -1705,8 +1705,8 @@ 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 = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int col = add_attrib(format, "color", GL_FLOAT, 4, KEEP_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int col = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); cmp = cuma->curve; @@ -1731,7 +1731,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti /* outline */ format = immVertexFormat(); - pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv((unsigned char *)wcol->outline); @@ -1822,8 +1822,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc BLI_rctf_size_y(&rect)); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int col = add_attrib(format, "color", GL_FLOAT, 4, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); UI_GetThemeColor4fv(TH_SEL_MARKER, col_sel); @@ -1911,7 +1911,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol float y = 0.5f * (recti->ymin + recti->ymax); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(but->col); @@ -1972,8 +1972,8 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, glEnable(GL_BLEND); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index cc7f1532b9d..9887cf1ee70 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -223,7 +223,7 @@ 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 = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.2f, 0.2f, 0.2f, alpha); @@ -254,10 +254,10 @@ static void vicon_keytype_draw_wrapper(int x, int y, int w, int h, float alpha, int yco = y + h / 2; VertexFormat *format = immVertexFormat(); - unsigned int pos_id = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size_id = add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color_id = add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); - unsigned int outline_color_id = add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); @@ -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 = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* XXX: Include alpha into this... */ @@ -1029,8 +1029,8 @@ static void icon_draw_texture( glBindTexture(GL_TEXTURE_2D, icongltex.id); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); if (rgb) immUniformColor3fvAlpha(rgb, alpha); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 5030b1d1e73..b2e8ddc5726 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); { @@ -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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); } /* an open panel */ else { @@ -1569,8 +1569,8 @@ static void ui_panel_category_draw_tab( int a; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + 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); /* mult */ for (a = 0; a < 4; a++) { @@ -1768,7 +1768,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) /* begin drawing */ glEnable(GL_LINE_SMOOTH); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw the background */ @@ -1827,7 +1827,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) /* tab blackline */ if (!is_active) { - pos = add_attrib(immVertexFormat(), "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(theme_col_tab_divider); @@ -1857,7 +1857,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) glDisable(GL_BLEND); /* tab blackline remaining (last tab) */ - pos = add_attrib(immVertexFormat(), "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_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 c595bc607a3..d9b2836d74d 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -197,7 +197,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y glEnable(GL_BLEND); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(draw_color); @@ -674,7 +674,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_CHECKER); /* checkers */ @@ -713,7 +713,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) } else { /* simple fill */ - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv((unsigned char *)wcol->inner); @@ -728,8 +728,8 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) unsigned char *col_pt = &col_array[0][0]; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -762,7 +762,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) UI_GetThemeColor4ubv(TH_WIDGET_EMBOSS, emboss); } - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); for (j = 0; j < WIDGET_AA_JITTER; j++) { @@ -793,7 +793,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) wcol->item[2], (unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER)}; - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(tcol); @@ -1381,7 +1381,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 = add_attrib(immVertexFormat(), "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv((unsigned char *)wcol->item); @@ -1413,7 +1413,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b t = 0; } - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(0.2f, 0.6f, 0.9f); @@ -2211,7 +2211,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2264,7 +2264,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2360,8 +2360,8 @@ 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 = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -2386,7 +2386,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * /* fully rounded outline */ format = immVertexFormat(); - pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2471,8 +2471,8 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons /* old below */ VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int col = add_attrib(format, "color", GL_FLOAT, 4, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); immBegin(GL_TRIANGLES, steps * 3 * 6); @@ -2631,7 +2631,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect) ui_hsv_cursor(x, y); /* outline */ - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ub(0, 0, 0); imm_draw_line_box(pos, (rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax)); @@ -2704,7 +2704,7 @@ static void ui_draw_separator(const rcti *rect, uiWidgetColors *wcol) 30 }; - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); glEnable(GL_BLEND); @@ -2795,7 +2795,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); #if 0 /* unused */ @@ -3159,7 +3159,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat bw += (bw < 0.5f) ? 0.5f : -0.5f; - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(bw, bw, bw, 1.0f); @@ -3518,7 +3518,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* make mask to draw over image */ @@ -4081,9 +4081,9 @@ static void draw_disk_shaded( unsigned int pos, col; VertexFormat *format = immVertexFormat(); - pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); if (shaded) { - col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); } else { @@ -4161,7 +4161,7 @@ void ui_draw_pie_center(uiBlock *block) } VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_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 5a9a4ef49eb..a04bd1503d7 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1326,8 +1326,8 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) return; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GL_LINES, vertex_count); @@ -1468,8 +1468,8 @@ void UI_view2d_constant_grid_draw(View2D *v2d) if (count_x > 0 || count_y > 0) { VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT); + 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); float theme_color[3]; UI_GetThemeColorShade3fv(TH_BACK, -10, theme_color); @@ -1519,8 +1519,8 @@ void UI_view2d_multi_grid_draw(View2D *v2d, int colorid, float step, int level_s vertex_count += 2 * ((int)((v2d->cur.ymax - v2d->cur.ymin) / lstep) + 1); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + 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); glLineWidth(1.0f); @@ -1840,7 +1840,7 @@ 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 pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1947,7 +1947,7 @@ 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 pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index eb3721a7ed3..09ac1f12aa2 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -124,7 +124,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin } VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); const unsigned char rgb_gray[4] = {0x60, 0x60, 0x60, 0xff}; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -212,7 +212,7 @@ 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 = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); immUniform1f("size", 0.7f * handle_size); @@ -402,7 +402,7 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* } VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); switch (draw_type) { @@ -816,7 +816,7 @@ 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 pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(255, 175, 0, 255); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index fb4970b23b2..84695c209e0 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1002,7 +1002,7 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd) copy_v3_v3(v2, ray_hit_best[1]); } - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_TRANSFORM); @@ -1044,7 +1044,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) gpuPushMatrix(); gpuMultMatrix3D(kcd->ob->obmat); - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 1c9c516f1dd..03543ed790b 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -108,7 +108,7 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) gpuPushMatrix(); gpuMultMatrix3D(lcd->ob->obmat); - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ub(255, 0, 255); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index fed8ed60ecc..e91b9389292 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -2711,7 +2711,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) brush = &pset->brush[pset->brushtype]; if (brush) { - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 5c3c47ee376..8fe07092d1c 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -93,8 +93,8 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GL_LINE_STRIP, 5); @@ -223,8 +223,8 @@ 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 = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immAttrib4ub(color, 255, 0, 0, alpha_debug); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); @@ -256,8 +256,8 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) glEnable(GL_LINE_SMOOTH); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GL_LINES, 12); @@ -298,7 +298,7 @@ static void region_draw_azone_icon(AZone *az) float midy = az->y1 + (az->y2 - az->y1) * 0.5f; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); /* outlined circle */ GPU_enable_program_point_size(); /* TODO: make a fixed-size shader to avoid this */ @@ -331,7 +331,7 @@ static void draw_azone_plus(float x1, float y1, float x2, float y2) float pad = 0.2f * U.widget_unit; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); glEnable(GL_BLEND); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -571,7 +571,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar) #if 0 glEnable(GL_BLEND); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_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,7 +2015,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, const char *context, int c UI_view2d_view_restore(C); glEnable(GL_BLEND); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_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); @@ -2149,7 +2149,7 @@ void ED_region_info_draw(ARegion *ar, const char *text, float fill_color[4], con glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(fill_color); immRecti(pos, rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1); @@ -2356,7 +2356,7 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame, BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymax, frame->ymax + box_y); /* draw top box */ VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_METADATA_BG); immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); @@ -2381,7 +2381,7 @@ void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame, BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymin - box_y, frame->ymin); /* draw top box */ VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_METADATA_BG); immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); @@ -2410,7 +2410,7 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) UI_view2d_view_to_region(&ar->v2d, 1.0f, 1.0f, &x2, &y2); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, 20); @@ -2443,8 +2443,8 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) if (count_fine > 0) { VertexFormat_clear(format); - pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GL_LINES, 4 * count_fine + 4 * count_large); @@ -2517,7 +2517,7 @@ void ED_region_visible_rect(ARegion *ar, rcti *rect) void ED_region_cache_draw_background(const ARegion *ar) { - unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(128, 128, 255, 64); immRecti(pos, 0, 0, ar->winx, 8 * UI_DPI_FAC); @@ -2537,7 +2537,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 pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_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); @@ -2551,7 +2551,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 pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_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 57bff45fc6e..f9e7a27e337 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -230,8 +230,8 @@ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, } VertexFormat *vert_format = immVertexFormat(); - unsigned int pos = add_attrib(vert_format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int texco = add_attrib(vert_format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(vert_format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int texco = VertexFormat_add_attrib(vert_format, "texCoord", COMP_F32, 2, KEEP_FLOAT); unsigned int program = glaGetOneInt(GL_CURRENT_PROGRAM); diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index bbcf4eb56a2..31acaecf029 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -303,7 +303,7 @@ void ED_screen_draw(wmWindow *win) wmSubWindowSet(win, win->screen->mainwin); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* Note: first loop only draws if U.pixelsize > 1, skip otherwise */ @@ -432,7 +432,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(col); diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 55e3573495a..a0b077a6b29 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -457,7 +457,7 @@ static void screencast_draw_cursor(bContext *UNUSED(C), int x, int y, void *UNUS glEnable(GL_BLEND); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_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 9bc163c6a62..44ef95ee0b6 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -669,8 +669,8 @@ 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 = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); @@ -757,8 +757,8 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush, } VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); @@ -930,7 +930,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1114,7 +1114,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 = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 234220cacc8..7bc46e1741c 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -722,7 +722,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda glEnable(GL_BLEND); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index e6113f2c2c3..9fd46424dfd 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -146,7 +146,7 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(paint->paint_cursor_col); @@ -173,7 +173,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) setlinestyle(3); glLineWidth(3.0f); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(0, 0, 0, paint->paint_cursor_col[3]); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index b6bed36b2c6..ff1fb30bea6 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -212,7 +212,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 4c65207d9a0..799756345c2 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -205,7 +205,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) y = (float)(-ACHANNEL_HEIGHT(ac)); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index 14d2ca21b0a..954b3f2bd1a 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -130,7 +130,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) unsigned int keyframe_ct = 0; VertexFormat *format = immVertexFormat(); - unsigned int pos_id = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* don't use totrect set, as the width stays the same @@ -214,10 +214,10 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene) if (keyframe_ct > 0) { /* draw keyframe markers */ format = immVertexFormat(); - pos_id = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size_id = add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color_id = add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); - unsigned int outline_color_id = add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); @@ -318,7 +318,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar) float y = (float) CHANNEL_FIRST; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_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 ef7b88cfcdf..dc40f083bc6 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -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 = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_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 = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* find window pixel coordinates of origin */ @@ -359,7 +359,7 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int gpuScale2f(zoomx, zoomy); gpuMultMatrix3D(sc->stabmat); /* XXX can we make stabmat a 2D matrix? --merwin */ - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(0.0f, 0.0f, 0.0f); @@ -436,7 +436,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin i++; } - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1101,8 +1101,8 @@ static void draw_plane_marker_image(Scene *scene, gpuMultMatrix3D(gl_matrix); /* XXX update for new 2D matrix API --merwin */ VertexFormat *imm_format = immVertexFormat(); - unsigned int pos = add_attrib(imm_format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int texCoord = add_attrib(imm_format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); immUniform4f("color", 1.0f, 1.0f, 1.0f, plane_track->image_opacity); @@ -1162,7 +1162,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane } if (draw_plane_quad || is_selected_track) { - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1363,7 +1363,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie } } - unsigned int position = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int position = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1547,7 +1547,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, gpuMultMatrix3D(sc->stabmat); /* XXX make 2D */ gpuScale2f(width, height); - unsigned int position = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int position = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index 139757e7b68..3698fba0d54 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -327,7 +327,7 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene) UI_view2d_grid_free(grid); if (clip) { - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 cdda8865588..a5096d3f171 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -246,7 +246,7 @@ 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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_CFRAME); @@ -281,7 +281,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index 8055e262611..e813557f9e8 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -159,7 +159,7 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN}; int pen[2]; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_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 dc67282f8c2..0df0bcec49d 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -400,7 +400,7 @@ static void file_draw_preview( /* border */ if (use_dropshadow) { VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2,KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2,KEEP_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 = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, -7); @@ -484,8 +484,8 @@ static void draw_dividers(FileLayout *layout, View2D *v2d) unsigned char col_hi[3], col_lo[3]; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); - unsigned int color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + 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); vertex_ct = (v2d->cur.xmax - v2d->tot.xmin) / step + 1; /* paint at least 1 divider */ vertex_ct *= 4; /* vertex_count = 2 points per divider * 2 lines per divider */ diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index e382c2dbd29..6c2355a415e 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; - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw two black lines showing the standard reference levels */ @@ -266,7 +266,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 pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); glEnable(GL_BLEND); GPU_enable_program_point_size(); @@ -310,7 +310,7 @@ static void draw_fcurve_handles(SpaceIpo *sipo, FCurve *fcu) { int sel, b; - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* slightly hacky, but we want to draw unselected points before selected ones @@ -442,7 +442,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 = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor((fcu->flag & FCURVE_SELECTED) ? TH_TEXT_HI : TH_TEXT); @@ -832,7 +832,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) //if ((driver->flag & DRIVER_FLAG_SHOWDEBUG) == 0) // return; - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* No curve to modify/visualize the result? @@ -943,7 +943,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* the ghost curves are simply sampled F-Curves stored in sipo->ghostCurves */ @@ -1024,7 +1024,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); if (((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) || (fcu->flag & FCURVE_MUTED)) { diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 70d3fad9554..b110f85df9a 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 pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index f63b0d51e00..139097979c4 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 = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_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 = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_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 = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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,7 +686,7 @@ void draw_image_sample_line(SpaceImage *sima) if (sima->sample_line_hist.flag & HISTO_FLAG_SAMPLELINE) { Histogram *hist = &sima->sample_line_hist; - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immBegin(GL_LINES, 2); @@ -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 pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_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 1872a8a0545..33c0565c12c 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -85,7 +85,7 @@ static void console_draw_sel(const char *str, const int sel[2], const int xy[2], glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(bg_sel); @@ -191,7 +191,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str if (bg) { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(bg); @@ -242,7 +242,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str if (bg) { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_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 ae9a9e3a36b..47f07183893 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -119,7 +119,7 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa color[3] *= 2.5f; VertexFormat *format = immVertexFormat(); - unsigned int pos_id = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immUniformColor4fv(color); @@ -140,10 +140,10 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa if (key_ct > 0) { format = immVertexFormat(); - pos_id = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int size_id = add_attrib(format, "size", COMP_F32, 1, KEEP_FLOAT); - unsigned int color_id = add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); - unsigned int outline_color_id = add_attrib(format, "outlineColor", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); GPU_enable_program_point_size(); immBegin(PRIM_POINTS, key_ct); @@ -352,7 +352,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); - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw extrapolation info first (as backdrop) @@ -405,7 +405,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri UI_draw_roundbox_shade_x(GL_TRIANGLE_FAN, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1, color); /* restore current vertex format & program (roundbox trashes it) */ - pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); } else { @@ -453,7 +453,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri UI_draw_roundbox_shade_x(GL_LINE_LOOP, strip->start, yminc, strip->end, ymaxc, 0.0, 0.0, 0.1, color); /* restore current vertex format & program (roundbox trashes it) */ - pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3fv(color); @@ -652,7 +652,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) { AnimData *adt = ale->adt; - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* just draw a semi-shaded rect spanning the width of the viewable area if there's data, diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index c74dc3f5b3c..7234d30c8ae 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -2168,7 +2168,7 @@ static void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNo const float cy = y + snode->zoom * backdropHeight * node->custom4; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2213,7 +2213,7 @@ static void node_composit_backdrop_boxmask(SpaceNode *snode, ImBuf *backdrop, bN y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2257,7 +2257,7 @@ static void node_composit_backdrop_ellipsemask(SpaceNode *snode, ImBuf *backdrop y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -3263,7 +3263,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_ACTIVE); @@ -3415,7 +3415,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, } if (do_triple || drawarrow || (!do_shaded)) { - pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); } @@ -3472,8 +3472,8 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, unsigned char col[3]; VertexFormat *format = immVertexFormat(); - pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 962ba7b78ce..e05db13d8ef 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -640,7 +640,7 @@ static void node_draw_preview_background(float tile, rctf *rect) float x, y; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -712,7 +712,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv) glDisable(GL_BLEND); - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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); @@ -765,8 +765,8 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * UI_view2d_scale_get(v2d, &scale, NULL); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned col = add_attrib(format, "color", GL_FLOAT, 4, KEEP_FLOAT); + 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); glEnable(GL_BLEND); GPU_enable_program_point_size(); @@ -1129,7 +1129,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b } /* scale widget thing */ - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(color_id, -10); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index cbfe0828103..e14a6fb6ec5 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -666,7 +666,7 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex) glLineWidth(1.0f); - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -15, -200); @@ -1468,7 +1468,7 @@ static void outliner_draw_tree_element( /* divider */ { VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); unsigned char col[4]; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1522,7 +1522,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); int coord_y = te_insert->ys; int coord_x = te_insert->xs; unsigned char col[4]; @@ -1609,7 +1609,7 @@ 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 = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); unsigned char col[4]; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1635,7 +1635,7 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * if (TSELEM_OPEN(tselem, soops)) if (tselem->type == TSE_RNA_STRUCT) { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_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); @@ -1647,7 +1647,7 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * outliner_draw_struct_marks(ar, soops, &te->subtree, starty); if (tselem->type == TSE_RNA_STRUCT) { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immThemeColorShadeAlpha(TH_BACK, -15, -200); @@ -1715,7 +1715,7 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx, glEnable(GL_BLEND); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_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); @@ -1787,7 +1787,7 @@ static void outliner_back(ARegion *ar) ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShade(TH_BACK, 6); @@ -1815,7 +1815,7 @@ static void outliner_draw_restrictcols(ARegion *ar) { glLineWidth(1.0f); - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_BACK, -15, -200); immBegin(PRIM_LINES, 6); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 44cb1d61f14..a7a638d0952 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); /* TODO: add back stippled line for muted strips? */ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1035,7 +1035,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons /* border */ setlinestyle(3); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_BACK); @@ -1306,8 +1306,8 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, format, type, display_buffer); VertexFormat *imm_format = immVertexFormat(); - unsigned int pos = add_attrib(imm_format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int texCoord = add_attrib(imm_format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); immUniform4f("color", 1.0f, 1.0f, 1.0f, 1.0f); @@ -1494,7 +1494,7 @@ static void draw_seq_backdrop(View2D *v2d) { int i; - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* darker gray overlay over the view backdrop */ @@ -1573,7 +1573,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) const Sequence *seq = special_seq_update; glEnable(GL_BLEND); - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ub(255, 255, 255, 48); @@ -1593,7 +1593,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) glEnable(GL_BLEND); - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* draw darkened area outside of active timeline @@ -1717,7 +1717,7 @@ 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 pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3f(0.2, 0.2, 0.2); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index b6d71b8ccf9..4d587109155 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 = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_BACK); immRecti(pos, back->xmin, back->ymin, back->xmax, back->ymax); @@ -968,7 +968,7 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) boxh = (DOC_HEIGHT + 1) * (st->lheight_dpi + TXT_LINE_SPACING); /* Draw panel */ - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_BACK); @@ -1067,7 +1067,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 = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_SHADE1); @@ -1090,7 +1090,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 = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int posi = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_SHADE2); @@ -1131,7 +1131,7 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar) return; } - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* Draw the selection */ @@ -1444,7 +1444,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) if (st->showlinenrs) { x = TXT_OFFSET + TEXTXLOC; - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_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); @@ -1504,7 +1504,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) if (margin_column_x >= x) { setlinestyle(1); - unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* same color as line number background */ diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 22ab9b73b3e..9844a8053db 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -84,7 +84,7 @@ static void time_draw_sfra_efra(Scene *scene, View2D *v2d) glEnable(GL_BLEND); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); @@ -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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* iterate over pointcaches on the active object, @@ -321,7 +321,7 @@ static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel, cons if (max_len > 0) { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(color); diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index 7ab2b4ec3a4..c241bbcd436 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -239,8 +239,8 @@ void draw_motion_path_instance(Scene *scene, glLineWidth(mpath->line_thickness); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); @@ -264,7 +264,7 @@ void draw_motion_path_instance(Scene *scene, glLineWidth(old_width); } - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -388,7 +388,7 @@ void draw_motion_path_instance(Scene *scene, /* point must be bigger than line */ glPointSize(mpath->line_thickness + 3.0); - pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(col); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index f0c47ee2639..da32ca19ed5 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -371,8 +371,8 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize) unsigned int i = 0; float n[3] = {0.0f}; /* Vertex format */ - unsigned int pos = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned int nor = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT); + 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); /* Vertices */ VertexBuffer_init_with_format(&vbo, &format); @@ -431,7 +431,7 @@ static void drawcube_size(float xsize, float ysize, float zsize) if (format.attrib_ct == 0) { /* Vertex format */ - unsigned int pos = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); /* Elements */ ElementListBuilder_init(&elb, GL_LINES, 12, 8); @@ -470,7 +470,7 @@ static void draw_bonevert(void) if (format.attrib_ct == 0) { /* Vertex format */ - unsigned int pos = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); /* Vertices */ VertexBuffer_init_with_format(&vbo, &format); @@ -583,7 +583,7 @@ static void draw_bone_octahedral(void) if (format.attrib_ct == 0) { /* Vertex format */ - unsigned int pos = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); /* Elements */ ElementListBuilder_init(&elb, GL_LINES, 12, 6); @@ -618,8 +618,8 @@ static void draw_bone_solid_octahedral(void) if (format.attrib_ct == 0) { unsigned int v_idx = 0; /* Vertex format */ - unsigned int pos = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned int nor = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT); + 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); /* Vertices */ VertexBuffer_init_with_format(&vbo, &format); @@ -811,7 +811,7 @@ static void draw_sphere_bone_dist(float smat[4][4], float imat[4][4], bPoseChann cross_v3_v3v3(norvec, dirvec, imat[2]); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immBegin(GL_TRIANGLE_STRIP, 66); @@ -867,7 +867,7 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4], float *headvec, *tailvec, dirvec[3]; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -1108,8 +1108,8 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co glPolygonOffset(-1.0f, -1.0f); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned int nor = add_attrib(format, "nor", GL_FLOAT, 3, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_SIMPLE_LIGHTING); immUniformColor4fv(fcolor); @@ -1146,7 +1146,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned length = ebone->length; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); gpuPushMatrix(); gpuScaleUniform(length); @@ -1452,7 +1452,7 @@ 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 = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(fcolor); @@ -1633,7 +1633,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp) bPoseChannel *parchan; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(fcolor); @@ -1792,7 +1792,7 @@ static void draw_pose_dofs(Object *ob) Bone *bone; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -2202,7 +2202,7 @@ static void draw_pose_bones(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion * */ if ((do_dashed & DASH_HELP_LINES) && ((bone->flag & BONE_CONNECTED) == 0)) { VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -2502,7 +2502,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt) /* offset to parent */ if (eBone->parent) { VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); GPU_select_load_id(-1); /* -1 here is OK! */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 19f8f6eae6f..726a67a5d74 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -539,7 +539,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const glLineWidth(1.0f); - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); if (color) { immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4ubv(color); @@ -706,8 +706,8 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char } VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_MODULATE_ALPHA); immUniform1f("alpha", ob_alpha); immUniform1i("image", 0); /* default GL_TEXTURE0 unit */ @@ -733,7 +733,7 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char /* Draw the image outline */ glLineWidth(1.5f); - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); const bool picking = dflag & DRAW_CONSTCOLOR; if (picking) { @@ -806,7 +806,7 @@ static void drawcentercircle(View3D *v3d, RegionView3D *UNUSED(rv3d), const floa glEnable(GL_BLEND); GPU_enable_program_point_size(); - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA); immUniform1f("size", size); @@ -1266,7 +1266,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, normalize_v3(imat[0]); normalize_v3(imat[1]); - const unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); /* lamp center */ copy_v3_v3(vec, ob->obmat[3]); @@ -1816,7 +1816,7 @@ static void draw_viewport_object_reconstruction( if (reconstruction->camnr >= 2) { MovieReconstructedCamera *camera = reconstruction->cameras; - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_CAMERA_PATH); @@ -2168,7 +2168,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 pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) { immUniformColor3ubv(ob_wire_col); @@ -2277,7 +2277,7 @@ void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, void drawspeaker(const unsigned char ob_wire_col[3]) { VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -2442,10 +2442,10 @@ static void drawlattice(View3D *v3d, Object *ob, const short dflag, const unsign } VertexFormat *format = immVertexFormat(); - unsigned int color, pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int color, pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); if (actdef_wcol) { - color = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT); + color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); } else { @@ -2499,8 +2499,8 @@ 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 = add_attrib(v_format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned int v_color = add_attrib(v_format, "color", GL_FLOAT, 4, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR); @@ -2560,8 +2560,8 @@ static void drawSelectedVertices(DerivedMesh *dm, Mesh *me) data.col[1] = sel_col; data.col[2] = act_col; - data.color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); - data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + 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); if (dm->getNumVerts(dm) == 0) return; @@ -2632,7 +2632,7 @@ static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv data.bm = em->bm; data.normalsize = scene->toolsettings->normalsize; - data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); calcDrawDMNormalScale(ob, &data); @@ -2666,7 +2666,7 @@ static void draw_dm_face_centers(BMEditMesh *em, DerivedMesh *dm, bool select, c drawBMSelect_userData data; data.bm = em->bm; data.select = select; - data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); if (dm->getNumPolys(dm) == 0) return; @@ -2718,7 +2718,7 @@ static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv data.bm = em->bm; data.normalsize = scene->toolsettings->normalsize; - data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); calcDrawDMNormalScale(ob, &data); @@ -2779,8 +2779,8 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer data.sel = sel; data.eve_act = eve_act; data.bm = em->bm; - data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - data.color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); /* Cache theme values */ UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, data.th_editmesh_active); @@ -2811,7 +2811,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + data.pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4ubv(data.th_skin_root); @@ -3136,7 +3136,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + data.pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); if (dm->getNumLoops(dm) == 0) return; @@ -3316,8 +3316,8 @@ 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 = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - data.col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); @@ -5114,7 +5114,7 @@ static bool draw_mesh_object_new(Scene *scene, SceneLayer *sl, ARegion *ar, View static void drawDispListVerts(int dt, const void *data, unsigned int vert_ct, const unsigned char wire_col[3]) { VertexFormat format = {0}; - unsigned int pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, vert_ct); @@ -5142,9 +5142,9 @@ static void drawDispListElem(bool quads, bool UNUSED(smooth), const float *data, const int *idx = elem; unsigned int pos_id, nor_id; - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); if (ndata) { - nor_id = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT); + nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT); } ElementListBuilder elb; @@ -5586,9 +5586,9 @@ static void draw_vertex_array(int dt, const float *vert, const float *nor, const { VertexFormat format = {0}; unsigned int pos_id, nor_id, col_id; - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - if (nor) nor_id = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT); - if (color) col_id = add_attrib(&format, "color", GL_FLOAT, 3, KEEP_FLOAT); + 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); VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, vert_ct); @@ -6114,7 +6114,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); imm_cpack(0xFFFFFF); } @@ -6311,7 +6311,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos_id = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3f(0.9f, 0.4f, 0.4f); @@ -6351,7 +6351,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv int *res = clmd->hair_grid_res; int i; - unsigned int pos_id = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos_id = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (select) immUniformThemeColor(TH_ACTIVE); @@ -6584,8 +6584,8 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) col_comp = ((point->flag & PEP_HIDE) || timed) ? 4 : 3; - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - col_id = add_attrib(&format, "color", GL_FLOAT, col_comp, KEEP_FLOAT); + 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); VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, path->segments + 1); @@ -6635,9 +6635,8 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) int totkeys_visible = 0; VertexFormat format = {0}; - unsigned int pos_id, col_id; - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - col_id = add_attrib(&format, "color", GL_FLOAT, (timed ? 4 : 3), KEEP_FLOAT); + 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); for (i = 0, point = edit->points; i < totpoint; i++, point++) if (!(point->flag & PEP_HIDE)) @@ -6702,8 +6701,8 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) } else if (pset->selectmode == SCE_SELECT_END) { VertexFormat *format = immVertexFormat(); - unsigned int pos_id = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned int col_id = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); immBeginAtMost(GL_POINTS, totpoint); for (i = 0, point = edit->points; i < totpoint; i++, point++) { @@ -6738,8 +6737,8 @@ static void ob_draw_RE_motion(float com[3], float rotscale[3][3], float itw, flo float th = ith * drw_size; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned int col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); immBegin(GL_LINES, 30); @@ -6890,8 +6889,8 @@ static void drawhandlesN(Nurb *nu, const char sel, const bool hide_handles) } VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned int col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); glLineWidth(1.0f); @@ -6945,7 +6944,7 @@ static void drawhandlesN_active(Nurb *nu) if (nu->hide) return; if (nu->type == CU_BEZIER && nu->pntsu > 0) { - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_ACTIVE_SPLINE); glLineWidth(2.0f); @@ -6989,8 +6988,8 @@ static void drawvertsN(const Nurb *nurb, const bool hide_handles, const void *ve if (count == 0) return; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); unsigned char vert_color[3]; @@ -7063,7 +7062,7 @@ 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 pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_ACTIVE_SPLINE); @@ -7090,7 +7089,7 @@ static void editnurb_draw_active_nurbs(Nurb *nu) { if (nu->pntsv > 0) { VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_ACTIVE_SPLINE); @@ -7158,7 +7157,7 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel) } format = immVertexFormat(); - pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); glLineWidth(1.0f); @@ -7188,8 +7187,8 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel) } format = immVertexFormat(); - pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); // just quick guesstimate of how many verts to draw @@ -7323,7 +7322,7 @@ static void draw_editnurb( BevList *bl; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(TH_WIRE_EDIT); @@ -7391,7 +7390,7 @@ static void draw_editnurb( static void draw_editfont_textcurs(RegionView3D *rv3d, float textcurs[4][2]) { - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); ED_view3d_polygon_offset(rv3d, -1.0); set_inverted_drawing(1); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -7429,7 +7428,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3 } if (cu->linewidth != 0.0f) { - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_WIRE_EDIT); copy_v3_v3(vec1, ob->orig); @@ -7450,7 +7449,7 @@ 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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(i == (cu->actbox - 1) ? TH_ACTIVE : TH_WIRE); vec1[0] = cu->xof + cu->tb[i].x; @@ -7477,7 +7476,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3 const int seltot = selend - selstart; float selboxw; - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); imm_cpack(0xffffff); set_inverted_drawing(1); @@ -7775,7 +7774,7 @@ static bool drawmball(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *r glLineWidth(1.0f); - const int unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); while (ml) { @@ -7831,7 +7830,7 @@ static void draw_forcefield(Object *ob, RegionView3D *rv3d, normalize_v3(imat[1]); #endif - const int unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3fv(draw_color); @@ -8033,7 +8032,7 @@ static void imm_draw_bb(BoundBox *bb, char type, bool around_origin, const unsig gpuPushMatrix(); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -8111,7 +8110,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -8134,7 +8133,7 @@ void draw_bounding_volume(Object *ob, char type, const unsigned char ob_wire_col } else { if (type == OB_BOUND_BOX) { - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -8178,7 +8177,7 @@ static void drawtexspace(Object *ob, const unsigned char ob_wire_col[3]) setlinestyle(2); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); if (ob_wire_col) { immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -8318,7 +8317,7 @@ static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data, const char *axis_str[3] = {"px", "py", "pz"}; float mat[4][4]; - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -8465,7 +8464,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -8929,7 +8928,7 @@ afterdraw: if (!render_override) { BoundBox bb; float p0[3], p1[3]; - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); if (ob_wire_col) immUniformColor3ubv(ob_wire_col); @@ -9067,7 +9066,7 @@ afterdraw: { float imat[4][4], vec[3] = {0.0f, 0.0f, 0.0f}; - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); invert_m4_m4(imat, rv3d->viewmatob); @@ -9122,7 +9121,7 @@ afterdraw: if ((base->sx != IS_CLIPPED) && (U.obcenter_dia != 0.0)) { - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_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 */ @@ -9151,7 +9150,7 @@ afterdraw: ListBase *list; RigidBodyCon *rbc = ob->rigidbody_constraint; - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(ob_wire_col); @@ -9337,8 +9336,8 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset) if (dm->getNumVerts(dm) == 0) return; - data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - data.col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + data.col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); @@ -9370,8 +9369,8 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset) data.bm = em->bm; data.offset = offset; VertexFormat *format = immVertexFormat(); - data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - data.col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + data.col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); @@ -9460,8 +9459,8 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d, drawBMOffset_userData data; /* don't use offset */ data.bm = em->bm; VertexFormat *format = immVertexFormat(); - data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - data.col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); + data.col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); diff --git a/source/blender/editors/space_view3d/drawsimdebug.c b/source/blender/editors/space_view3d/drawsimdebug.c index 5984633112d..da39a81a4d8 100644 --- a/source/blender/editors/space_view3d/drawsimdebug.c +++ b/source/blender/editors/space_view3d/drawsimdebug.c @@ -49,8 +49,8 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) { VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a2b59e9021d..27db505951b 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -523,7 +523,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) y2i = (int)(y2 + (1.0f - 0.0001f)); /* use the same program for everything */ - unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* passepartout, specified in camera edit buttons */ @@ -724,7 +724,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) static void drawrenderborder(ARegion *ar, View3D *v3d) { /* use the same program for everything */ - unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); glLineWidth(1.0f); @@ -813,8 +813,8 @@ static void view3d_draw_background_gradient(void) /* TODO: finish 2D API & draw background with that */ VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + 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); unsigned char col_hi[3], col_lo[3]; immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -1107,8 +1107,8 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** #endif VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); @@ -1283,8 +1283,8 @@ 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 = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); @@ -1371,8 +1371,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr /* draw axis lines -- sometimes grid floor is off, other times we still need to draw the Z axis */ VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); immBegin(GL_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2); @@ -1527,8 +1527,8 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) glLineWidth(1.0f); VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); @@ -1553,7 +1553,7 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) immUnbindProgram(); VertexFormat_clear(format); - pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1612,8 +1612,8 @@ static void draw_view_axis(RegionView3D *rv3d, rcti *rect) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned col = add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GL_LINES, 6); @@ -1656,8 +1656,8 @@ static void draw_rotation_guide(RegionView3D *rv3d) glDepthMask(GL_FALSE); /* don't overwrite zbuf */ VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); - unsigned col = add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 328e0b03bb8..c324cb7b251 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -260,7 +260,7 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), y2 = yoff + 0.55f * fly->height; VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index 414687636b0..c0618cf2c6d 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -460,7 +460,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a glEnable(GL_BLEND); if (ruler_item->flag & RULERITEM_USE_ANGLE) { - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); imm_cpack(is_act ? color_act : color_base); @@ -602,7 +602,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a } } else { - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); imm_cpack(is_act ? color_act : color_base); @@ -705,7 +705,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 pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); imm_cpack(color_act); diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 8390d56c610..48c16de4dbe 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -341,7 +341,7 @@ static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *a } VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 346b02dedcc..ead3817bae4 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1720,7 +1720,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) gpuPushMatrix(); - unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); UNUSED_VARS(pos); /* silence warning */ BLI_assert(pos == POS_INDEX); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -6877,7 +6877,7 @@ static void drawEdgeSlide(TransInfo *t) gpuPushMatrix(); gpuMultMatrix3D(t->obedit->obmat); - unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -7491,7 +7491,7 @@ static void drawVertSlide(TransInfo *t) glLineWidth(line_size); - unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index e934bacd0c7..d9c0942dece 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -730,7 +730,7 @@ void drawConstraint(TransInfo *t) if (depth_test_enabled) glDisable(GL_DEPTH_TEST); - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ub(255, 255, 255); @@ -802,7 +802,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) if (depth_test_enabled) glDisable(GL_DEPTH_TEST); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_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 aeac219c0a9..1cf53f95ef1 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1052,7 +1052,7 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis } UI_make_axis_color(col, col2, axis); - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(col2); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 13b97b2e1c0..ffa22e1326b 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -999,7 +999,7 @@ static void draw_manipulator_rotate( gpuTranslate3fv(rv3d->twmat[3]); - const unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + const unsigned pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); /* sets view screen aligned */ gpuRotate3f(-360.0f * saacos(rv3d->viewquat[0]) / (float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]); @@ -1293,7 +1293,7 @@ static void draw_manipulator_scale( glDisable(GL_DEPTH_TEST); - const unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -1483,7 +1483,7 @@ static void draw_manipulator_translate( // XXX if (moving) gpuTranslate3fv(t->vec); glDisable(GL_DEPTH_TEST); - const unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -1576,7 +1576,7 @@ static void draw_manipulator_rotate_cyl( manipulator_axis_order(rv3d, axis_order); - const unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 8f37b35c6f0..162808e3eb3 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 pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -219,7 +219,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) glEnable(GL_BLEND); - unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_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 96864c88d9d..8bf0b2eb020 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 setlinestyle(3); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_VIEW_OVERLAY); diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index b99e878c790..d0b581eed90 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -85,7 +85,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) gpuTranslate2fv(cursor); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -174,7 +174,7 @@ static void draw_uvs_shadow(Object *obedit) const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -239,7 +239,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe } } - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -319,8 +319,8 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe col[3] = 0.5f; /* hard coded alpha, not that nice */ VertexFormat *format = immVertexFormat(); - unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -521,7 +521,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -563,7 +563,7 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, SceneLayer *sl, Ob mloopuv = me->mloopuv; } - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -681,7 +681,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -746,7 +746,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe switch (sima->dt_uv) { case SI_UVDT_DASH: - pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -774,7 +774,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe break; case SI_UVDT_BLACK: /* black/white */ case SI_UVDT_WHITE: - pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -796,7 +796,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe break; case SI_UVDT_OUTLINE: - pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -820,8 +820,8 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe UI_GetThemeColor4ubv(TH_EDGE_SELECT, col1); VertexFormat *format = immVertexFormat(); - pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT); + 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); if (interpedges) { immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); @@ -876,7 +876,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe } } else { - pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(col2); @@ -907,8 +907,8 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe bool col_set = false; VertexFormat *format = immVertexFormat(); - pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); + 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); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); @@ -967,7 +967,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 = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index b940de4a727..9d5b6495938 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1562,7 +1562,7 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar static VertexFormat format = { 0 }; static unsigned int pos_id; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT); } glEnable(GL_BLEND); diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c index 0e4b71ab9b8..dd8b6172483 100644 --- a/source/blender/gpu/intern/gpu_batch.c +++ b/source/blender/gpu/intern/gpu_batch.c @@ -67,8 +67,8 @@ static Batch *batch_sphere(int lat_res, int lon_res) float lon, lat; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - nor_id = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT); } vbo = VertexBuffer_create_with_format(&format); @@ -103,8 +103,8 @@ static Batch *batch_sphere_wire(int lat_res, int lon_res) float lon, lat; if (format.attrib_ct == 0) { - pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT); - nor_id = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT); + pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT); } vbo = VertexBuffer_create_with_format(&format); diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c index e4647c33621..8ee22ce1c13 100644 --- a/source/blender/gpu/intern/gpu_compositing.c +++ b/source/blender/gpu/intern/gpu_compositing.c @@ -278,8 +278,8 @@ GPUFX *GPU_fx_compositor_create(void) static VertexFormat format = {0}; static unsigned int pos, uvs; if (format.attrib_ct == 0) { - pos = add_attrib(&format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - uvs = add_attrib(&format, "uvs", GL_FLOAT, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT); + uvs = VertexFormat_add_attrib(&format, "uvs", COMP_F32, 2, KEEP_FLOAT); } VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, 4); @@ -293,7 +293,7 @@ GPUFX *GPU_fx_compositor_create(void) static VertexFormat format_point = {0}; static unsigned int dummy_attrib; if (format_point.attrib_ct == 0) { - dummy_attrib = add_attrib(&format_point, "pos", GL_FLOAT, 2, KEEP_FLOAT); + dummy_attrib = VertexFormat_add_attrib(&format_point, "pos", COMP_F32, 2, KEEP_FLOAT); } float dummy[2] = {0.0f, 0.0f}; VertexBuffer *vbo_point = VertexBuffer_create_with_format(&format_point); diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index afc04ac8626..425fcecae0c 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -390,8 +390,8 @@ void GPU_framebuffer_blur( if (format.attrib_ct == 0) { unsigned int i = 0; /* Vertex format */ - unsigned int pos = add_attrib(&format, "pos", GL_FLOAT, 2, KEEP_FLOAT); - unsigned int uvs = add_attrib(&format, "uvs", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int uvs = VertexFormat_add_attrib(&format, "uvs", COMP_F32, 2, KEEP_FLOAT); /* Vertices */ VertexBuffer_init_with_format(&vbo, &format); diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c index cc874acbe52..1d9b58bfaa5 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.c +++ b/source/blender/gpu/intern/gpu_immediate_util.c @@ -186,7 +186,7 @@ void imm_draw_line_box_3d(unsigned pos, float x1, float y1, float x2, float y2) */ void imm_draw_checker_box(float x1, float y1, float x2, float y2) { - unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_CHECKER); immUniform4f("color1", 0.15f, 0.15f, 0.15f, 1.0f); diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c index bcfe4f38f3e..3aea6f8bea4 100644 --- a/source/blender/gpu/intern/gpu_viewport.c +++ b/source/blender/gpu/intern/gpu_viewport.c @@ -251,8 +251,8 @@ static void draw_ofs_to_screen(GPUViewport *viewport) const float h = (float)GPU_texture_height(color); VertexFormat *format = immVertexFormat(); - unsigned texcoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_MODULATE_ALPHA); GPU_texture_bind(color, 0); @@ -381,8 +381,8 @@ void GPU_viewport_debug_depth_draw(GPUViewport *viewport, const float znear, con const float h = (float)GPU_texture_height(viewport->debug_depth); VertexFormat *format = immVertexFormat(); - unsigned texcoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_DEPTH); diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index daba01cb3a6..be3d75180a1 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -443,8 +443,8 @@ void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple, float alpha) #endif VertexFormat *format = immVertexFormat(); - unsigned texcoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); const int activeTex = 7; /* arbitrary */ glActiveTexture(GL_TEXTURE0 + activeTex); diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index ace081623a7..c97995637a2 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -173,8 +173,8 @@ static void wm_gesture_draw_line(wmGesture *gt) rcti *rect = (rcti *)gt->customdata; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned line_origin = add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int line_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -221,7 +221,7 @@ static void wm_gesture_draw_rect(wmGesture *gt) rcti *rect = (rcti *)gt->customdata; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -243,8 +243,8 @@ static void wm_gesture_draw_rect(wmGesture *gt) glDisable(GL_BLEND); format = immVertexFormat(); - pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned line_origin = add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned line_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -292,7 +292,7 @@ static void wm_gesture_draw_circle(wmGesture *gt) glEnable(GL_BLEND); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -304,8 +304,8 @@ static void wm_gesture_draw_circle(wmGesture *gt) glDisable(GL_BLEND); format = immVertexFormat(); - pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned line_origin = add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); + pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int line_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -415,8 +415,8 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled) } VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned line_origin = add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int line_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); @@ -459,8 +459,8 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt) float x1, x2, y1, y2; VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); - unsigned line_origin = add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int line_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 1957e5ec2a6..d387df1d273 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3070,11 +3070,11 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph } VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); if (rc->gltex) { - unsigned texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT); glBindTexture(GL_TEXTURE_2D, rc->gltex); @@ -3202,7 +3202,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd RNA_property_float_get_array(&rc->col_ptr, rc->col_prop, col); VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3fvAlpha(col, 0.5); diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c index bd22cb191c7..d01bdc6d0ac 100644 --- a/source/blender/windowmanager/intern/wm_stereo.c +++ b/source/blender/windowmanager/intern/wm_stereo.c @@ -116,8 +116,8 @@ static void wm_method_draw_stereo3d_interlace(wmWindow *win) float halfy = GLA_PIXEL_OFS; VertexFormat *format = immVertexFormat(); - unsigned texcoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_INTERLACE); @@ -200,8 +200,8 @@ static void wm_method_draw_stereo3d_sidebyside(wmWindow *win) bool cross_eyed = (win->stereo3d_format->flag & S3D_SIDEBYSIDE_CROSSEYED) != 0; VertexFormat *format = immVertexFormat(); - unsigned texcoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); for (view = 0; view < 2; view ++) { drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1); @@ -273,8 +273,8 @@ static void wm_method_draw_stereo3d_topbottom(wmWindow *win) int soffy; VertexFormat *format = immVertexFormat(); - unsigned texcoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned int texcoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT); + unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); for (view = 0; view < 2; view ++) { drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1); -- cgit v1.2.3