diff options
author | Brian Paul <[email protected]> | 2009-10-21 19:55:44 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-10-21 19:55:44 -0600 |
commit | e4c700dbbf2a802f32bf62256c801105998c3729 (patch) | |
tree | 5929e808cd77e8f5dc5aeb36f019a0a21b6016b8 /src/mesa/main/texstore.c | |
parent | fa3046431a0da5990043fd4856602b0ba57ff9af (diff) |
mesa: added MESA_FORMAT_X8_Z24 format
24-bit Z in 32-bit pixel. We could probably use the MESA_FORMAT_S8_Z24
format but this there's a few places where we explicitly don't want stencil.
This format may go away at some point in the future.
Diffstat (limited to 'src/mesa/main/texstore.c')
-rw-r--r-- | src/mesa/main/texstore.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 604f6c462a2..d0d42503524 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1048,6 +1048,41 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) return GL_TRUE; } + +/** + * Store a 24-bit integer depth component texture image. + */ +static GLboolean +_mesa_texstore_x8_z24(TEXSTORE_PARAMS) +{ + const GLuint depthScale = 0xffffff; + const GLuint texelBytes = 4; + + (void) dims; + ASSERT(dstFormat == MESA_FORMAT_X8_Z24); + + { + /* general path */ + GLint img, row; + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + const GLvoid *src = _mesa_image_address(dims, srcPacking, + srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); + _mesa_unpack_depth_span(ctx, srcWidth, + GL_UNSIGNED_INT, (GLuint *) dstRow, + depthScale, srcType, src, srcPacking); + dstRow += dstRowStride; + } + } + } + return GL_TRUE; +} + + #define STRIDE_3D 0 /** @@ -3009,6 +3044,7 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 }, { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 }, { MESA_FORMAT_Z16, _mesa_texstore_z16 }, + { MESA_FORMAT_X8_Z24, _mesa_texstore_x8_z24 }, { MESA_FORMAT_Z32, _mesa_texstore_z32 }, { MESA_FORMAT_S8, NULL/*_mesa_texstore_s8*/ }, { MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 }, |