1
1

Compare commits

...

23 Commits

Author SHA1 Message Date
aac32481ac temp-pbvh-vbos: fix debug mode compile error 2022-09-28 13:43:12 -07:00
73c26e9956 temp-pbvh-vbos: final patch revision 2022-09-28 13:34:28 -07:00
ed80ba2787 Merge remote-tracking branch 'origin' into temp-pbvh-vbos 2022-09-28 13:14:44 -07:00
81fa0b15b5 temp-pbvh-vbos: Make requested changes
Also finished color attribute code, which was
missing support for corners and byte colors.
2022-09-27 12:27:36 -07:00
41088e16df Merge branch 'master' into temp-pbvh-vbos 2022-09-27 11:28:45 -07:00
6637ad5432 Merge branch 'master' into temp-pbvh-vbos 2022-09-24 13:38:38 -07:00
6482e092d0 temp-pbvh-vbos: Fix dyntopo wireframe bug 2022-09-15 20:06:04 -07:00
67b897ba9f Merge remote-tracking branch 'origin' into temp-pbvh-vbos 2022-09-15 18:52:15 -07:00
b2bdbeced6 temp-pbvh-vbos: Remove old pbvh draw code 2022-09-15 18:50:32 -07:00
88e6cb1ec0 temp-pbvh-vbos: Fix uvs attribute gpu alias
Also removed some debug printfs.
2022-09-15 18:48:30 -07:00
07e8bc3063 temp-pbvh-vbos: Fix wires and finish bmesh
* Wireframe drawing works again
* Finished bmesh implementation
2022-09-15 18:40:26 -07:00
1acc730ba1 temp-pbvh-vbos: Fix face hiding and implement PBVH_BMESH. 2022-09-14 03:49:15 -07:00
97d3a57edf temp-pbvh-vbos: Implement smooth shading for multires 2022-09-14 02:16:26 -07:00
9c5dd7aad8 Merge branch 'master' into temp-pbvh-vbos 2022-09-14 00:28:18 -07:00
daa8f55fd8 Merge remote-tracking branch 'origin' into temp-pbvh-vbos 2022-09-04 17:08:03 -07:00
6299c3e99c Merge remote-tracking branch 'origin' into temp-pbvh-vbos 2022-09-04 17:06:50 -07:00
6ef12195cb Merge branch 'master' into temp-pbvh-vbos 2022-09-01 08:24:34 -07:00
e3634d6acf Merge branch 'master' into temp-pbvh-vbos 2022-08-29 11:57:52 -07:00
461c1deb63 temp-pbvh-vbos: Add support for solid-shaded multires 2022-08-20 15:43:05 -07:00
900a0c3539 temp-pbvh-vbos: Move new pbvh draw code to draw module 2022-08-20 14:15:24 -07:00
e61459d0f6 Merge branch 'master' into temp-pbvh-vbos 2022-08-19 13:17:24 -07:00
edb3340076 temp-pbvh-vbos: Rough prototype 2022-08-07 04:31:37 -07:00
eb92741c3b Initial rough code 2022-08-06 18:27:14 -07:00
35 changed files with 1710 additions and 1840 deletions

View File

