[Mesa-dev] [PATCH 15/24] mesa: Add a function for comparing gl_format to format/type.

Brian Paul brian.e.paul at gmail.com
Sat Oct 29 10:09:59 PDT 2011


On Fri, Oct 28, 2011 at 1:50 PM, Eric Anholt <eric at anholt.net> wrote:
> This should be useful in making more generic fast paths in the pixel
> paths.
> ---
>  src/mesa/main/formats.c |  306 +++++++++++++++++++++++++++++++++++++++++++++++
>  src/mesa/main/formats.h |    3 +
>  2 files changed, 309 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
> index 6307f8e..b9a2434 100644
> --- a/src/mesa/main/formats.c
> +++ b/src/mesa/main/formats.c
> @@ -2444,3 +2444,309 @@ _mesa_format_to_type_and_comps(gl_format format,
>       *comps = 1;
>    }
>  }
> +
> +/**
> + * Returns a MESA_FORMAT describing pixels with the given format/type if
> + * available, or MESA_FORMAT_NONE.
> + *
> + * If a format is returned, it should be suitable to memcpy
> + * _mesa_get_format_bytes() at a time to move the pixel data.
> + */

Maybe note in the comment that one still needs to pay attention to
pixel packing/unpacking state, such as GL_PACK/UNPACK_SWAP_BYTES even
when the formats match, and possibly big vs. little endian.

-Brian


More information about the mesa-dev mailing list