summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/r300/r300_texstate.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2007-10-17 13:11:01 -0700
committerIan Romanick <[email protected]>2007-10-17 16:25:39 -0700
commita663e846b63c33685a9e88c8904f5e3a225f6e85 (patch)
tree65a3ca9845e0ac60fc662148d88585311d87c7e8 /src/mesa/drivers/dri/r300/r300_texstate.c
parent42a4386a4c18932221c59607e6d22b864a2577fb (diff)
Framework for supporting z24_s8 and z32 depth textures on r300.
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_texstate.c')
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 1c9851afb2a..efa201a52d5 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -116,10 +116,8 @@ static const struct tx_table {
_ASSIGN(INTENSITY_FLOAT32, R300_EASY_TX_FORMAT(X, X, X, X, FL_I32)),
_ASSIGN(INTENSITY_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, X, FL_I16)),
_ASSIGN(Z16, R300_EASY_TX_FORMAT(X, X, X, X, X16)),
-#if 0
_ASSIGN(Z24_S8, R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8)),
_ASSIGN(Z32, R300_EASY_TX_FORMAT(X, X, X, X, X32)),
-#endif
/* *INDENT-ON* */
};
@@ -127,6 +125,24 @@ static const struct tx_table {
void r300SetDepthTexMode(struct gl_texture_object *tObj)
{
+ static const GLuint formats[3][3] = {
+ {
+ R300_EASY_TX_FORMAT(X, X, X, X, X16),
+ R300_EASY_TX_FORMAT(X, X, X, ONE, X16),
+ R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X16),
+ },
+ {
+ R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8),
+ R300_EASY_TX_FORMAT(X, X, X, ONE, X24_Y8),
+ R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X24_Y8),
+ },
+ {
+ R300_EASY_TX_FORMAT(X, X, X, X, X32),
+ R300_EASY_TX_FORMAT(X, X, X, ONE, X32),
+ R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X32),
+ },
+ };
+ const GLuint *format;
r300TexObjPtr t;
if (!tObj)
@@ -134,22 +150,41 @@ void r300SetDepthTexMode(struct gl_texture_object *tObj)
t = (r300TexObjPtr) tObj->DriverData;
+
+ switch (tObj->Image[0][tObj->BaseLevel]->TexFormat->MesaFormat) {
+ case MESA_FORMAT_Z16:
+ format = formats[0];
+ break;
+ case MESA_FORMAT_Z24_S8:
+ format = formats[1];
+ break;
+ case MESA_FORMAT_Z32:
+ format = formats[2];
+ break;
+ default:
+ /* Error...which should have already been caught by higher
+ * levels of Mesa.
+ */
+ ASSERT(0);
+ return;
+ }
+
switch (tObj->DepthMode) {
case GL_LUMINANCE:
- t->format = R300_EASY_TX_FORMAT(X, X, X, X, X16);
+ t->format = format[0];
break;
case GL_INTENSITY:
- t->format = R300_EASY_TX_FORMAT(X, X, X, ONE, X16);
+ t->format = format[1];
break;
case GL_ALPHA:
- t->format = R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X16);
+ t->format = format[2];
break;
default:
/* Error...which should have already been caught by higher
* levels of Mesa.
*/
ASSERT(0);
- break;
+ return;
}
}