1
1

temp-pbvh-vbos: final patch revision

This commit is contained in:
2022-09-28 13:34:28 -07:00
parent ed80ba2787
commit 73c26e9956
11 changed files with 109 additions and 82 deletions

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -5,6 +5,8 @@
* \ingroup draw
*/
#include "DRW_pbvh.h"
#include "draw_attributes.h"
#include "draw_manager.h"
#include "draw_pbvh.h"

View File

@@ -46,10 +46,10 @@
#include "GPU_batch.h"
#include "DRW_engine.h"
#include "DRW_pbvh.h"
#include "draw_pbvh.h"
#include "gpu_private.h"
#include "bmesh.h"
#define MAX_PBVH_BATCH_KEY 512