-/* $Id: depth.c,v 1.15 2000/03/19 01:10:11 brianp Exp $ */
+/* $Id: depth.c,v 1.16 2000/04/04 00:54:23 brianp Exp $ */
/*
* Mesa 3-D graphics library
}
break;
case GL_NEVER:
- MEMSET(mask, 0, n * sizeof(GLubyte));
+ BZERO(mask, n * sizeof(GLubyte));
break;
default:
gl_problem(ctx, "Bad depth func in depth_test_span16");
}
break;
case GL_NEVER:
- MEMSET(mask, 0, n * sizeof(GLubyte));
+ BZERO(mask, n * sizeof(GLubyte));
break;
default:
gl_problem(ctx, "Bad depth func in depth_test_span32");
break;
case GL_NEVER:
/* depth test never passes */
- MEMSET(mask, 0, n * sizeof(GLubyte));
+ BZERO(mask, n * sizeof(GLubyte));
break;
default:
gl_problem(ctx, "Bad depth func in software_depth_test_pixels");
break;
case GL_NEVER:
/* depth test never passes */
- MEMSET(mask, 0, n * sizeof(GLubyte));
+ BZERO(mask, n * sizeof(GLubyte));
break;
default:
gl_problem(ctx, "Bad depth func in software_depth_test_pixels");
break;
case GL_NEVER:
/* depth test never passes */
- MEMSET(mask, 0, n * sizeof(GLubyte));
+ BZERO(mask, n * sizeof(GLubyte));
break;
default:
gl_problem(ctx, "Bad depth func in hardware_depth_test_pixels");
}
else {
/* no depth buffer */
- MEMSET(depth, 0, n * sizeof(GLfloat));
+ BZERO(depth, n * sizeof(GLfloat));
}
}
if (ctx->Visual->DepthBits <= 16) {
const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->Visual->DepthMax);
if ((clearValue & 0xff) == (clearValue >> 8)) {
- /* lower and upper bytes of clear_value are same, use MEMSET */
- MEMSET( ctx->DrawBuffer->DepthBuffer, clearValue & 0xff,
- 2 * ctx->DrawBuffer->Width * ctx->DrawBuffer->Height);
+ if (clearValue == 0) {
+ BZERO(ctx->DrawBuffer->DepthBuffer,
+ 2*ctx->DrawBuffer->Width*ctx->DrawBuffer->Height);
+ }
+ else {
+ /* lower and upper bytes of clear_value are same, use MEMSET */
+ MEMSET( ctx->DrawBuffer->DepthBuffer, clearValue & 0xff,
+ 2 * ctx->DrawBuffer->Width * ctx->DrawBuffer->Height);
+ }
}
else {
GLushort *d = (GLushort *) ctx->DrawBuffer->DepthBuffer;
}
else {
/* >16 bit depth buffer */
- GLuint *d = (GLuint *) ctx->DrawBuffer->DepthBuffer;
const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->Visual->DepthMax);
- GLint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height;
- while (n >= 16) {
- d[0] = clearValue; d[1] = clearValue;
- d[2] = clearValue; d[3] = clearValue;
- d[4] = clearValue; d[5] = clearValue;
- d[6] = clearValue; d[7] = clearValue;
- d[8] = clearValue; d[9] = clearValue;
- d[10] = clearValue; d[11] = clearValue;
- d[12] = clearValue; d[13] = clearValue;
- d[14] = clearValue; d[15] = clearValue;
- d += 16;
- n -= 16;
+ if (clearValue == 0) {
+ BZERO(ctx->DrawBuffer->DepthBuffer,
+ ctx->DrawBuffer->Width*ctx->DrawBuffer->Height*sizeof(GLuint));
}
- while (n > 0) {
- *d++ = clearValue;
- n--;
+ else {
+ GLint n = ctx->DrawBuffer->Width * ctx->DrawBuffer->Height;
+ GLuint *d = (GLuint *) ctx->DrawBuffer->DepthBuffer;
+ while (n >= 16) {
+ d[0] = clearValue; d[1] = clearValue;
+ d[2] = clearValue; d[3] = clearValue;
+ d[4] = clearValue; d[5] = clearValue;
+ d[6] = clearValue; d[7] = clearValue;
+ d[8] = clearValue; d[9] = clearValue;
+ d[10] = clearValue; d[11] = clearValue;
+ d[12] = clearValue; d[13] = clearValue;
+ d[14] = clearValue; d[15] = clearValue;
+ d += 16;
+ n -= 16;
+ }
+ while (n > 0) {
+ *d++ = clearValue;
+ n--;
+ }
}
}
}