summaryrefslogtreecommitdiff
path: root/xc/extras/Mesa/src/span.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/extras/Mesa/src/span.c')
-rw-r--r--xc/extras/Mesa/src/span.c113
1 files changed, 66 insertions, 47 deletions
diff --git a/xc/extras/Mesa/src/span.c b/xc/extras/Mesa/src/span.c
index 38f4449f1..653d0dc12 100644
--- a/xc/extras/Mesa/src/span.c
+++ b/xc/extras/Mesa/src/span.c
@@ -148,10 +148,10 @@ static void multi_write_index_span( GLcontext *ctx, GLuint n,
/* make copy of incoming indexes */
MEMCPY( indexTmp, indexes, n * sizeof(GLuint) );
if (ctx->Color.SWLogicOpEnabled) {
- gl_logicop_ci_span( ctx, n, x, y, indexTmp, mask );
+ _mesa_logicop_ci_span( ctx, n, x, y, indexTmp, mask );
}
if (ctx->Color.SWmasking) {
- gl_mask_index_span( ctx, n, x, y, indexTmp );
+ _mesa_mask_index_span( ctx, n, x, y, indexTmp );
}
(*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexTmp, mask );
}
@@ -218,7 +218,7 @@ void gl_write_index_span( GLcontext *ctx,
if (ctx->Stencil.Enabled) {
/* first stencil test */
- if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) {
+ if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) {
return;
}
}
@@ -227,6 +227,9 @@ void gl_write_index_span( GLcontext *ctx,
if (_mesa_depth_test_span( ctx, n, x, y, z, mask )==0) return;
}
+ /* if we get here, something passed the depth test */
+ ctx->OcclusionResult = GL_TRUE;
+
if (ctx->RasterMask & MULTI_DRAW_BIT) {
/* draw to zero or two or more buffers */
multi_write_index_span( ctx, n, x, y, index, mask );
@@ -234,10 +237,10 @@ void gl_write_index_span( GLcontext *ctx,
else {
/* normal situation: draw to exactly one buffer */
if (ctx->Color.SWLogicOpEnabled) {
- gl_logicop_ci_span( ctx, n, x, y, index, mask );
+ _mesa_logicop_ci_span( ctx, n, x, y, index, mask );
}
if (ctx->Color.SWmasking) {
- gl_mask_index_span( ctx, n, x, y, index );
+ _mesa_mask_index_span( ctx, n, x, y, index );
}
/* write pixels */
@@ -278,7 +281,7 @@ void gl_write_monoindex_span( GLcontext *ctx,
if (ctx->Stencil.Enabled) {
/* first stencil test */
- if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) {
+ if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) {
return;
}
}
@@ -287,6 +290,9 @@ void gl_write_monoindex_span( GLcontext *ctx,
if (_mesa_depth_test_span( ctx, n, x, y, z, mask )==0) return;
}
+ /* if we get here, something passed the depth test */
+ ctx->OcclusionResult = GL_TRUE;
+
if (ctx->Color.DrawBuffer == GL_NONE) {
/* write no pixels */
return;
@@ -305,11 +311,11 @@ void gl_write_monoindex_span( GLcontext *ctx,
}
if (ctx->Color.SWLogicOpEnabled) {
- gl_logicop_ci_span( ctx, n, x, y, indexes, mask );
+ _mesa_logicop_ci_span( ctx, n, x, y, indexes, mask );
}
if (ctx->Color.SWmasking) {
- gl_mask_index_span( ctx, n, x, y, indexes );
+ _mesa_mask_index_span( ctx, n, x, y, indexes );
}
if (ctx->RasterMask & MULTI_DRAW_BIT) {
@@ -319,10 +325,10 @@ void gl_write_monoindex_span( GLcontext *ctx,
else {
/* normal situation: draw to exactly one buffer */
if (ctx->Color.SWLogicOpEnabled) {
- gl_logicop_ci_span( ctx, n, x, y, indexes, mask );
+ _mesa_logicop_ci_span( ctx, n, x, y, indexes, mask );
}
if (ctx->Color.SWmasking) {
- gl_mask_index_span( ctx, n, x, y, indexes );
+ _mesa_mask_index_span( ctx, n, x, y, indexes );
}
(*ctx->Driver.WriteCI32Span)( ctx, n, x, y, indexes, mask );
}
@@ -386,20 +392,20 @@ static void multi_write_rgba_span( GLcontext *ctx, GLuint n,
MEMCPY( rgbaTmp, rgba, 4 * n * sizeof(GLubyte) );
if (ctx->Color.SWLogicOpEnabled) {
- gl_logicop_rgba_span( ctx, n, x, y, rgbaTmp, mask );
+ _mesa_logicop_rgba_span( ctx, n, x, y, rgbaTmp, mask );
}
else if (ctx->Color.BlendEnabled) {
_mesa_blend_span( ctx, n, x, y, rgbaTmp, mask );
}
if (ctx->Color.SWmasking) {
- gl_mask_rgba_span( ctx, n, x, y, rgbaTmp );
+ _mesa_mask_rgba_span( ctx, n, x, y, rgbaTmp );
}
(*ctx->Driver.WriteRGBASpan)( ctx, n, x, y,
(const GLubyte (*)[4]) rgbaTmp, mask );
if (ctx->RasterMask & ALPHABUF_BIT) {
- gl_write_alpha_span( ctx, n, x, y,
- (const GLubyte (*)[4])rgbaTmp, mask );
+ _mesa_write_alpha_span( ctx, n, x, y,
+ (const GLubyte (*)[4])rgbaTmp, mask );
}
}
}
@@ -470,7 +476,7 @@ void gl_write_rgba_span( GLcontext *ctx,
if (ctx->Stencil.Enabled) {
/* first stencil test */
- if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) {
+ if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) {
return;
}
write_all = GL_FALSE;
@@ -486,6 +492,9 @@ void gl_write_rgba_span( GLcontext *ctx,
}
}
+ /* if we get here, something passed the depth test */
+ ctx->OcclusionResult = GL_TRUE;
+
if (ctx->RasterMask & MULTI_DRAW_BIT) {
multi_write_rgba_span( ctx, n, x, y,
(const GLubyte (*)[4]) rgba,
@@ -495,7 +504,7 @@ void gl_write_rgba_span( GLcontext *ctx,
/* normal: write to exactly one buffer */
/* logic op or blending */
if (ctx->Color.SWLogicOpEnabled) {
- gl_logicop_rgba_span( ctx, n, x, y, rgba, mask );
+ _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask );
}
else if (ctx->Color.BlendEnabled) {
_mesa_blend_span( ctx, n, x, y, rgba, mask );
@@ -503,7 +512,7 @@ void gl_write_rgba_span( GLcontext *ctx,
/* Color component masking */
if (ctx->Color.SWmasking) {
- gl_mask_rgba_span( ctx, n, x, y, rgba );
+ _mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
/* write pixels */
@@ -512,9 +521,9 @@ void gl_write_rgba_span( GLcontext *ctx,
write_all ? Null : mask );
if (ctx->RasterMask & ALPHABUF_BIT) {
- gl_write_alpha_span( ctx, n, x, y,
- (const GLubyte (*)[4]) rgba,
- write_all ? Null : mask );
+ _mesa_write_alpha_span( ctx, n, x, y,
+ (const GLubyte (*)[4]) rgba,
+ write_all ? Null : mask );
}
}
@@ -580,7 +589,7 @@ void gl_write_monocolor_span( GLcontext *ctx,
if (ctx->Stencil.Enabled) {
/* first stencil test */
- if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) {
+ if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) {
return;
}
write_all = GL_FALSE;
@@ -596,6 +605,9 @@ void gl_write_monocolor_span( GLcontext *ctx,
}
}
+ /* if we get here, something passed the depth test */
+ ctx->OcclusionResult = GL_TRUE;
+
if (ctx->Color.DrawBuffer == GL_NONE) {
/* write no pixels */
return;
@@ -617,7 +629,7 @@ void gl_write_monocolor_span( GLcontext *ctx,
else {
/* normal: write to exactly one buffer */
if (ctx->Color.SWLogicOpEnabled) {
- gl_logicop_rgba_span( ctx, n, x, y, rgba, mask );
+ _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask );
}
else if (ctx->Color.BlendEnabled) {
_mesa_blend_span( ctx, n, x, y, rgba, mask );
@@ -625,7 +637,7 @@ void gl_write_monocolor_span( GLcontext *ctx,
/* Color component masking */
if (ctx->Color.SWmasking) {
- gl_mask_rgba_span( ctx, n, x, y, rgba );
+ _mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
/* write pixels */
@@ -633,9 +645,9 @@ void gl_write_monocolor_span( GLcontext *ctx,
(const GLubyte (*)[4]) rgba,
write_all ? Null : mask );
if (ctx->RasterMask & ALPHABUF_BIT) {
- gl_write_alpha_span( ctx, n, x, y,
- (const GLubyte (*)[4]) rgba,
- write_all ? Null : mask );
+ _mesa_write_alpha_span( ctx, n, x, y,
+ (const GLubyte (*)[4]) rgba,
+ write_all ? Null : mask );
}
}
}
@@ -658,8 +670,8 @@ void gl_write_monocolor_span( GLcontext *ctx,
else {
(*ctx->Driver.WriteMonoRGBASpan)( ctx, n, x, y, mask );
if (ctx->RasterMask & ALPHABUF_BIT) {
- gl_write_mono_alpha_span( ctx, n, x, y, (GLubyte) color[ACOMP],
- write_all ? Null : mask );
+ _mesa_write_mono_alpha_span( ctx, n, x, y, (GLubyte) color[ACOMP],
+ write_all ? Null : mask );
}
}
}
@@ -724,7 +736,7 @@ void gl_write_texture_span( GLcontext *ctx,
if (primitive==GL_BITMAP || (ctx->RasterMask & MULTI_DRAW_BIT)) {
/* must make a copy of the colors since they may be modified */
- MEMCPY(rgbaBackup, rgbaIn, 4 * sizeof(GLubyte));
+ MEMCPY(rgbaBackup, rgbaIn, 4 * n * sizeof(GLubyte));
rgba = rgbaBackup;
}
else {
@@ -732,7 +744,7 @@ void gl_write_texture_span( GLcontext *ctx,
}
/* Texture */
- ASSERT(ctx->Texture.Enabled);
+ ASSERT(ctx->Texture.ReallyEnabled);
gl_texture_pixels( ctx, 0, n, s, t, u, lambda, rgba );
/* Add base and specular colors */
@@ -769,7 +781,7 @@ void gl_write_texture_span( GLcontext *ctx,
if (ctx->Stencil.Enabled) {
/* first stencil test */
- if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) {
+ if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) {
return;
}
write_all = GL_FALSE;
@@ -785,6 +797,9 @@ void gl_write_texture_span( GLcontext *ctx,
}
}
+ /* if we get here, something passed the depth test */
+ ctx->OcclusionResult = GL_TRUE;
+
if (ctx->RasterMask & MULTI_DRAW_BIT) {
multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4])rgba,
write_all ? Null : mask );
@@ -792,20 +807,20 @@ void gl_write_texture_span( GLcontext *ctx,
else {
/* normal: write to exactly one buffer */
if (ctx->Color.SWLogicOpEnabled) {
- gl_logicop_rgba_span( ctx, n, x, y, rgba, mask );
+ _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask );
}
else if (ctx->Color.BlendEnabled) {
_mesa_blend_span( ctx, n, x, y, rgba, mask );
}
if (ctx->Color.SWmasking) {
- gl_mask_rgba_span( ctx, n, x, y, rgba );
+ _mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
(*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLubyte (*)[4])rgba,
write_all ? Null : mask );
if (ctx->RasterMask & ALPHABUF_BIT) {
- gl_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba,
- write_all ? Null : mask );
+ _mesa_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba,
+ write_all ? Null : mask );
}
}
}
@@ -848,7 +863,7 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits,
if (primitive==GL_BITMAP || (ctx->RasterMask & MULTI_DRAW_BIT)) {
/* must make a copy of the colors since they may be modified */
- MEMCPY(rgbaBackup, rgbaIn, 4 * sizeof(GLubyte));
+ MEMCPY(rgbaBackup, rgbaIn, 4 * n * sizeof(GLubyte));
rgba = rgbaBackup;
}
else {
@@ -856,7 +871,7 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits,
}
/* Texture */
- ASSERT(ctx->Texture.Enabled);
+ ASSERT(ctx->Texture.ReallyEnabled);
ASSERT(texUnits <= MAX_TEXTURE_UNITS);
for (i=0;i<texUnits;i++) {
gl_texture_pixels( ctx, i, n, s[i], t[i], u[i], lambda[i], rgba );
@@ -896,7 +911,7 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits,
if (ctx->Stencil.Enabled) {
/* first stencil test */
- if (gl_stencil_and_depth_test_span(ctx, n, x, y, z, mask) == GL_FALSE) {
+ if (_mesa_stencil_and_ztest_span(ctx, n, x, y, z, mask) == GL_FALSE) {
return;
}
write_all = GL_FALSE;
@@ -912,26 +927,30 @@ gl_write_multitexture_span( GLcontext *ctx, GLuint texUnits,
}
}
+ /* if we get here, something passed the depth test */
+ ctx->OcclusionResult = GL_TRUE;
+
if (ctx->RasterMask & MULTI_DRAW_BIT) {
- multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba, write_all ? Null : mask );
+ multi_write_rgba_span( ctx, n, x, y, (const GLubyte (*)[4]) rgba,
+ write_all ? Null : mask );
}
else {
/* normal: write to exactly one buffer */
if (ctx->Color.SWLogicOpEnabled) {
- gl_logicop_rgba_span( ctx, n, x, y, rgba, mask );
+ _mesa_logicop_rgba_span( ctx, n, x, y, rgba, mask );
}
else if (ctx->Color.BlendEnabled) {
_mesa_blend_span( ctx, n, x, y, rgba, mask );
}
if (ctx->Color.SWmasking) {
- gl_mask_rgba_span( ctx, n, x, y, rgba );
+ _mesa_mask_rgba_span( ctx, n, x, y, rgba );
}
(*ctx->Driver.WriteRGBASpan)( ctx, n, x, y, (const GLubyte (*)[4])rgba, write_all ? Null : mask );
if (ctx->RasterMask & ALPHABUF_BIT) {
- gl_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4])rgba,
- write_all ? Null : mask );
+ _mesa_write_alpha_span( ctx, n, x, y, (const GLubyte (*)[4])rgba,
+ write_all ? Null : mask );
}
}
}
@@ -950,7 +969,7 @@ void gl_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
|| x + (GLint) n < 0 || x >= buffer->Width) {
/* completely above, below, or right */
/* XXX maybe leave undefined? */
- MEMSET( rgba, 0, 4 * n * sizeof(GLubyte));
+ BZERO(rgba, 4 * n * sizeof(GLubyte));
}
else {
GLint skip, length;
@@ -982,8 +1001,8 @@ void gl_read_rgba_span( GLcontext *ctx, GLframebuffer *buffer,
}
(*ctx->Driver.ReadRGBASpan)( ctx, length, x + skip, y, rgba + skip );
- if (ctx->Visual->SoftwareAlpha) {
- gl_read_alpha_span( ctx, length, x + skip, y, rgba + skip );
+ if (buffer->UseSoftwareAlphaBuffers) {
+ _mesa_read_alpha_span( ctx, length, x + skip, y, rgba + skip );
}
}
}
@@ -1001,7 +1020,7 @@ void gl_read_index_span( GLcontext *ctx, GLframebuffer *buffer,
if (y < 0 || y >= buffer->Height
|| x + (GLint) n < 0 || x >= buffer->Width) {
/* completely above, below, or right */
- MEMSET(indx, 0, n * sizeof(GLuint));
+ BZERO(indx, n * sizeof(GLuint));
}
else {
GLint skip, length;