diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-09-29 00:51:23 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-09-29 00:51:23 +0300 |
commit | 65900d88a8317c207885ae4a3993272112114f36 (patch) | |
tree | f5ec12e068ab8f2ee36af384060e59de72ecc08f /source/blender/blenkernel/BKE_pbvh.h | |
parent | a790873d2a811e0c244266b090d92470cf378ef2 (diff) |
Sculpt: Rewrite PBVH draw
Rewrite PBVH draw to allocate attributes into individual VBOs.
The old system tried to create a single VBO that could feed
every open viewport. This required uploading every color and
UV attribute to the viewport whether needed or not, often exceeding
the VBO limit.
This new system creates one VBO per attribute. Each attribute layout is
given its own GPU batch which is cached inside the owning PBVH node.
Notes:
* This is a full C++ rewrite. The old code is still there; ripping it out
can happen later.
* PBVH nodes now have a collection of batches, PBVHBatches, that keeps
track of all the batches inside the node.
* Batches are built exclusively from a list of attributes.
* Each attribute has its own VBO.
* Overlays, workbench and EEVEE can all have different attribute
layouts, each of which will get its own batch.
Reviewed by: Clement Foucault
Differential Revision: https://developer.blender.org/D15428
Ref D15428
Diffstat (limited to 'source/blender/blenkernel/BKE_pbvh.h')
-rw-r--r-- | source/blender/blenkernel/BKE_pbvh.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index ff2140732cc..9e0884a8c76 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -16,6 +16,7 @@ /* For embedding CCGKey in iterator. */ #include "BKE_attribute.h" #include "BKE_ccg.h" +#include "DNA_customdata_types.h" #ifdef __cplusplus extern "C" { @@ -27,7 +28,6 @@ struct CCGElem; struct CCGKey; struct CustomData; struct DMFlagMat; -struct GPU_PBVH_Buffers; struct IsectRayPrecalc; struct MLoop; struct MLoopTri; @@ -36,7 +36,9 @@ struct MVert; struct Mesh; struct MeshElemMap; struct PBVH; +struct PBVHBatches; struct PBVHNode; +struct PBVH_GPU_Args; struct SubdivCCG; struct TaskParallelSettings; struct Image; @@ -98,6 +100,12 @@ typedef struct PBVHPixelsNode { void *node_data; } PBVHPixelsNode; +typedef struct PBVHAttrReq { + char name[MAX_CUSTOMDATA_LAYER_NAME]; + eAttrDomain domain; + eCustomDataType type; +} PBVHAttrReq; + typedef enum { PBVH_Leaf = 1 << 0, @@ -348,9 +356,13 @@ void BKE_pbvh_draw_cb(PBVH *pbvh, bool update_only_visible, PBVHFrustumPlanes *update_frustum, PBVHFrustumPlanes *draw_frustum, - void (*draw_fn)(void *user_data, struct GPU_PBVH_Buffers *buffers), + void (*draw_fn)(void *user_data, + struct PBVHBatches *batches, + struct PBVH_GPU_Args *args), void *user_data, - bool full_render); + bool full_render, + PBVHAttrReq *attrs, + int attrs_num); void BKE_pbvh_draw_debug_cb(PBVH *pbvh, void (*draw_fn)(PBVHNode *node, |