Mesa (master): i915g: fixup clear params emission

Daniel Vetter danvet at kemper.freedesktop.org
Fri Oct 7 12:47:46 UTC 2011


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

Author: Daniel Vetter <daniel.vetter at ffwll.ch>
Date:   Sun Sep 25 15:53:55 2011 +0200

i915g: fixup clear params emission

Docs say that default shader input color input need to be spec
as ARGB8888. And a clear rect prim essentially uses this value
instead of default diffuse. Depth on the other hands is an ieee
32 bit float. Clear stencil is U8.

Completely different are the clear values for zone init prims.
These are speced in the actual output pixel layout (and need
to be repeated for 16 bit formats).

Clear up the confusion by adding some comments.

v2: Retain the target swizzling support added by Stephan Marchesin.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>

---

 src/gallium/drivers/i915/i915_clear.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_clear.c b/src/gallium/drivers/i915/i915_clear.c
index c682c06..aa453bc 100644
--- a/src/gallium/drivers/i915/i915_clear.c
+++ b/src/gallium/drivers/i915/i915_clear.c
@@ -61,13 +61,18 @@ i915_clear_emit(struct pipe_context *pipe, unsigned buffers,
 
       clear_params |= CLEARPARAM_WRITE_COLOR;
       cbuf_tex = i915_texture(cbuf->texture);
+
       util_pack_color(color->f, cbuf->format, &u_color);
       if (util_format_get_blocksize(cbuf_tex->b.b.format) == 4)
          clear_color = u_color.ui;
       else
          clear_color = (u_color.ui & 0xffff) | (u_color.ui << 16);
 
-      util_pack_color(color->f, cbuf->format, &u_color);
+      /* correctly swizzle clear value */
+      if (i915->current.need_target_fixup)
+         util_pack_color(color->f, cbuf->format, &u_color);
+      else
+         util_pack_color(color->f, PIPE_FORMAT_B8G8R8A8_UNORM, &u_color);
       clear_color8888 = u_color.ui;
    } else
       clear_color = clear_color8888 = 0;
@@ -108,8 +113,10 @@ i915_clear_emit(struct pipe_context *pipe, unsigned buffers,
 
    OUT_BATCH(_3DSTATE_CLEAR_PARAMETERS);
    OUT_BATCH(clear_params | CLEARPARAM_CLEAR_RECT);
+   /* Used for zone init prim */
    OUT_BATCH(clear_color);
    OUT_BATCH(clear_depth);
+   /* Used for clear rect prim */
    OUT_BATCH(clear_color8888);
    OUT_BATCH_F(f_depth);
    OUT_BATCH(clear_stencil);




More information about the mesa-commit mailing list