summaryrefslogtreecommitdiff
path: root/src/mesa/main/texfetch_tmp.h
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-12-22 01:11:13 +0100
committerMarek Olšák <maraeo@gmail.com>2010-12-23 16:54:58 +0100
commitbb5ace68ce9e8bd171a39162ed6bd93632bd6619 (patch)
treeb9e09caf1c2a26ce0b770602143dc69b1f5565d1 /src/mesa/main/texfetch_tmp.h
parenteb31837a0d4fa4fe115bb288ddb37cbedea954ae (diff)
mesa: implement new texture format L16
Diffstat (limited to 'src/mesa/main/texfetch_tmp.h')
-rw-r--r--src/mesa/main/texfetch_tmp.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h
index 3a75cdcefe..0951f86b7b 100644
--- a/src/mesa/main/texfetch_tmp.h
+++ b/src/mesa/main/texfetch_tmp.h
@@ -1196,6 +1196,30 @@ static void store_texel_l8(struct gl_texture_image *texImage,
#endif
+/* MESA_FORMAT_L16 ***********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D l16 texture, return 4 GLchans */
+static void FETCH(f_l16)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ texel[RCOMP] =
+ texel[GCOMP] =
+ texel[BCOMP] = USHORT_TO_FLOAT( src[0] );
+ texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_l16(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLushort *rgba = (const GLushort *) texel;
+ GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ *dst = rgba[RCOMP];
+}
+#endif
+
+
/* MESA_FORMAT_I8 ************************************************************/
/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */