summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-11-19 18:16:07 -0700
committerBrian <brian.paul@tungstengraphics.com>2007-11-19 18:16:07 -0700
commitc4f9fbb57f6e941a3b896b52c69665f7dced2350 (patch)
tree59f4adbbc0f2bfb71524bb877707f3d1c0f18bd4 /src/mesa/pipe
parent0204cbb4f17ef24a3c1ae1e426d5da3dd3744f92 (diff)
optimize earlyz_quad(), add comments, remove unneeded #includes
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_earlyz.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/mesa/pipe/softpipe/sp_quad_earlyz.c b/src/mesa/pipe/softpipe/sp_quad_earlyz.c
index 7e0b37519c..89fab2dd35 100644
--- a/src/mesa/pipe/softpipe/sp_quad_earlyz.c
+++ b/src/mesa/pipe/softpipe/sp_quad_earlyz.c
@@ -31,38 +31,30 @@
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
-#include "sp_context.h"
#include "sp_headers.h"
-#include "sp_surface.h"
#include "sp_quad.h"
-#include "sp_tile_cache.h"
+
+/**
+ * All this stage does is compute the quad's Z values (which is normally
+ * done by the shading stage).
+ * The next stage will do the actual depth test.
+ */
static void
earlyz_quad(
struct quad_stage *qs,
struct quad_header *quad )
{
- uint i;
const float fx = (float) quad->x0;
const float fy = (float) quad->y0;
- float xy[4][2];
+ const float dzdx = quad->coef[0].dadx[2];
+ const float dzdy = quad->coef[0].dady[2];
+ const float z0 = quad->coef[0].a0[2] + dzdx * fx + dzdy * fy;
- xy[0][0] = fx;
- xy[1][0] = fx + 1.0f;
- xy[2][0] = fx;
- xy[3][0] = fx + 1.0f;
-
- xy[0][1] = fy;
- xy[1][1] = fy;
- xy[2][1] = fy + 1.0f;
- xy[3][1] = fy + 1.0f;
-
- for (i = 0; i < QUAD_SIZE; i++) {
- quad->outputs.depth[i] =
- quad->coef[0].a0[2] +
- quad->coef[0].dadx[2] * xy[i][0] +
- quad->coef[0].dady[2] * xy[i][1];
- }
+ quad->outputs.depth[0] = z0;
+ quad->outputs.depth[1] = z0 + dzdx;
+ quad->outputs.depth[2] = z0 + dzdy;
+ quad->outputs.depth[3] = z0 + dzdx + dzdy;
if (qs->next) {
qs->next->run( qs->next, quad );