diff options
author | Brian Paul <[email protected]> | 2011-12-24 08:54:26 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-12-24 08:54:26 -0700 |
commit | 4d6b0927ab6533f0384f463e2ccfc3eb5f80ecf9 (patch) | |
tree | 9c01768a8bef4cf849866f3853bfc57394608415 /src | |
parent | 82f28c0a12cf04e4fd3c4cfc4658919943fca825 (diff) |
swrast: rewrite _swrast_read_depth_span_float()
Stop using the deprecated renderbuffer GetRow() function.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/swrast/s_depth.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index f441795b90f..806e62b5ea0 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -449,19 +449,16 @@ _swrast_depth_bounds_test( struct gl_context *ctx, SWspan *span ) * bounds. */ void -_swrast_read_depth_span_float( struct gl_context *ctx, struct gl_renderbuffer *rb, - GLint n, GLint x, GLint y, GLfloat depth[] ) +_swrast_read_depth_span_float(struct gl_context *ctx, + struct gl_renderbuffer *rb, + GLint n, GLint x, GLint y, GLfloat depth[]) { - const GLfloat scale = 1.0F / ctx->DrawBuffer->_DepthMaxF; - if (!rb) { /* really only doing this to prevent FP exceptions later */ memset(depth, 0, n * sizeof(GLfloat)); return; } - ASSERT(rb->_BaseFormat == GL_DEPTH_COMPONENT); - if (y < 0 || y >= (GLint) rb->Height || x + n <= 0 || x >= (GLint) rb->Width) { /* span is completely outside framebuffer */ @@ -489,25 +486,7 @@ _swrast_read_depth_span_float( struct gl_context *ctx, struct gl_renderbuffer *r return; } - if (rb->DataType == GL_UNSIGNED_INT) { - GLuint temp[MAX_WIDTH]; - GLint i; - rb->GetRow(ctx, rb, n, x, y, temp); - for (i = 0; i < n; i++) { - depth[i] = temp[i] * scale; - } - } - else if (rb->DataType == GL_UNSIGNED_SHORT) { - GLushort temp[MAX_WIDTH]; - GLint i; - rb->GetRow(ctx, rb, n, x, y, temp); - for (i = 0; i < n; i++) { - depth[i] = temp[i] * scale; - } - } - else { - _mesa_problem(ctx, "Invalid depth renderbuffer data type"); - } + _mesa_unpack_float_z_row(rb->Format, n, get_z_address(rb, x, y), depth); } |