diff options
author | Jakob Bornecrantz <[email protected]> | 2008-06-18 01:39:46 +0200 |
---|---|---|
committer | Jakob Bornecrantz <[email protected]> | 2008-06-18 01:48:20 +0200 |
commit | a1524162bf838920ad965cd44ead97da29408e50 (patch) | |
tree | b1f76997ed67626ff3a7f92d300a12b5019e7d64 /src/mesa/main/texstore.c | |
parent | 3bf8fb64862b882bff8b372f3c2ce08ea8d401a7 (diff) |
mesa: Added _mesa_texstore_s8_z24
Diffstat (limited to 'src/mesa/main/texstore.c')
-rw-r--r-- | src/mesa/main/texstore.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 562e07a0f58..f3629cb0d1d 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2397,6 +2397,60 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) } +/** + * Store a combined depth/stencil texture image. + */ +GLboolean +_mesa_texstore_s8_z24(TEXSTORE_PARAMS) +{ + const GLuint depthScale = 0xffffff; + + ASSERT(dstFormat == &_mesa_texformat_s8_z24); + ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT); + ASSERT(srcType == GL_UNSIGNED_INT_24_8_EXT); + + + /* general path */ + const GLint srcRowStride + = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) + / sizeof(GLuint); + GLint img, row; + + for (img = 0; img < srcDepth; img++) { + GLuint *dstRow = (GLuint *) dstAddr + + dstImageOffsets[dstZoffset + img] + + dstYoffset * dstRowStride / sizeof(GLuint) + + dstXoffset; + const GLuint *src + = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr, + srcWidth, srcHeight, + srcFormat, srcType, + img, 0, 0); + for (row = 0; row < srcHeight; row++) { + GLubyte stencil[MAX_WIDTH]; + GLint i; + /* the 24 depth bits will be in the high position: */ + _mesa_unpack_depth_span(ctx, srcWidth, + GL_UNSIGNED_INT, /* dst type */ + dstRow, /* dst addr */ + depthScale, + srcType, src, srcPacking); + /* get the 8-bit stencil values */ + _mesa_unpack_stencil_span(ctx, srcWidth, + GL_UNSIGNED_BYTE, /* dst type */ + stencil, /* dst addr */ + srcType, src, srcPacking, + ctx->_ImageTransferState); + /* merge stencil values into depth values */ + for (i = 0; i < srcWidth; i++) + dstRow[i] = stencil[i] << 24; + + src += srcRowStride; + dstRow += dstRowStride / sizeof(GLuint); + } + } + return GL_TRUE; +} /** * Store an image in any of the formats: |