Cleanup: Remove unused argument to PBVH draw functions
The attributes weren't used by BKE_pbvh_draw_cb.
This commit is contained in:
@@ -314,10 +314,7 @@ void BKE_pbvh_draw_cb(const Mesh &mesh,
|
||||
void (*draw_fn)(void *user_data,
|
||||
blender::draw::pbvh::PBVHBatches *batches,
|
||||
const blender::draw::pbvh::PBVH_GPU_Args &args),
|
||||
void *user_data,
|
||||
bool full_render,
|
||||
PBVHAttrReq *attrs,
|
||||
int attrs_num);
|
||||
void *user_data);
|
||||
|
||||
/* PBVH Access */
|
||||
|
||||
|
||||
@@ -2876,8 +2876,6 @@ void BKE_pbvh_update_normals(PBVH *pbvh, SubdivCCG *subdiv_ccg)
|
||||
struct PBVHDrawSearchData {
|
||||
PBVHFrustumPlanes *frustum;
|
||||
int accum_update_flag;
|
||||
PBVHAttrReq *attrs;
|
||||
int attrs_num;
|
||||
};
|
||||
|
||||
static bool pbvh_draw_search(PBVHNode *node, PBVHDrawSearchData *data)
|
||||
@@ -2898,10 +2896,7 @@ void BKE_pbvh_draw_cb(const Mesh &mesh,
|
||||
void (*draw_fn)(void *user_data,
|
||||
blender::draw::pbvh::PBVHBatches *batches,
|
||||
const blender::draw::pbvh::PBVH_GPU_Args &args),
|
||||
void *user_data,
|
||||
bool /*full_render*/,
|
||||
PBVHAttrReq *attrs,
|
||||
int attrs_num)
|
||||
void *user_data)
|
||||
{
|
||||
using namespace blender;
|
||||
using namespace blender::bke::pbvh;
|
||||
@@ -2916,8 +2911,6 @@ void BKE_pbvh_draw_cb(const Mesh &mesh,
|
||||
PBVHDrawSearchData data{};
|
||||
data.frustum = update_frustum;
|
||||
data.accum_update_flag = 0;
|
||||
data.attrs = attrs;
|
||||
data.attrs_num = attrs_num;
|
||||
nodes = search_gather(pbvh, [&](PBVHNode &node) { return pbvh_draw_search(&node, &data); });
|
||||
update_flag = data.accum_update_flag;
|
||||
}
|
||||
|
||||
@@ -79,13 +79,13 @@ void node_gpu_flush(PBVHBatches *batches);
|
||||
PBVHBatches *node_create(const PBVH_GPU_Args &args);
|
||||
void node_free(PBVHBatches *batches);
|
||||
GPUBatch *tris_get(PBVHBatches *batches,
|
||||
PBVHAttrReq *attrs,
|
||||
const PBVHAttrReq *attrs,
|
||||
int attrs_num,
|
||||
const PBVH_GPU_Args &args,
|
||||
int *r_prim_count,
|
||||
bool do_coarse_grids);
|
||||
GPUBatch *lines_get(PBVHBatches *batches,
|
||||
PBVHAttrReq *attrs,
|
||||
const PBVHAttrReq *attrs,
|
||||
int attrs_num,
|
||||
const PBVH_GPU_Args &args,
|
||||
int *r_prim_count,
|
||||
|
||||
@@ -328,7 +328,7 @@ class Instance {
|
||||
}
|
||||
|
||||
if (object_state.use_per_material_batches) {
|
||||
for (SculptBatch &batch : sculpt_batches_get(ob_ref.object, true, features)) {
|
||||
for (SculptBatch &batch : sculpt_batches_get(ob_ref.object, features)) {
|
||||
Material mat = get_material(ob_ref, object_state.color_type, batch.material_slot);
|
||||
if (SCULPT_DEBUG_DRAW) {
|
||||
mat.base_color = batch.debug_color();
|
||||
@@ -346,7 +346,7 @@ class Instance {
|
||||
}
|
||||
else {
|
||||
Material mat = get_material(ob_ref, object_state.color_type);
|
||||
for (SculptBatch &batch : sculpt_batches_get(ob_ref.object, false, features)) {
|
||||
for (SculptBatch &batch : sculpt_batches_get(ob_ref.object, features)) {
|
||||
if (SCULPT_DEBUG_DRAW) {
|
||||
mat.base_color = batch.debug_color();
|
||||
}
|
||||
|
||||
@@ -1381,10 +1381,7 @@ static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd)
|
||||
(void (*)(void *,
|
||||
blender::draw::pbvh::PBVHBatches *,
|
||||
const blender::draw::pbvh::PBVH_GPU_Args &))sculpt_draw_cb,
|
||||
scd,
|
||||
scd->use_mats,
|
||||
scd->attrs,
|
||||
scd->attrs_num);
|
||||
scd);
|
||||
|
||||
if (SCULPT_DEBUG_BUFFERS) {
|
||||
int debug_node_nr = 0;
|
||||
|
||||
@@ -391,13 +391,13 @@ struct PBVHBatches {
|
||||
GPU_INDEXBUF_DISCARD_SAFE(lines_index_coarse);
|
||||
}
|
||||
|
||||
std::string build_key(PBVHAttrReq *attrs, int attrs_num, bool do_coarse_grids)
|
||||
std::string build_key(const PBVHAttrReq *attrs, int attrs_num, bool do_coarse_grids)
|
||||
{
|
||||
PBVHBatch batch;
|
||||
Vector<PBVHVbo> vbos;
|
||||
|
||||
for (int i : IndexRange(attrs_num)) {
|
||||
PBVHAttrReq *attr = attrs + i;
|
||||
const PBVHAttrReq *attr = attrs + i;
|
||||
|
||||
if (!pbvh_attr_supported(attr->type, attr->domain)) {
|
||||
continue;
|
||||
@@ -447,12 +447,12 @@ struct PBVHBatches {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool has_batch(PBVHAttrReq *attrs, int attrs_num, bool do_coarse_grids)
|
||||
bool has_batch(const PBVHAttrReq *attrs, int attrs_num, bool do_coarse_grids)
|
||||
{
|
||||
return batches.contains(build_key(attrs, attrs_num, do_coarse_grids));
|
||||
}
|
||||
|
||||
PBVHBatch &ensure_batch(PBVHAttrReq *attrs,
|
||||
PBVHBatch &ensure_batch(const PBVHAttrReq *attrs,
|
||||
int attrs_num,
|
||||
const PBVH_GPU_Args &args,
|
||||
bool do_coarse_grids)
|
||||
@@ -1332,7 +1332,7 @@ struct PBVHBatches {
|
||||
}
|
||||
}
|
||||
|
||||
void create_batch(PBVHAttrReq *attrs,
|
||||
void create_batch(const PBVHAttrReq *attrs,
|
||||
int attrs_num,
|
||||
const PBVH_GPU_Args &args,
|
||||
bool do_coarse_grids)
|
||||
@@ -1355,7 +1355,7 @@ struct PBVHBatches {
|
||||
}
|
||||
|
||||
for (int i : IndexRange(attrs_num)) {
|
||||
PBVHAttrReq *attr = attrs + i;
|
||||
const PBVHAttrReq *attr = attrs + i;
|
||||
|
||||
if (!pbvh_attr_supported(attr->type, attr->domain)) {
|
||||
continue;
|
||||
@@ -1402,7 +1402,7 @@ void node_free(PBVHBatches *batches)
|
||||
}
|
||||
|
||||
GPUBatch *tris_get(PBVHBatches *batches,
|
||||
PBVHAttrReq *attrs,
|
||||
const PBVHAttrReq *attrs,
|
||||
int attrs_num,
|
||||
const PBVH_GPU_Args &args,
|
||||
int *r_prim_count,
|
||||
@@ -1418,7 +1418,7 @@ GPUBatch *tris_get(PBVHBatches *batches,
|
||||
}
|
||||
|
||||
GPUBatch *lines_get(PBVHBatches *batches,
|
||||
PBVHAttrReq *attrs,
|
||||
const PBVHAttrReq *attrs,
|
||||
int attrs_num,
|
||||
const PBVH_GPU_Args &args,
|
||||
int *r_prim_count,
|
||||
|
||||
@@ -40,7 +40,7 @@ struct SculptCallbackData {
|
||||
bool use_wire;
|
||||
bool fast_mode;
|
||||
|
||||
PBVHAttrReq *attrs;
|
||||
const PBVHAttrReq *attrs;
|
||||
int attrs_len;
|
||||
|
||||
Vector<SculptBatch> batches;
|
||||
@@ -72,8 +72,10 @@ static void sculpt_draw_cb(SculptCallbackData *data,
|
||||
data->batches.append(batch);
|
||||
}
|
||||
|
||||
static Vector<SculptBatch> sculpt_batches_get_ex(
|
||||
const Object *ob, bool use_wire, bool use_materials, PBVHAttrReq *attrs, int attrs_len)
|
||||
static Vector<SculptBatch> sculpt_batches_get_ex(const Object *ob,
|
||||
bool use_wire,
|
||||
const PBVHAttrReq *attrs,
|
||||
int attrs_len)
|
||||
{
|
||||
/* PBVH should always exist for non-empty meshes, created by depsgraph eval. */
|
||||
PBVH *pbvh = ob->sculpt ? ob->sculpt->pbvh : nullptr;
|
||||
@@ -146,17 +148,12 @@ static Vector<SculptBatch> sculpt_batches_get_ex(
|
||||
&update_frustum,
|
||||
&draw_frustum,
|
||||
(void (*)(void *, pbvh::PBVHBatches *, const pbvh::PBVH_GPU_Args &))sculpt_draw_cb,
|
||||
&data,
|
||||
use_materials,
|
||||
attrs,
|
||||
attrs_len);
|
||||
&data);
|
||||
|
||||
return data.batches;
|
||||
}
|
||||
|
||||
Vector<SculptBatch> sculpt_batches_get(const Object *ob,
|
||||
bool per_material,
|
||||
SculptBatchFeature features)
|
||||
Vector<SculptBatch> sculpt_batches_get(const Object *ob, SculptBatchFeature features)
|
||||
{
|
||||
PBVHAttrReq attrs[16] = {};
|
||||
int attrs_len = 0;
|
||||
@@ -197,8 +194,7 @@ Vector<SculptBatch> sculpt_batches_get(const Object *ob,
|
||||
}
|
||||
}
|
||||
|
||||
return sculpt_batches_get_ex(
|
||||
ob, features & SCULPT_BATCH_WIREFRAME, per_material, attrs, attrs_len);
|
||||
return sculpt_batches_get_ex(ob, features & SCULPT_BATCH_WIREFRAME, attrs, attrs_len);
|
||||
}
|
||||
|
||||
Vector<SculptBatch> sculpt_batches_per_material_get(const Object *ob,
|
||||
@@ -241,7 +237,7 @@ Vector<SculptBatch> sculpt_batches_per_material_get(const Object *ob,
|
||||
}
|
||||
}
|
||||
|
||||
return sculpt_batches_get_ex(ob, false, true, attrs, attrs_len);
|
||||
return sculpt_batches_get_ex(ob, false, attrs, attrs_len);
|
||||
}
|
||||
|
||||
} // namespace blender::draw
|
||||
|
||||
@@ -32,9 +32,7 @@ enum SculptBatchFeature {
|
||||
ENUM_OPERATORS(SculptBatchFeature, SCULPT_BATCH_UV);
|
||||
|
||||
/** Used by engines that don't use GPUMaterials, like the Workbench and Overlay engines. */
|
||||
Vector<SculptBatch> sculpt_batches_get(const Object *ob,
|
||||
bool per_material,
|
||||
SculptBatchFeature features);
|
||||
Vector<SculptBatch> sculpt_batches_get(const Object *ob, SculptBatchFeature features);
|
||||
|
||||
/** Used by EEVEE. */
|
||||
Vector<SculptBatch> sculpt_batches_per_material_get(const Object *ob,
|
||||
|
||||
Reference in New Issue
Block a user