Mesa (master): i965: Implement frag prog DPH like DP4

Ian Romanick idr at kemper.freedesktop.org
Sat Aug 22 08:38:26 UTC 2009


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Sat Aug 22 01:35:12 2009 -0700

i965: Implement frag prog DPH like DP4

DPH can output to any component, not just to X.  This allows fpalu.c
to run without hitting the assertion in emit_dph.

---

 src/mesa/drivers/dri/i965/brw_wm_emit.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c
index b3cf524..5f29ca1 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c
@@ -588,17 +588,19 @@ static void emit_dph( struct brw_compile *p,
 		      const struct brw_reg *arg0,
 		      const struct brw_reg *arg1 )
 {
+   const int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1;
+
    if (!(mask & WRITEMASK_XYZW))
       return; /* Do not emit dead code */
 
-   assert((mask & WRITEMASK_XYZW) == WRITEMASK_X);
+   assert(is_power_of_two(mask & WRITEMASK_XYZW));
 
    brw_MUL(p, brw_null_reg(), arg0[0], arg1[0]);
    brw_MAC(p, brw_null_reg(), arg0[1], arg1[1]);
-   brw_MAC(p, dst[0], arg0[2], arg1[2]);
+   brw_MAC(p, dst[dst_chan], arg0[2], arg1[2]);
 
    brw_set_saturate(p, (mask & SATURATE) ? 1 : 0);
-   brw_ADD(p, dst[0], dst[0], arg1[3]);
+   brw_ADD(p, dst[dst_chan], dst[dst_chan], arg1[3]);
    brw_set_saturate(p, 0);
 }
 




More information about the mesa-commit mailing list