From f614a6190562e550257afca0d04e3846648942e8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 21 Oct 2006 00:20:16 +0000 Subject: [PATCH] Move interpolate_texcoords() and interpolate_varying() calls into shade_texture_span(). Added some INLINE hints. --- src/mesa/swrast/s_span.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index ac521ed..a23a608 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -153,7 +153,7 @@ _swrast_span_default_texcoords( GLcontext *ctx, SWspan *span ) /** * Interpolate primary colors to fill in the span->array->color array. */ -static void +static INLINE void interpolate_colors(SWspan *span) { const GLuint n = span->end; @@ -277,7 +277,7 @@ interpolate_colors(SWspan *span) /** * Interpolate specular/secondary colors. */ -static void +static INLINE void interpolate_specular(SWspan *span) { const GLuint n = span->end; @@ -390,7 +390,7 @@ interpolate_specular(SWspan *span) /* Fill in the span.color.index array from the interpolation values */ -static void +static INLINE void interpolate_indexes(GLcontext *ctx, SWspan *span) { GLfixed index = span->index; @@ -422,7 +422,7 @@ interpolate_indexes(GLcontext *ctx, SWspan *span) /* Fill in the span.array.fog values from the interpolation values */ -static void +static INLINE void interpolate_fog(const GLcontext *ctx, SWspan *span) { GLfloat *fog = span->array->fog; @@ -814,7 +814,7 @@ interpolate_texcoords(GLcontext *ctx, SWspan *span) /** * Fill in the span.varying array from the interpolation values. */ -static void +static INLINE void interpolate_varying(GLcontext *ctx, SWspan *span) { GLuint i, j; @@ -846,7 +846,7 @@ interpolate_varying(GLcontext *ctx, SWspan *span) /** * Apply the current polygon stipple pattern to a span of pixels. */ -static void +static INLINE void stipple_polygon_span( GLcontext *ctx, SWspan *span ) { const GLuint highbit = 0x80000000; @@ -879,7 +879,7 @@ stipple_polygon_span( GLcontext *ctx, SWspan *span ) * Return: GL_TRUE some pixels still visible * GL_FALSE nothing visible */ -static GLuint +static INLINE GLuint clip_span( GLcontext *ctx, SWspan *span ) { const GLint xmin = ctx->DrawBuffer->_Xmin; @@ -1178,7 +1178,7 @@ _swrast_write_index_span( GLcontext *ctx, SWspan *span) * Add specular color to base color. This is used only when * GL_LIGHT_MODEL_COLOR_CONTROL = GL_SEPARATE_SPECULAR_COLOR. */ -static void +static INLINE void add_specular(GLcontext *ctx, SWspan *span) { switch (span->array->ChanType) { @@ -1238,7 +1238,7 @@ add_specular(GLcontext *ctx, SWspan *span) /** * Apply antialiasing coverage value to alpha values. */ -static void +static INLINE void apply_aa_coverage(SWspan *span) { const GLfloat *coverage = span->array->coverage; @@ -1271,7 +1271,7 @@ apply_aa_coverage(SWspan *span) /** * Clamp span's float colors to [0,1] */ -static void +static INLINE void clamp_colors(SWspan *span) { GLfloat (*rgba)[4] = span->array->color.sz4.rgba; @@ -1289,7 +1289,7 @@ clamp_colors(SWspan *span) /** * Convert the span's color arrays to the given type. */ -static void +static INLINE void convert_color_type(GLcontext *ctx, SWspan *span, GLenum newType) { GLvoid *src, *dst; @@ -1324,13 +1324,16 @@ convert_color_type(GLcontext *ctx, SWspan *span, GLenum newType) /** * Apply fragment shader, fragment program or normal texturing to span. */ -static void +static INLINE void shade_texture_span(GLcontext *ctx, SWspan *span) { /* Now we need the rgba array, fill it in if needed */ if (span->interpMask & SPAN_RGBA) interpolate_colors(span); + if (ctx->Texture._EnabledCoordUnits && (span->interpMask & SPAN_TEXTURE)) + interpolate_texcoords(ctx, span); + if (ctx->ShaderObjects._FragmentShaderPresent || ctx->FragmentProgram._Enabled || ctx->ATIFragmentShader._Enabled) { @@ -1358,6 +1361,9 @@ shade_texture_span(GLcontext *ctx, SWspan *span) if (span->interpMask & SPAN_Z) _swrast_span_interpolate_z (ctx, span); + if (ctx->ShaderObjects._FragmentShaderPresent) + interpolate_varying(ctx, span); + /* Run fragment program/shader now */ if (ctx->ShaderObjects._FragmentShaderPresent) { _swrast_exec_arbshader (ctx, span); @@ -1451,15 +1457,6 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) stipple_polygon_span(ctx, span); } - /* Interpolate texcoords? */ - if (ctx->Texture._EnabledCoordUnits && (span->interpMask & SPAN_TEXTURE)) { - interpolate_texcoords(ctx, span); - } - - if (ctx->ShaderObjects._FragmentShaderPresent) { - interpolate_varying(ctx, span); - } - /* This is the normal place to compute the resulting fragment color/Z. * As an optimization, we try to defer this until after Z/stencil * testing in order to try to avoid computing colors that we won't -- 2.7.4