diff options
author | Brian <[email protected]> | 2008-03-28 15:22:34 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2008-03-28 15:22:34 -0600 |
commit | cbfe6ee5d58e7342012392a8ead7ae373625c00a (patch) | |
tree | 56dd2079621153d7ab220501d8056bf026cf4668 /src/gallium | |
parent | 5a460c7391ef35b1dcf6ad7f5494fb23279b2e45 (diff) |
gallium: Fix computation of Z values when not using early Z.
This fixes the missing bitmaps in the engine and fogcoord demos.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_quad_fs.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c index c10ad80e015..a73df31383f 100644 --- a/src/gallium/drivers/softpipe/sp_quad_fs.c +++ b/src/gallium/drivers/softpipe/sp_quad_fs.c @@ -113,15 +113,18 @@ shade_quad( } } else { - /* copy input Z (which was interpolated by the executor) to output Z */ - uint i; - for (i = 0; i < 4; i++) { - quad->outputs.depth[i] = machine->Inputs[0].xyzw[2].f[i]; - /* XXX not sure the above line is always correct. The following - * might be better: - quad->outputs.depth[i] = machine->QuadPos.xyzw[2].f[i]; - */ - } + /* compute Z values now, as in the quad earlyz stage */ + /* XXX we should really only do this if the earlyz stage is not used */ + const float fx = (float) quad->x0; + const float fy = (float) quad->y0; + const float dzdx = quad->posCoef->dadx[2]; + const float dzdy = quad->posCoef->dady[2]; + const float z0 = quad->posCoef->a0[2] + dzdx * fx + dzdy * fy; + + quad->outputs.depth[0] = z0; + quad->outputs.depth[1] = z0 + dzdx; + quad->outputs.depth[2] = z0 + dzdy; + quad->outputs.depth[3] = z0 + dzdx + dzdy; } /* shader may cull fragments */ |