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;
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);
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) {
// 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:
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:
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)