Cleanup: Remove redundant use of evaluated non-mesh objects

Metaball, curve, text, and surface objects use the geometry component
system to add evaluated mesh object instances to the dependency graph
"for render engine" iterator. Therefore it is unnecessary to process
those object types in these loops-- it would either be redundant work
or a no-op.
This commit is contained in:
Hans Goudey 2022-08-17 13:02:27 -04:00
parent 04a04e9f69
commit 27f2ff6b5b
7 changed files with 5 additions and 83 deletions

View File

@ -109,7 +109,7 @@ void EEVEE_cache_populate(void *vedata, Object *ob)
}
if (DRW_object_is_renderable(ob) && (ob_visibility & OB_VISIBLE_SELF)) {
if (ELEM(ob->type, OB_MESH, OB_SURF)) {
if (ob->type == OB_MESH) {
EEVEE_materials_cache_populate(vedata, sldata, ob, &cast_shadow);
}
else if (ob->type == OB_CURVES) {

View File

@ -224,7 +224,7 @@ void EEVEE_render_cache(void *vedata,
}
if (ob_visibility & OB_VISIBLE_SELF) {
if (ELEM(ob->type, OB_MESH, OB_SURF)) {
if (ob->type == OB_MESH) {
EEVEE_materials_cache_populate(vedata, sldata, ob, &cast_shadow);
if (do_cryptomatte) {
EEVEE_cryptomatte_cache_populate(data, sldata, ob);

View File

@ -142,12 +142,8 @@ void Instance::object_sync(Object *ob)
lights.sync_light(ob, ob_handle);
break;
case OB_MESH:
case OB_CURVES_LEGACY:
case OB_SURF:
case OB_FONT: {
sync.sync_mesh(ob, ob_handle);
break;
}
case OB_VOLUME:
break;
case OB_CURVES:

View File

@ -409,7 +409,7 @@ void workbench_cache_populate(void *ved, Object *ob)
return;
}
if (ELEM(ob->type, OB_MESH, OB_SURF, OB_POINTCLOUD)) {
if (ELEM(ob->type, OB_MESH, OB_POINTCLOUD)) {
bool use_sculpt_pbvh, use_texpaint_mode, draw_shadow, has_transp_mat = false;
eV3DShadingColorType color_type = workbench_color_type_get(
wpd, ob, &use_sculpt_pbvh, &use_texpaint_mode, &draw_shadow);

View File

@ -851,7 +851,6 @@ GPUBatch *DRW_cache_object_all_edges_get(Object *ob)
switch (ob->type) {
case OB_MESH:
return DRW_cache_mesh_all_edges_get(ob);
/* TODO: should match #DRW_cache_object_surface_get. */
default:
return NULL;
@ -863,18 +862,6 @@ GPUBatch *DRW_cache_object_edge_detection_get(Object *ob, bool *r_is_manifold)
switch (ob->type) {
case OB_MESH:
return DRW_cache_mesh_edge_detection_get(ob, r_is_manifold);
case OB_CURVES_LEGACY:
return NULL;
case OB_SURF:
return NULL;
case OB_FONT:
return NULL;
case OB_CURVES:
return NULL;
case OB_POINTCLOUD:
return NULL;
case OB_VOLUME:
return NULL;
default:
return NULL;
}
@ -885,21 +872,12 @@ GPUBatch *DRW_cache_object_face_wireframe_get(Object *ob)
switch (ob->type) {
case OB_MESH:
return DRW_cache_mesh_face_wireframe_get(ob);
case OB_CURVES_LEGACY:
return NULL;
case OB_SURF:
return NULL;
case OB_FONT:
return NULL;
case OB_CURVES:
return NULL;
case OB_POINTCLOUD:
return DRW_pointcloud_batch_cache_get_dots(ob);
case OB_VOLUME:
return DRW_cache_volume_face_wireframe_get(ob);
case OB_GPENCIL: {
case OB_GPENCIL:
return DRW_cache_gpencil_face_wireframe_get(ob);
}
default:
return NULL;
}
@ -910,18 +888,6 @@ GPUBatch *DRW_cache_object_loose_edges_get(struct Object *ob)
switch (ob->type) {
case OB_MESH:
return DRW_cache_mesh_loose_edges_get(ob);
case OB_CURVES_LEGACY:
return NULL;
case OB_SURF:
return NULL;
case OB_FONT:
return NULL;
case OB_CURVES:
return NULL;
case OB_POINTCLOUD:
return NULL;
case OB_VOLUME:
return NULL;
default:
return NULL;
}
@ -932,18 +898,8 @@ GPUBatch *DRW_cache_object_surface_get(Object *ob)
switch (ob->type) {
case OB_MESH:
return DRW_cache_mesh_surface_get(ob);
case OB_CURVES_LEGACY:
return NULL;
case OB_SURF:
return NULL;
case OB_FONT:
return NULL;
case OB_CURVES:
return NULL;
case OB_POINTCLOUD:
return DRW_cache_pointcloud_surface_get(ob);
case OB_VOLUME:
return NULL;
default:
return NULL;
}
@ -957,16 +913,6 @@ GPUVertBuf *DRW_cache_object_pos_vertbuf_get(Object *ob)
switch (type) {
case OB_MESH:
return DRW_mesh_batch_cache_pos_vertbuf_get((me != NULL) ? me : ob->data);
case OB_CURVES_LEGACY:
case OB_SURF:
case OB_FONT:
return NULL;
case OB_CURVES:
return NULL;
case OB_POINTCLOUD:
return NULL;
case OB_VOLUME:
return NULL;
default:
return NULL;
}
@ -1012,18 +958,8 @@ GPUBatch **DRW_cache_object_surface_material_get(struct Object *ob,
switch (ob->type) {
case OB_MESH:
return DRW_cache_mesh_surface_shaded_get(ob, gpumat_array, gpumat_array_len);
case OB_CURVES_LEGACY:
return NULL;
case OB_SURF:
return NULL;
case OB_FONT:
return NULL;
case OB_CURVES:
return NULL;
case OB_POINTCLOUD:
return DRW_cache_pointcloud_surface_shaded_get(ob, gpumat_array, gpumat_array_len);
case OB_VOLUME:
return NULL;
default:
return NULL;
}

View File

@ -161,16 +161,6 @@ static void stats_object(Object *ob,
stats->totlampsel++;
}
break;
case OB_SURF:
case OB_CURVES_LEGACY:
case OB_FONT: {
const Mesh *me_eval = BKE_object_get_evaluated_mesh(ob);
if ((me_eval != nullptr) && !BLI_gset_add(objects_gset, (void *)me_eval)) {
break;
}
stats_mesheval(me_eval, is_selected, stats);
break;
}
case OB_GPENCIL: {
if (is_selected) {
bGPdata *gpd = (bGPdata *)ob->data;

View File

@ -47,7 +47,7 @@ OBJMesh::OBJMesh(Depsgraph *depsgraph, const OBJExportParams &export_params, Obj
/* Since a new mesh been allocated, it needs to be freed in the destructor. */
mesh_eval_needs_free_ = true;
}
if (export_params.export_triangulated_mesh && ELEM(export_object_eval_.type, OB_MESH, OB_SURF)) {
if (export_params.export_triangulated_mesh && export_object_eval_.type == OB_MESH) {
std::tie(export_mesh_eval_, mesh_eval_needs_free_) = triangulate_mesh_eval();
}
set_world_axes_transform(export_params.forward_axis, export_params.up_axis);