pgraph: Fix prepare_scene() not properly invoking the shader generator

This commit is contained in:
rdb 2021-11-09 15:46:14 +01:00
parent 29294cb974
commit 32584f0a68

View File

@ -396,6 +396,24 @@ r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state,
geom_state = state_munger->munge_state(geom_state);
}
// As well as the shaders.
const ShaderAttrib *sa;
if (geom_state->get_attrib(sa)) {
Shader *shader = (Shader *)sa->get_shader();
if (shader != nullptr) {
prepared_objects->enqueue_shader(shader);
}
else if (sa->auto_shader()) {
gsg->ensure_generated_shader(geom_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);
}
// TODO: prepare the shader inputs.
}
// And now prepare each of the textures.
const TextureAttrib *ta;
if (geom_state->get_attrib(ta)) {
@ -408,16 +426,6 @@ r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state,
}
}
}
// As well as the shaders.
const ShaderAttrib *sa;
if (geom_state->get_attrib(sa)) {
Shader *shader = (Shader *)sa->get_shader();
if (shader != nullptr) {
prepared_objects->enqueue_shader(shader);
}
// TODO: prepare the shader inputs.
}
}
PandaNode::r_prepare_scene(gsg, node_state, transformer, current_thread);