diff options
author | Jakob Bornecrantz <[email protected]> | 2008-09-04 10:35:01 +0800 |
---|---|---|
committer | Xiang, Haihao <[email protected]> | 2008-09-04 10:35:01 +0800 |
commit | dc44bb8e9208680379b31df01b4499c3a3bde5cb (patch) | |
tree | 1e4f1e6edfa6ae97d01169f2888eb9dc6b2afccf /src/mesa/main/texformat_tmp.h | |
parent | a04aeea5c016530d7371e032438a0a8fa2c0d7f6 (diff) |
mesa: Support for MESA_FORMAT_S8_Z24 texture
cherry-picked from gallium-0.1
Diffstat (limited to 'src/mesa/main/texformat_tmp.h')
-rw-r--r-- | src/mesa/main/texformat_tmp.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 99785da1a0a..63939f40111 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1363,6 +1363,32 @@ static void store_texel_z24_s8(struct gl_texture_image *texImage, #endif +/* MESA_TEXFORMAT_S8_Z24 ***************************************************/ + +static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + /* only return Z, not stencil data */ + const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + const GLfloat scale = 1.0F / (GLfloat) 0xffffff; + texel[0] = ((*src) & 0x00ffffff) * scale; + ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_S8_Z24); + ASSERT(texel[0] >= 0.0F); + ASSERT(texel[0] <= 1.0F); +} + +#if DIM == 3 +static void store_texel_s8_z24(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + /* only store Z, not stencil */ + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + GLfloat depth = *((GLfloat *) texel); + GLuint zi = (GLuint) (depth * 0xffffff); + *dst = zi | (*dst & 0xff000000); +} +#endif + #undef TEXEL_ADDR #undef DIM |