diff options
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r-- | src/mesa/swrast/s_aaline.h | 2 | ||||
-rw-r--r-- | src/mesa/swrast/s_aatriangle.c | 3 | ||||
-rw-r--r-- | src/mesa/swrast/s_aatriangle.h | 2 | ||||
-rw-r--r-- | src/mesa/swrast/s_accum.h | 3 | ||||
-rw-r--r-- | src/mesa/swrast/s_alpha.h | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_atifragshader.h | 2 | ||||
-rw-r--r-- | src/mesa/swrast/s_bitmap.c | 1 | ||||
-rw-r--r-- | src/mesa/swrast/s_blend.c | 92 | ||||
-rw-r--r-- | src/mesa/swrast/s_blend.h | 5 | ||||
-rw-r--r-- | src/mesa/swrast/s_depth.h | 5 | ||||
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 1 | ||||
-rw-r--r-- | src/mesa/swrast/s_fog.h | 3 | ||||
-rw-r--r-- | src/mesa/swrast/s_fragprog.h | 3 | ||||
-rw-r--r-- | src/mesa/swrast/s_logic.h | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_masking.h | 5 | ||||
-rw-r--r-- | src/mesa/swrast/s_readpix.c | 2 | ||||
-rw-r--r-- | src/mesa/swrast/s_span.h | 7 | ||||
-rw-r--r-- | src/mesa/swrast/s_texcombine.c | 5 | ||||
-rw-r--r-- | src/mesa/swrast/s_texcombine.h | 3 | ||||
-rw-r--r-- | src/mesa/swrast/s_texfilter.c | 68 | ||||
-rw-r--r-- | src/mesa/swrast/s_texfilter.h | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_triangle.c | 7 | ||||
-rw-r--r-- | src/mesa/swrast/s_trispan.h | 31 |
23 files changed, 127 insertions, 135 deletions
diff --git a/src/mesa/swrast/s_aaline.h b/src/mesa/swrast/s_aaline.h index f7d92c5241..74d5518e17 100644 --- a/src/mesa/swrast/s_aaline.h +++ b/src/mesa/swrast/s_aaline.h @@ -28,7 +28,7 @@ #define S_AALINE_H -#include "main/mtypes.h" +struct gl_context; extern void diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c index c597808e40..2c02a01327 100644 --- a/src/mesa/swrast/s_aatriangle.c +++ b/src/mesa/swrast/s_aatriangle.c @@ -33,6 +33,7 @@ #include "main/colormac.h" #include "main/macros.h" #include "main/imports.h" +#include "main/state.h" #include "s_aatriangle.h" #include "s_context.h" #include "s_span.h" @@ -305,7 +306,7 @@ _swrast_set_aa_triangle_function(struct gl_context *ctx) if (ctx->Texture._EnabledCoordUnits != 0 || ctx->FragmentProgram._Current || swrast->_FogEnabled - || NEED_SECONDARY_COLOR(ctx)) { + || _mesa_need_secondary_color(ctx)) { SWRAST_CONTEXT(ctx)->Triangle = general_aa_tri; } else { diff --git a/src/mesa/swrast/s_aatriangle.h b/src/mesa/swrast/s_aatriangle.h index 746e456f5f..e40efb1985 100644 --- a/src/mesa/swrast/s_aatriangle.h +++ b/src/mesa/swrast/s_aatriangle.h @@ -28,7 +28,7 @@ #define S_AATRIANGLE_H -#include "main/mtypes.h" +struct gl_context; extern void diff --git a/src/mesa/swrast/s_accum.h b/src/mesa/swrast/s_accum.h index 071644b64f..1ad7d32952 100644 --- a/src/mesa/swrast/s_accum.h +++ b/src/mesa/swrast/s_accum.h @@ -27,7 +27,8 @@ #define S_ACCUM_H -#include "main/mtypes.h" +struct gl_context; +struct gl_renderbuffer; extern void diff --git a/src/mesa/swrast/s_alpha.h b/src/mesa/swrast/s_alpha.h index 7cd6d800b2..fca209a446 100644 --- a/src/mesa/swrast/s_alpha.h +++ b/src/mesa/swrast/s_alpha.h @@ -1,4 +1,3 @@ - /* * Mesa 3-D graphics library * Version: 4.1 @@ -28,9 +27,10 @@ #define S_ALPHA_H -#include "main/mtypes.h" +#include "main/glheader.h" #include "s_span.h" +struct gl_context; extern GLint _swrast_alpha_test( const struct gl_context *ctx, SWspan *span ); diff --git a/src/mesa/swrast/s_atifragshader.h b/src/mesa/swrast/s_atifragshader.h index 39a6e64ed9..10aaaa592c 100644 --- a/src/mesa/swrast/s_atifragshader.h +++ b/src/mesa/swrast/s_atifragshader.h @@ -27,9 +27,9 @@ #define S_ATIFRAGSHADER_H -#include "main/mtypes.h" #include "s_span.h" +struct gl_context; extern void _swrast_exec_fragment_shader( struct gl_context *ctx, SWspan *span ); diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 21488d3ba3..18f1c1866b 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -33,6 +33,7 @@ #include "main/condrender.h" #include "main/image.h" #include "main/macros.h" +#include "main/pbo.h" #include "s_context.h" #include "s_span.h" diff --git a/src/mesa/swrast/s_blend.c b/src/mesa/swrast/s_blend.c index d61baba0f3..793921250a 100644 --- a/src/mesa/swrast/s_blend.c +++ b/src/mesa/swrast/s_blend.c @@ -75,10 +75,10 @@ blend_noop(struct gl_context *ctx, GLuint n, const GLubyte mask[], { GLint bytes; - ASSERT(ctx->Color.BlendEquationRGB == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendEquationA == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendSrcRGB == GL_ZERO); - ASSERT(ctx->Color.BlendDstRGB == GL_ONE); + ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].SrcRGB == GL_ZERO); + ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE); (void) ctx; /* just memcpy */ @@ -101,10 +101,10 @@ static void _BLENDAPI blend_replace(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { - ASSERT(ctx->Color.BlendEquationRGB == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendEquationA == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendSrcRGB == GL_ONE); - ASSERT(ctx->Color.BlendDstRGB == GL_ZERO); + ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].SrcRGB == GL_ONE); + ASSERT(ctx->Color.Blend[0].DstRGB == GL_ZERO); (void) ctx; (void) n; (void) mask; @@ -125,12 +125,12 @@ blend_transparency_ubyte(struct gl_context *ctx, GLuint n, const GLubyte mask[], const GLubyte (*dest)[4] = (const GLubyte (*)[4]) dst; GLuint i; - ASSERT(ctx->Color.BlendEquationRGB == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendEquationA == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendSrcRGB == GL_SRC_ALPHA); - ASSERT(ctx->Color.BlendSrcA == GL_SRC_ALPHA); - ASSERT(ctx->Color.BlendDstRGB == GL_ONE_MINUS_SRC_ALPHA); - ASSERT(ctx->Color.BlendDstA == GL_ONE_MINUS_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA); ASSERT(chanType == GL_UNSIGNED_BYTE); (void) ctx; @@ -170,12 +170,12 @@ blend_transparency_ushort(struct gl_context *ctx, GLuint n, const GLubyte mask[] const GLushort (*dest)[4] = (const GLushort (*)[4]) dst; GLuint i; - ASSERT(ctx->Color.BlendEquationRGB == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendEquationA == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendSrcRGB == GL_SRC_ALPHA); - ASSERT(ctx->Color.BlendSrcA == GL_SRC_ALPHA); - ASSERT(ctx->Color.BlendDstRGB == GL_ONE_MINUS_SRC_ALPHA); - ASSERT(ctx->Color.BlendDstA == GL_ONE_MINUS_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA); ASSERT(chanType == GL_UNSIGNED_SHORT); (void) ctx; @@ -208,12 +208,12 @@ blend_transparency_float(struct gl_context *ctx, GLuint n, const GLubyte mask[], const GLfloat (*dest)[4] = (const GLfloat (*)[4]) dst; GLuint i; - ASSERT(ctx->Color.BlendEquationRGB == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendEquationA == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendSrcRGB == GL_SRC_ALPHA); - ASSERT(ctx->Color.BlendSrcA == GL_SRC_ALPHA); - ASSERT(ctx->Color.BlendDstRGB == GL_ONE_MINUS_SRC_ALPHA); - ASSERT(ctx->Color.BlendDstA == GL_ONE_MINUS_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].SrcRGB == GL_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].SrcA == GL_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE_MINUS_SRC_ALPHA); + ASSERT(ctx->Color.Blend[0].DstA == GL_ONE_MINUS_SRC_ALPHA); ASSERT(chanType == GL_FLOAT); (void) ctx; @@ -248,10 +248,10 @@ blend_add(struct gl_context *ctx, GLuint n, const GLubyte mask[], { GLuint i; - ASSERT(ctx->Color.BlendEquationRGB == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendEquationA == GL_FUNC_ADD); - ASSERT(ctx->Color.BlendSrcRGB == GL_ONE); - ASSERT(ctx->Color.BlendDstRGB == GL_ONE); + ASSERT(ctx->Color.Blend[0].EquationRGB == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].EquationA == GL_FUNC_ADD); + ASSERT(ctx->Color.Blend[0].SrcRGB == GL_ONE); + ASSERT(ctx->Color.Blend[0].DstRGB == GL_ONE); (void) ctx; if (chanType == GL_UNSIGNED_BYTE) { @@ -313,8 +313,8 @@ blend_min(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { GLuint i; - ASSERT(ctx->Color.BlendEquationRGB == GL_MIN); - ASSERT(ctx->Color.BlendEquationA == GL_MIN); + ASSERT(ctx->Color.Blend[0].EquationRGB == GL_MIN); + ASSERT(ctx->Color.Blend[0].EquationA == GL_MIN); (void) ctx; if (chanType == GL_UNSIGNED_BYTE) { @@ -366,8 +366,8 @@ blend_max(struct gl_context *ctx, GLuint n, const GLubyte mask[], GLvoid *src, const GLvoid *dst, GLenum chanType) { GLuint i; - ASSERT(ctx->Color.BlendEquationRGB == GL_MAX); - ASSERT(ctx->Color.BlendEquationA == GL_MAX); + ASSERT(ctx->Color.Blend[0].EquationRGB == GL_MAX); + ASSERT(ctx->Color.Blend[0].EquationA == GL_MAX); (void) ctx; if (chanType == GL_UNSIGNED_BYTE) { @@ -500,7 +500,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[], */ /* Source RGB factor */ - switch (ctx->Color.BlendSrcRGB) { + switch (ctx->Color.Blend[0].SrcRGB) { case GL_ZERO: sR = sG = sB = 0.0F; break; @@ -570,7 +570,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[], } /* Source Alpha factor */ - switch (ctx->Color.BlendSrcA) { + switch (ctx->Color.Blend[0].SrcA) { case GL_ZERO: sA = 0.0F; break; @@ -624,7 +624,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[], } /* Dest RGB factor */ - switch (ctx->Color.BlendDstRGB) { + switch (ctx->Color.Blend[0].DstRGB) { case GL_ZERO: dR = dG = dB = 0.0F; break; @@ -687,7 +687,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[], } /* Dest Alpha factor */ - switch (ctx->Color.BlendDstA) { + switch (ctx->Color.Blend[0].DstA) { case GL_ZERO: dA = 0.0F; break; @@ -738,7 +738,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[], } /* compute the blended RGB */ - switch (ctx->Color.BlendEquationRGB) { + switch (ctx->Color.Blend[0].EquationRGB) { case GL_FUNC_ADD: r = Rs * sR + Rd * dR; g = Gs * sG + Gd * dG; @@ -775,7 +775,7 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[], } /* compute the blended alpha */ - switch (ctx->Color.BlendEquationA) { + switch (ctx->Color.Blend[0].EquationA) { case GL_FUNC_ADD: a = As * sA + Ad * dA; break; @@ -907,13 +907,13 @@ void _swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - const GLenum eq = ctx->Color.BlendEquationRGB; - const GLenum srcRGB = ctx->Color.BlendSrcRGB; - const GLenum dstRGB = ctx->Color.BlendDstRGB; - const GLenum srcA = ctx->Color.BlendSrcA; - const GLenum dstA = ctx->Color.BlendDstA; + const GLenum eq = ctx->Color.Blend[0].EquationRGB; + const GLenum srcRGB = ctx->Color.Blend[0].SrcRGB; + const GLenum dstRGB = ctx->Color.Blend[0].DstRGB; + const GLenum srcA = ctx->Color.Blend[0].SrcA; + const GLenum dstA = ctx->Color.Blend[0].DstA; - if (ctx->Color.BlendEquationRGB != ctx->Color.BlendEquationA) { + if (ctx->Color.Blend[0].EquationRGB != ctx->Color.Blend[0].EquationA) { swrast->BlendFunc = blend_general; } else if (eq == GL_MIN) { diff --git a/src/mesa/swrast/s_blend.h b/src/mesa/swrast/s_blend.h index 8b06dd5031..69cd89e7ac 100644 --- a/src/mesa/swrast/s_blend.h +++ b/src/mesa/swrast/s_blend.h @@ -27,9 +27,12 @@ #define S_BLEND_H -#include "main/mtypes.h" +#include "main/glheader.h" #include "s_span.h" +struct gl_context; +struct gl_renderbuffer; + extern void _swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span); diff --git a/src/mesa/swrast/s_depth.h b/src/mesa/swrast/s_depth.h index e5dae7ef86..44820ac8f7 100644 --- a/src/mesa/swrast/s_depth.h +++ b/src/mesa/swrast/s_depth.h @@ -27,9 +27,12 @@ #define S_DEPTH_H -#include "main/mtypes.h" +#include "main/glheader.h" #include "s_span.h" +struct gl_context; +struct gl_renderbuffer; + extern GLuint _swrast_depth_test_span( struct gl_context *ctx, SWspan *span); diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 4d0666898b..11c63457f5 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -31,6 +31,7 @@ #include "main/imports.h" #include "main/macros.h" #include "main/pack.h" +#include "main/pbo.h" #include "main/pixeltransfer.h" #include "main/state.h" diff --git a/src/mesa/swrast/s_fog.h b/src/mesa/swrast/s_fog.h index ebc3513f49..9f93b70508 100644 --- a/src/mesa/swrast/s_fog.h +++ b/src/mesa/swrast/s_fog.h @@ -28,9 +28,10 @@ #define S_FOG_H -#include "main/mtypes.h" +#include "main/glheader.h" #include "s_span.h" +struct gl_context; extern GLfloat _swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z); diff --git a/src/mesa/swrast/s_fragprog.h b/src/mesa/swrast/s_fragprog.h index 689d3fc82e..62a6836176 100644 --- a/src/mesa/swrast/s_fragprog.h +++ b/src/mesa/swrast/s_fragprog.h @@ -27,9 +27,10 @@ #define S_FRAGPROG_H -#include "main/mtypes.h" #include "s_span.h" +struct gl_context; + extern void _swrast_exec_fragment_program(struct gl_context *ctx, SWspan *span); diff --git a/src/mesa/swrast/s_logic.h b/src/mesa/swrast/s_logic.h index 95c7fe3e15..0a3adfca5f 100644 --- a/src/mesa/swrast/s_logic.h +++ b/src/mesa/swrast/s_logic.h @@ -27,9 +27,11 @@ #define S_LOGIC_H -#include "main/mtypes.h" #include "s_span.h" +struct gl_context; +struct gl_renderbuffer; + extern void _swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span); diff --git a/src/mesa/swrast/s_masking.h b/src/mesa/swrast/s_masking.h index 3712c82163..5124509a04 100644 --- a/src/mesa/swrast/s_masking.h +++ b/src/mesa/swrast/s_masking.h @@ -27,9 +27,12 @@ #define S_MASKING_H -#include "main/mtypes.h" +#include "main/glheader.h" #include "s_span.h" +struct gl_context; +struct gl_renderbuffer; + extern void _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 9fe0752a37..5c8d7e9c5c 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -24,7 +24,6 @@ #include "main/glheader.h" -#include "main/bufferobj.h" #include "main/colormac.h" #include "main/feedback.h" #include "main/formats.h" @@ -32,6 +31,7 @@ #include "main/imports.h" #include "main/macros.h" #include "main/pack.h" +#include "main/pbo.h" #include "main/state.h" #include "s_context.h" diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h index 18e275ec8a..afafbe09ac 100644 --- a/src/mesa/swrast/s_span.h +++ b/src/mesa/swrast/s_span.h @@ -28,7 +28,12 @@ #define S_SPAN_H -#include "swrast.h" +#include "main/config.h" +#include "main/glheader.h" +#include "main/mtypes.h" + +struct gl_context; +struct gl_renderbuffer; /** diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 99c44413fb..0c8cc9ff37 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -713,11 +713,6 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) swrast->TextureSample[unit]( ctx, texUnit->_Current, span->end, texcoords, lambda, texels ); - /* GL_SGI_texture_color_table */ - if (texUnit->ColorTableEnabled) { - _mesa_lookup_rgba_float(&texUnit->ColorTable, span->end, texels); - } - /* GL_EXT_texture_swizzle */ if (curObj->_Swizzle != SWIZZLE_NOOP) { swizzle_texels(curObj->_Swizzle, span->end, texels); diff --git a/src/mesa/swrast/s_texcombine.h b/src/mesa/swrast/s_texcombine.h index 5f47ebecbf..11049d86b2 100644 --- a/src/mesa/swrast/s_texcombine.h +++ b/src/mesa/swrast/s_texcombine.h @@ -27,9 +27,10 @@ #define S_TEXCOMBINE_H -#include "main/mtypes.h" #include "s_span.h" +struct gl_context; + extern void _swrast_texture_span( struct gl_context *ctx, SWspan *span ); diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 539d878ddb..42785400c0 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -27,7 +27,6 @@ #include "main/context.h" #include "main/colormac.h" #include "main/imports.h" -#include "main/texformat.h" #include "s_context.h" #include "s_texfilter.h" @@ -2919,51 +2918,51 @@ shadow_compare4(GLenum function, GLfloat coord, switch (function) { case GL_LEQUAL: - if (depth00 <= coord) luminance -= d; - if (depth01 <= coord) luminance -= d; - if (depth10 <= coord) luminance -= d; - if (depth11 <= coord) luminance -= d; + if (coord > depth00) luminance -= d; + if (coord > depth01) luminance -= d; + if (coord > depth10) luminance -= d; + if (coord > depth11) luminance -= d; return luminance; case GL_GEQUAL: - if (depth00 >= coord) luminance -= d; - if (depth01 >= coord) luminance -= d; - if (depth10 >= coord) luminance -= d; - if (depth11 >= coord) luminance -= d; + if (coord < depth00) luminance -= d; + if (coord < depth01) luminance -= d; + if (coord < depth10) luminance -= d; + if (coord < depth11) luminance -= d; return luminance; case GL_LESS: - if (depth00 < coord) luminance -= d; - if (depth01 < coord) luminance -= d; - if (depth10 < coord) luminance -= d; - if (depth11 < coord) luminance -= d; + if (coord >= depth00) luminance -= d; + if (coord >= depth01) luminance -= d; + if (coord >= depth10) luminance -= d; + if (coord >= depth11) luminance -= d; return luminance; case GL_GREATER: - if (depth00 > coord) luminance -= d; - if (depth01 > coord) luminance -= d; - if (depth10 > coord) luminance -= d; - if (depth11 > coord) luminance -= d; + if (coord <= depth00) luminance -= d; + if (coord <= depth01) luminance -= d; + if (coord <= depth10) luminance -= d; + if (coord <= depth11) luminance -= d; return luminance; case GL_EQUAL: - if (depth00 == coord) luminance -= d; - if (depth01 == coord) luminance -= d; - if (depth10 == coord) luminance -= d; - if (depth11 == coord) luminance -= d; + if (coord != depth00) luminance -= d; + if (coord != depth01) luminance -= d; + if (coord != depth10) luminance -= d; + if (coord != depth11) luminance -= d; return luminance; case GL_NOTEQUAL: - if (depth00 != coord) luminance -= d; - if (depth01 != coord) luminance -= d; - if (depth10 != coord) luminance -= d; - if (depth11 != coord) luminance -= d; + if (coord == depth00) luminance -= d; + if (coord == depth01) luminance -= d; + if (coord == depth10) luminance -= d; + if (coord == depth11) luminance -= d; return luminance; case GL_ALWAYS: - return 0.0; + return 1.0F; case GL_NEVER: return ambient; case GL_NONE: /* ordinary bilinear filtering */ return lerp_2d(wi, wj, depth00, depth10, depth01, depth11); default: - _mesa_problem(NULL, "Bad compare func in sample_depth_texture"); - return 0.0F; + _mesa_problem(NULL, "Bad compare func in sample_compare4"); + return ambient; } } @@ -3031,7 +3030,7 @@ sample_depth_texture( struct gl_context *ctx, if (tObj->MagFilter == GL_NEAREST) { GLuint i; for (i = 0; i < n; i++) { - GLfloat depthSample; + GLfloat depthSample, depthRef; GLint col, row, slice; nearest_texcoord(tObj, level, texcoords[i], &col, &row, &slice); @@ -3044,8 +3043,9 @@ sample_depth_texture( struct gl_context *ctx, depthSample = tObj->BorderColor.f[0]; } - result = shadow_compare(function, texcoords[i][compare_coord], - depthSample, ambient); + depthRef = CLAMP(texcoords[i][compare_coord], 0.0F, 1.0F); + + result = shadow_compare(function, depthRef, depthSample, ambient); switch (tObj->DepthMode) { case GL_LUMINANCE: @@ -3069,7 +3069,7 @@ sample_depth_texture( struct gl_context *ctx, GLuint i; ASSERT(tObj->MagFilter == GL_LINEAR); for (i = 0; i < n; i++) { - GLfloat depth00, depth01, depth10, depth11; + GLfloat depth00, depth01, depth10, depth11, depthRef; GLint i0, i1, j0, j1; GLint slice; GLfloat wi, wj; @@ -3135,7 +3135,9 @@ sample_depth_texture( struct gl_context *ctx, } } - result = shadow_compare4(function, texcoords[i][compare_coord], + depthRef = CLAMP(texcoords[i][compare_coord], 0.0F, 1.0F); + + result = shadow_compare4(function, depthRef, depth00, depth01, depth10, depth11, ambient, wi, wj); diff --git a/src/mesa/swrast/s_texfilter.h b/src/mesa/swrast/s_texfilter.h index 34520f2294..69f2d80003 100644 --- a/src/mesa/swrast/s_texfilter.h +++ b/src/mesa/swrast/s_texfilter.h @@ -27,9 +27,11 @@ #define S_TEXFILTER_H -#include "main/mtypes.h" #include "s_context.h" +struct gl_context; +struct gl_texture_object; + extern texture_sample_func _swrast_choose_texture_sample_func( struct gl_context *ctx, diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 85513e1f20..d07a4ef751 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -34,7 +34,8 @@ #include "main/colormac.h" #include "main/imports.h" #include "main/macros.h" -#include "main/texformat.h" +#include "main/mtypes.h" +#include "main/state.h" #include "program/prog_instruction.h" #include "s_aatriangle.h" @@ -1032,7 +1033,7 @@ _swrast_choose_triangle( struct gl_context *ctx ) if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram._Current || ctx->ATIFragmentShader._Enabled || - NEED_SECONDARY_COLOR(ctx) || + _mesa_need_secondary_color(ctx) || swrast->_FogEnabled) { /* Ugh, we do a _lot_ of tests to pick the best textured tri func */ const struct gl_texture_object *texObj2D; @@ -1113,7 +1114,7 @@ _swrast_choose_triangle( struct gl_context *ctx ) } else { ASSERT(!swrast->_FogEnabled); - ASSERT(!NEED_SECONDARY_COLOR(ctx)); + ASSERT(!_mesa_need_secondary_color(ctx)); if (ctx->Light.ShadeModel==GL_SMOOTH) { /* smooth shaded, no texturing, stippled or some raster ops */ #if CHAN_BITS != 8 diff --git a/src/mesa/swrast/s_trispan.h b/src/mesa/swrast/s_trispan.h deleted file mode 100644 index 15207e863e..0000000000 --- a/src/mesa/swrast/s_trispan.h +++ /dev/null @@ -1,31 +0,0 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.5 - * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef S_TRISPAN_H -#define S_TRISPAN_H - - -#endif /* S_TRISPAN_H */ |