diff options
author | Marek Olšák <[email protected]> | 2012-07-08 00:23:41 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-07-09 13:57:59 +0200 |
commit | a460df9299dfeb7915689befc15155e18e41ddb8 (patch) | |
tree | 6f8d2388b794c79d880d4a1aa4142f946c00905e /src/gallium/drivers/r600 | |
parent | c1e8c845ea9c6f843cc5bba5974668c007799bbc (diff) |
r600g: add assertions after translate_colorswap/colorformat/dbformat/texformat
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 11 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 15727986ea8..939e05b06d8 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -983,8 +983,10 @@ static struct pipe_sampler_view *evergreen_create_sampler_view(struct pipe_conte format = r600_translate_texformat(ctx->screen, state->format, swizzle, &word4, &yuv_format); + assert(format != ~0); if (format == ~0) { - format = 0; + FREE(view); + return NULL; } if (tmp->is_depth && !tmp->is_flushing_texture) { @@ -1415,7 +1417,11 @@ static void evergreen_cb(struct r600_context *rctx, struct r600_pipe_state *rsta } format = r600_translate_colorformat(surf->base.format); + assert(format != ~0); + swap = r600_translate_colorswap(surf->base.format); + assert(swap != ~0); + if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) { endian = ENDIAN_NONE; } else { @@ -1534,6 +1540,7 @@ static void evergreen_db(struct r600_context *rctx, struct r600_pipe_state *rsta rtex = (struct r600_resource_texture*)surf->base.texture; first_layer = surf->base.u.tex.first_layer; format = r600_translate_dbformat(surf->base.format); + assert(format != ~0); offset = r600_resource_va(rctx->context.screen, surf->base.texture); /* XXX remove this once tiling is properly supported */ diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 3fd77daae7d..d51c64bca5e 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -995,8 +995,10 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c format = r600_translate_texformat(ctx->screen, state->format, swizzle, &word4, &yuv_format); + assert(format != ~0); if (format == ~0) { - format = 0; + FREE(view); + return NULL; } if (tmp->is_depth && !tmp->is_flushing_texture) { @@ -1456,8 +1458,12 @@ static void r600_cb(struct r600_context *rctx, struct r600_pipe_state *rstate, } format = r600_translate_colorformat(surf->base.format); + assert(format != ~0); + swap = r600_translate_colorswap(surf->base.format); - if(rtex->resource.b.b.usage == PIPE_USAGE_STAGING) { + assert(swap != ~0); + + if (rtex->resource.b.b.usage == PIPE_USAGE_STAGING) { endian = ENDIAN_NONE; } else { endian = r600_colorformat_endian_swap(format); @@ -1612,6 +1618,7 @@ static void r600_db(struct r600_context *rctx, struct r600_pipe_state *rstate, } format = r600_translate_dbformat(state->zsbuf->format); + assert(format != ~0); r600_pipe_state_add_reg_bo(rstate, R_02800C_DB_DEPTH_BASE, offset >> 8, &rtex->resource, RADEON_USAGE_READWRITE); |