new depth buffer functions
This commit is contained in:
parent
4c7fd2cfce
commit
1478647932
|
@ -811,11 +811,10 @@ void fxSetupDDPointers(GLcontext *ctx)
|
||||||
|
|
||||||
ctx->Driver.UpdateState=fxDDUpdateDDPointers;
|
ctx->Driver.UpdateState=fxDDUpdateDDPointers;
|
||||||
|
|
||||||
ctx->Driver.AllocDepthBuffer=fxAllocDepthBuffer;
|
ctx->Driver.WriteDepthSpan=fxDDWriteDepthSpan;
|
||||||
ctx->Driver.DepthTestSpan=fxDDDepthTestSpanGeneric;
|
ctx->Driver.WriteDepthPixels=fxDDWriteDepthPixels;
|
||||||
ctx->Driver.DepthTestPixels=fxDDDepthTestPixelsGeneric;
|
ctx->Driver.ReadDepthSpan=fxDDReadDepthSpan;
|
||||||
ctx->Driver.ReadDepthSpanFloat=fxDDReadDepthSpanFloat;
|
ctx->Driver.ReadDepthPixels=fxDDReadDepthPixels;
|
||||||
ctx->Driver.ReadDepthSpanInt=fxDDReadDepthSpanInt;
|
|
||||||
|
|
||||||
ctx->Driver.GetString=fxDDGetString;
|
ctx->Driver.GetString=fxDDGetString;
|
||||||
|
|
||||||
|
|
|
@ -122,11 +122,6 @@ void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer,
|
||||||
|
|
||||||
#if defined(FX_GLIDE3) && defined(XF86DRI)
|
#if defined(FX_GLIDE3) && defined(XF86DRI)
|
||||||
|
|
||||||
static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
|
|
||||||
FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format,
|
|
||||||
FxU32 src_width, FxU32 src_height, FxI32 src_stride,
|
|
||||||
void *src_data);
|
|
||||||
|
|
||||||
FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
|
FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer,
|
||||||
FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format,
|
FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format,
|
||||||
FxU32 src_width, FxU32 src_height, FxI32 src_stride,
|
FxU32 src_width, FxU32 src_height, FxI32 src_stride,
|
||||||
|
@ -388,7 +383,7 @@ static void fxDDReadRGBAPixels(const GLcontext *ctx,
|
||||||
{
|
{
|
||||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
GLint bottom=fxMesa->y_delta-1;
|
||||||
|
|
||||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||||
fprintf(stderr,"fxmesa: fxDDReadRGBAPixels(...)\n");
|
fprintf(stderr,"fxmesa: fxDDReadRGBAPixels(...)\n");
|
||||||
|
@ -411,30 +406,37 @@ static void fxDDReadRGBAPixels(const GLcontext *ctx,
|
||||||
/***** Depth functions *****/
|
/***** Depth functions *****/
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
void fxDDReadDepthSpanFloat(GLcontext *ctx,
|
void fxDDWriteDepthSpan(GLcontext *ctx,
|
||||||
GLuint n, GLint x, GLint y, GLfloat depth[])
|
GLuint n, GLint x, GLint y, const GLdepth depth[],
|
||||||
|
const GLubyte mask[])
|
||||||
{
|
{
|
||||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||||
GLuint i;
|
|
||||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||||
GLushort data[MAX_WIDTH];
|
|
||||||
|
|
||||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||||
fprintf(stderr,"fxmesa: fxDDReadDepthSpanFloat(...)\n");
|
fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
x+=fxMesa->x_offset;
|
x += fxMesa->x_offset;
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,data);
|
|
||||||
|
|
||||||
/*
|
if (mask) {
|
||||||
convert the read values to float values [0.0 .. 1.0].
|
GLint i;
|
||||||
*/
|
for (i = 0; i < n; i++) {
|
||||||
for(i=0;i<n;i++)
|
if (mask[i]) {
|
||||||
depth[i]=data[i]/65535.0f;
|
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x + i, bottom-y,
|
||||||
|
GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &depth[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, x, bottom-y,
|
||||||
|
GR_LFB_SRC_FMT_ZA16, n, 1, 0, (void *) depth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fxDDReadDepthSpanInt(GLcontext *ctx,
|
|
||||||
GLuint n, GLint x, GLint y, GLdepth depth[])
|
void fxDDReadDepthSpan(GLcontext *ctx,
|
||||||
|
GLuint n, GLint x, GLint y, GLdepth depth[])
|
||||||
{
|
{
|
||||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||||
|
@ -447,440 +449,53 @@ void fxDDReadDepthSpanInt(GLcontext *ctx,
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth);
|
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
|
|
||||||
GLuint n, GLint x, GLint y, const GLdepth z[],
|
|
||||||
GLubyte mask[])
|
void fxDDWriteDepthPixels(GLcontext *ctx,
|
||||||
|
GLuint n, const GLint x[], const GLint y[],
|
||||||
|
const GLdepth depth[], const GLubyte mask[])
|
||||||
{
|
{
|
||||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||||
GLushort depthdata[MAX_WIDTH];
|
|
||||||
GLdepth *zptr=depthdata;
|
|
||||||
GLubyte *m=mask;
|
|
||||||
GLuint i;
|
|
||||||
GLuint passed=0;
|
|
||||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||||
|
GLuint i;
|
||||||
|
|
||||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||||
fprintf(stderr,"fxmesa: fxDDDepthTestSpanGeneric(...)\n");
|
fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
x+=fxMesa->x_offset;
|
for (i = 0; i < n; i++) {
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x,bottom-y,n,1,0,depthdata);
|
if (mask[i]) {
|
||||||
|
int xpos = x[i] + fxMesa->x_offset;
|
||||||
/* switch cases ordered from most frequent to less frequent */
|
int ypos = bottom - y[i];
|
||||||
switch (ctx->Depth.Func) {
|
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER, xpos, ypos,
|
||||||
case GL_LESS:
|
GR_LFB_SRC_FMT_ZA16, 1, 1, 0, (void *) &depth[i]);
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0; i<n; i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] < *zptr) {
|
|
||||||
/* pass */
|
|
||||||
*zptr = z[i];
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
/* fail */
|
|
||||||
*m = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0; i<n; i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] < *zptr) {
|
|
||||||
/* pass */
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
*m = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case GL_LEQUAL:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0;i<n;i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] <= *zptr) {
|
|
||||||
*zptr = z[i];
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
*m = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0;i<n;i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] <= *zptr) {
|
|
||||||
/* pass */
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
*m = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_GEQUAL:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0;i<n;i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] >= *zptr) {
|
|
||||||
*zptr = z[i];
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
*m = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0;i<n;i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] >= *zptr) {
|
|
||||||
/* pass */
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
*m = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_GREATER:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0;i<n;i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] > *zptr) {
|
|
||||||
*zptr = z[i];
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
*m = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0;i<n;i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] > *zptr) {
|
|
||||||
/* pass */
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
*m = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_NOTEQUAL:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0;i<n;i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] != *zptr) {
|
|
||||||
*zptr = z[i];
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
*m = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0;i<n;i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] != *zptr) {
|
|
||||||
/* pass */
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
*m = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_EQUAL:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0;i<n;i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] == *zptr) {
|
|
||||||
*zptr = z[i];
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
*m =0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0;i<n;i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
if (z[i] == *zptr) {
|
|
||||||
/* pass */
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
*m =0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_ALWAYS:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0;i<n;i++,zptr++,m++) {
|
|
||||||
if (*m) {
|
|
||||||
*zptr = z[i];
|
|
||||||
passed++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer or mask */
|
|
||||||
passed = n;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_NEVER:
|
|
||||||
for (i=0;i<n;i++) {
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
;
|
|
||||||
} /*switch*/
|
|
||||||
|
|
||||||
if(passed)
|
|
||||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x,bottom-y,GR_LFB_SRC_FMT_ZA16,n,1,0,depthdata);
|
|
||||||
|
|
||||||
return passed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
|
||||||
GLuint n, const GLint x[], const GLint y[],
|
void fxDDReadDepthPixels(GLcontext *ctx, GLuint n,
|
||||||
const GLdepth z[], GLubyte mask[])
|
const GLint x[], const GLint y[], GLdepth depth[])
|
||||||
{
|
{
|
||||||
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
|
||||||
GLdepth zval;
|
|
||||||
GLuint i;
|
|
||||||
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
GLint bottom=fxMesa->height+fxMesa->y_offset-1;
|
||||||
|
GLuint i;
|
||||||
|
|
||||||
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
if (MESA_VERBOSE&VERBOSE_DRIVER) {
|
||||||
fprintf(stderr,"fxmesa: fxDDDepthTestPixelsGeneric(...)\n");
|
fprintf(stderr,"fxmesa: fxDDReadDepthSpanInt(...)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* switch cases ordered from most frequent to less frequent */
|
|
||||||
switch (ctx->Depth.Func) {
|
for (i = 0; i < n; i++) {
|
||||||
case GL_LESS:
|
int xpos = x[i] + fxMesa->x_offset;
|
||||||
if (ctx->Depth.Mask) {
|
int ypos = bottom - y[i];
|
||||||
/* Update Z buffer */
|
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,xpos,ypos,1,1,0,&depth[i]);
|
||||||
for (i=0; i<n; i++) {
|
}
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] < zval) {
|
|
||||||
/* pass */
|
|
||||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
|
||||||
} else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] < zval) {
|
|
||||||
/* pass */
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_LEQUAL:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] <= zval) {
|
|
||||||
/* pass */
|
|
||||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
|
||||||
} else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] <= zval) {
|
|
||||||
/* pass */
|
|
||||||
} else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_GEQUAL:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] >= zval) {
|
|
||||||
/* pass */
|
|
||||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
|
||||||
} else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] >= zval) {
|
|
||||||
/* pass */
|
|
||||||
} else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_GREATER:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] > zval) {
|
|
||||||
/* pass */
|
|
||||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
|
||||||
} else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] > zval) {
|
|
||||||
/* pass */
|
|
||||||
} else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_NOTEQUAL:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] != zval) {
|
|
||||||
/* pass */
|
|
||||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
|
||||||
} else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] != zval) {
|
|
||||||
/* pass */
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_EQUAL:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] == zval) {
|
|
||||||
/* pass */
|
|
||||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
|
||||||
} else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
FX_grLfbReadRegion(GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],1,1,0,&zval);
|
|
||||||
if (z[i] == zval) {
|
|
||||||
/* pass */
|
|
||||||
} else {
|
|
||||||
/* fail */
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_ALWAYS:
|
|
||||||
if (ctx->Depth.Mask) {
|
|
||||||
/* Update Z buffer */
|
|
||||||
for (i=0; i<n; i++) {
|
|
||||||
if (mask[i]) {
|
|
||||||
writeRegionClipped(fxMesa, GR_BUFFER_AUXBUFFER,x[i]+fxMesa->x_offset,bottom-y[i],GR_LFB_SRC_FMT_ZA16,1,1,0,(void*)&z[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Don't update Z buffer or mask */
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GL_NEVER:
|
|
||||||
/* depth test never passes */
|
|
||||||
for (i=0;i<n;i++) {
|
|
||||||
mask[i] = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
;
|
|
||||||
} /*switch*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -636,22 +636,19 @@ extern GLboolean fxDDColorMask(GLcontext *ctx,
|
||||||
GLboolean r, GLboolean g,
|
GLboolean r, GLboolean g,
|
||||||
GLboolean b, GLboolean a );
|
GLboolean b, GLboolean a );
|
||||||
|
|
||||||
extern GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
|
extern void fxDDWriteDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||||
GLuint n, GLint x, GLint y,
|
const GLdepth depth[], const GLubyte mask[]);
|
||||||
const GLdepth z[],
|
|
||||||
GLubyte mask[]);
|
|
||||||
|
|
||||||
extern void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
|
extern void fxDDReadDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||||
GLuint n,
|
GLdepth depth[]);
|
||||||
const GLint x[], const GLint y[],
|
|
||||||
const GLdepth z[], GLubyte mask[]);
|
|
||||||
|
|
||||||
extern void fxDDReadDepthSpanFloat(GLcontext *ctx,
|
extern void fxDDWriteDepthPixels(GLcontext *ctx, GLuint n,
|
||||||
GLuint n, GLint x, GLint y, GLfloat depth[]);
|
const GLint x[], const GLint y[],
|
||||||
|
const GLdepth depth[], const GLubyte mask[]);
|
||||||
extern void fxDDReadDepthSpanInt(GLcontext *ctx,
|
|
||||||
GLuint n, GLint x, GLint y, GLdepth depth[]);
|
|
||||||
|
|
||||||
|
extern void fxDDReadDepthPixels(GLcontext *ctx, GLuint n,
|
||||||
|
const GLint x[], const GLint y[],
|
||||||
|
GLdepth depth[]);
|
||||||
|
|
||||||
extern void fxDDFastPath( struct vertex_buffer *VB );
|
extern void fxDDFastPath( struct vertex_buffer *VB );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue