diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-06 17:40:07 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-06 23:13:06 +0300 |
commit | 7ffff04e4900ca284519900d12bd1490e218c4f4 (patch) | |
tree | d148ee3c5c286a45bc33f521c2c606e47dd43968 /source/blender/draw/intern/draw_instance_data.c | |
parent | 98fc3f263cf18a1222d7ffe7dc0e1c0a1fa47ecd (diff) |
GPUVertBuf: Make GPUVertBuf private to the GPU module
This is just a cleanup to isolate the internals of the vertbuf.
This adds some getters to avoid refactor of existing code.
Diffstat (limited to 'source/blender/draw/intern/draw_instance_data.c')
-rw-r--r-- | source/blender/draw/intern/draw_instance_data.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c index 9d0727555b6..7a6f357cb9c 100644 --- a/source/blender/draw/intern/draw_instance_data.c +++ b/source/blender/draw/intern/draw_instance_data.c @@ -150,7 +150,8 @@ GPUBatch *DRW_temp_batch_instance_request(DRWInstanceDataList *idatalist, } GPUBatch *batch = handle->batch; - bool instancer_compat = buf ? ((batch->inst[0] == buf) && (buf->vbo_id != 0)) : + bool instancer_compat = buf ? ((batch->inst[0] == buf) && + (GPU_vertbuf_get_status(buf) & GPU_VERTBUF_DATA_UPLOADED)) : ((batch->inst[0] == instancer->verts[0]) && (batch->inst[1] == instancer->verts[1])); bool is_compatible = (batch->prim_type == geom->prim_type) && instancer_compat && @@ -184,8 +185,8 @@ GPUBatch *DRW_temp_batch_request(DRWInstanceDataList *idatalist, } GPUBatch *batch = *batch_ptr; - bool is_compatible = (batch->verts[0] == buf) && (buf->vbo_id != 0) && - (batch->prim_type == prim_type); + bool is_compatible = (batch->verts[0] == buf) && (batch->prim_type == prim_type) && + (GPU_vertbuf_get_status(buf) & GPU_VERTBUF_DATA_UPLOADED); if (!is_compatible) { GPU_batch_clear(batch); GPU_batch_init(batch, prim_type, buf, NULL); @@ -220,7 +221,7 @@ void DRW_instance_buffer_finish(DRWInstanceDataList *idatalist) if (handle->vert_len != NULL) { uint vert_len = *(handle->vert_len); uint target_buf_size = ((vert_len / DRW_BUFFER_VERTS_CHUNK) + 1) * DRW_BUFFER_VERTS_CHUNK; - if (target_buf_size < handle->buf->vertex_alloc) { + if (target_buf_size < GPU_vertbuf_get_vertex_alloc(handle->buf)) { GPU_vertbuf_data_resize(handle->buf, target_buf_size); } GPU_vertbuf_data_len_set(handle->buf, vert_len); |