[Mesa-dev] [PATCH] meta: do fallback when texture is enabled for DrawPixels

Roland Scheidegger sroland at vmware.com
Fri May 4 18:44:56 PDT 2012


Am 04.05.2012 16:33, schrieb Liu Aleaxander:
> From: Yuanhan Liu <yuanhan.liu at linux.intel.com>
> 
> If there are already some texture unit enabled, a fallback is needed,
> or the original texture stuff would not work.
> 
> A much better way is to use multi-texture to handle this case: like
> treat the pixels as texture 1 and the original texture as texture 2.
> I haven't do much inverstigation on that way, but fallback is definitely
> a much simpler and straight way.
> 
> This would fix oglc mipsel test case.
> 
> Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
> ---
>  src/mesa/drivers/common/meta.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index 95336fc..c860f3c 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -2210,6 +2210,16 @@ _mesa_meta_DrawPixels(struct gl_context *ctx,
>        fallback = GL_TRUE;
>     }
> 
> +   /*
> +    * If there are already some texture unit enabled, a fallback is needed,
> +    * or the original texture stuff would not work
> +    *
> +    * FIXME: we may use multi-texture to handle this case. But fallback is
> +    * definitely a much simple and straight way.
> +    */
> +   if (ctx->Texture._EnabledUnits)
> +      fallback = GL_TRUE;
> +
>     if (_mesa_is_color_format(format)) {
>        /* use more compact format when possible */
>        /* XXX disable special case for GL_LUMINANCE for now to work around

Wouldn't you also have to test for active fragment shader too (i.e.
essentially same test that _mesa_meta_Bitmap is doing I think they might
have the same prerequisites for fallback for the hilarious combination
of these ops with ordinary fragment shading)? Though I guess maybe you
could avoid fallback in some cases (like drawing to stencil buffer then
texture bound shouldn't matter I think though a fragment shader writing
to depth or killing fragments still would).

Roland


More information about the mesa-dev mailing list