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/engines | |
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/engines')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_motion_blur.c | 13 | ||||
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_motion_path.c | 4 |
2 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c index e10c627494a..c84d1ba33ea 100644 --- a/source/blender/draw/engines/eevee/eevee_motion_blur.c +++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c @@ -480,7 +480,7 @@ void EEVEE_motion_blur_cache_finish(EEVEE_Data *vedata) for (int i = 0; i < MB_CURR; i++) { GPUVertBuf *vbo = mb_geom->vbo[i]; if (vbo && batch) { - if (vbo->vertex_len != batch->verts[0]->vertex_len) { + if (GPU_vertbuf_get_vertex_len(vbo) != GPU_vertbuf_get_vertex_len(batch->verts[0])) { /* Vertex count mismatch, disable deform motion blur. */ mb_geom->use_deform = false; } @@ -506,9 +506,9 @@ void EEVEE_motion_blur_cache_finish(EEVEE_Data *vedata) /* Perform a copy to avoid loosing it after RE_engine_frame_set(). */ mb_geom->vbo[mb_step] = vbo = GPU_vertbuf_duplicate(vbo); /* Find and replace "pos" attrib name. */ - int attrib_id = GPU_vertformat_attr_id_get(&vbo->format, "pos"); - GPU_vertformat_attr_rename( - &vbo->format, attrib_id, (mb_step == MB_PREV) ? "prv" : "nxt"); + GPUVertFormat *format = (GPUVertFormat *)GPU_vertbuf_get_format(vbo); + int attrib_id = GPU_vertformat_attr_id_get(format, "pos"); + GPU_vertformat_attr_rename(format, attrib_id, (mb_step == MB_PREV) ? "prv" : "nxt"); } } break; @@ -573,8 +573,9 @@ void EEVEE_motion_blur_swap_data(EEVEE_Data *vedata) if (mb_geom->vbo[MB_NEXT]) { GPUVertBuf *vbo = mb_geom->vbo[MB_NEXT]; - int attrib_id = GPU_vertformat_attr_id_get(&vbo->format, "nxt"); - GPU_vertformat_attr_rename(&vbo->format, attrib_id, "prv"); + GPUVertFormat *format = (GPUVertFormat *)GPU_vertbuf_get_format(vbo); + int attrib_id = GPU_vertformat_attr_id_get(format, "nxt"); + GPU_vertformat_attr_rename(format, attrib_id, "prv"); } break; diff --git a/source/blender/draw/engines/overlay/overlay_motion_path.c b/source/blender/draw/engines/overlay/overlay_motion_path.c index 0e5a52702fe..48b7b53a5ba 100644 --- a/source/blender/draw/engines/overlay/overlay_motion_path.c +++ b/source/blender/draw/engines/overlay/overlay_motion_path.c @@ -68,7 +68,9 @@ static GPUVertBuf *mpath_vbo_get(bMotionPath *mpath) mpath->points_vbo = GPU_vertbuf_create_with_format(&format); GPU_vertbuf_data_alloc(mpath->points_vbo, mpath->length); /* meh... a useless memcpy. */ - memcpy(mpath->points_vbo->data, mpath->points, sizeof(bMotionPathVert) * mpath->length); + memcpy(GPU_vertbuf_get_data(mpath->points_vbo), + mpath->points, + sizeof(bMotionPathVert) * mpath->length); } return mpath->points_vbo; } |