pgraph: Remove unused vertices during premunge phase

Disable with premunge-remove-unused-vertices config var - let me know if causes issues for you, performance or otherwise, though!
This commit is contained in:
rdb 2022-10-25 13:19:53 +02:00
parent 4d5d7047af
commit fc8c07a949
4 changed files with 10 additions and 0 deletions

View File

@ -290,6 +290,11 @@ ConfigVariableBool premunge_data
"encoding requirements, as appropriate. When this is false, the "
"data will be munged at render time instead."));
ConfigVariableBool premunge_remove_unused_vertices
("premunge-remove-unused-vertices", true,
PRC_DESC("Set this true to remove unused vertices as part of the premunge "
"which occurs when models are loaded from disk."));
ConfigVariableBool preserve_geom_nodes
("preserve-geom-nodes", false,
PRC_DESC("This specifies the default value for the \"preserved\" flag on "

View File

@ -55,6 +55,7 @@ extern ConfigVariableBool depth_offset_decals;
extern ConfigVariableInt max_collect_vertices;
extern ConfigVariableInt max_collect_indices;
extern EXPCL_PANDA_PGRAPH ConfigVariableBool premunge_data;
extern ConfigVariableBool premunge_remove_unused_vertices;
extern ConfigVariableBool preserve_geom_nodes;
extern ConfigVariableBool flatten_geoms;
extern EXPCL_PANDA_PGRAPH ConfigVariableInt max_lenses;

View File

@ -892,6 +892,9 @@ do_premunge(GraphicsStateGuardianBase *gsg,
CPT(Geom) geom = entry._geom.get_read_pointer();
PT(GeomMunger) munger = gsg->get_geom_munger(geom_state, current_thread);
entry._geom = transformer.premunge_geom(geom, munger);
if (premunge_remove_unused_vertices) {
transformer.register_vertices(entry._geom.get_write_pointer(), true);
}
}
}
CLOSE_ITERATE_CURRENT_AND_UPSTREAM(_cycler);

View File

@ -176,5 +176,6 @@ premunge(PandaNode *root, const RenderState *initial_state) {
if (_gsg != nullptr) {
PStatTimer timer(_premunge_collector);
r_premunge(root, initial_state);
_transformer.finish_apply();
}
}