diff options
author | Ian Romanick <idr@us.ibm.com> | 2007-10-17 13:11:01 -0700 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2007-10-17 16:25:39 -0700 |
commit | a663e846b63c33685a9e88c8904f5e3a225f6e85 (patch) | |
tree | 65a3ca9845e0ac60fc662148d88585311d87c7e8 /src/mesa/drivers | |
parent | 42a4386a4c18932221c59607e6d22b864a2577fb (diff) |
Framework for supporting z24_s8 and z32 depth textures on r300.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_reg.h | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_texstate.c | 47 |
2 files changed, 49 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 1baa74c526..ee556d347e 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -886,6 +886,14 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_FORMAT_A8R8G8B8 0x13 /* no swizzle */ # define R300_TX_FORMAT_B8G8_B8G8 0x14 /* no swizzle */ # define R300_TX_FORMAT_G8R8_G8B8 0x15 /* no swizzle */ + + /* These two values are wrong, but they're the only values that + * produce any even vaguely correct results. Can r300 only do 16-bit + * depth textures? + */ +# define R300_TX_FORMAT_X24_Y8 0x1e +# define R300_TX_FORMAT_X32 0x1e + /* 0x16 - some 16 bit green format.. ?? */ # define R300_TX_FORMAT_UNK25 (1 << 25) /* no swizzle */ # define R300_TX_FORMAT_CUBIC_MAP (1 << 26) diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 1c9851afb2..efa201a52d 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; } } |