Mesa (master): i965: Fill in the remaining fields of gen5+ sampler default color.

Eric Anholt anholt at kemper.freedesktop.org
Sat Apr 23 13:23:06 PDT 2011


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

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Apr 20 14:03:21 2011 -0700

i965: Fill in the remaining fields of gen5+ sampler default color.

Still doesn't fix texwrap.

---

 src/mesa/drivers/dri/i965/brw_wm_sampler_state.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index 8e12e0c..9ceac5a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -91,10 +91,20 @@ static drm_intel_bo *upload_default_color( struct brw_context *brw,
       UNCLAMPED_FLOAT_TO_SHORT(sdc.s[2], color[2]);
       UNCLAMPED_FLOAT_TO_SHORT(sdc.s[3], color[3]);
 
-      /* XXX: Fill in half floats */
-      /* XXX: Fill in signed bytes */
-
-      COPY_4V(sdc.f, color);
+      sdc.hf[0] = _mesa_float_to_half(color[0]);
+      sdc.hf[1] = _mesa_float_to_half(color[1]);
+      sdc.hf[2] = _mesa_float_to_half(color[2]);
+      sdc.hf[3] = _mesa_float_to_half(color[3]);
+
+      sdc.b[0] = sdc.s[0] >> 8;
+      sdc.b[1] = sdc.s[1] >> 8;
+      sdc.b[2] = sdc.s[2] >> 8;
+      sdc.b[3] = sdc.s[3] >> 8;
+
+      sdc.f[0] = color[0];
+      sdc.f[1] = color[1];
+      sdc.f[2] = color[2];
+      sdc.f[3] = color[3];
 
       return brw_cache_data(&brw->cache, BRW_SAMPLER_DEFAULT_COLOR,
 			    &sdc, sizeof(sdc));



More information about the mesa-commit mailing list