summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2006-10-10 15:00:53 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2006-10-10 15:00:53 +0000
commita64e6d7c7c3c719788af070779b46aef4334aec6 (patch)
treecec3621ab940c056e3e372136f30b99b1c5d0ee3
parent0dab8d51e576730a909fee5f51d7385ca3b0ce3e (diff)
Rasterize smooth-shaded quads like trifans, which avoids texture
discontinuity along the diagonal.
-rw-r--r--src/mesa/drivers/dri/i915/intel_tris.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
index 78e9bd160f..1ba49d8f6e 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -188,8 +188,20 @@ intel_draw_quad(struct intel_context *intel,
COPY_DWORDS(j, vb, vertsize, v0);
COPY_DWORDS(j, vb, vertsize, v1);
- COPY_DWORDS(j, vb, vertsize, v3);
- COPY_DWORDS(j, vb, vertsize, v1);
+
+ /* If smooth shading, draw like a trifan which gives better
+ * rasterization. Otherwise draw as two triangles with provoking
+ * vertex in third position as required for flat shading.
+ */
+ if (intel->ctx.Light.ShadeModel == GL_FLAT) {
+ COPY_DWORDS(j, vb, vertsize, v3);
+ COPY_DWORDS(j, vb, vertsize, v1);
+ }
+ else {
+ COPY_DWORDS(j, vb, vertsize, v2);
+ COPY_DWORDS(j, vb, vertsize, v0);
+ }
+
COPY_DWORDS(j, vb, vertsize, v2);
COPY_DWORDS(j, vb, vertsize, v3);
}