summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_draw.c
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-12-22 09:40:39 +0000
committerKeith Whitwell <[email protected]>2009-12-22 09:40:39 +0000
commitaa02683e45f1eaf61bba2ba7eeda7686efeed2ca (patch)
tree63e0ef2fa85e5d7ebd6ffc6ae9043ce0819251a2 /src/mesa/state_tracker/st_draw.c
parentebbc73d1aed283c9bc4aa2b37bed4374bbaec5b5 (diff)
parent0fc4dd3819af252c028ed43bbd668b4f34104e32 (diff)
Merge branch 'i965g-restart'
Conflicts: configure.ac
Diffstat (limited to 'src/mesa/state_tracker/st_draw.c')
-rw-r--r--src/mesa/state_tracker/st_draw.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index d297b9bc06d..ec8092d7e9e 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -538,6 +538,20 @@ check_uniforms(GLcontext *ctx)
}
+static unsigned translate_prim( GLcontext *ctx,
+ unsigned prim )
+{
+ /* Avoid quadstrips if it's easy to do so:
+ */
+ if (prim == GL_QUAD_STRIP &&
+ ctx->Light.ShadeModel != GL_FLAT &&
+ ctx->Polygon.FrontMode == GL_FILL &&
+ ctx->Polygon.BackMode == GL_FILL)
+ prim = GL_TRIANGLE_STRIP;
+
+ return prim;
+}
+
/**
* This function gets plugged into the VBO module and is called when
* we have something to render.
@@ -564,7 +578,8 @@ st_draw_vbo(GLcontext *ctx,
/* Gallium probably doesn't want this in some cases. */
if (!index_bounds_valid)
- vbo_get_minmax_index(ctx, prims, ib, &min_index, &max_index);
+ if (!vbo_all_varyings_in_vbos(arrays))
+ vbo_get_minmax_index(ctx, prims, ib, &min_index, &max_index);
/* sanity check for pointer arithmetic below */
assert(sizeof(arrays[0]->Ptr[0]) == 1);
@@ -633,6 +648,7 @@ st_draw_vbo(GLcontext *ctx,
struct gl_buffer_object *bufobj = ib->obj;
struct pipe_buffer *indexBuf = NULL;
unsigned indexSize, indexOffset, i;
+ unsigned prim;
switch (ib->type) {
case GL_UNSIGNED_INT:
@@ -675,10 +691,12 @@ st_draw_vbo(GLcontext *ctx,
prims[i].start + indexOffset, prims[i].count,
arrays[VERT_ATTRIB_EDGEFLAG]);
+ prim = translate_prim( ctx, prims[i].mode );
+
pipe->draw_range_elements(pipe, indexBuf, indexSize,
min_index,
max_index,
- prims[i].mode,
+ prim,
prims[i].start + indexOffset, prims[i].count);
}
else {
@@ -686,9 +704,11 @@ st_draw_vbo(GLcontext *ctx,
setup_edgeflags(ctx, prims[i].mode,
prims[i].start + indexOffset, prims[i].count,
arrays[VERT_ATTRIB_EDGEFLAG]);
+
+ prim = translate_prim( ctx, prims[i].mode );
pipe->draw_elements(pipe, indexBuf, indexSize,
- prims[i].mode,
+ prim,
prims[i].start + indexOffset, prims[i].count);
}
}
@@ -698,12 +718,16 @@ st_draw_vbo(GLcontext *ctx,
else {
/* non-indexed */
GLuint i;
+ GLuint prim;
+
for (i = 0; i < nr_prims; i++) {
setup_edgeflags(ctx, prims[i].mode,
prims[i].start, prims[i].count,
arrays[VERT_ATTRIB_EDGEFLAG]);
- pipe->draw_arrays(pipe, prims[i].mode, prims[i].start, prims[i].count);
+ prim = translate_prim( ctx, prims[i].mode );
+
+ pipe->draw_arrays(pipe, prim, prims[i].start, prims[i].count);
}
}