[Mesa-dev] [PATCH 10/11] mesa: Add MESA_FORMAT_{A8R8G8B8, X8R8G8B8, X8B8G8R8}_SRGB

Dave Airlie airlied at gmail.com
Tue Sep 16 00:00:32 PDT 2014


>
>  static void
> +FETCH(A8R8G8B8_SRGB)(const struct swrast_texture_image *texImage,
> +                     GLint i, GLint j, GLint k, GLfloat *texel)
> +{
> +   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> +   texel[RCOMP] = nonlinear_to_linear( (s >>  8) & 0xff );
> +   texel[GCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
> +   texel[BCOMP] = nonlinear_to_linear( (s >> 24) );
> +   texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff ); /* linear! */
> +}
> +
> +
> +static void
>  FETCH(R8G8B8A8_SRGB)(const struct swrast_texture_image *texImage,
>                       GLint i, GLint j, GLint k, GLfloat *texel)
>  {
> @@ -793,6 +805,18 @@ FETCH(R8G8B8X8_SRGB)(const struct swrast_texture_image *texImage,
>
>
>  static void
> +FETCH(X8B8G8R8_SRGB)(const struct swrast_texture_image *texImage,
> +                     GLint i, GLint j, GLint k, GLfloat *texel)
> +{
> +   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
> +   texel[RCOMP] = nonlinear_to_linear( (s >> 24) );
> +   texel[GCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
> +   texel[BCOMP] = nonlinear_to_linear( (s >>  8) & 0xff );
> +   texel[ACOMP] = 1.0f;
> +}
> +
> +

I've just noticed these locally don't build, I've fixed them to use
the new interfaces.

Dave.


More information about the mesa-dev mailing list