mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
fix crash with identity state
This commit is contained in:
parent
6b7ab70359
commit
c7f9706553
@ -306,6 +306,34 @@ reset() {
|
||||
free_pointers();
|
||||
GraphicsStateGuardian::reset();
|
||||
|
||||
// Build _inv_state_mask as a mask of 1's where we don't care, and
|
||||
// 0's where we do care, about the state.
|
||||
_inv_state_mask = RenderState::SlotMask::all_on();
|
||||
_inv_state_mask.clear_bit(ShaderAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(AlphaTestAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(AntialiasAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(ClipPlaneAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(ColorAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(ColorScaleAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(CullFaceAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(DepthOffsetAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(DepthTestAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(DepthWriteAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(RenderModeAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(RescaleNormalAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(ShadeModelAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(TransparencyAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(ColorWriteAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(ColorBlendAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(TextureAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(TexGenAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(TexMatrixAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(MaterialAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(LightAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(StencilAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(FogAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(ScissorAttrib::get_class_slot());
|
||||
|
||||
// Output the vendor and version strings.
|
||||
query_gl_version();
|
||||
|
||||
@ -5961,7 +5989,7 @@ set_state_and_transform(const RenderState *target,
|
||||
do_issue_transform();
|
||||
}
|
||||
|
||||
if (target == _state_rs) {
|
||||
if (target == _state_rs && (_state_mask | _inv_state_mask).is_all_on()) {
|
||||
return;
|
||||
}
|
||||
_target_rs = target;
|
||||
|
@ -519,6 +519,8 @@ public:
|
||||
DeletedDisplayLists _deleted_display_lists;
|
||||
DeletedDisplayLists _deleted_queries;
|
||||
|
||||
RenderState::SlotMask _inv_state_mask;
|
||||
|
||||
static PStatCollector _load_display_list_pcollector;
|
||||
static PStatCollector _primitive_batches_display_list_pcollector;
|
||||
static PStatCollector _vertices_display_list_pcollector;
|
||||
|
@ -89,6 +89,19 @@ reset() {
|
||||
free_pointers();
|
||||
GraphicsStateGuardian::reset();
|
||||
|
||||
// Build _inv_state_mask as a mask of 1's where we don't care, and
|
||||
// 0's where we do care, about the state.
|
||||
_inv_state_mask = RenderState::SlotMask::all_on();
|
||||
_inv_state_mask.clear_bit(ColorAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(ColorScaleAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(CullFaceAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(RescaleNormalAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(RenderModeAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(TextureAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(MaterialAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(LightAttrib::get_class_slot());
|
||||
_inv_state_mask.clear_bit(ScissorAttrib::get_class_slot());
|
||||
|
||||
if (_c != (GLContext *)NULL) {
|
||||
glClose(_c);
|
||||
_c = NULL;
|
||||
@ -1403,7 +1416,7 @@ set_state_and_transform(const RenderState *target,
|
||||
do_issue_transform();
|
||||
}
|
||||
|
||||
if (target == _state_rs) {
|
||||
if (target == _state_rs && (_state_mask | _inv_state_mask).is_all_on()) {
|
||||
return;
|
||||
}
|
||||
_target_rs = target;
|
||||
|
@ -146,6 +146,7 @@ private:
|
||||
bool _texture_replace;
|
||||
bool _filled_flat;
|
||||
bool _auto_rescale_normal;
|
||||
RenderState::SlotMask _inv_state_mask;
|
||||
|
||||
CPT(TransformState) _scissor_mat;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user