From 73c26e99561e3268dfe3f107161f8c2c0b7720ec Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Wed, 28 Sep 2022 13:34:28 -0700 Subject: temp-pbvh-vbos: final patch revision --- release/datafiles/locale | 2 +- release/scripts/addons | 2 +- release/scripts/addons_contrib | 2 +- source/blender/blenkernel/intern/pbvh.c | 2 +- source/blender/blenkernel/intern/pbvh_bmesh.c | 2 +- source/blender/draw/CMakeLists.txt | 1 + source/blender/draw/DRW_engine.h | 74 ------------------- source/blender/draw/DRW_pbvh.h | 98 ++++++++++++++++++++++++++ source/blender/draw/intern/draw_manager_data.c | 2 + source/blender/draw/intern/draw_pbvh.cc | 4 +- source/tools | 2 +- 11 files changed, 109 insertions(+), 82 deletions(-) create mode 100644 source/blender/draw/DRW_pbvh.h diff --git a/release/datafiles/locale b/release/datafiles/locale index 7be7aff5a18..1b891478f44 160000 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@ -1 +1 @@ -Subproject commit 7be7aff5a18c550465b3f7634539ed4168af7c51 +Subproject commit 1b891478f44dd047c3a92fda3ebd17fae1c3acd3 diff --git a/release/scripts/addons b/release/scripts/addons index 726d08c9036..67f1fbca148 160000 --- a/release/scripts/addons +++ b/release/scripts/addons @@ -1 +1 @@ -Subproject commit 726d08c9036b939f46b59bceb72a61e3102600cc +Subproject commit 67f1fbca1482d9d9362a4001332e785c3fd5d230 diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib index c43c0b2bcf0..95107484d07 160000 --- a/release/scripts/addons_contrib +++ b/release/scripts/addons_contrib @@ -1 +1 @@ -Subproject commit c43c0b2bcf08c34d933c3b56f096c9a23c8eff68 +Subproject commit 95107484d076bc965239942e857c83433bfa86d7 diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 23cefa14a73..a1de8e40fe3 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -25,7 +25,7 @@ #include "BKE_pbvh.h" #include "BKE_subdiv_ccg.h" -#include "DRW_engine.h" +#include "DRW_pbvh.h" #include "PIL_time.h" diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 795117a8f73..de908adac79 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -17,7 +17,7 @@ #include "BKE_ccg.h" #include "BKE_pbvh.h" -#include "DRW_engine.h" +#include "DRW_pbvh.h" #include "bmesh.h" #include "pbvh_intern.h" diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index b477182dbb6..2acff89ce7e 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -208,6 +208,7 @@ set(SRC DRW_engine.h DRW_select_buffer.h + DRW_pbvh.h intern/DRW_gpu_wrapper.hh intern/DRW_render.h intern/draw_attributes.h diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index cfa122845f4..dec7a22aadb 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -7,12 +7,7 @@ #pragma once -#include "BLI_assert.h" -#include "BLI_bitmap.h" #include "BLI_sys_types.h" /* for bool */ -#include "BLI_utildefines.h" - -#include "BKE_ccg.h" #include "DNA_object_enums.h" @@ -32,16 +27,9 @@ struct GPUVertFormat; struct CustomDataLayer; struct CustomData; struct GPUViewport; -struct PBVHAttrReq; -struct GPUBatch; struct ID; struct Main; struct Object; -struct PBVH_GPU_Args; -struct PBVHBatches; -struct PBVHNode; -struct CCGElem; -struct DMFlagMat; struct Render; struct RenderEngine; struct RenderEngineType; @@ -239,68 +227,6 @@ void DRW_cdlayer_attr_aliases_add(struct GPUVertFormat *format, const struct CustomDataLayer *cl, bool is_active_render, bool is_active_layer); - -/* PBVH */ - -typedef struct PBVHBatches PBVHBatches; - -typedef struct PBVH_GPU_Args { - int pbvh_type; - - struct BMesh *bm; - const struct Mesh *me; - const struct MVert *mvert; - const struct MLoop *mloop; - const struct MPoly *mpoly; - int mesh_verts_num, mesh_faces_num, mesh_grids_num; - struct CustomData *vdata, *ldata, *pdata; - const float (*vert_normals)[3]; - - int face_sets_color_seed, face_sets_color_default; - int *face_sets; /* for PBVH_FACES and PBVH_GRIDS */ - - struct SubdivCCG *subdiv_ccg; - const struct DMFlagMat *grid_flag_mats; - const int *grid_indices; - struct CCGKey ccg_key; - CCGElem **grids; - void **gridfaces; - BLI_bitmap **grid_hidden; - - int *prim_indices; - int totprim; - - bool *hide_poly; - - int node_verts_num; - - const struct MLoopTri *mlooptri; - struct PBVHNode *node; - - /* BMesh. */ - struct GSet *bm_unique_vert, *bm_other_verts, *bm_faces; - int cd_mask_layer; -} PBVH_GPU_Args; - -typedef struct PBVHGPUFormat PBVHGPUFormat; - -void DRW_pbvh_node_update(struct PBVHBatches *batches, struct PBVH_GPU_Args *args); -void DRW_pbvh_update_pre(struct PBVHBatches *batches, struct PBVH_GPU_Args *args); - -void DRW_pbvh_node_gpu_flush(struct PBVHBatches *batches); -struct PBVHBatches *DRW_pbvh_node_create(struct PBVH_GPU_Args *args); -void DRW_pbvh_node_free(struct PBVHBatches *batches); -struct GPUBatch *DRW_pbvh_tris_get(struct PBVHBatches *batches, - struct PBVHAttrReq *attrs, - int attrs_num, - struct PBVH_GPU_Args *args, - int *r_prim_count); -struct GPUBatch *DRW_pbvh_lines_get(struct PBVHBatches *batches, - struct PBVHAttrReq *attrs, - int attrs_num, - struct PBVH_GPU_Args *args, - int *r_prim_count); - #ifdef __cplusplus } #endif diff --git a/source/blender/draw/DRW_pbvh.h b/source/blender/draw/DRW_pbvh.h new file mode 100644 index 00000000000..ffd4b92d87b --- /dev/null +++ b/source/blender/draw/DRW_pbvh.h @@ -0,0 +1,98 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright 2022 Blender Foundation. */ + +/** \file + * \ingroup draw + */ + +#pragma once + +/* Needed for BKE_ccg.h. */ +#include "BLI_assert.h" +#include "BLI_bitmap.h" + +#include "BKE_ccg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct GPUViewport; +struct PBVHAttrReq; +struct GPUBatch; +struct PBVHNode; +struct GSet; +struct DMFlagMat; +struct Object; +struct Mesh; +struct MLoopTri; +struct CustomData; +struct MVert; +struct MEdge; +struct MLoop; +struct MPoly; +struct SubdivCCG; +struct BMesh; + +typedef struct PBVHBatches PBVHBatches; + +typedef struct PBVH_GPU_Args { + int pbvh_type; + + struct BMesh *bm; + const struct Mesh *me; + const struct MVert *mvert; + const struct MLoop *mloop; + const struct MPoly *mpoly; + int mesh_verts_num, mesh_faces_num, mesh_grids_num; + struct CustomData *vdata, *ldata, *pdata; + const float (*vert_normals)[3]; + + int face_sets_color_seed, face_sets_color_default; + int *face_sets; /* for PBVH_FACES and PBVH_GRIDS */ + + struct SubdivCCG *subdiv_ccg; + const struct DMFlagMat *grid_flag_mats; + const int *grid_indices; + CCGKey ccg_key; + CCGElem **grids; + void **gridfaces; + BLI_bitmap **grid_hidden; + + int *prim_indices; + int totprim; + + bool *hide_poly; + + int node_verts_num; + + const struct MLoopTri *mlooptri; + struct PBVHNode *node; + + /* BMesh. */ + struct GSet *bm_unique_vert, *bm_other_verts, *bm_faces; + int cd_mask_layer; +} PBVH_GPU_Args; + +typedef struct PBVHGPUFormat PBVHGPUFormat; + +void DRW_pbvh_node_update(PBVHBatches *batches, PBVH_GPU_Args *args); +void DRW_pbvh_update_pre(PBVHBatches *batches, PBVH_GPU_Args *args); + +void DRW_pbvh_node_gpu_flush(PBVHBatches *batches); +struct PBVHBatches *DRW_pbvh_node_create(PBVH_GPU_Args *args); +void DRW_pbvh_node_free(PBVHBatches *batches); +struct GPUBatch *DRW_pbvh_tris_get(PBVHBatches *batches, + struct PBVHAttrReq *attrs, + int attrs_num, + PBVH_GPU_Args *args, + int *r_prim_count); +struct GPUBatch *DRW_pbvh_lines_get(struct PBVHBatches *batches, + struct PBVHAttrReq *attrs, + int attrs_num, + PBVH_GPU_Args *args, + int *r_prim_count); + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 6f70b2a43ed..3e0708d8b49 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -5,6 +5,8 @@ * \ingroup draw */ +#include "DRW_pbvh.h" + #include "draw_attributes.h" #include "draw_manager.h" #include "draw_pbvh.h" diff --git a/source/blender/draw/intern/draw_pbvh.cc b/source/blender/draw/intern/draw_pbvh.cc index db854972ce8..126ba98d06c 100644 --- a/source/blender/draw/intern/draw_pbvh.cc +++ b/source/blender/draw/intern/draw_pbvh.cc @@ -46,10 +46,10 @@ #include "GPU_batch.h" #include "DRW_engine.h" -#include "draw_pbvh.h" +#include "DRW_pbvh.h" +#include "draw_pbvh.h" #include "gpu_private.h" - #include "bmesh.h" #define MAX_PBVH_BATCH_KEY 512 diff --git a/source/tools b/source/tools index 2ab59df2c98..2a541f164a2 160000 --- a/source/tools +++ b/source/tools @@ -1 +1 @@ -Subproject commit 2ab59df2c987d383a7ed9dbcd4f3897bbba7c12b +Subproject commit 2a541f164a222ef7bcd036d37687738acee8d946 -- cgit v1.2.3