summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-10-29 20:03:51 +0000
committerJosé Fonseca <jfonseca@vmware.com>2009-10-29 20:03:51 +0000
commitc6164ff155189007c02aabb31549f5f4dc767d1b (patch)
tree95aaca8c946d10829e099161f089cf060ef851ee /src/mesa
parenta7fa56a64b8963e74e93f3bac8ac80813f4a9778 (diff)
mesa: Add MESA_FORMAT_Z24_X8.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/formats.c14
-rw-r--r--src/mesa/main/formats.h1
-rw-r--r--src/mesa/main/texfetch.c7
-rw-r--r--src/mesa/main/texstore.c41
-rw-r--r--src/mesa/state_tracker/st_format.c2
5 files changed, 64 insertions, 1 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 72d043c4c3..aed313445f 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -331,6 +331,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
1, 1, 4 /* BlockWidth/Height,Bytes */
},
{
+ MESA_FORMAT_Z24_X8, /* Name */
+ "MESA_FORMAT_Z24_X8", /* StrName */
+ GL_DEPTH_COMPONENT, /* BaseFormat */
+ GL_UNSIGNED_INT, /* DataType */
+ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
+ 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */
+ 1, 1, 4 /* BlockWidth/Height,Bytes */
+ },
+ {
MESA_FORMAT_Z32, /* Name */
"MESA_FORMAT_Z32", /* StrName */
GL_DEPTH_COMPONENT, /* BaseFormat */
@@ -1004,6 +1013,11 @@ _mesa_format_to_type_and_comps(gl_format format,
*comps = 1;
return;
+ case MESA_FORMAT_Z24_X8:
+ *datatype = GL_UNSIGNED_INT;
+ *comps = 1;
+ return;
+
case MESA_FORMAT_Z32:
*datatype = GL_UNSIGNED_INT;
*comps = 1;
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 91ea023077..fa6359f5c8 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -77,6 +77,7 @@ typedef enum
MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */
MESA_FORMAT_X8_Z24, /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
+ MESA_FORMAT_Z24_X8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
MESA_FORMAT_S8, /* SSSS SSSS */
/*@}*/
diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c
index e6e28aef19..314ccb7b65 100644
--- a/src/mesa/main/texfetch.c
+++ b/src/mesa/main/texfetch.c
@@ -530,6 +530,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
store_texel_s8_z24
},
{
+ MESA_FORMAT_Z24_X8,
+ fetch_texel_1d_f_z24_s8,
+ fetch_texel_2d_f_z24_s8,
+ fetch_texel_3d_f_z24_s8,
+ store_texel_z24_s8
+ },
+ {
MESA_FORMAT_Z32,
fetch_texel_1d_f_z32,
fetch_texel_2d_f_z32,
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 6237511e9f..14cad6b32f 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1078,6 +1078,44 @@ _mesa_texstore_x8_z24(TEXSTORE_PARAMS)
/**
+ * Store a 24-bit integer depth component texture image.
+ */
+static GLboolean
+_mesa_texstore_z24_x8(TEXSTORE_PARAMS)
+{
+ const GLuint depthScale = 0xffffff;
+ const GLuint texelBytes = 4;
+
+ (void) dims;
+ ASSERT(dstFormat == MESA_FORMAT_Z24_X8);
+
+ {
+ /* 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);
+ GLuint *dst = (GLuint *) dstRow;
+ GLint i;
+ _mesa_unpack_depth_span(ctx, srcWidth,
+ GL_UNSIGNED_INT, dst,
+ depthScale, srcType, src, srcPacking);
+ for (i = 0; i < srcWidth; i++)
+ dst[i] <<= 8;
+ dstRow += dstRowStride;
+ }
+ }
+ }
+ return GL_TRUE;
+}
+
+
+/**
* Store a 16-bit integer depth component texture image.
*/
static GLboolean
@@ -3012,7 +3050,7 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS)
* Table mapping MESA_FORMAT_8 to _mesa_texstore_*()
* XXX this is somewhat temporary.
*/
-static struct {
+const static struct {
gl_format Name;
StoreTexImageFunc Store;
}
@@ -3046,6 +3084,7 @@ texstore_funcs[MESA_FORMAT_COUNT] =
{ MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 },
{ MESA_FORMAT_Z16, _mesa_texstore_z16 },
{ MESA_FORMAT_X8_Z24, _mesa_texstore_x8_z24 },
+ { MESA_FORMAT_Z24_X8, _mesa_texstore_z24_x8 },
{ MESA_FORMAT_Z32, _mesa_texstore_z32 },
{ MESA_FORMAT_S8, NULL/*_mesa_texstore_s8*/ },
{ MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 },
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index bb57adbf32..02f80057c2 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -309,6 +309,8 @@ st_pipe_format_to_mesa_format(enum pipe_format pipeFormat)
return MESA_FORMAT_Z16;
case PIPE_FORMAT_Z32_UNORM:
return MESA_FORMAT_Z32;
+ case PIPE_FORMAT_Z24X8_UNORM:
+ return MESA_FORMAT_Z24_X8;
case PIPE_FORMAT_Z24S8_UNORM:
return MESA_FORMAT_Z24_S8;
case PIPE_FORMAT_X8Z24_UNORM: