[Mesa-dev] [PATCH 2/2] st/mesa: support internalFormat=GL_BGRA in textures

Brian Paul brianp at vmware.com
Mon Jan 17 16:14:40 PST 2011


On 01/17/2011 03:44 PM, Benjamin Franzke wrote:
> ---
>   src/mesa/state_tracker/st_format.c |   11 ++++++++++-
>   1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
> index 2e0a664..a532e08 100644
> --- a/src/mesa/state_tracker/st_format.c
> +++ b/src/mesa/state_tracker/st_format.c
> @@ -511,6 +511,14 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
>         return default_rgba_format( screen, target, sample_count, bindings,
>                                     geom_flags );
>
> +   case GL_BGRA:
> +      if (screen->is_format_supported( screen, PIPE_FORMAT_B8G8R8A8_UNORM,
> +                                       target, sample_count, bindings,
> +                                       geom_flags ))
> +         return PIPE_FORMAT_B8G8R8A8_UNORM;
> +      return default_rgba_format( screen, target, sample_count, bindings,
> +                                  geom_flags );
> +
>      case 3:
>      case GL_RGB:
>      case GL_RGB8:
> @@ -1032,7 +1040,8 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLint internalFormat,
>      boolean want_renderable =
>         internalFormat == 3 || internalFormat == 4 ||
>         internalFormat == GL_RGB || internalFormat == GL_RGBA ||
> -      internalFormat == GL_RGB8 || internalFormat == GL_RGBA8;
> +      internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
> +      internalFormat == GL_BGRA;
>
>      return st_ChooseTextureFormat_renderable(ctx, internalFormat,
>   					    format, type, want_renderable);


Signed-off-by: Brian Paul <brianp at vmware.com>



More information about the mesa-dev mailing list