@@ -450,6 +450,7 @@ int CustomData_get_stencil_layer(const struct CustomData *data, int type);
* if no such active layer is defined.
*/
const char *CustomData_get_active_layer_name(const struct CustomData *data, int type);
const char *CustomData_get_render_layer_name(const struct CustomData *data, int type);
/**
* Returns name of the default layer of the given type or NULL

View File

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

View File

@@ -25,9 +25,9 @@
#include "BKE_pbvh.h"
#include "BKE_subdiv_ccg.h"
#include "PIL_time.h"
#include "DRW_pbvh.h"
#include "GPU_buffers.h"
#include "PIL_time.h"
#include "bmesh.h"
@@ -513,6 +513,80 @@ static void pbvh_build(PBVH *pbvh, BB *cb, BBC *prim_bbc, int totprim)
build_sub(pbvh, 0, cb, prim_bbc, 0, totprim);
}
static void pbvh_draw_args_init(PBVH *pbvh, PBVH_GPU_Args *args, PBVHNode *node)
{
memset((void *)args, 0, sizeof(*args));
args->pbvh_type = pbvh->header.type;
args->mesh_verts_num = pbvh->totvert;
args->mesh_grids_num = pbvh->totgrid;
args->node = node;
BKE_pbvh_node_num_verts(pbvh, node, NULL, &args->node_verts_num);
args->grid_hidden = pbvh->grid_hidden;
args->face_sets_color_default = pbvh->face_sets_color_default;
args->face_sets_color_seed = pbvh->face_sets_color_seed;
args->mvert = pbvh->verts;
args->mloop = pbvh->mloop;
args->mpoly = pbvh->mpoly;
args->mlooptri = pbvh->looptri;
if (ELEM(pbvh->header.type, PBVH_FACES, PBVH_GRIDS)) {
args->hide_poly = pbvh->pdata ?
CustomData_get_layer_named(pbvh->pdata, CD_PROP_BOOL, ".hide_poly") :
NULL;
}
switch (pbvh->header.type) {
case PBVH_FACES:
args->mesh_faces_num = pbvh->mesh->totpoly;
args->vdata = pbvh->vdata;
args->ldata = pbvh->ldata;
args->pdata = pbvh->pdata;
args->totprim = node->totprim;
args->me = pbvh->mesh;
args->mpoly = pbvh->mpoly;
args->vert_normals = pbvh->vert_normals;
args->prim_indices = node->prim_indices;
args->face_sets = pbvh->face_sets;
break;
case PBVH_GRIDS:
args->vdata = pbvh->vdata;
args->ldata = pbvh->ldata;
args->pdata = pbvh->pdata;
args->ccg_key = pbvh->gridkey;
args->me = pbvh->mesh;
args->totprim = node->totprim;
args->grid_indices = node->prim_indices;
args->subdiv_ccg = pbvh->subdiv_ccg;
args->face_sets = pbvh->face_sets;
args->mpoly = pbvh->mpoly;
args->mesh_grids_num = pbvh->totgrid;
args->grids = pbvh->grids;
args->gridfaces = pbvh->gridfaces;
args->grid_flag_mats = pbvh->grid_flag_mats;
args->vert_normals = pbvh->vert_normals;
args->face_sets = pbvh->face_sets;
break;
case PBVH_BMESH:
args->bm = pbvh->header.bm;
args->vdata = &args->bm->vdata;
args->ldata = &args->bm->ldata;
args->pdata = &args->bm->pdata;
args->bm_faces = node->bm_faces;
args->bm_other_verts = node->bm_other_verts;
args->bm_unique_vert = node->bm_unique_verts;
args->totprim = BLI_gset_len(node->bm_faces);
args->cd_mask_layer = CustomData_get_offset(&pbvh->header.bm->vdata, CD_PAINT_MASK);
break;
}
}
void BKE_pbvh_build_mesh(PBVH *pbvh,
Mesh *mesh,
const MPoly *mpoly,
@@ -645,8 +719,8 @@ void BKE_pbvh_free(PBVH *pbvh)
PBVHNode *node = &pbvh->nodes[i];
if (node->flag & PBVH_Leaf) {
if (node->draw_buffers) {
GPU_pbvh_buffers_free(node->draw_buffers);
if (node->draw_batches) {
DRW_pbvh_node_free(node->draw_batches);
}
if (node->vert_indices) {
MEM_freeN((void *)node->vert_indices);
@@ -693,10 +767,6 @@ void BKE_pbvh_free(PBVH *pbvh)
MEM_SAFE_FREE(pbvh->vert_bitmap);
if (pbvh->vbo_id) {
GPU_pbvh_free_format(pbvh->vbo_id);
}
MEM_freeN(pbvh);
}
@@ -988,6 +1058,8 @@ typedef struct PBVHUpdateData {
float (*vnors)[3];
int flag;
bool show_sculpt_face_sets;
PBVHAttrReq *attrs;
int attrs_num;
} PBVHUpdateData;
static void pbvh_update_normals_clear_task_cb(void *__restrict userdata,
@@ -1240,13 +1312,6 @@ void pbvh_update_BB_redraw(PBVH *pbvh, PBVHNode **nodes, int totnode, int flag)
BLI_task_parallel_range(0, totnode, &data, pbvh_update_BB_redraw_task_cb, &settings);
}
static int pbvh_get_buffers_update_flags(PBVH *UNUSED(pbvh))
{
int update_flags = GPU_PBVH_BUFFERS_SHOW_VCOL | GPU_PBVH_BUFFERS_SHOW_MASK |
GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS;
return update_flags;
}
bool BKE_pbvh_get_color_layer(const Mesh *me, CustomDataLayer **r_layer, eAttrDomain *r_attr)
{
CustomDataLayer *layer = BKE_id_attributes_active_color_get((ID *)me);
@@ -1283,128 +1348,29 @@ static void pbvh_update_draw_buffer_cb(void *__restrict userdata,
PBVHNode *node = data->nodes[n];
if (node->flag & PBVH_RebuildDrawBuffers) {
switch (pbvh->header.type) {
case PBVH_GRIDS: {
bool smooth = node->totprim > 0 ?
pbvh->grid_flag_mats[node->prim_indices[0]].flag & ME_SMOOTH :
false;
PBVH_GPU_Args args;
pbvh_draw_args_init(pbvh, &args, node);
node->draw_buffers = GPU_pbvh_grid_buffers_build(node->totprim, pbvh->grid_hidden, smooth);
break;
}
case PBVH_FACES:
node->draw_buffers = GPU_pbvh_mesh_buffers_build(
pbvh->mesh, pbvh->looptri, node->prim_indices, node->totprim);
break;
case PBVH_BMESH:
node->draw_buffers = GPU_pbvh_bmesh_buffers_build(pbvh->flags &
PBVH_DYNTOPO_SMOOTH_SHADING);
break;
}
node->draw_batches = DRW_pbvh_node_create(&args);
}
if (node->flag & PBVH_UpdateDrawBuffers) {
node->debug_draw_gen++;
const int update_flags = pbvh_get_buffers_update_flags(pbvh);
switch (pbvh->header.type) {
case PBVH_GRIDS:
GPU_pbvh_grid_buffers_update(pbvh->vbo_id,
node->draw_buffers,
pbvh->subdiv_ccg,
pbvh->grids,
pbvh->grid_flag_mats,
node->prim_indices,
node->totprim,
pbvh->face_sets,
pbvh->face_sets_color_seed,
pbvh->face_sets_color_default,
&pbvh->gridkey,
update_flags);
break;
case PBVH_FACES: {
/* Pass vertices separately because they may be not be the same as the mesh's vertices,
* and pass normals separately because they are managed by the PBVH. */
GPU_pbvh_mesh_buffers_update(
pbvh->vbo_id,
node->draw_buffers,
pbvh->mesh,
pbvh->verts,
CustomData_get_layer(pbvh->vdata, CD_PAINT_MASK),
CustomData_get_layer_named(pbvh->pdata, CD_PROP_INT32, ".sculpt_face_set"),
pbvh->face_sets_color_seed,
pbvh->face_sets_color_default,
update_flags,
pbvh->vert_normals);
break;
}
case PBVH_BMESH:
GPU_pbvh_bmesh_buffers_update(pbvh->vbo_id,
node->draw_buffers,
pbvh->header.bm,
node->bm_faces,
node->bm_unique_verts,
node->bm_other_verts,
update_flags);
break;
if (node->draw_batches) {
PBVH_GPU_Args args;
pbvh_draw_args_init(pbvh, &args, node);
DRW_pbvh_node_update(node->draw_batches, &args);
}
}
}
void pbvh_free_draw_buffers(PBVH *pbvh, PBVHNode *node)
{
if (node->draw_buffers) {
pbvh->draw_cache_invalid = true;
GPU_pbvh_buffers_free(node->draw_buffers);
node->draw_buffers = NULL;
}
}
static void pbvh_check_draw_layout(PBVH *pbvh)
{
const CustomData *vdata;
const CustomData *ldata;
if (!pbvh->vbo_id) {
pbvh->vbo_id = GPU_pbvh_make_format();
}
switch (pbvh->header.type) {
case PBVH_BMESH:
if (!pbvh->header.bm) {
/* BMesh hasn't been created yet */
return;
}
vdata = &pbvh->header.bm->vdata;
ldata = &pbvh->header.bm->ldata;
break;
case PBVH_FACES:
vdata = pbvh->vdata;
ldata = pbvh->ldata;
break;
case PBVH_GRIDS:
ldata = vdata = NULL;
break;
}
/* Rebuild all draw buffers if attribute layout changed.
*
* NOTE: The optimization where we only send active attributes
* to the GPU in workbench mode is disabled due to bugs
* (there's no guarantee there isn't another EEVEE viewport which would
* free the draw buffers and corrupt the draw cache).
*/
if (GPU_pbvh_attribute_names_update(pbvh->header.type, pbvh->vbo_id, vdata, ldata, false)) {
/* attribute layout changed; force rebuild */
for (int i = 0; i < pbvh->totnode; i++) {
PBVHNode *node = pbvh->nodes + i;
if (node->flag & PBVH_Leaf) {
node->flag |= PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers | PBVH_UpdateRedraw;
}
}
if (node->draw_batches) {
DRW_pbvh_node_free(node->draw_batches);
node->draw_batches = NULL;
}
}
@@ -1412,10 +1378,6 @@ static void pbvh_update_draw_buffers(PBVH *pbvh, PBVHNode **nodes, int totnode,
{
const CustomData *vdata;
if (!pbvh->vbo_id) {
pbvh->vbo_id = GPU_pbvh_make_format();
}
switch (pbvh->header.type) {
case PBVH_BMESH:
if (!pbvh->header.bm) {
@@ -1441,14 +1403,11 @@ static void pbvh_update_draw_buffers(PBVH *pbvh, PBVHNode **nodes, int totnode,
if (node->flag & PBVH_RebuildDrawBuffers) {
pbvh_free_draw_buffers(pbvh, node);
}
else if ((node->flag & PBVH_UpdateDrawBuffers) && node->draw_buffers) {
if (pbvh->header.type == PBVH_GRIDS) {
GPU_pbvh_grid_buffers_update_free(
node->draw_buffers, pbvh->grid_flag_mats, node->prim_indices);
}
else if (pbvh->header.type == PBVH_BMESH) {
GPU_pbvh_bmesh_buffers_update_free(node->draw_buffers);
}
else if ((node->flag & PBVH_UpdateDrawBuffers) && node->draw_batches) {
PBVH_GPU_Args args;
pbvh_draw_args_init(pbvh, &args, node);
DRW_pbvh_update_pre(node->draw_batches, &args);
}
}
}
@@ -1468,7 +1427,10 @@ static void pbvh_update_draw_buffers(PBVH *pbvh, PBVHNode **nodes, int totnode,
if (node->flag & PBVH_UpdateDrawBuffers) {
/* Flush buffers uses OpenGL, so not in parallel. */
GPU_pbvh_buffers_update_flush(node->draw_buffers);
if (node->draw_batches) {
DRW_pbvh_node_gpu_flush(node->draw_batches);
}
}
node->flag &= ~(PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers);
@@ -2810,6 +2772,8 @@ void BKE_pbvh_face_sets_color_set(PBVH *pbvh, int seed, int color_default)
typedef struct PBVHDrawSearchData {
PBVHFrustumPlanes *frustum;
int accum_update_flag;
PBVHAttrReq *attrs;
int attrs_num;
} PBVHDrawSearchData;
static bool pbvh_draw_search_cb(PBVHNode *node, void *data_v)
@@ -2827,9 +2791,11 @@ void BKE_pbvh_draw_cb(PBVH *pbvh,
bool update_only_visible,
PBVHFrustumPlanes *update_frustum,
PBVHFrustumPlanes *draw_frustum,
void (*draw_fn)(void *user_data, GPU_PBVH_Buffers *buffers),
void (*draw_fn)(void *user_data, PBVHBatches *batches, PBVH_GPU_Args *args),
void *user_data,
bool UNUSED(full_render))
bool UNUSED(full_render),
PBVHAttrReq *attrs,
int attrs_num)
{
PBVHNode **nodes;
int totnode;
@@ -2840,7 +2806,8 @@ void BKE_pbvh_draw_cb(PBVH *pbvh,
/* Search for nodes that need updates. */
if (update_only_visible) {
/* Get visible nodes with draw updates. */
PBVHDrawSearchData data = {.frustum = update_frustum, .accum_update_flag = 0};
PBVHDrawSearchData data = {
.frustum = update_frustum, .accum_update_flag = 0, attrs, attrs_num};
BKE_pbvh_search_gather(pbvh, pbvh_draw_search_cb, &data, &nodes, &totnode);
update_flag = data.accum_update_flag;
}
@@ -2852,8 +2819,6 @@ void BKE_pbvh_draw_cb(PBVH *pbvh,
update_flag = PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers;
}
pbvh_check_draw_layout(pbvh);
/* Update draw buffers. */
if (totnode != 0 && (update_flag & (PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers))) {
pbvh_update_draw_buffers(pbvh, nodes, totnode, update_flag);
@@ -2864,10 +2829,14 @@ void BKE_pbvh_draw_cb(PBVH *pbvh,
PBVHDrawSearchData draw_data = {.frustum = draw_frustum, .accum_update_flag = 0};
BKE_pbvh_search_gather(pbvh, pbvh_draw_search_cb, &draw_data, &nodes, &totnode);
PBVH_GPU_Args args;
for (int i = 0; i < totnode; i++) {
PBVHNode *node = nodes[i];
if (!(node->flag & PBVH_FullyHidden)) {
draw_fn(user_data, node->draw_buffers);
pbvh_draw_args_init(pbvh, &args, node);
draw_fn(user_data, node->draw_batches, &args);
}
}

View File

@@ -29,8 +29,6 @@
#include "PIL_time.h"
#include "GPU_buffers.h"
#include "bmesh.h"
#include "atomic_ops.h"

View File

@@ -17,7 +17,7 @@
#include "BKE_ccg.h"
#include "BKE_pbvh.h"
#include "GPU_buffers.h"
#include "DRW_pbvh.h"
#include "bmesh.h"
#include "pbvh_intern.h"
@@ -347,8 +347,8 @@ static void pbvh_bmesh_node_split(PBVH *pbvh, const BBC *bbc_array, int node_ind
n->bm_other_verts = NULL;
n->layer_disp = NULL;
if (n->draw_buffers) {
pbvh_free_draw_buffers(pbvh, n);
if (n->draw_batches) {
DRW_pbvh_node_free(n->draw_batches);
}
n->flag &= ~PBVH_Leaf;

View File

@@ -33,7 +33,7 @@ struct MeshElemMap;
* union'd structs */
struct PBVHNode {
/* Opaque handle for drawing code */
struct GPU_PBVH_Buffers *draw_buffers;
struct PBVHBatches *draw_batches;
/* Voxel bounds */
BB vb;

View File

@@ -556,6 +556,11 @@ template<typename T, int Size> struct vec_base : public vec_struct_base<T, Size>
}
};
using char3 = blender::vec_base<int8_t, 3>;
using uchar3 = blender::vec_base<uint8_t, 3>;
using uchar4 = blender::vec_base<uint8_t, 4>;
using int2 = vec_base<int32_t, 2>;
using int3 = vec_base<int32_t, 3>;
using int4 = vec_base<int32_t, 4>;
@@ -564,7 +569,11 @@ using uint2 = vec_base<uint32_t, 2>;
using uint3 = vec_base<uint32_t, 3>;
using uint4 = vec_base<uint32_t, 4>;
using short3 = blender::vec_base<int16_t, 3>;
using ushort2 = vec_base<uint16_t, 2>;
using ushort3 = blender::vec_base<uint16_t, 3>;
using ushort4 = blender::vec_base<uint16_t, 4>;
using float2 = vec_base<float, 2>;
using float3 = vec_base<float, 3>;

View File

@@ -94,6 +94,7 @@ set(SRC
intern/draw_manager_shader.c
intern/draw_manager_text.c
intern/draw_manager_texture.c
intern/draw_pbvh.cc
intern/draw_select_buffer.c
intern/draw_shader.cc
intern/draw_texture_pool.cc
@@ -207,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
@@ -229,6 +231,7 @@ set(SRC
intern/draw_manager_profiling.h
intern/draw_manager_testing.h
intern/draw_manager_text.h
intern/draw_pbvh.h
intern/draw_pass.hh
intern/draw_resource.cc
intern/draw_resource.hh

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

@@ -199,7 +199,7 @@ static void basic_cache_populate(void *vedata, Object *ob)
}
if (use_sculpt_pbvh) {
DRW_shgroup_call_sculpt(shgrp, ob, false, false);
DRW_shgroup_call_sculpt(shgrp, ob, false, false, false, false, false);
}
else {
if (stl->g_data->use_material_slot_selection && BKE_object_supports_material_slots(ob)) {

View File

@@ -824,14 +824,17 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
if (use_sculpt_pbvh) {
struct DRWShadingGroup **shgrps_array = BLI_array_alloca(shgrps_array, materials_len);
struct GPUMaterial **gpumat_array = BLI_array_alloca(gpumat_array, materials_len);
MATCACHE_AS_ARRAY(matcache, shading_gpumat, materials_len, gpumat_array);
MATCACHE_AS_ARRAY(matcache, shading_grp, materials_len, shgrps_array);
DRW_shgroup_call_sculpt_with_materials(shgrps_array, materials_len, ob);
DRW_shgroup_call_sculpt_with_materials(shgrps_array, gpumat_array, materials_len, ob);
MATCACHE_AS_ARRAY(matcache, depth_grp, materials_len, shgrps_array);
DRW_shgroup_call_sculpt_with_materials(shgrps_array, materials_len, ob);
DRW_shgroup_call_sculpt_with_materials(shgrps_array, gpumat_array, materials_len, ob);
MATCACHE_AS_ARRAY(matcache, shadow_grp, materials_len, shgrps_array);
DRW_shgroup_call_sculpt_with_materials(shgrps_array, materials_len, ob);
DRW_shgroup_call_sculpt_with_materials(shgrps_array, gpumat_array, materials_len, ob);
}
else {
struct GPUMaterial **gpumat_array = BLI_array_alloca(gpumat_array, materials_len);

View File

@@ -48,7 +48,7 @@ void OVERLAY_facing_cache_populate(OVERLAY_Data *vedata, Object *ob)
const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
if (use_sculpt_pbvh) {
DRW_shgroup_call_sculpt(pd->facing_grp[is_xray], ob, false, false);
DRW_shgroup_call_sculpt(pd->facing_grp[is_xray], ob, false, false, false, false, false);
}
else {
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);

View File

@@ -58,7 +58,7 @@ void OVERLAY_fade_cache_populate(OVERLAY_Data *vedata, Object *ob)
const bool is_xray = (ob->dtx & OB_DRAW_IN_FRONT) != 0;
if (use_sculpt_pbvh) {
DRW_shgroup_call_sculpt(pd->fade_grp[is_xray], ob, false, false);
DRW_shgroup_call_sculpt(pd->fade_grp[is_xray], ob, false, false, false, false, false);
}
else {
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);

View File

@@ -110,7 +110,7 @@ void OVERLAY_mode_transfer_cache_populate(OVERLAY_Data *vedata, Object *ob)
pd->mode_transfer.any_animated = true;
if (use_sculpt_pbvh) {
DRW_shgroup_call_sculpt(mode_transfer_grp[is_xray], ob, false, false);
DRW_shgroup_call_sculpt(mode_transfer_grp[is_xray], ob, false, false, false, false, false);
}
else {
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);

View File

@@ -53,7 +53,7 @@ void OVERLAY_sculpt_cache_populate(OVERLAY_Data *vedata, Object *ob)
}
if (use_pbvh) {
DRW_shgroup_call_sculpt(pd->sculpt_mask_grp, ob, false, true);
DRW_shgroup_call_sculpt(pd->sculpt_mask_grp, ob, false, true, true, false, false);
}
else {
sculpt_overlays = DRW_mesh_batch_cache_get_sculpt_overlays(static_cast<Mesh *>(ob->data));

View File

@@ -302,7 +302,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
DRW_shgroup_call_no_cull(shgrp, geom, ob);
}
else if (use_sculpt_pbvh) {
DRW_shgroup_call_sculpt(shgrp, ob, true, false);
DRW_shgroup_call_sculpt(shgrp, ob, true, false, false, false, false);
}
else {
DRW_shgroup_call(shgrp, geom, ob);

View File

@@ -102,7 +102,11 @@ static void workbench_cache_sculpt_populate(WORKBENCH_PrivateData *wpd,
const bool use_single_drawcall = !ELEM(color_type, V3D_SHADING_MATERIAL_COLOR);
if (use_single_drawcall) {
DRWShadingGroup *grp = workbench_material_setup(wpd, ob, ob->actcol, color_type, NULL);
DRW_shgroup_call_sculpt(grp, ob, false, false);
bool use_color = color_type == V3D_SHADING_VERTEX_COLOR;
bool use_uv = color_type == V3D_SHADING_TEXTURE_COLOR;
DRW_shgroup_call_sculpt(grp, ob, false, false, false, use_color, use_uv);
}
else {
const int materials_len = DRW_cache_object_material_count_get(ob);
@@ -110,7 +114,7 @@ static void workbench_cache_sculpt_populate(WORKBENCH_PrivateData *wpd,
for (int i = 0; i < materials_len; i++) {
shgrps[i] = workbench_material_setup(wpd, ob, i + 1, color_type, NULL);
}
DRW_shgroup_call_sculpt_with_materials(shgrps, materials_len, ob);
DRW_shgroup_call_sculpt_with_materials(shgrps, NULL, materials_len, ob);
}
}

View File

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

View File

@@ -16,6 +16,7 @@
#include "BLI_sys_types.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "GPU_shader.h"
#include "GPU_vertex_format.h"
@@ -36,6 +37,23 @@ typedef struct DRW_Attributes {
int num_requests;
} DRW_Attributes;
typedef struct DRW_MeshCDMask {
uint32_t uv : 8;
uint32_t tan : 8;
uint32_t orco : 1;
uint32_t tan_orco : 1;
uint32_t sculpt_overlays : 1;
/**
* Edit uv layer is from the base edit mesh as modifiers could remove it. (see T68857)
*/
uint32_t edit_uv : 1;
} DRW_MeshCDMask;
/* Keep `DRW_MeshCDMask` struct within a `uint32_t`.
* bit-wise and atomic operations are used to compare and update the struct.
* See `mesh_cd_layers_type_*` functions. */
BLI_STATIC_ASSERT(sizeof(DRW_MeshCDMask) <= sizeof(uint32_t), "DRW_MeshCDMask exceeds 32 bits")
void drw_attributes_clear(DRW_Attributes *attributes);
void drw_attributes_merge(DRW_Attributes *dst,

View File

@@ -3388,7 +3388,7 @@ void DRW_cdlayer_attr_aliases_add(GPUVertFormat *format,
/* Active render layer name. */
if (is_active_render) {
GPU_vertformat_alias_add(format, base_name);
GPU_vertformat_alias_add(format, cl->type == CD_MLOOPUV ? "a" : base_name);
}
/* Active display layer name. */

View File

@@ -52,22 +52,6 @@ enum {
DRW_MESH_WEIGHT_STATE_LOCK_RELATIVE = (1 << 2),
};
struct DRW_MeshCDMask {
uint32_t uv : 8;
uint32_t tan : 8;
uint32_t orco : 1;
uint32_t tan_orco : 1;
uint32_t sculpt_overlays : 1;
/**
* Edit uv layer is from the base edit mesh as modifiers could remove it. (see T68857)
*/
uint32_t edit_uv : 1;
};
/* Keep `DRW_MeshCDMask` struct within a `uint32_t`.
* bit-wise and atomic operations are used to compare and update the struct.
* See `mesh_cd_layers_type_*` functions. */
BLI_STATIC_ASSERT(sizeof(DRW_MeshCDMask) <= sizeof(uint32_t), "DRW_MeshCDMask exceeds 32 bits")
enum eMRIterType {
MR_ITER_LOOPTRI = 1 << 0,
MR_ITER_POLY = 1 << 1,

View File

@@ -191,6 +191,7 @@ struct GPUBatch **DRW_mesh_batch_cache_get_surface_shaded(struct Object *object,
struct Mesh *me,
struct GPUMaterial **gpumat_array,
uint gpumat_array_len);
struct GPUBatch **DRW_mesh_batch_cache_get_surface_texpaint(struct Object *object,
struct Mesh *me);
struct GPUBatch *DRW_mesh_batch_cache_get_surface_texpaint_single(struct Object *object,

View File

@@ -62,6 +62,7 @@
#include "draw_subdivision.h"
#include "draw_cache_impl.h" /* own include */
#include "draw_manager.h"
#include "mesh_extractors/extract_mesh.hh"
@@ -981,6 +982,27 @@ GPUBatch *DRW_mesh_batch_cache_get_edit_mesh_analysis(Mesh *me)
return DRW_batch_request(&cache->batch.edit_mesh_analysis);
}
void DRW_mesh_get_attributes(Object *object,
Mesh *me,
struct GPUMaterial **gpumat_array,
int gpumat_array_len,
DRW_Attributes *r_attrs,
DRW_MeshCDMask *r_cd_needed)
{
DRW_Attributes attrs_needed;
drw_attributes_clear(&attrs_needed);
DRW_MeshCDMask cd_needed = mesh_cd_calc_used_gpu_layers(
object, me, gpumat_array, gpumat_array_len, &attrs_needed);
if (r_attrs) {
*r_attrs = attrs_needed;
}
if (r_cd_needed) {
*r_cd_needed = cd_needed;
}
}
GPUBatch **DRW_mesh_batch_cache_get_surface_shaded(Object *object,
Mesh *me,
struct GPUMaterial **gpumat_array,

View File

@@ -694,6 +694,16 @@ bool drw_engine_data_engines_data_validate(GPUViewport *viewport, void **engine_
void drw_engine_data_cache_release(GPUViewport *viewport);
void drw_engine_data_free(GPUViewport *viewport);
struct DRW_Attributes;
struct DRW_MeshCDMask;
struct GPUMaterial;
void DRW_mesh_get_attributes(struct Object *object,
struct Mesh *me,
struct GPUMaterial **gpumat_array,
int gpumat_array_len,
struct DRW_Attributes *r_attrs,
struct DRW_MeshCDMask *r_cd_needed);
void DRW_manager_begin_sync(void);
void DRW_manager_end_sync(void);

View File

@@ -5,7 +5,11 @@
* \ingroup draw
*/
#include "DRW_pbvh.h"
#include "draw_attributes.h"
#include "draw_manager.h"
#include "draw_pbvh.h"
#include "BKE_curve.h"
#include "BKE_duplilist.h"
@@ -32,12 +36,12 @@
#include "BLI_listbase.h"
#include "BLI_memblock.h"
#include "BLI_mempool.h"
#include "BLI_math_bits.h"
#ifdef DRW_DEBUG_CULLING
# include "BLI_math_bits.h"
#endif
#include "GPU_buffers.h"
#include "GPU_capabilities.h"
#include "GPU_material.h"
#include "GPU_uniform_buffer.h"
@@ -1144,6 +1148,8 @@ typedef struct DRWSculptCallbackData {
bool fast_mode; /* Set by draw manager. Do not init. */
int debug_node_nr;
PBVHAttrReq *attrs;
int attrs_num;
} DRWSculptCallbackData;
#define SCULPT_DEBUG_COLOR(id) (sculpt_debug_colors[id % 9])
@@ -1159,22 +1165,28 @@ static float sculpt_debug_colors[9][4] = {
{0.7f, 0.2f, 1.0f, 1.0f},
};
static void sculpt_draw_cb(DRWSculptCallbackData *scd, GPU_PBVH_Buffers *buffers)
static void sculpt_draw_cb(DRWSculptCallbackData *scd,
PBVHBatches *batches,
PBVH_GPU_Args *pbvh_draw_args)
{
if (!buffers) {
if (!batches) {
return;
}
/* Meh... use_mask is a bit misleading here. */
if (scd->use_mask && !GPU_pbvh_buffers_has_overlays(buffers)) {
return;
int primcount;
GPUBatch *geom;
if (!scd->use_wire) {
geom = DRW_pbvh_tris_get(batches, scd->attrs, scd->attrs_num, pbvh_draw_args, &primcount);
}
else {
geom = DRW_pbvh_lines_get(batches, scd->attrs, scd->attrs_num, pbvh_draw_args, &primcount);
}
GPUBatch *geom = GPU_pbvh_buffers_batch_get(buffers, scd->fast_mode, scd->use_wire);
short index = 0;
if (scd->use_mats) {
index = GPU_pbvh_buffers_material_index_get(buffers);
index = drw_pbvh_material_index_get(batches);
if (index >= scd->num_shading_groups) {
index = 0;
}
@@ -1298,9 +1310,11 @@ static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd)
update_only_visible,
&update_frustum,
&draw_frustum,
(void (*)(void *, GPU_PBVH_Buffers *))sculpt_draw_cb,
(void (*)(void *, PBVHBatches *, PBVH_GPU_Args *))sculpt_draw_cb,
scd,
scd->use_mats);
scd->use_mats,
scd->attrs,
scd->attrs_num);
if (SCULPT_DEBUG_BUFFERS) {
int debug_node_nr = 0;
@@ -1313,7 +1327,13 @@ static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd)
}
}
void DRW_shgroup_call_sculpt(DRWShadingGroup *shgroup, Object *ob, bool use_wire, bool use_mask)
void DRW_shgroup_call_sculpt(DRWShadingGroup *shgroup,
Object *ob,
bool use_wire,
bool use_mask,
bool use_fset,
bool use_color,
bool use_uv)
{
DRWSculptCallbackData scd = {
.ob = ob,
@@ -1323,13 +1343,115 @@ void DRW_shgroup_call_sculpt(DRWShadingGroup *shgroup, Object *ob, bool use_wire
.use_mats = false,
.use_mask = use_mask,
};
PBVHAttrReq attrs[16];
int attrs_num = 0;
memset(attrs, 0, sizeof(attrs));
attrs[attrs_num++].type = CD_PBVH_CO_TYPE;
attrs[attrs_num++].type = CD_PBVH_NO_TYPE;
if (use_mask) {
attrs[attrs_num++].type = CD_PBVH_MASK_TYPE;
}
if (use_fset) {
attrs[attrs_num++].type = CD_PBVH_FSET_TYPE;
}
Mesh *me = BKE_object_get_original_mesh(ob);
if (use_color) {
CustomDataLayer *layer = BKE_id_attributes_active_color_get(&me->id);
if (layer) {
eAttrDomain domain = BKE_id_attribute_domain(&me->id, layer);
attrs[attrs_num].type = layer->type;
attrs[attrs_num].domain = domain;
BLI_strncpy(attrs[attrs_num].name, layer->name, sizeof(attrs[attrs_num].name));
attrs_num++;
}
}
if (use_uv) {
int layer_i = CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV);
if (layer_i != -1) {
CustomDataLayer *layer = me->ldata.layers + layer_i;
attrs[attrs_num].type = CD_MLOOPUV;
attrs[attrs_num].domain = ATTR_DOMAIN_CORNER;
BLI_strncpy(attrs[attrs_num].name, layer->name, sizeof(attrs[attrs_num].name));
attrs_num++;
}
}
scd.attrs = attrs;
scd.attrs_num = attrs_num;
drw_sculpt_generate_calls(&scd);
}
void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **shgroups,
GPUMaterial **gpumats,
int num_shgroups,
Object *ob)
{
DRW_Attributes draw_attrs;
DRW_MeshCDMask cd_needed;
if (gpumats) {
DRW_mesh_get_attributes(ob, (Mesh *)ob->data, gpumats, num_shgroups, &draw_attrs, &cd_needed);
}
else {
memset(&draw_attrs, 0, sizeof(draw_attrs));
memset(&cd_needed, 0, sizeof(cd_needed));
}
int attrs_num = 2 + draw_attrs.num_requests;
/* UV maps are not in attribute requests. */
attrs_num += count_bits_i(cd_needed.uv);
PBVHAttrReq *attrs = BLI_array_alloca(attrs, attrs_num);
memset(attrs, 0, sizeof(PBVHAttrReq) * attrs_num);
int attrs_i = 0;
attrs[attrs_i++].type = CD_PBVH_CO_TYPE;
attrs[attrs_i++].type = CD_PBVH_NO_TYPE;
for (int i = 0; i < draw_attrs.num_requests; i++) {
DRW_AttributeRequest *req = draw_attrs.requests + i;
attrs[attrs_i].type = req->cd_type;
attrs[attrs_i].domain = req->domain;
BLI_strncpy(attrs[attrs_i].name, req->attribute_name, sizeof(attrs->name));
attrs_i++;
}
/* UV maps are not in attribute requests. */
Mesh *me = (Mesh *)ob->data;
for (uint i = 0; i < 32; i++) {
if (cd_needed.uv & (1 << i)) {
int layer_i = CustomData_get_layer_index_n(&me->ldata, CD_MLOOPUV, i);
CustomDataLayer *layer = layer_i != -1 ? me->ldata.layers + layer_i : NULL;
if (layer) {
attrs[attrs_i].type = CD_MLOOPUV;
attrs[attrs_i].domain = ATTR_DOMAIN_CORNER;
BLI_strncpy(attrs[attrs_i].name, layer->name, sizeof(attrs->name));
attrs_i++;
}
}
}
attrs_num = attrs_i;
DRWSculptCallbackData scd = {
.ob = ob,
.shading_groups = shgroups,
@@ -1337,6 +1459,8 @@ void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **shgroups,
.use_wire = false,
.use_mats = true,
.use_mask = false,
.attrs = attrs,
.attrs_num = attrs_num,
};
drw_sculpt_generate_calls(&scd);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
#pragma once
#include "DNA_customdata_types.h"
#ifdef __cplusplus
extern "C" {
#endif
struct PBVHBatches;
enum {
CD_PBVH_CO_TYPE = CD_NUMTYPES,
CD_PBVH_NO_TYPE = CD_NUMTYPES + 1,
CD_PBVH_FSET_TYPE = CD_NUMTYPES + 2,
CD_PBVH_MASK_TYPE = CD_NUMTYPES + 3
};
int drw_pbvh_material_index_get(struct PBVHBatches *batches);
#ifdef __cplusplus
}
#endif

View File

@@ -47,7 +47,6 @@ set(SRC
intern/gpu_batch.cc
intern/gpu_batch_presets.c
intern/gpu_batch_utils.c
intern/gpu_buffers.c
intern/gpu_capabilities.cc
intern/gpu_codegen.cc
intern/gpu_compute.cc
@@ -84,7 +83,6 @@ set(SRC
GPU_batch.h
GPU_batch_presets.h
GPU_batch_utils.h
GPU_buffers.h
GPU_capabilities.h
GPU_common.h
GPU_common_types.h

View File

@@ -1,157 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2005 Blender Foundation. All rights reserved. */
/** \file
* \ingroup gpu
*/
#pragma once
#include <stddef.h>
#include "BKE_attribute.h"
#include "BKE_pbvh.h"
#ifdef __cplusplus
extern "C" {
#endif
struct BMesh;
struct CCGElem;
struct CCGKey;
struct DMFlagMat;
struct GSet;
struct TableGSet;
struct Mesh;
struct MLoop;
struct MLoopCol;
struct MLoopTri;
struct MPoly;
struct MPropCol;
struct MVert;
struct Mesh;
struct PBVH;
struct SubdivCCG;
struct CustomData;
typedef struct PBVHGPUFormat PBVHGPUFormat;
/**
* Buffers for drawing from PBVH grids.
*/
typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers;
/**
* Build must be called once before using the other functions,
* used every time mesh topology changes.
*
* Threaded: do not call any functions that use OpenGL calls!
*/
GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const struct Mesh *mesh,
const struct MLoopTri *looptri,
const int *face_indices,
int face_indices_len);
/**
* Threaded: do not call any functions that use OpenGL calls!
*/
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(int totgrid,
unsigned int **grid_hidden,
bool smooth);
/**
* Threaded: do not call any functions that use OpenGL calls!
*/
GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading);
/**
* Free part of data for update. Not thread safe, must run in OpenGL main thread.
*/
void GPU_pbvh_bmesh_buffers_update_free(GPU_PBVH_Buffers *buffers);
void GPU_pbvh_grid_buffers_update_free(GPU_PBVH_Buffers *buffers,
const struct DMFlagMat *grid_flag_mats,
const int *grid_indices);
/**
* Update mesh buffers without topology changes. Threaded.
*/
enum {
GPU_PBVH_BUFFERS_SHOW_MASK = (1 << 1),
GPU_PBVH_BUFFERS_SHOW_VCOL = (1 << 2),
GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS = (1 << 3),
};
/**
* Creates a vertex buffer (coordinate, normal, color) and,
* if smooth shading, an element index buffer.
* Threaded: do not call any functions that use OpenGL calls!
*/
void GPU_pbvh_mesh_buffers_update(PBVHGPUFormat *vbo_id,
GPU_PBVH_Buffers *buffers,
const struct Mesh *mesh,
const struct MVert *mvert,
const float *vmask,
const int *sculpt_face_sets,
const int face_sets_color_seed,
const int face_sets_color_default,
const int update_flags,
const float (*vert_normals)[3]);
bool GPU_pbvh_attribute_names_update(PBVHType pbvh_type,
PBVHGPUFormat *vbo_id,
const struct CustomData *vdata,
const struct CustomData *ldata,
bool active_attrs_only);
/**
* Creates a vertex buffer (coordinate, normal, color) and,
* if smooth shading, an element index buffer.
* Threaded: do not call any functions that use OpenGL calls!
*/
void GPU_pbvh_bmesh_buffers_update(PBVHGPUFormat *vbo_id,
struct GPU_PBVH_Buffers *buffers,
struct BMesh *bm,
struct GSet *bm_faces,
struct GSet *bm_unique_verts,
struct GSet *bm_other_verts,
const int update_flags);
/**
* Threaded: do not call any functions that use OpenGL calls!
*/
void GPU_pbvh_grid_buffers_update(PBVHGPUFormat *vbo_id,
GPU_PBVH_Buffers *buffers,
struct SubdivCCG *subdiv_ccg,
struct CCGElem **grids,
const struct DMFlagMat *grid_flag_mats,
int *grid_indices,
int totgrid,
const int *sculpt_face_sets,
int face_sets_color_seed,
int face_sets_color_default,
const struct CCGKey *key,
int update_flags);
/**
* Finish update. Not thread safe, must run in OpenGL main
* thread.
*/
void GPU_pbvh_buffers_update_flush(GPU_PBVH_Buffers *buffers);
/**
* Free buffers. Not thread safe, must run in OpenGL main thread.
*/
void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers);
/** Draw. */
struct GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast, bool wires);
short GPU_pbvh_buffers_material_index_get(GPU_PBVH_Buffers *buffers);
bool GPU_pbvh_buffers_has_overlays(GPU_PBVH_Buffers *buffers);
PBVHGPUFormat *GPU_pbvh_make_format(void);
void GPU_pbvh_free_format(PBVHGPUFormat *vbo_id);
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -36,18 +36,10 @@ void GPU_init(void)
gpu_codegen_init();
gpu_batch_init();
#ifndef GPU_STANDALONE
gpu_pbvh_init();
#endif
}
void GPU_exit(void)
{
#ifndef GPU_STANDALONE
gpu_pbvh_exit();
#endif
gpu_batch_exit();
gpu_codegen_exit();