diff options
-rw-r--r-- | source/blender/blenkernel/intern/mesh_render.c | 26 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 54 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 63 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_smart_stitch.c | 18 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_batch.c | 4 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_compositing.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/manipulators/intern/wm_manipulator.c | 4 |
10 files changed, 91 insertions, 102 deletions
diff --git a/source/blender/blenkernel/intern/mesh_render.c b/source/blender/blenkernel/intern/mesh_render.c index cde412e3ae5..c1495ab325b 100644 --- a/source/blender/blenkernel/intern/mesh_render.c +++ b/source/blender/blenkernel/intern/mesh_render.c @@ -971,7 +971,7 @@ static ElementList *mesh_batch_cache_get_edges_in_order(MeshRenderData *mrdata, const int edge_ct = mesh_render_data_edges_num_get(mrdata); ElementListBuilder elb; - ElementListBuilder_init(&elb, GL_LINES, edge_ct, vertex_ct); + ElementListBuilder_init(&elb, PRIM_LINES, edge_ct, vertex_ct); for (int i = 0; i < edge_ct; ++i) { int vert_idx[2]; mesh_render_data_edge_verts_indices_get(mrdata, i, vert_idx); @@ -992,7 +992,7 @@ static ElementList *mesh_batch_cache_get_triangles_in_order(MeshRenderData *mrda const int tri_ct = mesh_render_data_looptri_num_get(mrdata); ElementListBuilder elb; - ElementListBuilder_init(&elb, GL_TRIANGLES, tri_ct, vertex_ct); + ElementListBuilder_init(&elb, PRIM_TRIANGLES, tri_ct, vertex_ct); for (int i = 0; i < tri_ct; ++i) { int tri_vert_idx[3]; mesh_render_data_looptri_verts_indices_get(mrdata, i, tri_vert_idx); @@ -1013,7 +1013,7 @@ Batch *BKE_mesh_batch_cache_get_all_edges(Mesh *me) /* create batch from Mesh */ MeshRenderData *mrdata = mesh_render_data_create(me, MR_DATATYPE_VERT | MR_DATATYPE_EDGE); - cache->all_edges = Batch_create(GL_LINES, mesh_batch_cache_get_pos_and_nor_in_order(mrdata, cache), + cache->all_edges = Batch_create(PRIM_LINES, mesh_batch_cache_get_pos_and_nor_in_order(mrdata, cache), mesh_batch_cache_get_edges_in_order(mrdata, cache)); mesh_render_data_free(mrdata); @@ -1030,7 +1030,7 @@ Batch *BKE_mesh_batch_cache_get_all_triangles(Mesh *me) /* create batch from DM */ MeshRenderData *mrdata = mesh_render_data_create(me, MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI); - cache->all_triangles = Batch_create(GL_TRIANGLES, mesh_batch_cache_get_pos_and_nor_in_order(mrdata, cache), + cache->all_triangles = Batch_create(PRIM_TRIANGLES, mesh_batch_cache_get_pos_and_nor_in_order(mrdata, cache), mesh_batch_cache_get_triangles_in_order(mrdata, cache)); mesh_render_data_free(mrdata); @@ -1046,7 +1046,7 @@ Batch *BKE_mesh_batch_cache_get_triangles_with_normals(Mesh *me) if (cache->triangles_with_normals == NULL) { MeshRenderData *mrdata = mesh_render_data_create(me, MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY); - cache->triangles_with_normals = Batch_create(GL_TRIANGLES, mesh_batch_cache_get_pos_and_normals(mrdata, cache), NULL); + cache->triangles_with_normals = Batch_create(PRIM_TRIANGLES, mesh_batch_cache_get_pos_and_normals(mrdata, cache), NULL); mesh_render_data_free(mrdata); } @@ -1061,7 +1061,7 @@ Batch *BKE_mesh_batch_cache_get_points_with_normals(Mesh *me) if (cache->points_with_normals == NULL) { MeshRenderData *mrdata = mesh_render_data_create(me, MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY); - cache->points_with_normals = Batch_create(GL_POINTS, mesh_batch_cache_get_pos_and_normals(mrdata, cache), NULL); + cache->points_with_normals = Batch_create(PRIM_POINTS, mesh_batch_cache_get_pos_and_normals(mrdata, cache), NULL); mesh_render_data_free(mrdata); } @@ -1077,7 +1077,7 @@ Batch *BKE_mesh_batch_cache_get_all_verts(Mesh *me) /* create batch from DM */ MeshRenderData *mrdata = mesh_render_data_create(me, MR_DATATYPE_VERT); - cache->all_verts = Batch_create(GL_POINTS, mesh_batch_cache_get_pos_and_nor_in_order(mrdata, cache), NULL); + cache->all_verts = Batch_create(PRIM_POINTS, mesh_batch_cache_get_pos_and_nor_in_order(mrdata, cache), NULL); mesh_render_data_free(mrdata); } @@ -1111,7 +1111,7 @@ Batch *BKE_mesh_batch_cache_get_fancy_edges(Mesh *me) const int edge_ct = mesh_render_data_edges_num_get(mrdata); - const int vertex_ct = edge_ct * 2; /* these are GL_LINE verts, not mesh verts */ + const int vertex_ct = edge_ct * 2; /* these are PRIM_LINE verts, not mesh verts */ VertexBuffer_allocate_data(vbo, vertex_ct); for (int i = 0; i < edge_ct; ++i) { float *vcos1, *vcos2; @@ -1146,7 +1146,7 @@ Batch *BKE_mesh_batch_cache_get_fancy_edges(Mesh *me) VertexBuffer_set_attrib(vbo, n2_id, 2 * i + 1, n2); } - cache->fancy_edges = Batch_create(GL_LINES, vbo, NULL); + cache->fancy_edges = Batch_create(PRIM_LINES, vbo, NULL); mesh_render_data_free(mrdata); } @@ -1187,7 +1187,7 @@ static void mesh_batch_cache_create_overlay_batches(Mesh *me) gpu_vert_idx += 3; } - cache->overlay_triangles = Batch_create(GL_TRIANGLES, vbo, NULL); + cache->overlay_triangles = Batch_create(PRIM_TRIANGLES, vbo, NULL); } if (cache->overlay_loose_edges == NULL) { @@ -1202,7 +1202,7 @@ static void mesh_batch_cache_create_overlay_batches(Mesh *me) vert_idx[0], vert_idx[1], mrdata->loose_edges[i], gpu_vert_idx); gpu_vert_idx += 2; } - cache->overlay_loose_edges = Batch_create(GL_LINES, vbo, NULL); + cache->overlay_loose_edges = Batch_create(PRIM_LINES, vbo, NULL); } if (cache->overlay_loose_verts == NULL) { @@ -1215,7 +1215,7 @@ static void mesh_batch_cache_create_overlay_batches(Mesh *me) mrdata->loose_verts[i], gpu_vert_idx); gpu_vert_idx += 1; } - cache->overlay_loose_verts = Batch_create(GL_POINTS, vbo, NULL); + cache->overlay_loose_verts = Batch_create(PRIM_POINTS, vbo, NULL); } mesh_render_data_free(mrdata); @@ -1297,7 +1297,7 @@ Batch *BKE_mesh_batch_cache_get_overlay_facedots(Mesh *me) VertexBuffer_set_attrib(vbo, pos_id, i, pcenter); } - cache->overlay_facedots = Batch_create(GL_POINTS, vbo, NULL); + cache->overlay_facedots = Batch_create(PRIM_POINTS, vbo, NULL); mesh_render_data_free(mrdata); } diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index e8d2f1b83fe..892df42072d 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -270,7 +270,7 @@ Batch *DRW_cache_fullscreen_quad_get(void) VertexBuffer_set_attrib(vbo, uvs_id, i, uvs[i]); } - SHC.drw_fullscreen_quad = Batch_create(GL_TRIANGLE_STRIP, vbo, NULL); + SHC.drw_fullscreen_quad = Batch_create(PRIM_TRIANGLE_STRIP, vbo, NULL); } return SHC.drw_fullscreen_quad; } @@ -307,7 +307,7 @@ Batch *DRW_cache_cube_get(void) VertexBuffer_set_attrib(vbo, pos_id, i, verts[indices[i]]); } - SHC.drw_cube = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_cube = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_cube; } @@ -340,7 +340,7 @@ Batch *DRW_cache_circle_get(void) VertexBuffer_set_attrib(vbo, pos_id, a * 2 + 1, v); } - SHC.drw_circle = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_circle = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_circle; #undef CIRCLE_RESOL @@ -369,7 +369,7 @@ Batch *DRW_cache_square_get(void) VertexBuffer_set_attrib(vbo, pos_id, i * 2 + 1, p[(i+1) % 4]); } - SHC.drw_square = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_square = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_square; } @@ -394,7 +394,7 @@ Batch *DRW_cache_single_line_get(void) VertexBuffer_set_attrib(vbo, pos_id, 0, v1); VertexBuffer_set_attrib(vbo, pos_id, 1, v2); - SHC.drw_line = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_line = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_line; } @@ -420,7 +420,7 @@ Batch *DRW_cache_single_line_endpoints_get(void) VertexBuffer_set_attrib(vbo, pos_id, 0, v1); VertexBuffer_set_attrib(vbo, pos_id, 1, v2); - SHC.drw_line_endpoints = Batch_create(GL_POINTS, vbo, NULL); + SHC.drw_line_endpoints = Batch_create(PRIM_POINTS, vbo, NULL); } return SHC.drw_line_endpoints; } @@ -454,7 +454,7 @@ Batch *DRW_cache_plain_axes_get(void) v1[axis] = v2[axis] = 0.0f; } - SHC.drw_plain_axes = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_plain_axes = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_plain_axes; } @@ -494,7 +494,7 @@ Batch *DRW_cache_single_arrow_get(void) VertexBuffer_set_attrib(vbo, pos_id, sides * 3 + 2, v3); } - SHC.drw_single_arrow = Batch_create(GL_TRIANGLES, vbo, NULL); + SHC.drw_single_arrow = Batch_create(PRIM_TRIANGLES, vbo, NULL); } return SHC.drw_single_arrow; } @@ -503,7 +503,7 @@ Batch *DRW_cache_empty_sphere_get(void) { if (!SHC.drw_empty_sphere) { VertexBuffer *vbo = sphere_wire_vbo(1.0f); - SHC.drw_empty_sphere = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_empty_sphere = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_empty_sphere; } @@ -550,7 +550,7 @@ Batch *DRW_cache_empty_cone_get(void) VertexBuffer_set_attrib(vbo, pos_id, i * 4 + 3, v); } - SHC.drw_empty_cone = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_empty_cone = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_empty_cone; #undef NSEGMENTS @@ -561,7 +561,7 @@ Batch *DRW_cache_arrows_get(void) if (!SHC.drw_arrows) { VertexBuffer *vbo = fill_arrows_vbo(1.0f); - SHC.drw_arrows = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_arrows = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_arrows; } @@ -622,7 +622,7 @@ Batch *DRW_cache_axis_names_get(void) VertexBuffer_set_attrib(vbo, pos_id, 12, v1); VertexBuffer_set_attrib(vbo, pos_id, 13, v2); - SHC.drw_axis_names = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_axis_names = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_axis_names; } @@ -654,7 +654,7 @@ Batch *DRW_cache_lamp_get(void) VertexBuffer_set_attrib(vbo, pos_id, a * 2 + 1, v); } - SHC.drw_lamp = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_lamp = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_lamp; #undef NSEGMENTS @@ -686,7 +686,7 @@ Batch *DRW_cache_lamp_sunrays_get(void) VertexBuffer_set_attrib(vbo, pos_id, a * 2 + 1, v2); } - SHC.drw_lamp_sunrays = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_lamp_sunrays = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_lamp_sunrays; } @@ -720,7 +720,7 @@ Batch *DRW_cache_lamp_area_get(void) v1[1] = 0.5f; VertexBuffer_set_attrib(vbo, pos_id, 7, v1); - SHC.drw_lamp_area = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_lamp_area = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_lamp_area; } @@ -782,7 +782,7 @@ Batch *DRW_cache_lamp_hemi_get(void) } - SHC.drw_lamp_hemi = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_lamp_hemi = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_lamp_hemi; #undef CIRCLE_RESOL @@ -852,7 +852,7 @@ Batch *DRW_cache_lamp_spot_get(void) VertexBuffer_set_attrib(vbo, n2_id, i * 4 + 3, neg[(i) % NSEGMENTS]); } - SHC.drw_lamp_spot = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_lamp_spot = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_lamp_spot; #undef NSEGMENTS @@ -888,7 +888,7 @@ Batch *DRW_cache_lamp_spot_square_get(void) VertexBuffer_set_attrib(vbo, pos_id, v_idx++, p[((i+1) % 4)+1]); } - SHC.drw_lamp_spot_square = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_lamp_spot_square = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_lamp_spot_square; } @@ -946,7 +946,7 @@ Batch *DRW_cache_speaker_get(void) } } - SHC.drw_speaker = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_speaker = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_speaker; } @@ -1024,7 +1024,7 @@ Batch *DRW_cache_bone_octahedral_get(void) VertexBuffer_set_attrib(vbo, pos_id, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][2]]); } - SHC.drw_bone_octahedral = Batch_create(GL_TRIANGLES, vbo, NULL); + SHC.drw_bone_octahedral = Batch_create(PRIM_TRIANGLES, vbo, NULL); } return SHC.drw_bone_octahedral; } @@ -1054,7 +1054,7 @@ Batch *DRW_cache_bone_octahedral_wire_outline_get(void) add_fancy_edge(vbo, pos_id, n1_id, n2_id, &v_idx, co1, co2, n1, n2); } - SHC.drw_bone_octahedral_wire = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_bone_octahedral_wire = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_bone_octahedral_wire; } @@ -1098,7 +1098,7 @@ Batch *DRW_cache_bone_point_get(void) } } - SHC.drw_bone_point = Batch_create(GL_TRIANGLES, vbo, NULL); + SHC.drw_bone_point = Batch_create(PRIM_TRIANGLES, vbo, NULL); } return SHC.drw_bone_point; } @@ -1107,7 +1107,7 @@ Batch *DRW_cache_bone_point_wire_outline_get(void) { if (!SHC.drw_bone_point_wire) { VertexBuffer *vbo = sphere_wire_vbo(0.05f); - SHC.drw_bone_point_wire = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_bone_point_wire = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_bone_point_wire; } @@ -1116,7 +1116,7 @@ Batch *DRW_cache_bone_arrows_get(void) { if (!SHC.drw_bone_arrows) { VertexBuffer *vbo = fill_arrows_vbo(0.25f); - SHC.drw_bone_arrows = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_bone_arrows = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_bone_arrows; } @@ -1183,7 +1183,7 @@ Batch *DRW_cache_camera_get(void) VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v7); VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v5); - SHC.drw_camera = Batch_create(GL_LINES, vbo, NULL); + SHC.drw_camera = Batch_create(PRIM_LINES, vbo, NULL); } return SHC.drw_camera; } @@ -1214,7 +1214,7 @@ Batch *DRW_cache_camera_tria_get(void) VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v6); VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v7); - SHC.drw_camera_tria = Batch_create(GL_TRIANGLES, vbo, NULL); + SHC.drw_camera_tria = Batch_create(PRIM_TRIANGLES, vbo, NULL); } return SHC.drw_camera_tria; } @@ -1237,7 +1237,7 @@ Batch *DRW_cache_single_vert_get(void) VertexBuffer_set_attrib(vbo, pos_id, 0, v1); - SHC.drw_single_vertice = Batch_create(GL_POINTS, vbo, NULL); + SHC.drw_single_vertice = Batch_create(PRIM_POINTS, vbo, NULL); } return SHC.drw_single_vertice; } diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 939c1050141..d233caedbd1 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -661,7 +661,7 @@ static void shgroup_dynamic_batch(DRWShadingGroup *shgroup) DRWInterface *interface = shgroup->interface; int nbr = interface->instance_count; - GLenum type = (shgroup->type == DRW_SHG_POINT_BATCH) ? GL_POINTS : GL_LINES; + PrimitiveType type = (shgroup->type == DRW_SHG_POINT_BATCH) ? PRIM_POINTS : PRIM_LINES; if (nbr == 0) return; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index bf14ed9df94..0b1d58c5836 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -577,7 +577,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w /** * Draw title and text safe areas. * - * The first parameter is a GL_FLOAT, 2, KEEP_FLOAT vertex attrib + * The first parameter is a PRIM_FLOAT, 2, KEEP_FLOAT vertex attrib * The next 4 parameters are the offsets for the view, not the zones. */ void UI_draw_safe_areas( @@ -773,7 +773,7 @@ static void waveform_draw_one(float *waveform, int nbr, const float col[3]) VertexBuffer_fill_attrib(vbo, pos_id, waveform); /* TODO store the Batch inside the scope */ - Batch *batch = Batch_create(GL_POINTS, vbo, NULL); + Batch *batch = Batch_create(PRIM_POINTS, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_2D_UNIFORM_COLOR); Batch_Uniform4f(batch, "color", col[0], col[1], col[2], 1.0f); Batch_draw(batch); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 7f3cf0e3d7e..a3ce33bd71d 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -401,7 +401,7 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize) add_solid_flat_triangle(&vbo, &i, pos, nor, cube_vert[7], cube_vert[4], cube_vert[0], n); add_solid_flat_triangle(&vbo, &i, pos, nor, cube_vert[0], cube_vert[3], cube_vert[7], n); - Batch_init(&batch, GL_TRIANGLES, &vbo, NULL); + Batch_init(&batch, PRIM_TRIANGLES, &vbo, NULL); } gpuPushMatrix(); @@ -434,7 +434,7 @@ static void drawcube_size(float xsize, float ysize, float zsize) unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); /* Elements */ - ElementListBuilder_init(&elb, GL_LINES, 12, 8); + ElementListBuilder_init(&elb, PRIM_LINES, 12, 8); for (int i = 0; i < 12; ++i) { add_line_vertices(&elb, cube_wire[i*2], cube_wire[i*2+1]); } @@ -447,7 +447,7 @@ static void drawcube_size(float xsize, float ysize, float zsize) VertexBuffer_set_attrib(&vbo, pos, i, cube_vert[i]); } - Batch_init(&batch, GL_LINES, &vbo, &el); + Batch_init(&batch, PRIM_LINES, &vbo, &el); Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR); } @@ -503,7 +503,7 @@ static void draw_bonevert(void) VertexBuffer_set_attrib(&vbo, pos, i * 6 + 5, vert); } - Batch_init(&batch, GL_LINES, &vbo, NULL); + Batch_init(&batch, PRIM_LINES, &vbo, NULL); Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR); } @@ -586,7 +586,7 @@ static void draw_bone_octahedral(void) unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); /* Elements */ - ElementListBuilder_init(&elb, GL_LINES, 12, 6); + ElementListBuilder_init(&elb, PRIM_LINES, 12, 6); for (int i = 0; i < 12; ++i) { add_line_vertices(&elb, bone_octahedral_wire[i*2], bone_octahedral_wire[i*2+1]); } @@ -599,7 +599,7 @@ static void draw_bone_octahedral(void) VertexBuffer_set_attrib(&vbo, pos, i, bone_octahedral_verts[i]); } - Batch_init(&batch, GL_LINES, &vbo, &el); + Batch_init(&batch, PRIM_LINES, &vbo, &el); Batch_set_builtin_program(&batch, GPU_SHADER_3D_UNIFORM_COLOR); } @@ -633,7 +633,7 @@ static void draw_bone_solid_octahedral(void) bone_octahedral_solid_normals[i]); } - Batch_init(&batch, GL_TRIANGLES, &vbo, NULL); + Batch_init(&batch, PRIM_TRIANGLES, &vbo, NULL); } if (flat_color) { diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 930df90b9cc..131483cf879 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -427,7 +427,7 @@ static const float cosval[CIRCLE_RESOL] = { */ static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3], float size, int axis, unsigned pos) { - int line_type; + PrimitiveType line_type = PRIM_LINES; float buffer[4][3]; int n = 0; @@ -440,8 +440,6 @@ static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3] switch (axis) { case 0: /* x axis */ - line_type = GL_LINES; - /* bottom left to top right */ negate_v3_v3(v1, dx); sub_v3_v3(v1, dy); @@ -461,8 +459,6 @@ static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3] break; case 1: /* y axis */ - line_type = GL_LINES; - /* bottom left to top right */ mul_v3_fl(dx, 0.75f); negate_v3_v3(v1, dx); @@ -483,7 +479,7 @@ static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3] break; case 2: /* z axis */ - line_type = GL_LINE_STRIP; + line_type = PRIM_LINE_STRIP; /* start at top left */ negate_v3_v3(v1, dx); @@ -521,13 +517,6 @@ static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3] immEnd(); /* TODO: recode this function for clarity once we're not in a hurry to modernize GL usage */ - -#if 0 - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, 0, buffer); - glDrawArrays(line_type, 0, n); - glDisableClientState(GL_VERTEX_ARRAY); -#endif } void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const unsigned char color[4]) @@ -1001,7 +990,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, bool depth_write, flo */ static void drawcube_size(float size, unsigned pos) { - const GLfloat verts[8][3] = { + const float verts[8][3] = { {-size, -size, -size}, {-size, -size, size}, {-size, size, -size}, @@ -5111,7 +5100,7 @@ static bool draw_mesh_object_new(Scene *scene, SceneLayer *sl, ARegion *ar, View /* ************** DRAW DISPLIST ****************** */ -static void drawDispListVerts(int dt, const void *data, unsigned int vert_ct, const unsigned char wire_col[3]) +static void drawDispListVerts(PrimitiveType prim_type, const void *data, unsigned int vert_ct, const unsigned char wire_col[3]) { VertexFormat format = {0}; unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); @@ -5121,7 +5110,7 @@ static void drawDispListVerts(int dt, const void *data, unsigned int vert_ct, co VertexBuffer_fill_attrib(vbo, pos_id, data); - Batch *batch = Batch_create(dt, vbo, NULL); + Batch *batch = Batch_create(prim_type, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); if (wire_col) { Batch_Uniform4f(batch, "color", wire_col[0]/255.0f, wire_col[1]/255.0f, wire_col[2]/255.0f, 1.0f); @@ -5148,7 +5137,7 @@ static void drawDispListElem(bool quads, bool UNUSED(smooth), const float *data, } ElementListBuilder elb; - ElementListBuilder_init(&elb, GL_TRIANGLES, (quads) ? elem_ct * 2 : elem_ct, 0xffffffff); + ElementListBuilder_init(&elb, PRIM_TRIANGLES, (quads) ? elem_ct * 2 : elem_ct, 0xffffffff); if (quads) { for (i = elem_ct; i; --i, idx += 4) { @@ -5171,7 +5160,7 @@ static void drawDispListElem(bool quads, bool UNUSED(smooth), const float *data, VertexBuffer_fill_attrib(vbo, nor_id, ndata); } - Batch *batch = Batch_create(GL_TRIANGLES, vbo, ElementList_build(&elb)); + Batch *batch = Batch_create(PRIM_TRIANGLES, vbo, ElementList_build(&elb)); Batch_set_builtin_program(batch, GPU_SHADER_SIMPLE_LIGHTING); if (wire_col) { Batch_Uniform4f(batch, "color", wire_col[0]/255.0f, wire_col[1]/255.0f, wire_col[2]/255.0f, 1.0f); @@ -5207,20 +5196,20 @@ static bool drawDispListwire_ex(ListBase *dlbase, unsigned int dl_type_mask, con switch (dl->type) { case DL_SEGM: for (parts = 0; parts < dl->parts; parts++) - drawDispListVerts(GL_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col); + drawDispListVerts(PRIM_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col); break; case DL_POLY: for (parts = 0; parts < dl->parts; parts++) - drawDispListVerts(GL_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col); + drawDispListVerts(PRIM_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col); break; case DL_SURF: for (parts = 0; parts < dl->parts; parts++) { if (dl->flag & DL_CYCL_U) - drawDispListVerts(GL_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col); + drawDispListVerts(PRIM_LINE_LOOP, data + (parts * dl->nr * 3), dl->nr, wire_col); else - drawDispListVerts(GL_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col); + drawDispListVerts(PRIM_LINE_STRIP, data + (parts * dl->nr * 3), dl->nr, wire_col); } float *data_aligned = MEM_mallocN(sizeof(float) * 3 * dl->parts, "aligned data"); @@ -5238,9 +5227,9 @@ static bool drawDispListwire_ex(ListBase *dlbase, unsigned int dl_type_mask, con } if (dl->flag & DL_CYCL_V) - drawDispListVerts(GL_LINE_LOOP, data_aligned, dl->parts, wire_col); + drawDispListVerts(PRIM_LINE_LOOP, data_aligned, dl->parts, wire_col); else - drawDispListVerts(GL_LINE_STRIP, data_aligned, dl->parts, wire_col); + drawDispListVerts(PRIM_LINE_STRIP, data_aligned, dl->parts, wire_col); } if (data_aligned) @@ -5300,7 +5289,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, const short UNUSED(dflag col = -1; } - drawDispListVerts(GL_LINE_STRIP, data, dl->nr, ob_wire_col); + drawDispListVerts(PRIM_LINE_STRIP, data, dl->nr, ob_wire_col); } break; case DL_POLY: @@ -5310,7 +5299,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, const short UNUSED(dflag col = -1; } - drawDispListVerts(GL_LINE_LOOP, data, dl->nr, ob_wire_col); + drawDispListVerts(PRIM_LINE_LOOP, data, dl->nr, ob_wire_col); } break; case DL_SURF: @@ -5633,10 +5622,10 @@ static void draw_particle_arrays_new(int draw_as, int ob_dt, int select, switch (draw_as) { case PART_DRAW_AXIS: case PART_DRAW_CROSS: - draw_vertex_array(GL_LINES, vert, nor, color, 0, 6 * totpoint, col); + draw_vertex_array(PRIM_LINES, vert, nor, color, 0, 6 * totpoint, col); break; case PART_DRAW_LINE: - draw_vertex_array(GL_LINES, vert, nor, color, 0, 2 * totpoint, col); + draw_vertex_array(PRIM_LINES, vert, nor, color, 0, 2 * totpoint, col); break; case PART_DRAW_BB: if (ob_dt <= OB_WIRE || select) @@ -5647,7 +5636,7 @@ static void draw_particle_arrays_new(int draw_as, int ob_dt, int select, draw_vertex_array(PRIM_QUADS_XXX, vert, nor, color, 0, 4 * totpoint, col); break; default: - draw_vertex_array(GL_POINTS, vert, nor, color, 0, totpoint, col); + draw_vertex_array(PRIM_POINTS, vert, nor, color, 0, totpoint, col); break; } } @@ -6284,12 +6273,12 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv path = cache[a]; if (path->segments > 0) { if (((dflag & DRAW_CONSTCOLOR) == 0) && (part->draw_col == PART_DRAW_COL_MAT)) { - draw_vertex_array(GL_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL); + draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL); } else { float color[4]; rgba_uchar_to_float(color, tcol); - draw_vertex_array(GL_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color); + draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color); } } } @@ -6304,7 +6293,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv /* XXX use proper theme color here */ float color[4] = {0.58f, 0.67f, 1.0f, 1.0f}; - draw_vertex_array(GL_LINE_STRIP, hkey->world_co, NULL, NULL, sizeof(HairKey), pa->totkey, color); + draw_vertex_array(PRIM_LINE_STRIP, hkey->world_co, NULL, NULL, sizeof(HairKey), pa->totkey, color); } } @@ -6425,11 +6414,11 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv path = cache[a]; if (((dflag & DRAW_CONSTCOLOR) == 0) && (part->draw_col == PART_DRAW_COL_MAT)) { - draw_vertex_array(GL_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL); + draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, path->col, sizeof(ParticleCacheKey), path->segments + 1, NULL); } else { float color[4] = {0.0f, 0.0f, 0.0f, 1.0f}; - draw_vertex_array(GL_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color); + draw_vertex_array(PRIM_LINE_STRIP, path->co, path->vel, NULL, sizeof(ParticleCacheKey), path->segments + 1, color); } } @@ -6498,7 +6487,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if (pdd && pdd->vedata) { float color[4] = {0.75f, 0.75f, 0.75f, 1.0f}; - draw_vertex_array(GL_LINES, pdd->vedata, NULL, NULL, 0, 2 * totve, color); + draw_vertex_array(PRIM_LINES, pdd->vedata, NULL, NULL, 0, 2 * totve, color); } glPolygonMode(GL_FRONT, polygonmode[0]); @@ -6618,7 +6607,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) VertexBuffer_fill_attrib_stride(vbo, col_id, sizeof(ParticleCacheKey), path->col); } - Batch *batch = Batch_create(GL_LINE_STRIP, vbo, NULL); + Batch *batch = Batch_create(PRIM_LINE_STRIP, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR); Batch_draw(batch); Batch_discard_all(batch); @@ -6689,7 +6678,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) VertexBuffer_fill_attrib(vbo, col_id, cd); - Batch *batch = Batch_create(GL_POINTS, vbo, NULL); + Batch *batch = Batch_create(PRIM_POINTS, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR); Batch_draw(batch); Batch_discard_all(batch); diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 9d5b6495938..bcdaca450c6 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1540,9 +1540,9 @@ static void stitch_calculate_edge_normal(BMEditMesh *em, UvEdge *edge, float *no normalize_v2(normal); } -static void stitch_draw_vbo(VertexBuffer *vbo, int type, const float col[4]) +static void stitch_draw_vbo(VertexBuffer *vbo, PrimitiveType prim_type, const float col[4]) { - Batch *batch = Batch_create(type, vbo, NULL); + Batch *batch = Batch_create(prim_type, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_2D_UNIFORM_COLOR); Batch_Uniform4fv(batch, "color", col); Batch_draw(batch); @@ -1573,7 +1573,7 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar VertexBuffer_allocate_data(vbo, stitch_preview->num_static_tris * 3); for (int i = 0; i < stitch_preview->num_static_tris * 3; i++) VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->static_tris[i*2]); - stitch_draw_vbo(vbo, GL_TRIANGLES, col); + stitch_draw_vbo(vbo, PRIM_TRIANGLES, col); /* Preview Polys */ @@ -1612,9 +1612,9 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar index += stitch_preview->uvs_per_polygon[i] * 2; } UI_GetThemeColor4fv(TH_STITCH_PREVIEW_FACE, col); - stitch_draw_vbo(vbo, GL_TRIANGLES, col); + stitch_draw_vbo(vbo, PRIM_TRIANGLES, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_EDGE, col); - stitch_draw_vbo(vbo_line, GL_LINES, col); + stitch_draw_vbo(vbo_line, PRIM_LINES, col); glDisable(GL_BLEND); @@ -1628,14 +1628,14 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar VertexBuffer_allocate_data(vbo, stitch_preview->num_stitchable); for (int i = 0; i < stitch_preview->num_stitchable; i++) VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); - stitch_draw_vbo(vbo, GL_POINTS, col); + stitch_draw_vbo(vbo, PRIM_POINTS, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col); vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, stitch_preview->num_unstitchable); for (int i = 0; i < stitch_preview->num_unstitchable; i++) VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); - stitch_draw_vbo(vbo, GL_POINTS, col); + stitch_draw_vbo(vbo, PRIM_POINTS, col); } else { UI_GetThemeColor4fv(TH_STITCH_PREVIEW_STITCHABLE, col); @@ -1643,14 +1643,14 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar VertexBuffer_allocate_data(vbo, stitch_preview->num_stitchable * 2); for (int i = 0; i < stitch_preview->num_stitchable * 2; i++) VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); - stitch_draw_vbo(vbo, GL_LINES, col); + stitch_draw_vbo(vbo, PRIM_LINES, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col); vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, stitch_preview->num_unstitchable * 2); for (int i = 0; i < stitch_preview->num_unstitchable * 2; i++) VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); - stitch_draw_vbo(vbo, GL_LINES, col); + stitch_draw_vbo(vbo, PRIM_LINES, col); } } diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c index dd8b6172483..a36830cf277 100644 --- a/source/blender/gpu/intern/gpu_batch.c +++ b/source/blender/gpu/intern/gpu_batch.c @@ -93,7 +93,7 @@ static Batch *batch_sphere(int lat_res, int lon_res) } } - return Batch_create(GL_TRIANGLES, vbo, NULL); + return Batch_create(PRIM_TRIANGLES, vbo, NULL); } static Batch *batch_sphere_wire(int lat_res, int lon_res) @@ -125,7 +125,7 @@ static Batch *batch_sphere_wire(int lat_res, int lon_res) } } - return Batch_create(GL_LINES, vbo, NULL); + return Batch_create(PRIM_LINES, vbo, NULL); } Batch *Batch_get_sphere(int lod) diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c index 8ee22ce1c13..719708ff7aa 100644 --- a/source/blender/gpu/intern/gpu_compositing.c +++ b/source/blender/gpu/intern/gpu_compositing.c @@ -287,7 +287,7 @@ GPUFX *GPU_fx_compositor_create(void) VertexBuffer_set_attrib(vbo, pos, i, fullscreencos[i]); VertexBuffer_set_attrib(vbo, uvs, i, fullscreenuvs[i]); } - fx->quad_batch = Batch_create(GL_TRIANGLE_STRIP, vbo, NULL); + fx->quad_batch = Batch_create(PRIM_TRIANGLE_STRIP, vbo, NULL); /* Point Buffer */ static VertexFormat format_point = {0}; @@ -299,7 +299,7 @@ GPUFX *GPU_fx_compositor_create(void) VertexBuffer *vbo_point = VertexBuffer_create_with_format(&format_point); VertexBuffer_allocate_data(vbo_point, 1); VertexBuffer_set_attrib(vbo_point, dummy_attrib, 0, &dummy); - fx->point_batch = Batch_create(GL_POINTS, vbo_point, NULL); + fx->point_batch = Batch_create(PRIM_POINTS, vbo_point, NULL); return fx; } diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c index b11fad46286..de2096dbde9 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c @@ -79,7 +79,7 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo } /* Elements */ - ElementListBuilder_init(&elb, GL_TRIANGLES, info->ntris, info->nverts); + ElementListBuilder_init(&elb, PRIM_TRIANGLES, info->ntris, info->nverts); for (int i = 0; i < info->ntris; ++i) { const unsigned short *idx = &info->indices[i * 3]; add_triangle_vertices(&elb, idx[0], idx[1], idx[2]); @@ -96,7 +96,7 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo VertexBuffer_fill_attrib(vbo, nor_id, info->normals); } - batch = Batch_create(GL_TRIANGLES, vbo, el); + batch = Batch_create(PRIM_TRIANGLES, vbo, el); Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); Batch_Uniform4fv(batch, "color", color); |