mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 00:06:44 -04:00
glgsg: fix shader inputs not being updated in esoteric case
Specifically, this happens if you have a custom ShaderGenerator that assigns shader inputs via the ShaderAttrib. If two objects then both have the auto-shader turned on, and the shader generator generates ShaderAttribs with the same shaders but different inputs, the inputs will not be updated properly for one of the objects.
This commit is contained in:
parent
886d44d15d
commit
60a944e783
@ -2042,10 +2042,6 @@ set_state_and_transform(const RenderState *target_rs,
|
||||
target_rs->get_attrib(MaterialAttrib::get_class_slot())) {
|
||||
altered |= Shader::SSD_material;
|
||||
}
|
||||
if (state_rs->get_attrib(ShaderAttrib::get_class_slot()) !=
|
||||
target_rs->get_attrib(ShaderAttrib::get_class_slot())) {
|
||||
altered |= Shader::SSD_shaderinputs;
|
||||
}
|
||||
if (state_rs->get_attrib(FogAttrib::get_class_slot()) !=
|
||||
target_rs->get_attrib(FogAttrib::get_class_slot())) {
|
||||
altered |= Shader::SSD_fog;
|
||||
@ -2069,6 +2065,11 @@ set_state_and_transform(const RenderState *target_rs,
|
||||
_state_rs = target_rs;
|
||||
}
|
||||
|
||||
if (_shader_attrib.get_orig() != _glgsg->_target_shader || _shader_attrib.was_deleted()) {
|
||||
altered |= Shader::SSD_shaderinputs;
|
||||
_shader_attrib = _glgsg->_target_shader;
|
||||
}
|
||||
|
||||
// Is this the first time this shader is used this frame?
|
||||
int frame_number = ClockObject::get_global_clock()->get_frame_count();
|
||||
if (frame_number != _frame_number) {
|
||||
|
@ -76,6 +76,7 @@ private:
|
||||
CPT(TransformState) _camera_transform;
|
||||
CPT(TransformState) _projection_transform;
|
||||
CPT(ColorAttrib) _color_attrib;
|
||||
WCPT(ShaderAttrib) _shader_attrib;
|
||||
|
||||
/*
|
||||
* struct ParamContext { CPT(InternalName) _name; GLint _location; GLsizei
|
||||
|
Loading…
x
Reference in New Issue
Block a user