}
}
-
-/**
- * As above, but return 32-bit GLuint values.
- */
-void
-_swrast_read_depth_span_uint( struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLint n, GLint x, GLint y, GLuint depth[] )
-{
- GLuint depthBits;
-
- if (!rb) {
- /* really only doing this to prevent FP exceptions later */
- memset(depth, 0, n * sizeof(GLuint));
- return;
- }
-
- depthBits = _mesa_get_format_bits(rb->Format, GL_DEPTH_BITS);
-
- 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 */
- memset(depth, 0, n * sizeof(GLfloat));
- return;
- }
-
- if (x < 0) {
- GLint dx = -x;
- GLint i;
- for (i = 0; i < dx; i++)
- depth[i] = 0;
- x = 0;
- n -= dx;
- depth += dx;
- }
- if (x + n > (GLint) rb->Width) {
- GLint dx = x + n - (GLint) rb->Width;
- GLint i;
- for (i = 0; i < dx; i++)
- depth[n - i - 1] = 0;
- n -= dx;
- }
- if (n <= 0) {
- return;
- }
-
- if (rb->DataType == GL_UNSIGNED_INT) {
- rb->GetRow(ctx, rb, n, x, y, depth);
- if (depthBits < 32) {
- GLuint shift = 32 - depthBits;
- GLint i;
- for (i = 0; i < n; i++) {
- GLuint z = depth[i];
- depth[i] = z << shift; /* XXX lsb bits? */
- }
- }
- }
- else if (rb->DataType == GL_UNSIGNED_SHORT) {
- GLushort temp[MAX_WIDTH];
- GLint i;
- rb->GetRow(ctx, rb, n, x, y, temp);
- if (depthBits == 16) {
- for (i = 0; i < n; i++) {
- GLuint z = temp[i];
- depth[i] = (z << 16) | z;
- }
- }
- else {
- GLuint shift = 16 - depthBits;
- for (i = 0; i < n; i++) {
- GLuint z = temp[i];
- depth[i] = (z << (shift + 16)) | (z << shift); /* XXX lsb bits? */
- }
- }
- }
- else {
- _mesa_problem(ctx, "Invalid depth renderbuffer data type");
- }
-}
-
-
-
/**
* Clear the given z/depth renderbuffer.
*/
_swrast_read_depth_span_float( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint n, GLint x, GLint y, GLfloat depth[] );
-
-extern void
-_swrast_read_depth_span_uint( struct gl_context *ctx, struct gl_renderbuffer *rb,
- GLint n, GLint x, GLint y, GLuint depth[] );
-
extern void
_swrast_clear_depth_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb );