[Mesa-dev] [PATCH 2/5] meta: Use _mesa_get_format_bits() to get the GL_RED_BITS

Pohjolainen, Topi topi.pohjolainen at intel.com
Mon Aug 4 02:11:53 PDT 2014


On Wed, Jul 30, 2014 at 07:11:24PM -0700, Anuj Phogat wrote:
> We currently get red bits from ctx->DrawBuffer->Visual.redBits
> by making a false assumption that the texture we're writing to
> (in glCopyTexImage2D()) is used as a DrawBuffer.
> 
> Fixes many failures in gles3 Khronos CTS test:
> copy_tex_image_conversions_required
> 
> Cc: <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  src/mesa/drivers/common/meta.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index 28bd065..ba84eb8 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -2722,6 +2722,7 @@ static GLenum
>  get_temp_image_type(struct gl_context *ctx, mesa_format format)
>  {
>     GLenum baseFormat = _mesa_get_format_base_format(format);
> +   GLint format_red_bits = _mesa_get_format_bits(format, GL_RED_BITS);

Now the results depend only on the given format and not on the current state.
Even though there are things I don't know about meta and gl-state, this makes
perfect sense to me.
You declare it constant as well.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

>  
>     switch (baseFormat) {
>     case GL_RGBA:
> @@ -2732,9 +2733,9 @@ get_temp_image_type(struct gl_context *ctx, mesa_format format)
>     case GL_LUMINANCE:
>     case GL_LUMINANCE_ALPHA:
>     case GL_INTENSITY:
> -      if (ctx->DrawBuffer->Visual.redBits <= 8) {
> +      if (format_red_bits <= 8) {
>           return GL_UNSIGNED_BYTE;
> -      } else if (ctx->DrawBuffer->Visual.redBits <= 16) {
> +      } else if (format_red_bits <= 16) {
>           return GL_UNSIGNED_SHORT;
>        } else {
>           GLenum datatype = _mesa_get_format_datatype(format);
> -- 
> 1.9.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list