summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast/s_texfetch_tmp.h
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2011-11-22 15:05:25 +0800
committerChia-I Wu <[email protected]>2011-11-27 12:43:24 +0800
commitd4fcf67a3ac78c29448000486dadc2b4b1b2a56d (patch)
treede68969c78428e72aef94a30adcd94c389bc56c4 /src/mesa/swrast/s_texfetch_tmp.h
parent6baa5f10c04641960e0bedce664d0a5cf39e8954 (diff)
mesa: add MESA_FORMAT_RGBX8888 and MESA_FORMAT_RGBX8888_REV
MESA_FORMAT_RGBX8888_REV is one of the opaque pixel formats used on Android. Thanks to texture-from-pixmap, drivers may actually see texture images with this format on Android. MESA_FORMAT_RGBX8888 is added only for completeness. Reviewed-by: Brian Paul <[email protected]> [olv: Move the new formats after MESA_FORMAT_ARGB8888_REV in gl_format. I accidentally moved them to the wrong place when preparing the patch.]
Diffstat (limited to 'src/mesa/swrast/s_texfetch_tmp.h')
-rw-r--r--src/mesa/swrast/s_texfetch_tmp.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h
index 8b7e930f905..4ee05a5ea5a 100644
--- a/src/mesa/swrast/s_texfetch_tmp.h
+++ b/src/mesa/swrast/s_texfetch_tmp.h
@@ -646,6 +646,54 @@ static void store_texel_argb8888_rev(struct swrast_texture_image *texImage,
#endif
+/* MESA_FORMAT_RGBX8888 ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rgbx8888 texture, return 4 GLfloats */
+static void FETCH(f_rgbx8888)( 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] = UBYTE_TO_FLOAT( (s >> 24) );
+ texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+ texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
+ texel[ACOMP] = 1.0f;
+}
+
+#if DIM == 3
+static void store_texel_rgbx8888(struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLubyte *rgba = (const GLubyte *) texel;
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], 0xff);
+}
+#endif
+
+
+/* MESA_FORMAT_RGBX888_REV ***************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rgbx8888_rev texture, return 4 GLchans */
+static void FETCH(f_rgbx8888_rev)( 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] = UBYTE_TO_FLOAT( (s ) & 0xff );
+ texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
+ texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+ texel[ACOMP] = 1.0f;
+}
+
+#if DIM == 3
+static void store_texel_rgbx8888_rev(struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLubyte *rgba = (const GLubyte *) texel;
+ GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], 0xff);
+}
+#endif
+
+
/* MESA_FORMAT_XRGB8888 ******************************************************/
/* Fetch texel from 1D, 2D or 3D xrgb8888 texture, return 4 GLchans */