[Mesa-dev] [PATCH] st/mesa: choose 3-component float formats before 4-component formats

Marek Olšák maraeo at gmail.com
Wed Apr 27 04:32:04 PDT 2011


Reviewed-by: Marek Olšák <maraeo at gmail.com>

On Wed, Apr 27, 2011 at 2:42 AM, <brianp at vmware.com> wrote:

> From: Brian Paul <brianp at vmware.com>
>
> If GL_RGB16F or GL_RGB32F is specified let's try the 3-component float
> texture formats before trying the 4-component ones.  Before this,
> GL_RGB16/32F were treated the same as GL_RGBA16/32F.
> ---
>  src/mesa/state_tracker/st_format.c |   23 +++++++++++++++++++++--
>  1 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_format.c
> b/src/mesa/state_tracker/st_format.c
> index 8e50dbd..4e7bef2 100644
> --- a/src/mesa/state_tracker/st_format.c
> +++ b/src/mesa/state_tracker/st_format.c
> @@ -954,14 +954,24 @@ st_choose_format(struct pipe_screen *screen, GLenum
> internalFormat,
>
>    /* prefer formats in order of data size, choosing 16-bit ones if equal
> sized */
>    case GL_RGBA16F_ARB:
> +      {
> +         static const enum pipe_format formats[] = {
> +               PIPE_FORMAT_R16G16B16A16_FLOAT,
> +               PIPE_FORMAT_R32G32B32A32_FLOAT
> +         };
> +         return find_supported_format(screen, formats, Elements(formats),
> +                                      target, sample_count, bindings);
> +      }
>    case GL_RGB16F_ARB:
>       {
>          static const enum pipe_format formats[] = {
> +               PIPE_FORMAT_R16G16B16_FLOAT,
>                PIPE_FORMAT_R16G16B16A16_FLOAT,
> +               PIPE_FORMAT_R32G32B32_FLOAT,
>                PIPE_FORMAT_R32G32B32A32_FLOAT
>          };
>          return find_supported_format(screen, formats, Elements(formats),
> -               target, sample_count, bindings);
> +                                      target, sample_count, bindings);
>       }
>    case GL_LUMINANCE_ALPHA16F_ARB:
>       {
> @@ -1040,14 +1050,23 @@ st_choose_format(struct pipe_screen *screen, GLenum
> internalFormat,
>
>    /* try a 32-bit format if available, otherwise fallback to a 16-bit one
> */
>    case GL_RGBA32F_ARB:
> +      {
> +         static const enum pipe_format formats[] = {
> +               PIPE_FORMAT_R32G32B32A32_FLOAT,
> +               PIPE_FORMAT_R16G16B16A16_FLOAT
> +         };
> +         return find_supported_format(screen, formats, Elements(formats),
> +                                      target, sample_count, bindings);
> +      }
>    case GL_RGB32F_ARB:
>       {
>          static const enum pipe_format formats[] = {
> +               PIPE_FORMAT_R32G32B32_FLOAT,
>                PIPE_FORMAT_R32G32B32A32_FLOAT,
>                PIPE_FORMAT_R16G16B16A16_FLOAT
>          };
>          return find_supported_format(screen, formats, Elements(formats),
> -               target, sample_count, bindings);
> +                                      target, sample_count, bindings);
>       }
>    case GL_LUMINANCE_ALPHA32F_ARB:
>       {
> --
> 1.7.3.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110427/b31a6e34/attachment-0001.htm>


More information about the mesa-dev mailing list