summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-07-10 13:53:21 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-07-10 13:53:21 -0600
commit1deafdb1dec24c2920ab92098f1433273b2ccbdd (patch)
tree620113d9c9ebee3dd3a80df46771252c3e03c78f /src/mesa/drivers
parentf6dffd6ee70473dcbf65420a9c635049199f7a4e (diff)
Do depth testing with integer values.
Using floats (and float->ushort->float conversion) introduces errors. Only GLushort depth buffers work for now...
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/x11/xm_surface.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mesa/drivers/x11/xm_surface.c b/src/mesa/drivers/x11/xm_surface.c
index 30c9049cbf..5158e42d9a 100644
--- a/src/mesa/drivers/x11/xm_surface.c
+++ b/src/mesa/drivers/x11/xm_surface.c
@@ -43,6 +43,7 @@
#include "renderbuffer.h"
#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
#include "pipe/softpipe/sp_context.h"
#include "pipe/softpipe/sp_surface.h"
@@ -245,7 +246,7 @@ xmesa_get_color_surface(GLcontext *ctx, GLuint buf)
static void
read_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, GLfloat zzzz[QUAD_SIZE])
+ GLint x, GLint y, GLuint zzzz[QUAD_SIZE])
{
struct xmesa_surface *xmsurf = xmesa_surface(sps);
struct gl_renderbuffer *rb = xmsurf->rb;
@@ -254,22 +255,24 @@ read_quad_z(struct softpipe_surface *sps,
GET_CURRENT_CONTEXT(ctx);
rb->GetRow(ctx, rb, 2, x, y, temp);
rb->GetRow(ctx, rb, 2, x, y + 1, temp + 2);
+ /* convert from GLushort to GLuint */
for (i = 0; i < 4; i++) {
- zzzz[i] = USHORT_TO_FLOAT(temp[i]);
+ zzzz[i] = temp[i];
}
}
static void
write_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, const GLfloat zzzz[QUAD_SIZE])
+ GLint x, GLint y, const GLuint zzzz[QUAD_SIZE])
{
struct xmesa_surface *xmsurf = xmesa_surface(sps);
struct gl_renderbuffer *rb = xmsurf->rb;
GLushort temp[4];
GLuint i;
GET_CURRENT_CONTEXT(ctx);
+ /* convert from GLuint to GLushort */
for (i = 0; i < 4; i++) {
- CLAMPED_FLOAT_TO_USHORT(temp[i], zzzz[i]);
+ temp[i] = zzzz[i];
}
rb->PutRow(ctx, rb, 2, x, y, temp, NULL);
rb->PutRow(ctx, rb, 2, x, y + 1, temp + 2, NULL);
@@ -283,6 +286,7 @@ create_z_surface(XMesaContext xmctx, struct gl_renderbuffer *rb)
xmsurf = CALLOC_STRUCT(xmesa_surface);
if (xmsurf) {
+ xmsurf->sps.surface.format = PIPE_FORMAT_U_Z16;
xmsurf->sps.surface.width = rb->Width;
xmsurf->sps.surface.height = rb->Height;
xmsurf->sps.read_quad_z = read_quad_z;