mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
glgsg: fix occasional WeakPointerTo dereference
This commit is contained in:
parent
19e1b1d877
commit
d48695cb2e
@ -1910,12 +1910,14 @@ set_state_and_transform(const RenderState *target_rs,
|
|||||||
// Reset all of the state.
|
// Reset all of the state.
|
||||||
altered |= Shader::SSD_general;
|
altered |= Shader::SSD_general;
|
||||||
_state_rs = target_rs;
|
_state_rs = target_rs;
|
||||||
|
target_rs->get_attrib_def(_color_attrib);
|
||||||
|
|
||||||
} else if (state_rs != target_rs) {
|
} else if (state_rs != target_rs) {
|
||||||
// The state has changed since last time.
|
// The state has changed since last time.
|
||||||
if (state_rs->get_attrib(ColorAttrib::get_class_slot()) !=
|
if (state_rs->get_attrib(ColorAttrib::get_class_slot()) !=
|
||||||
target_rs->get_attrib(ColorAttrib::get_class_slot())) {
|
target_rs->get_attrib(ColorAttrib::get_class_slot())) {
|
||||||
altered |= Shader::SSD_color;
|
altered |= Shader::SSD_color;
|
||||||
|
target_rs->get_attrib_def(_color_attrib);
|
||||||
}
|
}
|
||||||
if (state_rs->get_attrib(ColorScaleAttrib::get_class_slot()) !=
|
if (state_rs->get_attrib(ColorScaleAttrib::get_class_slot()) !=
|
||||||
target_rs->get_attrib(ColorScaleAttrib::get_class_slot())) {
|
target_rs->get_attrib(ColorScaleAttrib::get_class_slot())) {
|
||||||
@ -2227,8 +2229,7 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) {
|
|||||||
|
|
||||||
// Get the active ColorAttrib. We'll need it to determine how to apply
|
// Get the active ColorAttrib. We'll need it to determine how to apply
|
||||||
// vertex colors.
|
// vertex colors.
|
||||||
const ColorAttrib *color_attrib;
|
const ColorAttrib *color_attrib = _color_attrib.p();
|
||||||
_state_rs->get_attrib_def(color_attrib);
|
|
||||||
|
|
||||||
const GeomVertexArrayDataHandle *array_reader;
|
const GeomVertexArrayDataHandle *array_reader;
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ private:
|
|||||||
CPT(TransformState) _modelview_transform;
|
CPT(TransformState) _modelview_transform;
|
||||||
CPT(TransformState) _camera_transform;
|
CPT(TransformState) _camera_transform;
|
||||||
CPT(TransformState) _projection_transform;
|
CPT(TransformState) _projection_transform;
|
||||||
|
CPT(ColorAttrib) _color_attrib;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct ParamContext { CPT(InternalName) _name; GLint _location; GLsizei
|
* struct ParamContext { CPT(InternalName) _name; GLint _location; GLsizei
|
||||||
|
Loading…
x
Reference in New Issue
Block a user