|
|
@@ -57,8 +57,6 @@
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
-#define DEBUG_BUFFERS false
|
|
|
-
|
|
|
TypeHandle CLP(GraphicsStateGuardian)::_type_handle;
|
|
|
|
|
|
PStatCollector CLP(GraphicsStateGuardian)::_load_display_list_pcollector("Draw:Transfer data:Display lists");
|
|
|
@@ -1644,8 +1642,8 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader,
|
|
|
// Before we compile or call a display list, make sure the current
|
|
|
// buffers are unbound, or the nVidia drivers may crash.
|
|
|
if (_current_vbuffer_index != 0) {
|
|
|
- if (GLCAT.is_spam()) {
|
|
|
- GLCAT.spam()
|
|
|
+ if (GLCAT.is_debug() && CLP(debug_buffers)) {
|
|
|
+ GLCAT.debug()
|
|
|
<< "unbinding vertex buffer\n";
|
|
|
}
|
|
|
_glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
|
@@ -2770,7 +2768,7 @@ prepare_vertex_buffer(GeomVertexArrayData *data) {
|
|
|
CLP(VertexBufferContext) *gvbc = new CLP(VertexBufferContext)(_prepared_objects, data);
|
|
|
_glGenBuffers(1, &gvbc->_index);
|
|
|
|
|
|
- if (DEBUG_BUFFERS && GLCAT.is_debug()) {
|
|
|
+ if (GLCAT.is_debug() && CLP(debug_buffers)) {
|
|
|
GLCAT.debug()
|
|
|
<< "creating vertex buffer " << gvbc->_index << ": "
|
|
|
<< data->get_num_rows() << " vertices "
|
|
|
@@ -2799,8 +2797,8 @@ apply_vertex_buffer(VertexBufferContext *vbc,
|
|
|
CLP(VertexBufferContext) *gvbc = DCAST(CLP(VertexBufferContext), vbc);
|
|
|
|
|
|
if (_current_vbuffer_index != gvbc->_index) {
|
|
|
- if (GLCAT.is_spam()) {
|
|
|
- GLCAT.spam()
|
|
|
+ if (GLCAT.is_debug() && CLP(debug_buffers)) {
|
|
|
+ GLCAT.debug()
|
|
|
<< "binding vertex buffer " << gvbc->_index << "\n";
|
|
|
}
|
|
|
_glBindBuffer(GL_ARRAY_BUFFER, gvbc->_index);
|
|
|
@@ -2810,8 +2808,8 @@ apply_vertex_buffer(VertexBufferContext *vbc,
|
|
|
|
|
|
if (gvbc->was_modified(reader)) {
|
|
|
int num_bytes = reader->get_data_size_bytes();
|
|
|
- if (GLCAT.is_spam()) {
|
|
|
- GLCAT.spam()
|
|
|
+ if (GLCAT.is_debug() && CLP(debug_buffers)) {
|
|
|
+ GLCAT.debug()
|
|
|
<< "copying " << num_bytes
|
|
|
<< " bytes into vertex buffer " << gvbc->_index << "\n";
|
|
|
}
|
|
|
@@ -2853,7 +2851,7 @@ release_vertex_buffer(VertexBufferContext *vbc) {
|
|
|
|
|
|
CLP(VertexBufferContext) *gvbc = DCAST(CLP(VertexBufferContext), vbc);
|
|
|
|
|
|
- if (DEBUG_BUFFERS && GLCAT.is_debug()) {
|
|
|
+ if (GLCAT.is_debug() && CLP(debug_buffers)) {
|
|
|
GLCAT.debug()
|
|
|
<< "deleting vertex buffer " << gvbc->_index << "\n";
|
|
|
}
|
|
|
@@ -2863,8 +2861,8 @@ release_vertex_buffer(VertexBufferContext *vbc) {
|
|
|
// help out a flaky driver, and we need to keep our internal state
|
|
|
// consistent anyway.
|
|
|
if (_current_vbuffer_index == gvbc->_index) {
|
|
|
- if (GLCAT.is_spam()) {
|
|
|
- GLCAT.spam()
|
|
|
+ if (GLCAT.is_debug() && CLP(debug_buffers)) {
|
|
|
+ GLCAT.debug()
|
|
|
<< "unbinding vertex buffer\n";
|
|
|
}
|
|
|
_glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
|
@@ -2907,12 +2905,12 @@ setup_array_data(const unsigned char *&client_pointer,
|
|
|
return (client_pointer != NULL);
|
|
|
}
|
|
|
if (!vertex_buffers || _geom_display_list != 0 ||
|
|
|
- array_reader->get_usage_hint() == Geom::UH_client) {
|
|
|
+ array_reader->get_usage_hint() < CLP(min_buffer_usage_hint)) {
|
|
|
// The array specifies client rendering only, or buffer objects
|
|
|
// are configured off.
|
|
|
if (_current_vbuffer_index != 0) {
|
|
|
- if (GLCAT.is_spam()) {
|
|
|
- GLCAT.spam()
|
|
|
+ if (GLCAT.is_debug() && CLP(debug_buffers)) {
|
|
|
+ GLCAT.debug()
|
|
|
<< "unbinding vertex buffer\n";
|
|
|
}
|
|
|
_glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
|
@@ -2953,7 +2951,7 @@ prepare_index_buffer(GeomPrimitive *data) {
|
|
|
CLP(IndexBufferContext) *gibc = new CLP(IndexBufferContext)(_prepared_objects, data);
|
|
|
_glGenBuffers(1, &gibc->_index);
|
|
|
|
|
|
- if (DEBUG_BUFFERS && GLCAT.is_debug()) {
|
|
|
+ if (GLCAT.is_debug() && CLP(debug_buffers)) {
|
|
|
GLCAT.debug()
|
|
|
<< "creating index buffer " << gibc->_index << ": "
|
|
|
<< data->get_num_vertices() << " indices ("
|
|
|
@@ -3038,7 +3036,7 @@ release_index_buffer(IndexBufferContext *ibc) {
|
|
|
|
|
|
CLP(IndexBufferContext) *gibc = DCAST(CLP(IndexBufferContext), ibc);
|
|
|
|
|
|
- if (DEBUG_BUFFERS && GLCAT.is_debug()) {
|
|
|
+ if (GLCAT.is_debug() && CLP(debug_buffers)) {
|
|
|
GLCAT.debug()
|
|
|
<< "deleting index buffer " << gibc->_index << "\n";
|
|
|
}
|