From 85ef9930f56bf15181f9a0b238f03d55303cf411 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 22 Nov 2010 19:42:40 +0000 Subject: Updated to mesalib 7.9 --- mesalib/src/mesa/swrast/s_aaline.h | 2 +- mesalib/src/mesa/swrast/s_aatriangle.h | 2 +- mesalib/src/mesa/swrast/s_alpha.h | 3 ++- mesalib/src/mesa/swrast/s_atifragshader.c | 4 +-- mesalib/src/mesa/swrast/s_atifragshader.h | 3 ++- mesalib/src/mesa/swrast/s_blend.h | 3 ++- mesalib/src/mesa/swrast/s_clear.c | 1 - mesalib/src/mesa/swrast/s_context.c | 7 +++--- mesalib/src/mesa/swrast/s_context.h | 3 ++- mesalib/src/mesa/swrast/s_depth.c | 1 - mesalib/src/mesa/swrast/s_depth.h | 3 ++- mesalib/src/mesa/swrast/s_feedback.c | 1 - mesalib/src/mesa/swrast/s_fog.c | 1 - mesalib/src/mesa/swrast/s_fog.h | 3 ++- mesalib/src/mesa/swrast/s_fragprog.c | 4 +-- mesalib/src/mesa/swrast/s_fragprog.h | 3 ++- mesalib/src/mesa/swrast/s_logic.h | 3 ++- mesalib/src/mesa/swrast/s_masking.h | 3 ++- mesalib/src/mesa/swrast/s_points.c | 1 - mesalib/src/mesa/swrast/s_readpix.c | 18 ++++++++++---- mesalib/src/mesa/swrast/s_span.c | 24 +++++++++++++++--- mesalib/src/mesa/swrast/s_stencil.h | 3 ++- mesalib/src/mesa/swrast/s_texcombine.c | 2 +- mesalib/src/mesa/swrast/s_texcombine.h | 3 ++- mesalib/src/mesa/swrast/s_texfilter.c | 41 ++++++++++++++++++++++--------- mesalib/src/mesa/swrast/s_texfilter.h | 3 ++- mesalib/src/mesa/swrast/s_triangle.c | 2 +- mesalib/src/mesa/swrast/s_zoom.h | 3 ++- 28 files changed, 101 insertions(+), 49 deletions(-) (limited to 'mesalib/src/mesa/swrast') diff --git a/mesalib/src/mesa/swrast/s_aaline.h b/mesalib/src/mesa/swrast/s_aaline.h index f1d708ec8..922eb230e 100644 --- a/mesalib/src/mesa/swrast/s_aaline.h +++ b/mesalib/src/mesa/swrast/s_aaline.h @@ -28,7 +28,7 @@ #define S_AALINE_H -#include "swrast.h" +#include "main/mtypes.h" extern void diff --git a/mesalib/src/mesa/swrast/s_aatriangle.h b/mesalib/src/mesa/swrast/s_aatriangle.h index 4b57fa73a..9aed41a19 100644 --- a/mesalib/src/mesa/swrast/s_aatriangle.h +++ b/mesalib/src/mesa/swrast/s_aatriangle.h @@ -28,7 +28,7 @@ #define S_AATRIANGLE_H -#include "swrast.h" +#include "main/mtypes.h" extern void diff --git a/mesalib/src/mesa/swrast/s_alpha.h b/mesalib/src/mesa/swrast/s_alpha.h index 7a5b72e65..239484a97 100644 --- a/mesalib/src/mesa/swrast/s_alpha.h +++ b/mesalib/src/mesa/swrast/s_alpha.h @@ -28,7 +28,8 @@ #define S_ALPHA_H -#include "s_context.h" +#include "main/mtypes.h" +#include "s_span.h" extern GLint diff --git a/mesalib/src/mesa/swrast/s_atifragshader.c b/mesalib/src/mesa/swrast/s_atifragshader.c index 0f06cdf9f..1338b6802 100644 --- a/mesalib/src/mesa/swrast/s_atifragshader.c +++ b/mesalib/src/mesa/swrast/s_atifragshader.c @@ -21,10 +21,10 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" -#include "shader/atifragshader.h" +#include "main/atifragshader.h" #include "swrast/s_atifragshader.h" +#include "swrast/s_context.h" /** diff --git a/mesalib/src/mesa/swrast/s_atifragshader.h b/mesalib/src/mesa/swrast/s_atifragshader.h index 871a0c045..cce455a04 100644 --- a/mesalib/src/mesa/swrast/s_atifragshader.h +++ b/mesalib/src/mesa/swrast/s_atifragshader.h @@ -27,7 +27,8 @@ #define S_ATIFRAGSHADER_H -#include "s_context.h" +#include "main/mtypes.h" +#include "s_span.h" extern void diff --git a/mesalib/src/mesa/swrast/s_blend.h b/mesalib/src/mesa/swrast/s_blend.h index 8d5a81635..9cedde3bf 100644 --- a/mesalib/src/mesa/swrast/s_blend.h +++ b/mesalib/src/mesa/swrast/s_blend.h @@ -27,7 +27,8 @@ #define S_BLEND_H -#include "s_context.h" +#include "main/mtypes.h" +#include "s_span.h" extern void diff --git a/mesalib/src/mesa/swrast/s_clear.c b/mesalib/src/mesa/swrast/s_clear.c index 7b0a63391..efe500ae2 100644 --- a/mesalib/src/mesa/swrast/s_clear.c +++ b/mesalib/src/mesa/swrast/s_clear.c @@ -25,7 +25,6 @@ #include "main/glheader.h" #include "main/colormac.h" #include "main/condrender.h" -#include "main/formats.h" #include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c index 751966348..f76a2b68e 100644 --- a/mesalib/src/mesa/swrast/s_context.c +++ b/mesalib/src/mesa/swrast/s_context.c @@ -28,12 +28,11 @@ #include "main/imports.h" #include "main/bufferobj.h" -#include "main/context.h" #include "main/colormac.h" #include "main/mtypes.h" #include "main/teximage.h" -#include "shader/prog_parameter.h" -#include "shader/prog_statevars.h" +#include "program/prog_parameter.h" +#include "program/prog_statevars.h" #include "swrast.h" #include "s_blend.h" #include "s_context.h" @@ -951,7 +950,7 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) v->attrib[FRAG_ATTRIB_COL1][2], v->attrib[FRAG_ATTRIB_COL1][3]); _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]); - _mesa_debug(ctx, "index %d\n", v->attrib[FRAG_ATTRIB_CI][0]); + _mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]); _mesa_debug(ctx, "pointsize %f\n", v->pointSize); _mesa_debug(ctx, "\n"); } diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h index 9059f9b5e..6d81f7476 100644 --- a/mesalib/src/mesa/swrast/s_context.h +++ b/mesalib/src/mesa/swrast/s_context.h @@ -43,8 +43,9 @@ #ifndef S_CONTEXT_H #define S_CONTEXT_H +#include "main/compiler.h" #include "main/mtypes.h" -#include "shader/prog_execute.h" +#include "program/prog_execute.h" #include "swrast.h" #include "s_span.h" diff --git a/mesalib/src/mesa/swrast/s_depth.c b/mesalib/src/mesa/swrast/s_depth.c index ed637cac1..f952fd6ba 100644 --- a/mesalib/src/mesa/swrast/s_depth.c +++ b/mesalib/src/mesa/swrast/s_depth.c @@ -30,7 +30,6 @@ #include "main/imports.h" #include "s_depth.h" -#include "s_context.h" #include "s_span.h" diff --git a/mesalib/src/mesa/swrast/s_depth.h b/mesalib/src/mesa/swrast/s_depth.h index 7eae36674..878d242f5 100644 --- a/mesalib/src/mesa/swrast/s_depth.h +++ b/mesalib/src/mesa/swrast/s_depth.h @@ -27,7 +27,8 @@ #define S_DEPTH_H -#include "s_context.h" +#include "main/mtypes.h" +#include "s_span.h" extern GLuint diff --git a/mesalib/src/mesa/swrast/s_feedback.c b/mesalib/src/mesa/swrast/s_feedback.c index 373b1416e..6ac8ac73b 100644 --- a/mesalib/src/mesa/swrast/s_feedback.c +++ b/mesalib/src/mesa/swrast/s_feedback.c @@ -24,7 +24,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/feedback.h" #include "main/macros.h" diff --git a/mesalib/src/mesa/swrast/s_fog.c b/mesalib/src/mesa/swrast/s_fog.c index 3fc843921..689500a61 100644 --- a/mesalib/src/mesa/swrast/s_fog.c +++ b/mesalib/src/mesa/swrast/s_fog.c @@ -25,7 +25,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "s_context.h" diff --git a/mesalib/src/mesa/swrast/s_fog.h b/mesalib/src/mesa/swrast/s_fog.h index 06107de3f..a496746d1 100644 --- a/mesalib/src/mesa/swrast/s_fog.h +++ b/mesalib/src/mesa/swrast/s_fog.h @@ -28,7 +28,8 @@ #define S_FOG_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" extern GLfloat diff --git a/mesalib/src/mesa/swrast/s_fragprog.c b/mesalib/src/mesa/swrast/s_fragprog.c index 7c1de62e8..9facb44d9 100644 --- a/mesalib/src/mesa/swrast/s_fragprog.c +++ b/mesalib/src/mesa/swrast/s_fragprog.c @@ -24,9 +24,9 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" -#include "shader/prog_instruction.h" +#include "program/prog_instruction.h" +#include "s_context.h" #include "s_fragprog.h" #include "s_span.h" diff --git a/mesalib/src/mesa/swrast/s_fragprog.h b/mesalib/src/mesa/swrast/s_fragprog.h index e1b7e6791..92b9d01e1 100644 --- a/mesalib/src/mesa/swrast/s_fragprog.h +++ b/mesalib/src/mesa/swrast/s_fragprog.h @@ -27,7 +27,8 @@ #define S_FRAGPROG_H -#include "s_context.h" +#include "main/mtypes.h" +#include "s_span.h" extern void diff --git a/mesalib/src/mesa/swrast/s_logic.h b/mesalib/src/mesa/swrast/s_logic.h index e8cfae33f..d60951334 100644 --- a/mesalib/src/mesa/swrast/s_logic.h +++ b/mesalib/src/mesa/swrast/s_logic.h @@ -27,7 +27,8 @@ #define S_LOGIC_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" extern void _swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, diff --git a/mesalib/src/mesa/swrast/s_masking.h b/mesalib/src/mesa/swrast/s_masking.h index 3ba4f8356..cb000da0f 100644 --- a/mesalib/src/mesa/swrast/s_masking.h +++ b/mesalib/src/mesa/swrast/s_masking.h @@ -27,7 +27,8 @@ #define S_MASKING_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" extern void diff --git a/mesalib/src/mesa/swrast/s_points.c b/mesalib/src/mesa/swrast/s_points.c index 1663ece82..12431662c 100644 --- a/mesalib/src/mesa/swrast/s_points.c +++ b/mesalib/src/mesa/swrast/s_points.c @@ -25,7 +25,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "s_context.h" #include "s_feedback.h" diff --git a/mesalib/src/mesa/swrast/s_readpix.c b/mesalib/src/mesa/swrast/s_readpix.c index 368311e14..1de481248 100644 --- a/mesalib/src/mesa/swrast/s_readpix.c +++ b/mesalib/src/mesa/swrast/s_readpix.c @@ -27,7 +27,6 @@ #include "main/bufferobj.h" #include "main/colormac.h" #include "main/convolve.h" -#include "main/context.h" #include "main/feedback.h" #include "main/formats.h" #include "main/image.h" @@ -192,7 +191,8 @@ fast_read_rgba_pixels( GLcontext *ctx, if (!rb) return GL_FALSE; - ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB); + ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB || + rb->_BaseFormat == GL_ALPHA); /* clipping should have already been done */ ASSERT(x + width <= (GLint) rb->Width); @@ -265,10 +265,18 @@ adjust_colors(const struct gl_framebuffer *fb, GLuint n, GLfloat rgba[][4]) const GLuint rShift = 8 - fb->Visual.redBits; const GLuint gShift = 8 - fb->Visual.greenBits; const GLuint bShift = 8 - fb->Visual.blueBits; - const GLfloat rScale = 1.0F / (GLfloat) ((1 << fb->Visual.redBits ) - 1); - const GLfloat gScale = 1.0F / (GLfloat) ((1 << fb->Visual.greenBits) - 1); - const GLfloat bScale = 1.0F / (GLfloat) ((1 << fb->Visual.blueBits ) - 1); + GLfloat rScale = 1.0F / (GLfloat) ((1 << fb->Visual.redBits ) - 1); + GLfloat gScale = 1.0F / (GLfloat) ((1 << fb->Visual.greenBits) - 1); + GLfloat bScale = 1.0F / (GLfloat) ((1 << fb->Visual.blueBits ) - 1); GLuint i; + + if (fb->Visual.redBits == 0) + rScale = 0; + if (fb->Visual.greenBits == 0) + gScale = 0; + if (fb->Visual.blueBits == 0) + bScale = 0; + for (i = 0; i < n; i++) { GLint r, g, b; /* convert float back to ubyte */ diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c index 687c8eb0b..28c82990e 100644 --- a/mesalib/src/mesa/swrast/s_span.c +++ b/mesalib/src/mesa/swrast/s_span.c @@ -33,7 +33,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "main/imports.h" #include "main/image.h" @@ -971,6 +970,10 @@ shade_texture_span(GLcontext *ctx, SWspan *span) if (span->primitive == GL_BITMAP && span->array->ChanType != GL_FLOAT) { convert_color_type(span, GL_FLOAT, 0); } + else { + span->array->rgba = (void *) span->array->attribs[FRAG_ATTRIB_COL0]; + } + if (span->primitive != GL_POINT || (span->interpMask & SPAN_RGBA) || ctx->Point.PointSprite) { @@ -1222,9 +1225,22 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) GLchan rgbaSave[MAX_WIDTH][4]; const GLuint fragOutput = multiFragOutputs ? buf : 0; + /* set span->array->rgba to colors for render buffer's datatype */ if (rb->DataType != span->array->ChanType || fragOutput > 0) { convert_color_type(span, rb->DataType, fragOutput); } + else { + if (rb->DataType == GL_UNSIGNED_BYTE) { + span->array->rgba = span->array->rgba8; + } + else if (rb->DataType == GL_UNSIGNED_SHORT) { + span->array->rgba = (void *) span->array->rgba16; + } + else { + span->array->rgba = (void *) + span->array->attribs[FRAG_ATTRIB_COL0]; + } + } if (!multiFragOutputs && numBuffers > 1) { /* save colors for second, third renderbuffer writes */ @@ -1232,7 +1248,8 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) 4 * span->end * sizeof(GLchan)); } - ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB); + ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB || + rb->_BaseFormat == GL_ALPHA); if (ctx->Color._LogicOpEnabled) { _swrast_logicop_rgba_span(ctx, rb, span); @@ -1330,7 +1347,8 @@ _swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb, ASSERT(rb); ASSERT(rb->GetRow); - ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA); + ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA || + rb->_BaseFormat == GL_ALPHA); if (rb->DataType == dstType) { rb->GetRow(ctx, rb, length, x + skip, y, diff --git a/mesalib/src/mesa/swrast/s_stencil.h b/mesalib/src/mesa/swrast/s_stencil.h index cd6cbc57b..c076ebbe2 100644 --- a/mesalib/src/mesa/swrast/s_stencil.h +++ b/mesalib/src/mesa/swrast/s_stencil.h @@ -27,7 +27,8 @@ #define S_STENCIL_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c index f322663ad..2ac0aaa24 100644 --- a/mesalib/src/mesa/swrast/s_texcombine.c +++ b/mesalib/src/mesa/swrast/s_texcombine.c @@ -29,7 +29,7 @@ #include "main/colormac.h" #include "main/image.h" #include "main/imports.h" -#include "shader/prog_instruction.h" +#include "program/prog_instruction.h" #include "s_context.h" #include "s_texcombine.h" diff --git a/mesalib/src/mesa/swrast/s_texcombine.h b/mesalib/src/mesa/swrast/s_texcombine.h index 9ed96efb8..4f5dfbe1a 100644 --- a/mesalib/src/mesa/swrast/s_texcombine.h +++ b/mesalib/src/mesa/swrast/s_texcombine.h @@ -27,7 +27,8 @@ #define S_TEXCOMBINE_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" extern void _swrast_texture_span( GLcontext *ctx, SWspan *span ); diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c index 997c2f4bb..3fc554c5a 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.c +++ b/mesalib/src/mesa/swrast/s_texfilter.c @@ -488,14 +488,15 @@ tex_array_slice(GLfloat coord, GLsizei size) /** * Compute nearest integer texcoords for given texobj and coordinate. + * NOTE: only used for depth texture sampling. */ static INLINE void nearest_texcoord(const struct gl_texture_object *texObj, + GLuint level, const GLfloat texcoord[4], GLint *i, GLint *j, GLint *k) { - const GLint baseLevel = texObj->BaseLevel; - const struct gl_texture_image *img = texObj->Image[0][baseLevel]; + const struct gl_texture_image *img = texObj->Image[0][level]; const GLint width = img->Width; const GLint height = img->Height; const GLint depth = img->Depth; @@ -534,15 +535,16 @@ nearest_texcoord(const struct gl_texture_object *texObj, /** * Compute linear integer texcoords for given texobj and coordinate. + * NOTE: only used for depth texture sampling. */ static INLINE void linear_texcoord(const struct gl_texture_object *texObj, + GLuint level, const GLfloat texcoord[4], GLint *i0, GLint *i1, GLint *j0, GLint *j1, GLint *slice, GLfloat *wi, GLfloat *wj) { - const GLint baseLevel = texObj->BaseLevel; - const struct gl_texture_image *img = texObj->Image[0][baseLevel]; + const struct gl_texture_image *img = texObj->Image[0][level]; const GLint width = img->Width; const GLint height = img->Height; const GLint depth = img->Depth; @@ -2963,7 +2965,26 @@ shadow_compare4(GLenum function, GLfloat coord, /** - * Sample a shadow/depth texture. + * Choose the mipmap level to use when sampling from a depth texture. + */ +static int +choose_depth_texture_level(const struct gl_texture_object *tObj, GLfloat lambda) +{ + GLint level; + + lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod); + + level = (GLint) lambda; + + level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel); + + return level; +} + + +/** + * Sample a shadow/depth texture. This function is incomplete. It doesn't + * check for minification vs. magnification, etc. */ static void sample_depth_texture( GLcontext *ctx, @@ -2971,8 +2992,8 @@ sample_depth_texture( GLcontext *ctx, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat texel[][4] ) { - const GLint baseLevel = tObj->BaseLevel; - const struct gl_texture_image *img = tObj->Image[0][baseLevel]; + const GLint level = choose_depth_texture_level(tObj, lambda[0]); + const struct gl_texture_image *img = tObj->Image[0][level]; const GLint width = img->Width; const GLint height = img->Height; const GLint depth = img->Depth; @@ -2982,8 +3003,6 @@ sample_depth_texture( GLcontext *ctx, GLenum function; GLfloat result; - (void) lambda; - ASSERT(img->_BaseFormat == GL_DEPTH_COMPONENT || img->_BaseFormat == GL_DEPTH_STENCIL_EXT); @@ -3006,7 +3025,7 @@ sample_depth_texture( GLcontext *ctx, GLfloat depthSample; GLint col, row, slice; - nearest_texcoord(tObj, texcoords[i], &col, &row, &slice); + nearest_texcoord(tObj, level, texcoords[i], &col, &row, &slice); if (col >= 0 && row >= 0 && col < width && row < height && slice >= 0 && slice < depth) { @@ -3044,7 +3063,7 @@ sample_depth_texture( GLcontext *ctx, GLfloat wi, wj; GLuint useBorderTexel; - linear_texcoord(tObj, texcoords[i], &i0, &i1, &j0, &j1, &slice, + linear_texcoord(tObj, level, texcoords[i], &i0, &i1, &j0, &j1, &slice, &wi, &wj); useBorderTexel = 0; diff --git a/mesalib/src/mesa/swrast/s_texfilter.h b/mesalib/src/mesa/swrast/s_texfilter.h index 2e265d685..eceab5965 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.h +++ b/mesalib/src/mesa/swrast/s_texfilter.h @@ -27,7 +27,8 @@ #define S_TEXFILTER_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_context.h" extern texture_sample_func diff --git a/mesalib/src/mesa/swrast/s_triangle.c b/mesalib/src/mesa/swrast/s_triangle.c index 812dddf15..d1b369bcd 100644 --- a/mesalib/src/mesa/swrast/s_triangle.c +++ b/mesalib/src/mesa/swrast/s_triangle.c @@ -35,7 +35,7 @@ #include "main/imports.h" #include "main/macros.h" #include "main/texformat.h" -#include "shader/prog_instruction.h" +#include "program/prog_instruction.h" #include "s_aatriangle.h" #include "s_context.h" diff --git a/mesalib/src/mesa/swrast/s_zoom.h b/mesalib/src/mesa/swrast/s_zoom.h index 43917be65..09f624efa 100644 --- a/mesalib/src/mesa/swrast/s_zoom.h +++ b/mesalib/src/mesa/swrast/s_zoom.h @@ -25,7 +25,8 @@ #ifndef S_ZOOM_H #define S_ZOOM_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" extern void -- cgit v1.2.3