diff options
author | Brian <[email protected]> | 2007-07-10 13:53:21 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-07-10 13:53:21 -0600 |
commit | 1deafdb1dec24c2920ab92098f1433273b2ccbdd (patch) | |
tree | 620113d9c9ebee3dd3a80df46771252c3e03c78f /src/mesa/drivers/x11 | |
parent | f6dffd6ee70473dcbf65420a9c635049199f7a4e (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/x11')
-rw-r--r-- | src/mesa/drivers/x11/xm_surface.c | 12 |
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 30c9049cbfe..5158e42d9a0 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; |