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/draw/intern/DRW_render.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/draw/intern/DRW_render.h')
-rw-r--r-- | source/blender/draw/intern/DRW_render.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 7b80ffd2b88..1752198c349 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -398,8 +398,18 @@ void DRW_shgroup_call_instances_with_attrs(DRWShadingGroup *shgroup, struct GPUBatch *geom, struct GPUBatch *inst_attributes); -void DRW_shgroup_call_sculpt(DRWShadingGroup *sh, Object *ob, bool wire, bool mask); -void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **sh, int num_sh, Object *ob); +void DRW_shgroup_call_sculpt(DRWShadingGroup *shgroup, + Object *ob, + bool use_wire, + bool use_mask, + bool use_fset, + bool use_color, + bool use_uv); + +void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **shgroups, + struct GPUMaterial **gpumats, + int num_shgroups, + Object *ob); DRWCallBuffer *DRW_shgroup_call_buffer(DRWShadingGroup *shgroup, struct GPUVertFormat *format, @@ -934,6 +944,14 @@ typedef struct DRWContextState { const DRWContextState *DRW_context_state_get(void); +struct DRW_Attributes; +struct DRW_MeshCDMask; + +void DRW_mesh_batch_cache_get_attributes(struct Object *object, + struct Mesh *me, + struct DRW_Attributes **r_attrs, + struct DRW_MeshCDMask **r_cd_needed); + #ifdef __cplusplus } #endif |