[Mesa-dev] [PATCH 2/2] swrast: Use fixed-function processing if the _TexEnvProgram is empty

Eric Anholt eric at anholt.net
Thu Jan 19 18:32:27 PST 2012


On Thu, 19 Jan 2012 17:53:12 -0800, "Ian Romanick" <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> This is a hack to work around drivers such as i965 that:
> 
>     - Set _MaintainTexEnvProgram to generate GLSL IR for
>       fixed-function fragment processing.
>     - Don't call _mesa_ir_link_shader to generate Mesa IR from the
>       GLSL IR.
>     - May use swrast to handle glDrawPixels.
> 
> Since _mesa_ir_link_shader is never called, there is no Mesa IR to
> execute.  Instead do regular fixed-function processing.
> 
> NOTE: This is a candidate for the 8.0 branch.
> 
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44749
> ---
>  src/mesa/swrast/s_span.c |   21 +++++++++++++++++++--
>  1 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
> index e899303..439b0e9 100644
> --- a/src/mesa/swrast/s_span.c
> +++ b/src/mesa/swrast/s_span.c
> @@ -50,6 +50,7 @@
>  #include "s_stencil.h"
>  #include "s_texcombine.h"
>  
> +#include <stdbool.h>
>  
>  /**
>   * Set default fragment attributes for the span using the
> @@ -968,7 +969,23 @@ convert_color_type(SWspan *span, GLenum newType, GLuint output)
>  static inline void
>  shade_texture_span(struct gl_context *ctx, SWspan *span)
>  {
> -   if (ctx->FragmentProgram._Current ||
> +   /* This is a hack to work around drivers such as i965 that:
> +    *
> +    *     - Set _MaintainTexEnvProgram to generate GLSL IR for
> +    *       fixed-function fragment processing.
> +    *     - Don't call _mesa_ir_link_shader to generate Mesa IR from
> +    *       the GLSL IR.
> +    *     - May use swrast to handle glDrawPixels.
> +    *
> +    * Since _mesa_ir_link_shader is never called, there is no Mesa IR
> +    * to execute.  Instead do regular fixed-function processing.
> +    */
> +   const bool use_fragment_program =
> +      ctx->FragmentProgram._Current
> +      && (ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram
> +	  || ctx->FragmentProgram._Current->Base.NumInstructions != 0);

We used to have a hack like this in the driver just to reduce the
performance penalty.  I think you could just drop the NumInstructions
check to duplicate that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120119/abf58e87/attachment.pgp>


More information about the mesa-dev mailing list