Mesa (master): Revert "i915g: Remove unused poly stipple state."

Stephane Marchesin marcheu at kemper.freedesktop.org
Fri Apr 13 01:31:34 UTC 2012


Module: Mesa
Branch: master
Commit: 05265bee8554241d98e741643d62ad2f8d270192
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=05265bee8554241d98e741643d62ad2f8d270192

Author: Stéphane Marchesin <marcheu at chromium.org>
Date:   Thu Apr 12 18:30:59 2012 -0700

Revert "i915g: Remove unused poly stipple state."

This reverts commit be6a02266d1a934c6eff9aaf12fc618588b2d586.

---

 src/gallium/drivers/i915/i915_context.h       |    1 +
 src/gallium/drivers/i915/i915_state_dynamic.c |   53 +++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h
index 5790a2d..b019c9f 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -239,6 +239,7 @@ struct i915_context {
    struct pipe_clip_state clip;
    struct pipe_resource *constants[PIPE_SHADER_TYPES];
    struct pipe_framebuffer_state framebuffer;
+   struct pipe_poly_stipple poly_stipple;
    struct pipe_scissor_state scissor;
    struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
    struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_SAMPLERS];
diff --git a/src/gallium/drivers/i915/i915_state_dynamic.c b/src/gallium/drivers/i915/i915_state_dynamic.c
index 7e17597..1a21433 100644
--- a/src/gallium/drivers/i915/i915_state_dynamic.c
+++ b/src/gallium/drivers/i915/i915_state_dynamic.c
@@ -194,6 +194,58 @@ const struct i915_tracked_state i915_upload_DEPTHSCALE = {
 
 
 /***********************************************************************
+ * Polygon stipple
+ *
+ * The i915 supports a 4x4 stipple natively, GL wants 32x32.
+ * Fortunately stipple is usually a repeating pattern.
+ *
+ * XXX: does stipple pattern need to be adjusted according to
+ * the window position?
+ *
+ * XXX: possibly need workaround for conform paths test.
+ */
+static void upload_STIPPLE(struct i915_context *i915)
+{
+   unsigned st[2];
+
+   st[0] = _3DSTATE_STIPPLE;
+   st[1] = 0;
+
+   /* I915_NEW_RASTERIZER
+    */
+   st[1] |= i915->rasterizer->st;
+
+   /* I915_NEW_STIPPLE
+    */
+   {
+      const ubyte *mask = (const ubyte *)i915->poly_stipple.stipple;
+      ubyte p[4];
+
+      p[0] = mask[12] & 0xf;
+      p[1] = mask[8] & 0xf;
+      p[2] = mask[4] & 0xf;
+      p[3] = mask[0] & 0xf;
+
+      /* Not sure what to do about fallbacks, so for now just dont:
+       */
+      st[1] |= ((p[0] << 0) |
+                (p[1] << 4) |
+                (p[2] << 8) |
+                (p[3] << 12));
+   }
+
+   set_dynamic_array(i915, I915_DYNAMIC_STP_0, st, 2);
+}
+
+const struct i915_tracked_state i915_upload_STIPPLE = {
+   "STIPPLE",
+   upload_STIPPLE,
+   I915_NEW_RASTERIZER | I915_NEW_STIPPLE
+};
+
+
+
+/***********************************************************************
  * Scissor enable
  */
 static void upload_SCISSOR_ENABLE( struct i915_context *i915 )
@@ -243,6 +295,7 @@ static const struct i915_tracked_state *atoms[] = {
    &i915_upload_BLENDCOLOR,
    &i915_upload_IAB,
    &i915_upload_DEPTHSCALE,
+   &i915_upload_STIPPLE,
    &i915_upload_SCISSOR_ENABLE,
    &i915_upload_SCISSOR_RECT
 };




More information about the mesa-commit mailing list