work around driver crash with GL_COMPILE_AND_EXECUTE

This commit is contained in:
David Rose 2005-03-19 15:36:58 +00:00
parent c3941698f4
commit 0bcbaa6056
3 changed files with 30 additions and 23 deletions

View File

@ -2061,20 +2061,23 @@ begin_draw_primitives(const qpGeom *geom, const qpGeomVertexData *vertex_data) {
// If it has been modified, or this is the first time, then we
// need to build the display list up.
GLP(NewList)(ggc->_index, GL_COMPILE_AND_EXECUTE);
if (CLP(compile_and_execute)) {
GLP(NewList)(ggc->_index, GL_COMPILE_AND_EXECUTE);
} else {
GLP(NewList)(ggc->_index, GL_COMPILE);
}
ggc->_modified = geom->get_modified();
_geom_display_list = ggc;
#ifdef DO_PSTATS
// Count up the number of vertices we're about to render, by
// checking the PStats vertex counters now, and at the end. This is
// kind of hacky, but this is debug code.
_num_display_list_verts_before =
_vertices_tristrip_pcollector.get_level() +
_vertices_trifan_pcollector.get_level() +
_vertices_tri_pcollector.get_level() +
_vertices_other_pcollector.get_level();
// Count up the number of vertices used by primitives in the Geom,
// for PStats reporting.
ggc->_num_verts = 0;
for (int i = 0; i < geom->get_num_primitives(); i++) {
ggc->_num_verts += geom->get_primitive(i)->get_num_vertices();
}
#endif
_geom_display_list = ggc;
}
const qpGeomVertexArrayData *array_data;
@ -2145,11 +2148,11 @@ begin_draw_primitives(const qpGeom *geom, const qpGeomVertexData *vertex_data) {
////////////////////////////////////////////////////////////////////
void CLP(GraphicsStateGuardian)::
draw_triangles(const qpGeomTriangles *primitive) {
setup_antialias_polygon();
// setup_antialias_polygon();
_vertices_tri_pcollector.add_level(primitive->get_num_vertices());
const unsigned short *client_pointer = setup_primitive(primitive);
_glDrawRangeElements(GL_TRIANGLES,
primitive->get_min_vertex(),
primitive->get_max_vertex(),
@ -2166,7 +2169,7 @@ draw_triangles(const qpGeomTriangles *primitive) {
////////////////////////////////////////////////////////////////////
void CLP(GraphicsStateGuardian)::
draw_tristrips(const qpGeomTristrips *primitive) {
setup_antialias_polygon();
// setup_antialias_polygon();
_vertices_tristrip_pcollector.add_level(primitive->get_num_vertices());
const unsigned short *client_pointer = setup_primitive(primitive);
@ -2199,16 +2202,9 @@ end_draw_primitives() {
if (_geom_display_list != NULL) {
// If we were building a display list, close it now.
GLP(EndList)();
#ifdef DO_PSTATS
float num_verts_after =
_vertices_tristrip_pcollector.get_level() +
_vertices_trifan_pcollector.get_level() +
_vertices_tri_pcollector.get_level() +
_vertices_other_pcollector.get_level();
float num_verts = num_verts_after - _num_display_list_verts_before;
_geom_display_list->_num_verts = (int)(num_verts + 0.5);
#endif
if (!CLP(compile_and_execute)) {
GLP(CallList)(_geom_display_list->_index);
}
}
_geom_display_list = NULL;

View File

@ -58,6 +58,16 @@ ConfigVariableBool CLP(color_mask)
"is broken (some are). This will force the use of a (presumably) "
"more expensive blending operation instead."));
ConfigVariableBool CLP(compile_and_execute)
("gl-compile-and-execute", false,
PRC_DESC("Configure this true if you know your GL's implementation of "
"glNewList(n, GL_COMPILE_AND_EXECUTE) works. It is "
"false by default, since it is known to cause a crash with "
"Intel 855GM driver 4.14.10.3889 at least. Turning this on "
"*may* reduce the chug you get for preparing display lists "
"for the first time, by allowing the display list to be "
"rendered at the same time it is being compiled."));
void CLP(init_classes)() {
CLP(GraphicsStateGuardian)::init_type();

View File

@ -29,6 +29,7 @@ extern ConfigVariableBool CLP(force_mipmaps);
extern ConfigVariableBool CLP(show_mipmaps);
extern ConfigVariableBool CLP(save_mipmaps);
extern ConfigVariableBool CLP(color_mask);
extern ConfigVariableBool CLP(compile_and_execute);
extern EXPCL_GL void CLP(init_classes)();