mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
Fix glObjectLabel error, fix crash on shutdown with pstats-gpu-timing
This commit is contained in:
parent
c5dd6c69dd
commit
c2aa6991d6
@ -2732,6 +2732,13 @@ close_gsg() {
|
|||||||
Thread *current_thread = Thread::get_current_thread();
|
Thread *current_thread = Thread::get_current_thread();
|
||||||
_prepared_objects->begin_frame(this, current_thread);
|
_prepared_objects->begin_frame(this, current_thread);
|
||||||
_prepared_objects->end_frame(current_thread);
|
_prepared_objects->end_frame(current_thread);
|
||||||
|
|
||||||
|
// We have to clear the list of timer queries, though, otherwise
|
||||||
|
// their destructors will cause a crash when they try to access
|
||||||
|
// the GSG object.
|
||||||
|
#ifdef DO_PSTATS
|
||||||
|
_pending_timer_queries.clear();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -445,8 +445,16 @@ rebuild_bitplanes() {
|
|||||||
if (_fbo[layer] == 0) {
|
if (_fbo[layer] == 0) {
|
||||||
glgsg->_glGenFramebuffers(1, &_fbo[layer]);
|
glgsg->_glGenFramebuffers(1, &_fbo[layer]);
|
||||||
|
|
||||||
|
if (_fbo[layer] == 0) {
|
||||||
|
report_my_gl_errors();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
glgsg->bind_fbo(_fbo[layer]);
|
||||||
|
|
||||||
#ifndef OPENGLES
|
#ifndef OPENGLES
|
||||||
if (glgsg->_use_object_labels) {
|
if (glgsg->_use_object_labels) {
|
||||||
|
// Assign a label for OpenGL to use when displaying debug messages.
|
||||||
if (num_fbos > 1) {
|
if (num_fbos > 1) {
|
||||||
GLchar name[128];
|
GLchar name[128];
|
||||||
GLsizei len = snprintf(name, 128, "%s[%d]", _name.c_str(), layer);
|
GLsizei len = snprintf(name, 128, "%s[%d]", _name.c_str(), layer);
|
||||||
@ -457,13 +465,6 @@ rebuild_bitplanes() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_fbo[layer] == 0) {
|
|
||||||
report_my_gl_errors();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
glgsg->bind_fbo(_fbo[layer]);
|
|
||||||
|
|
||||||
// For all slots, update the slot.
|
// For all slots, update the slot.
|
||||||
if (_use_depth_stencil) {
|
if (_use_depth_stencil) {
|
||||||
bind_slot(layer, rb_resize, attach, RTP_depth_stencil, GL_DEPTH_ATTACHMENT_EXT);
|
bind_slot(layer, rb_resize, attach, RTP_depth_stencil, GL_DEPTH_ATTACHMENT_EXT);
|
||||||
|
@ -5122,6 +5122,9 @@ issue_timer_query(int pstats_index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Issue the timestamp query.
|
||||||
|
_glQueryCounter(query->_index, GL_TIMESTAMP);
|
||||||
|
|
||||||
if (_use_object_labels) {
|
if (_use_object_labels) {
|
||||||
// Assign a label to it based on the PStatCollector name.
|
// Assign a label to it based on the PStatCollector name.
|
||||||
const PStatClient *client = PStatClient::get_global_pstats();
|
const PStatClient *client = PStatClient::get_global_pstats();
|
||||||
@ -5129,9 +5132,6 @@ issue_timer_query(int pstats_index) {
|
|||||||
_glObjectLabel(GL_QUERY, query->_index, name.size(), name.data());
|
_glObjectLabel(GL_QUERY, query->_index, name.size(), name.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue the timestamp query.
|
|
||||||
_glQueryCounter(query->_index, GL_TIMESTAMP);
|
|
||||||
|
|
||||||
_pending_timer_queries.push_back((TimerQueryContext *)query);
|
_pending_timer_queries.push_back((TimerQueryContext *)query);
|
||||||
|
|
||||||
return (TimerQueryContext *)query;
|
return (TimerQueryContext *)query;
|
||||||
|
@ -30,11 +30,16 @@ CLP(TimerQueryContext)::
|
|||||||
~CLP(TimerQueryContext)() {
|
~CLP(TimerQueryContext)() {
|
||||||
if (_index != 0) {
|
if (_index != 0) {
|
||||||
// Tell the GSG to recycle this index when it gets around to it.
|
// Tell the GSG to recycle this index when it gets around to it.
|
||||||
|
// If it has already shut down, though, too bad. This means we
|
||||||
|
// never get to free this index, but presumably the app is
|
||||||
|
// already shutting down anyway.
|
||||||
|
if (!_glgsg.was_deleted()) {
|
||||||
LightMutexHolder holder(_glgsg->_lock);
|
LightMutexHolder holder(_glgsg->_lock);
|
||||||
_glgsg->_deleted_queries.push_back(_index);
|
_glgsg->_deleted_queries.push_back(_index);
|
||||||
_index = 0;
|
_index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: GLTimerQueryContext::is_answer_ready
|
// Function: GLTimerQueryContext::is_answer_ready
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
virtual double get_timestamp() const;
|
virtual double get_timestamp() const;
|
||||||
|
|
||||||
GLuint _index;
|
GLuint _index;
|
||||||
CLP(GraphicsStateGuardian) *_glgsg;
|
WPT(CLP(GraphicsStateGuardian)) _glgsg;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static TypeHandle get_class_type() {
|
static TypeHandle get_class_type() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user