summaryrefslogtreecommitdiff
path: root/src/mesa/swrast
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_aaline.h2
-rw-r--r--src/mesa/swrast/s_aatriangle.c3
-rw-r--r--src/mesa/swrast/s_aatriangle.h2
-rw-r--r--src/mesa/swrast/s_accum.h3
-rw-r--r--src/mesa/swrast/s_alpha.h4
-rw-r--r--src/mesa/swrast/s_atifragshader.h2
-rw-r--r--src/mesa/swrast/s_bitmap.c1
-rw-r--r--src/mesa/swrast/s_blend.c92
-rw-r--r--src/mesa/swrast/s_blend.h5
-rw-r--r--src/mesa/swrast/s_depth.h5
-rw-r--r--src/mesa/swrast/s_drawpix.c1
-rw-r--r--src/mesa/swrast/s_fog.h3
-rw-r--r--src/mesa/swrast/s_fragprog.h3
-rw-r--r--src/mesa/swrast/s_logic.h4
-rw-r--r--src/mesa/swrast/s_masking.h5
-rw-r--r--src/mesa/swrast/s_readpix.c2
-rw-r--r--src/mesa/swrast/s_span.h7
-rw-r--r--src/mesa/swrast/s_texcombine.c5
-rw-r--r--src/mesa/swrast/s_texcombine.h3
-rw-r--r--src/mesa/swrast/s_texfilter.c68
-rw-r--r--src/mesa/swrast/s_texfilter.h4
-rw-r--r--src/mesa/swrast/s_triangle.c7
-rw-r--r--src/mesa/swrast/s_trispan.h31
23 files changed, 127 insertions, 135 deletions
diff --git a/src/mesa/swrast/s_aaline.h b/src/mesa/swrast/s_aaline.h
index f7d92c52412..74d5518e179 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 c597808e40e..2c02a01327f 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 746e456f5f4..e40efb1985b 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 071644b64fa..1ad7d329529 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 7cd6d800b29..fca209a4467 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 39a6e64ed92..10aaaa592c7 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 21488d3ba3e..18f1c1866bf 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 d61baba0f33..793921250ad 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 8b06dd5031e..69cd89e7ac4 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 e5dae7ef865..44820ac8f76 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 4d0666898b4..11c63457f52 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 ebc3513f496..9f93b705084 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 689d3fc82e4..62a68361769 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 95c7fe3e150..0a3adfca5ff 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 3712c82163b..5124509a049 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 9fe0752a37f..5c8d7e9c5cf 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 18e275ec8ab..afafbe09acf 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 99c44413fbe..0c8cc9ff37b 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 5f47ebecbf1..11049d86b26 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 539d878ddb4..42785400c0e 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 34520f22948..69f2d80003a 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 85513e1f204..d07a4ef7513 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 15207e863e3..00000000000
--- 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 */