mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 12:12:10 -04:00
work around driver crash with GL_COMPILE_AND_EXECUTE
This commit is contained in:
parent
c3941698f4
commit
0bcbaa6056
@ -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
|
// If it has been modified, or this is the first time, then we
|
||||||
// need to build the display list up.
|
// 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();
|
ggc->_modified = geom->get_modified();
|
||||||
_geom_display_list = ggc;
|
|
||||||
|
|
||||||
#ifdef DO_PSTATS
|
#ifdef DO_PSTATS
|
||||||
// Count up the number of vertices we're about to render, by
|
// Count up the number of vertices used by primitives in the Geom,
|
||||||
// checking the PStats vertex counters now, and at the end. This is
|
// for PStats reporting.
|
||||||
// kind of hacky, but this is debug code.
|
ggc->_num_verts = 0;
|
||||||
_num_display_list_verts_before =
|
for (int i = 0; i < geom->get_num_primitives(); i++) {
|
||||||
_vertices_tristrip_pcollector.get_level() +
|
ggc->_num_verts += geom->get_primitive(i)->get_num_vertices();
|
||||||
_vertices_trifan_pcollector.get_level() +
|
}
|
||||||
_vertices_tri_pcollector.get_level() +
|
|
||||||
_vertices_other_pcollector.get_level();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_geom_display_list = ggc;
|
||||||
}
|
}
|
||||||
|
|
||||||
const qpGeomVertexArrayData *array_data;
|
const qpGeomVertexArrayData *array_data;
|
||||||
@ -2145,11 +2148,11 @@ begin_draw_primitives(const qpGeom *geom, const qpGeomVertexData *vertex_data) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void CLP(GraphicsStateGuardian)::
|
void CLP(GraphicsStateGuardian)::
|
||||||
draw_triangles(const qpGeomTriangles *primitive) {
|
draw_triangles(const qpGeomTriangles *primitive) {
|
||||||
setup_antialias_polygon();
|
// setup_antialias_polygon();
|
||||||
|
|
||||||
_vertices_tri_pcollector.add_level(primitive->get_num_vertices());
|
_vertices_tri_pcollector.add_level(primitive->get_num_vertices());
|
||||||
const unsigned short *client_pointer = setup_primitive(primitive);
|
const unsigned short *client_pointer = setup_primitive(primitive);
|
||||||
|
|
||||||
_glDrawRangeElements(GL_TRIANGLES,
|
_glDrawRangeElements(GL_TRIANGLES,
|
||||||
primitive->get_min_vertex(),
|
primitive->get_min_vertex(),
|
||||||
primitive->get_max_vertex(),
|
primitive->get_max_vertex(),
|
||||||
@ -2166,7 +2169,7 @@ draw_triangles(const qpGeomTriangles *primitive) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void CLP(GraphicsStateGuardian)::
|
void CLP(GraphicsStateGuardian)::
|
||||||
draw_tristrips(const qpGeomTristrips *primitive) {
|
draw_tristrips(const qpGeomTristrips *primitive) {
|
||||||
setup_antialias_polygon();
|
// setup_antialias_polygon();
|
||||||
|
|
||||||
_vertices_tristrip_pcollector.add_level(primitive->get_num_vertices());
|
_vertices_tristrip_pcollector.add_level(primitive->get_num_vertices());
|
||||||
const unsigned short *client_pointer = setup_primitive(primitive);
|
const unsigned short *client_pointer = setup_primitive(primitive);
|
||||||
@ -2199,16 +2202,9 @@ end_draw_primitives() {
|
|||||||
if (_geom_display_list != NULL) {
|
if (_geom_display_list != NULL) {
|
||||||
// If we were building a display list, close it now.
|
// If we were building a display list, close it now.
|
||||||
GLP(EndList)();
|
GLP(EndList)();
|
||||||
|
if (!CLP(compile_and_execute)) {
|
||||||
#ifdef DO_PSTATS
|
GLP(CallList)(_geom_display_list->_index);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
_geom_display_list = NULL;
|
_geom_display_list = NULL;
|
||||||
|
|
||||||
|
@ -58,6 +58,16 @@ ConfigVariableBool CLP(color_mask)
|
|||||||
"is broken (some are). This will force the use of a (presumably) "
|
"is broken (some are). This will force the use of a (presumably) "
|
||||||
"more expensive blending operation instead."));
|
"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)() {
|
void CLP(init_classes)() {
|
||||||
CLP(GraphicsStateGuardian)::init_type();
|
CLP(GraphicsStateGuardian)::init_type();
|
||||||
|
@ -29,6 +29,7 @@ extern ConfigVariableBool CLP(force_mipmaps);
|
|||||||
extern ConfigVariableBool CLP(show_mipmaps);
|
extern ConfigVariableBool CLP(show_mipmaps);
|
||||||
extern ConfigVariableBool CLP(save_mipmaps);
|
extern ConfigVariableBool CLP(save_mipmaps);
|
||||||
extern ConfigVariableBool CLP(color_mask);
|
extern ConfigVariableBool CLP(color_mask);
|
||||||
|
extern ConfigVariableBool CLP(compile_and_execute);
|
||||||
|
|
||||||
extern EXPCL_GL void CLP(init_classes)();
|
extern EXPCL_GL void CLP(init_classes)();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user