From a4d53a8cedd0ed42525556ead74778dfcb66c5ea Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 13 Dec 2021 13:22:06 +0100 Subject: [PATCH] pgraph: Fix unnecessary double state munge in prepare_scene() [skip ci] --- panda/src/pgraph/geomNode.cxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/panda/src/pgraph/geomNode.cxx b/panda/src/pgraph/geomNode.cxx index b7e9842beb..c92d27d5f0 100644 --- a/panda/src/pgraph/geomNode.cxx +++ b/panda/src/pgraph/geomNode.cxx @@ -394,11 +394,6 @@ r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state, prepared_objects->enqueue_index_buffer((GeomPrimitive *)prim.p()); } - if (munger->is_of_type(StateMunger::get_class_type())) { - StateMunger *state_munger = (StateMunger *)munger.p(); - geom_state = state_munger->munge_state(geom_state); - } - // As well as the shaders. const ShaderAttrib *sa; if (geom_state->get_attrib(sa)) { @@ -412,7 +407,9 @@ r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state, else if (munger->is_of_type(StateMunger::get_class_type())) { // Premunge the state for the fixed-function pipeline. StateMunger *state_munger = (StateMunger *)munger.p(); - geom_state = state_munger->munge_state(geom_state); + if (state_munger->should_munge_state()) { + geom_state = state_munger->munge_state(geom_state); + } } // TODO: prepare the shader inputs. }