aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_rast_priv.h
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-02-10 11:01:26 +0000
committerJosé Fonseca <[email protected]>2010-02-10 11:01:26 +0000
commit5e6a9005100ec2636ce9734a5e4535216494cf60 (patch)
treee6be5e6ee6a48b8ef0122a4ac3ebe1697a5dc24e /src/gallium/drivers/llvmpipe/lp_rast_priv.h
parent7a593afa1741bfb0abd31422ecbd551628508711 (diff)
llvmpipe: Leave depth buffer in swizzled format.
This fixes several assertion failures due to only Z32 being supported.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_rast_priv.h')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_priv.h31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
index 71e3a301e61..4760d337c64 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
@@ -29,6 +29,8 @@
#define LP_RAST_PRIV_H
#include "os/os_thread.h"
+#include "util/u_format.h"
+#include "gallivm/lp_bld_debug.h"
#include "lp_rast.h"
#include "lp_tile_soa.h"
@@ -48,8 +50,6 @@ struct lp_rasterizer;
struct lp_rast_tile
{
uint8_t *color[PIPE_MAX_COLOR_BUFS];
-
- uint32_t *depth;
};
@@ -91,7 +91,7 @@ struct lp_rasterizer
struct pipe_transfer *cbuf_transfer[PIPE_MAX_COLOR_BUFS];
struct pipe_transfer *zsbuf_transfer;
void *cbuf_map[PIPE_MAX_COLOR_BUFS];
- void *zsbuf_map;
+ uint8_t *zsbuf_map;
struct {
struct pipe_framebuffer_state fb;
@@ -129,6 +129,28 @@ void lp_rast_shade_quads( struct lp_rasterizer *rast,
/**
+ * Get the pointer to the depth buffer for a block.
+ * \param x, y location of 4x4 block in window coords
+ */
+static INLINE void *
+lp_rast_depth_pointer( struct lp_rasterizer *rast,
+ unsigned x, unsigned y )
+{
+ void * depth;
+ assert((x % TILE_VECTOR_WIDTH) == 0);
+ assert((y % TILE_VECTOR_HEIGHT) == 0);
+ depth = rast->zsbuf_map +
+ y*rast->zsbuf_transfer->stride +
+ TILE_VECTOR_HEIGHT*x*util_format_get_blocksize(rast->zsbuf_transfer->texture->format);
+#ifdef DEBUG
+ assert(lp_check_alignment(depth, 16));
+#endif
+ return depth;
+}
+
+
+
+/**
* Shade all pixels in a 4x4 block. The fragment code omits the
* triangle in/out tests.
* \param x, y location of 4x4 block in window coords
@@ -153,8 +175,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer *rast,
for (i = 0; i < rast->state.fb.nr_cbufs; i++)
color[i] = tile->color[i] + 4 * block_offset;
- /* depth buffer */
- depth = tile->depth + block_offset;
+ depth = lp_rast_depth_pointer(rast, x, y);
/* run shader */
state->jit_function[0]( &state->jit_context,