summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_fs_exec.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-02-21 19:07:31 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2008-02-21 19:17:27 +0000
commit20fbcbf5801c28865c0bfab3cda45302c8474a66 (patch)
tree73b3d485ab7f8d0ce02133a72767112e190a7518 /src/gallium/drivers/softpipe/sp_fs_exec.c
parent4339744c1676f925d42251bd32795bba9928cd5f (diff)
[PATCH] softpipe: unbreak sp_setup_pos_vector on non-x86 systems
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_fs_exec.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_exec.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c
index 9ad30a7681..8cb0534342 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -44,6 +44,41 @@ struct sp_exec_fragment_shader {
+/**
+ * Compute quad X,Y,Z,W for the four fragments in a quad.
+ *
+ * This should really be part of the compiled shader.
+ */
+void
+sp_setup_pos_vector(const struct tgsi_interp_coef *coef,
+ float x, float y,
+ struct tgsi_exec_vector *quadpos)
+{
+ uint chan;
+ /* do X */
+ quadpos->xyzw[0].f[0] = x;
+ quadpos->xyzw[0].f[1] = x + 1;
+ quadpos->xyzw[0].f[2] = x;
+ quadpos->xyzw[0].f[3] = x + 1;
+
+ /* do Y */
+ quadpos->xyzw[1].f[0] = y;
+ quadpos->xyzw[1].f[1] = y;
+ quadpos->xyzw[1].f[2] = y + 1;
+ quadpos->xyzw[1].f[3] = y + 1;
+
+ /* do Z and W for all fragments in the quad */
+ for (chan = 2; chan < 4; chan++) {
+ const float dadx = coef->dadx[chan];
+ const float dady = coef->dady[chan];
+ const float a0 = coef->a0[chan] + dadx * x + dady * y;
+ quadpos->xyzw[chan].f[0] = a0;
+ quadpos->xyzw[chan].f[1] = a0 + dadx;
+ quadpos->xyzw[chan].f[2] = a0 + dady;
+ quadpos->xyzw[chan].f[3] = a0 + dadx + dady;
+ }
+}
+
static void
exec_prepare( struct sp_fragment_shader *base,