Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-09-06 17:40:07 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-09-06 23:13:06 +0300
commit7ffff04e4900ca284519900d12bd1490e218c4f4 (patch)
treed148ee3c5c286a45bc33f521c2c606e47dd43968 /source/blender/draw/intern/draw_cache_inline.h
parent98fc3f263cf18a1222d7ffe7dc0e1c0a1fa47ecd (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_cache_inline.h')
-rw-r--r--source/blender/draw/intern/draw_cache_inline.h15
1 files changed, 3 insertions, 12 deletions
diff --git a/source/blender/draw/intern/draw_cache_inline.h b/source/blender/draw/intern/draw_cache_inline.h
index 720cc31b0be..120e547bbe2 100644
--- a/source/blender/draw/intern/draw_cache_inline.h
+++ b/source/blender/draw/intern/draw_cache_inline.h
@@ -89,21 +89,12 @@ BLI_INLINE void DRW_vbo_request(GPUBatch *batch, GPUVertBuf **vbo)
*vbo = GPU_vertbuf_create(GPU_USAGE_STATIC);
}
if (batch != NULL) {
- /* HACK set first vbo if not init. */
- if (batch->verts[0] == NULL) {
- GPU_batch_vertbuf_add(batch, *vbo);
- }
- else {
- /* HACK: bypass assert */
- int vbo_vert_len = (*vbo)->vertex_len;
- (*vbo)->vertex_len = batch->verts[0]->vertex_len;
- GPU_batch_vertbuf_add(batch, *vbo);
- (*vbo)->vertex_len = vbo_vert_len;
- }
+ /* HACK we set vbos that may not yet be valid. */
+ GPU_batch_vertbuf_add(batch, *vbo);
}
}
BLI_INLINE bool DRW_vbo_requested(GPUVertBuf *vbo)
{
- return (vbo != NULL && vbo->format.attr_len == 0);
+ return (vbo != NULL && (GPU_vertbuf_get_status(vbo) & GPU_VERTBUF_INIT) == 0);
}