diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-29 01:08:10 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-30 14:42:21 +0300 |
commit | 77f5210f22332b3594fabe08bee5809fc8333dba (patch) | |
tree | 82f8fbba7d762d30363a40eb9d41f0df828d7586 /source/blender/draw | |
parent | dc0c490b7601b4dced13be6a9877f68ee9712736 (diff) |
GPU: Remove GPU_INDEX_U8
This type of indices is not natively supported on modern GPU and
gives warning on some implementation. The memory savings it
provides is also quite minimal and unlikely to be visible on
nowadays hardware.
This remove some uneeded struct members and makes primitive
restart always enabled by default. This can be broken by addons
if they are not careful enough but many other states have this
problem.
Also leverage GL_PRIMITIVE_RESTART_FIXED_INDEX if
ARB_ES3_compatibility is supported. This removes all API calls
to change restart index depending on indices length.
Diffstat (limited to 'source/blender/draw')
4 files changed, 10 insertions, 12 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index c40e9772340..88125e884d5 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -2707,7 +2707,7 @@ GPUBatch *DRW_cache_bone_stick_get(void) GPU_vertbuf_data_alloc(vbo, vcount); GPUIndexBufBuilder elb; - GPU_indexbuf_init_ex(&elb, GPU_PRIM_TRI_FAN, (CIRCLE_RESOL + 2) * 2 + 6 + 2, vcount, true); + GPU_indexbuf_init_ex(&elb, GPU_PRIM_TRI_FAN, (CIRCLE_RESOL + 2) * 2 + 6 + 2, vcount); /* head/tail points */ for (int i = 0; i < 2; ++i) { @@ -3931,7 +3931,7 @@ GPUBatch *DRW_cache_cursor_get(bool crosshair_lines) } GPUIndexBufBuilder elb; - GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_STRIP, index_len, vert_len, true); + GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_STRIP, index_len, vert_len); GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format); GPU_vertbuf_data_alloc(vbo, vert_len); diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c b/source/blender/draw/intern/draw_cache_impl_curve.c index 0904027ebce..1d6f2aaa070 100644 --- a/source/blender/draw/intern/draw_cache_impl_curve.c +++ b/source/blender/draw/intern/draw_cache_impl_curve.c @@ -601,7 +601,7 @@ static void curve_create_curves_lines(CurveRenderData *rdata, GPUIndexBuf *ibo_c const int index_len = edge_len + curve_len * 2; GPUIndexBufBuilder elb; - GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_STRIP, index_len, vert_len, true); + GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_STRIP, index_len, vert_len); int v_idx = 0; for (const BevList *bl = rdata->ob_curve_cache->bev.first; bl; bl = bl->next) { diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 9fb9f9713d1..27956f1b808 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -3802,7 +3802,7 @@ static void mesh_create_loops_line_strips(MeshRenderData *rdata, const int poly_len = mesh_render_data_polys_len_get(rdata); GPUIndexBufBuilder elb; - GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_STRIP, loop_len + poly_len * 2, loop_len, true); + GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_STRIP, loop_len + poly_len * 2, loop_len); uint v_index = 0; if (rdata->mapped.use == false) { @@ -4842,13 +4842,13 @@ static void mesh_create_uvedit_buffers(MeshRenderData *rdata, GPUIndexBufBuilder elb_vert, elb_edge, elb_face; if (DRW_TEST_ASSIGN_IBO(ibo_vert)) { - GPU_indexbuf_init_ex(&elb_vert, GPU_PRIM_POINTS, loop_len, loop_len, false); + GPU_indexbuf_init_ex(&elb_vert, GPU_PRIM_POINTS, loop_len, loop_len); } if (DRW_TEST_ASSIGN_IBO(ibo_edge)) { - GPU_indexbuf_init_ex(&elb_edge, GPU_PRIM_LINES, loop_len * 2, loop_len, false); + GPU_indexbuf_init_ex(&elb_edge, GPU_PRIM_LINES, loop_len * 2, loop_len); } if (DRW_TEST_ASSIGN_IBO(ibo_face)) { - GPU_indexbuf_init_ex(&elb_face, GPU_PRIM_TRI_FAN, idx_len, loop_len, true); + GPU_indexbuf_init_ex(&elb_face, GPU_PRIM_TRI_FAN, idx_len, loop_len); } uvedit_fill_buffer_data(rdata, diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c index 9a15c51598f..5b1916447a6 100644 --- a/source/blender/draw/intern/draw_cache_impl_particles.c +++ b/source/blender/draw/intern/draw_cache_impl_particles.c @@ -1053,7 +1053,7 @@ static void particle_batch_cache_ensure_procedural_indices(PTCacheEdit *edit, GPU_vertbuf_data_alloc(vbo, 1); GPUIndexBufBuilder elb; - GPU_indexbuf_init_ex(&elb, prim_type, element_count, element_count, true); + GPU_indexbuf_init_ex(&elb, prim_type, element_count, element_count); if (edit != NULL && edit->pathcache != NULL) { particle_batch_cache_fill_segments_indices( @@ -1194,8 +1194,7 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, GPU_vertbuf_data_alloc(hair_cache->pos, hair_cache->point_len); GPUIndexBufBuilder elb; - GPU_indexbuf_init_ex( - &elb, GPU_PRIM_LINE_STRIP, hair_cache->elems_len, hair_cache->point_len, true); + GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_STRIP, hair_cache->elems_len, hair_cache->point_len); if (num_uv_layers || num_col_layers) { BKE_mesh_tessface_ensure(psmd->mesh_final); @@ -1499,8 +1498,7 @@ static void particle_batch_cache_ensure_edit_pos_and_seg(PTCacheEdit *edit, GPU_vertbuf_data_alloc(hair_cache->pos, hair_cache->point_len); GPU_vertbuf_attr_get_raw_data(hair_cache->pos, pos_id, &data_step); - GPU_indexbuf_init_ex( - &elb, GPU_PRIM_LINE_STRIP, hair_cache->elems_len, hair_cache->point_len, true); + GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_STRIP, hair_cache->elems_len, hair_cache->point_len); if (edit != NULL && edit->pathcache != NULL) { particle_batch_cache_fill_segments_edit( |