summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texfetch_tmp.h
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-12-22 01:12:20 +0100
committerMarek Olšák <[email protected]>2010-12-23 16:54:58 +0100
commitfd8aa7ac71699facf9839e2ae56b5e37579c6bcc (patch)
treec47179613e19630bbd95d7594f75edca64814864 /src/mesa/main/texfetch_tmp.h
parentbb5ace68ce9e8bd171a39162ed6bd93632bd6619 (diff)
mesa: implement new texture format I16
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 0951f86b7ba..0b69b69add5 100644
--- a/src/mesa/main/texfetch_tmp.h
+++ b/src/mesa/main/texfetch_tmp.h
@@ -1244,6 +1244,30 @@ static void store_texel_i8(struct gl_texture_image *texImage,
#endif
+/* MESA_FORMAT_I16 ***********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D i16 texture, return 4 GLchans */
+static void FETCH(f_i16)( 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] =
+ texel[ACOMP] = USHORT_TO_FLOAT( src[0] );
+}
+
+#if DIM == 3
+static void store_texel_i16(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_CI8 ***********************************************************/
/* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a