[Mesa-dev] [PATCH 1/2] mesa: don't use format chooser code for glCompressedTexImage

Ian Romanick idr at freedesktop.org
Thu Feb 7 21:25:56 PST 2013


On 01/31/2013 06:02 PM, Brian Paul wrote:
> When glCompressedTexImage is called the internalFormat is a specific
> format for the incoming image and the the hardware format should be
                                     ^^^^^^^
> the same (since we never do format transcoding).  So use the simpler

Not necessarily true.  We convert ETC textures to other formats.  Eric 
even sent patches to the list to transcode ETC to S3TC or FXT1.

> _mesa_glenum_to_compressed_format() function.  This change is also
> needed for the next patch.
>
> Note: This is a candidate for the stable branches.
>
> --
>
> Note: I haven't completed my full piglit regression test yet but I
> wanted to get this out for review anyway.
> ---
>   src/mesa/main/teximage.c |   14 ++++++++++++--
>   1 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index f03e84a..ff3c92c 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -3004,8 +3004,18 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
>      texObj = _mesa_get_current_tex_object(ctx, target);
>      assert(texObj);
>
> -   texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
> -                                           internalFormat, format, type);
> +   if (compressed) {
> +      /* For glCompressedTexImage() the driver has no choice about the
> +       * texture format since we'll never transcode the user's compressed
> +       * image data.  The internalFormat was error checked earlier.
> +       */
> +      texFormat = _mesa_glenum_to_compressed_format(internalFormat);
> +   }
> +   else {
> +      texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
> +                                              internalFormat, format, type);
> +   }
> +
>      assert(texFormat != MESA_FORMAT_NONE);
>
>      /* check that width, height, depth are legal for the mipmap level */
>



More information about the mesa-dev mailing list