-/* $Id: s_depth.c,v 1.20 2002/04/12 15:39:59 brianp Exp $ */
+/* $Id: s_depth.c,v 1.25 2002/10/30 19:49:30 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "glheader.h"
#include "context.h"
#include "macros.h"
-#include "mem.h"
+#include "imports.h"
#include "s_depth.h"
#include "s_context.h"
}
break;
case GL_NEVER:
- BZERO(mask, n * sizeof(GLubyte));
+ _mesa_bzero(mask, n * sizeof(GLubyte));
break;
default:
_mesa_problem(ctx, "Bad depth func in depth_test_span16");
}
break;
case GL_NEVER:
- BZERO(mask, n * sizeof(GLubyte));
+ _mesa_bzero(mask, n * sizeof(GLubyte));
break;
default:
_mesa_problem(ctx, "Bad depth func in depth_test_span32");
GLdepth zbuffer[MAX_WIDTH];
GLuint passed;
(*swrast->Driver.ReadDepthSpan)(ctx, n, x, y, zbuffer);
- passed = depth_test_span32(ctx, n, zbuffer, span->zArray, span->mask);
+ passed = depth_test_span32(ctx, n, zbuffer, span->array->z,
+ span->array->mask);
ASSERT(swrast->Driver.WriteDepthSpan);
- (*swrast->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer, span->mask);
+ (*swrast->Driver.WriteDepthSpan)(ctx, n, x, y, zbuffer,
+ span->array->mask);
if (passed < n)
span->writeAll = GL_FALSE;
return passed;
/* software depth buffer */
if (ctx->Visual.depthBits <= 16) {
GLushort *zptr = (GLushort *) Z_ADDRESS16(ctx, x, y);
- passed = depth_test_span16(ctx, n, zptr, span->zArray, span->mask);
+ passed = depth_test_span16(ctx, n, zptr, span->array->z, span->array->mask);
}
else {
GLuint *zptr = (GLuint *) Z_ADDRESS32(ctx, x, y);
- passed = depth_test_span32(ctx, n, zptr, span->zArray, span->mask);
+ passed = depth_test_span32(ctx, n, zptr, span->array->z, span->array->mask);
}
-#if 0
+#if 1
+ if (passed < span->end) {
+ span->writeAll = GL_FALSE;
+ }
+#else
/* this causes a glDrawPixels(GL_DEPTH_COMPONENT) conformance failure */
if (passed < span->end) {
span->writeAll = GL_FALSE;
break;
case GL_NEVER:
/* depth test never passes */
- BZERO(mask, n * sizeof(GLubyte));
+ _mesa_bzero(mask, n * sizeof(GLubyte));
break;
default:
_mesa_problem(ctx, "Bad depth func in software_depth_test_pixels");
break;
case GL_NEVER:
/* depth test never passes */
- BZERO(mask, n * sizeof(GLubyte));
+ _mesa_bzero(mask, n * sizeof(GLubyte));
break;
default:
_mesa_problem(ctx, "Bad depth func in software_depth_test_pixels");
break;
case GL_NEVER:
/* depth test never passes */
- BZERO(mask, n * sizeof(GLubyte));
+ _mesa_bzero(mask, n * sizeof(GLubyte));
break;
default:
_mesa_problem(ctx, "Bad depth func in hardware_depth_test_pixels");
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLuint n = span->end;
- const GLint *x = span->xArray;
- const GLint *y = span->yArray;
- const GLdepth *z = span->zArray;
- GLubyte *mask = span->mask;
+ const GLint *x = span->array->x;
+ const GLint *y = span->array->y;
+ const GLdepth *z = span->array->z;
+ GLubyte *mask = span->array->mask;
if (swrast->Driver.ReadDepthPixels) {
/* read depth values from hardware Z buffer */
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- if (y < 0 || y >= ctx->DrawBuffer->Height ||
- x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) {
+ if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height ||
+ x + (GLint) n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
GLint i;
for (i = 0; i < n; i++)
n -= dx;
depth += dx;
}
- if (x + n > ctx->DrawBuffer->Width) {
- GLint dx = x + n - ctx->DrawBuffer->Width;
+ if (x + n > (GLint) ctx->DrawBuffer->Width) {
+ GLint dx = x + n - (GLint) ctx->DrawBuffer->Width;
GLint i;
for (i = 0; i < dx; i++)
depth[n - i - 1] = 0;
}
else {
/* no depth buffer */
- BZERO(depth, n * sizeof(GLfloat));
+ _mesa_bzero(depth, n * sizeof(GLfloat));
}
}
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLfloat scale = 1.0F / ctx->DepthMaxF;
- if (y < 0 || y >= ctx->DrawBuffer->Height ||
- x + (GLint) n <= 0 || x >= ctx->DrawBuffer->Width) {
+ if (y < 0 || y >= (GLint) ctx->DrawBuffer->Height ||
+ x + (GLint) n <= 0 || x >= (GLint) ctx->DrawBuffer->Width) {
/* span is completely outside framebuffer */
GLint i;
for (i = 0; i < n; i++)
n -= dx;
x = 0;
}
- if (x + n > ctx->DrawBuffer->Width) {
- GLint dx = x + n - ctx->DrawBuffer->Width;
+ if (x + n > (GLint) ctx->DrawBuffer->Width) {
+ GLint dx = x + n - (GLint) ctx->DrawBuffer->Width;
GLint i;
for (i = 0; i < dx; i++)
depth[n - i - 1] = 0.0F;
}
else {
/* no depth buffer */
- BZERO(depth, n * sizeof(GLfloat));
+ _mesa_bzero(depth, n * sizeof(GLfloat));
}
}
const GLushort clearValue = (GLushort) (ctx->Depth.Clear * ctx->DepthMax);
if ((clearValue & 0xff) == (clearValue >> 8)) {
if (clearValue == 0) {
- BZERO(ctx->DrawBuffer->DepthBuffer,
+ _mesa_bzero(ctx->DrawBuffer->DepthBuffer,
2*ctx->DrawBuffer->Width*ctx->DrawBuffer->Height);
}
else {
/* >16 bit depth buffer */
const GLuint clearValue = (GLuint) (ctx->Depth.Clear * ctx->DepthMax);
if (clearValue == 0) {
- BZERO(ctx->DrawBuffer->DepthBuffer,
+ _mesa_bzero(ctx->DrawBuffer->DepthBuffer,
ctx->DrawBuffer->Width*ctx->DrawBuffer->Height*sizeof(GLuint));
}
else {