mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
gobj: fix _contexts != nullptr
assert when prepare fails
This commit is contained in:
parent
dcc96a60b1
commit
a2fa54f385
@ -239,19 +239,24 @@ is_prepared(PreparedGraphicsObjects *prepared_objects) const {
|
|||||||
VertexBufferContext *GeomVertexArrayData::
|
VertexBufferContext *GeomVertexArrayData::
|
||||||
prepare_now(PreparedGraphicsObjects *prepared_objects,
|
prepare_now(PreparedGraphicsObjects *prepared_objects,
|
||||||
GraphicsStateGuardianBase *gsg) {
|
GraphicsStateGuardianBase *gsg) {
|
||||||
if (_contexts == nullptr) {
|
if (_contexts != nullptr) {
|
||||||
|
Contexts::const_iterator ci;
|
||||||
|
ci = _contexts->find(prepared_objects);
|
||||||
|
if (ci != _contexts->end()) {
|
||||||
|
return (*ci).second;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
_contexts = new Contexts;
|
_contexts = new Contexts;
|
||||||
}
|
}
|
||||||
Contexts::const_iterator ci;
|
|
||||||
ci = _contexts->find(prepared_objects);
|
|
||||||
if (ci != _contexts->end()) {
|
|
||||||
return (*ci).second;
|
|
||||||
}
|
|
||||||
|
|
||||||
VertexBufferContext *vbc = prepared_objects->prepare_vertex_buffer_now(this, gsg);
|
VertexBufferContext *vbc = prepared_objects->prepare_vertex_buffer_now(this, gsg);
|
||||||
if (vbc != nullptr) {
|
if (vbc != nullptr) {
|
||||||
(*_contexts)[prepared_objects] = vbc;
|
(*_contexts)[prepared_objects] = vbc;
|
||||||
}
|
}
|
||||||
|
else if (_contexts->empty()) {
|
||||||
|
delete _contexts;
|
||||||
|
_contexts = nullptr;
|
||||||
|
}
|
||||||
return vbc;
|
return vbc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,19 +76,24 @@ is_prepared(PreparedGraphicsObjects *prepared_objects) const {
|
|||||||
BufferContext *ShaderBuffer::
|
BufferContext *ShaderBuffer::
|
||||||
prepare_now(PreparedGraphicsObjects *prepared_objects,
|
prepare_now(PreparedGraphicsObjects *prepared_objects,
|
||||||
GraphicsStateGuardianBase *gsg) {
|
GraphicsStateGuardianBase *gsg) {
|
||||||
if (_contexts == nullptr) {
|
if (_contexts != nullptr) {
|
||||||
|
Contexts::const_iterator ci;
|
||||||
|
ci = _contexts->find(prepared_objects);
|
||||||
|
if (ci != _contexts->end()) {
|
||||||
|
return (*ci).second;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
_contexts = new Contexts;
|
_contexts = new Contexts;
|
||||||
}
|
}
|
||||||
Contexts::const_iterator ci;
|
|
||||||
ci = _contexts->find(prepared_objects);
|
|
||||||
if (ci != _contexts->end()) {
|
|
||||||
return (*ci).second;
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferContext *vbc = prepared_objects->prepare_shader_buffer_now(this, gsg);
|
BufferContext *vbc = prepared_objects->prepare_shader_buffer_now(this, gsg);
|
||||||
if (vbc != nullptr) {
|
if (vbc != nullptr) {
|
||||||
(*_contexts)[prepared_objects] = vbc;
|
(*_contexts)[prepared_objects] = vbc;
|
||||||
}
|
}
|
||||||
|
else if (_contexts->empty()) {
|
||||||
|
delete _contexts;
|
||||||
|
_contexts = nullptr;
|
||||||
|
}
|
||||||
return vbc;
|
return vbc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user