summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-08-06 15:06:25 +1000
committerDave Airlie <[email protected]>2010-08-06 15:06:25 +1000
commitfc47cb9d710c046d34e8238337e009d7b76a3207 (patch)
treee19d3d359c1ccfd6d65c7d15f1435ad5830d47fd /src/gallium/drivers/r600
parentb8de7788a4b20c702b06402e2e6eed60467e2522 (diff)
r600g: fixup z format translations.
this enables GL_EXT_packed_depth_stencil. fbo-d24s8 passes
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r--src/gallium/drivers/r600/r600_state.c20
-rw-r--r--src/gallium/drivers/r600/r600_state_inlines.h24
2 files changed, 24 insertions, 20 deletions
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index e43e4afe55e..82145617ca1 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -706,22 +706,6 @@ static int r600_cb0(struct r600_context *rctx, struct radeon_state *rstate)
return radeon_state_pm4(rstate);
}
-static int r600_db_format(unsigned pformat, unsigned *format)
-{
- switch (pformat) {
- case PIPE_FORMAT_Z24X8_UNORM:
- *format = V_028010_DEPTH_X8_24;
- return 0;
- case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- *format = V_028010_DEPTH_8_24;
- return 0;
- default:
- *format = V_028010_DEPTH_INVALID;
- R600_ERR("unsupported %d\n", pformat);
- return -EINVAL;
- }
-}
-
static int r600_db(struct r600_context *rctx, struct radeon_state *rstate)
{
struct r600_screen *rscreen = rctx->screen;
@@ -746,9 +730,7 @@ static int r600_db(struct r600_context *rctx, struct radeon_state *rstate)
level = state->zsbuf->level;
pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1;
- if (r600_db_format(state->zsbuf->texture->format, &format)) {
- return -EINVAL;
- }
+ format = r600_translate_dbformat(state->zsbuf->texture->format);
rstate->states[R600_DB__DB_DEPTH_BASE] = 0x00000000;
rstate->states[R600_DB__DB_DEPTH_INFO] = 0x00010000 |
S_028010_FORMAT(format);
diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h
index b45089dcc18..4a955da1c02 100644
--- a/src/gallium/drivers/r600/r600_state_inlines.h
+++ b/src/gallium/drivers/r600/r600_state_inlines.h
@@ -129,6 +129,20 @@ static INLINE uint32_t r600_translate_ds_func(int func)
return func;
}
+static uint32_t r600_translate_dbformat(enum pipe_format format)
+{
+ switch (format) {
+ case PIPE_FORMAT_Z16_UNORM:
+ return V_028010_DEPTH_16;
+ case PIPE_FORMAT_Z24X8_UNORM:
+ return V_028010_DEPTH_X8_24;
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ return V_028010_DEPTH_8_24;
+ default:
+ return ~0;
+ }
+}
+
static uint32_t r600_translate_colorswap(enum pipe_format format)
{
switch (format) {
@@ -168,6 +182,10 @@ static uint32_t r600_translate_colorswap(enum pipe_format format)
// case PIPE_FORMAT_R8SG8SB8UX8U_NORM:
return SWAP_STD_REV;
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ return SWAP_STD;
+
case PIPE_FORMAT_R10G10B10A2_UNORM:
case PIPE_FORMAT_R10G10B10X2_SNORM:
case PIPE_FORMAT_B10G10R10A2_UNORM:
@@ -234,6 +252,10 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format)
case PIPE_FORMAT_R10SG10SB10SA2U_NORM:
return V_0280A0_COLOR_10_10_10_2;
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ return V_0280A0_COLOR_24_8;
+
/* 64-bit buffers. */
case PIPE_FORMAT_R16G16B16A16_UNORM:
case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -271,7 +293,7 @@ static INLINE boolean r600_is_colorbuffer_format_supported(enum pipe_format form
static INLINE boolean r600_is_zs_format_supported(enum pipe_format format)
{
- return TRUE;
+ return r600_translate_dbformat(format) != ~0;
}
static INLINE boolean r600_is_vertex_format_supported(enum pipe_format format)