summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorRichard Sandiford <[email protected]>2014-07-22 10:51:17 +0100
committerDave Airlie <[email protected]>2014-09-17 13:17:47 +1000
commitdf14091c5857dc398521aaa9ff43bbbaee2d6116 (patch)
treef4e07d9d59dbb70a1d5e2e999092072d479ab6ab /src/mesa/swrast
parent234d194b49f392f9b5d55dc7f8a8b16eb8f07925 (diff)
mesa: Add MESA_FORMAT_A8L8_{SNORM,SRGB}
The associated UNORM format already existed. This means that each LnAn format has a reversed counterpart, which is necessary for handling big-endian mesa<->gallium mappings. [airlied: rebased onto current master] Signed-off-by: Richard Sandiford <[email protected]> Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_texfetch.c2
-rw-r--r--src/mesa/swrast/s_texfetch_tmp.h24
2 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
index 38d71caa38b..dfba19096f2 100644
--- a/src/mesa/swrast/s_texfetch.c
+++ b/src/mesa/swrast/s_texfetch.c
@@ -210,6 +210,7 @@ texfetch_funcs[] =
FETCH_FUNCS(R8G8_SNORM),
FETCH_NULL(G8R8_SNORM),
FETCH_FUNCS(L8A8_SNORM),
+ FETCH_FUNCS(A8L8_SNORM),
/* Array signed/normalized formats */
FETCH_FUNCS(A_SNORM8),
@@ -232,6 +233,7 @@ texfetch_funcs[] =
FETCH_FUNCS(R8G8B8A8_SRGB),
FETCH_FUNCS(R8G8B8X8_SRGB),
FETCH_FUNCS(L8A8_SRGB),
+ FETCH_FUNCS(A8L8_SRGB),
/* Array sRGB formats */
FETCH_FUNCS(L_SRGB8),
diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h
index 3923e2b6246..f6888994aa7 100644
--- a/src/mesa/swrast/s_texfetch_tmp.h
+++ b/src/mesa/swrast/s_texfetch_tmp.h
@@ -817,6 +817,18 @@ FETCH(L8A8_SRGB)(const struct swrast_texture_image *texImage,
static void
+FETCH(A8L8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 2);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = util_format_srgb_8unorm_to_linear_float(s >> 8);
+ texel[ACOMP] = UBYTE_TO_FLOAT(s & 0xff); /* linear */
+}
+
+
+static void
FETCH(RGBA_SINT8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
@@ -961,6 +973,18 @@ FETCH(L8A8_SNORM)(const struct swrast_texture_image *texImage,
static void
+FETCH(A8L8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) );
+ texel[ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s & 0xff) );
+}
+
+
+static void
FETCH(X8B8G8R8_SNORM)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{