From: Marek Olšák Date: Mon, 3 May 2010 18:14:17 +0000 (+0200) Subject: r300g: use util_format_short_name and util_format_is_plain X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ac6a26b429d70395cf6def04d2d9c8cf1bd2c964;p=mesa.git r300g: use util_format_short_name and util_format_is_plain --- diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index 819d5e3f0c8..85c2c149016 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -129,8 +129,8 @@ void r300_surface_copy(struct pipe_context* pipe, if (dst->texture->format != src->texture->format) { debug_printf("r300: Implementation error: Format mismatch in %s\n" " : src: %s dst: %s\n", __FUNCTION__, - util_format_name(src->texture->format), - util_format_name(dst->texture->format)); + util_format_short_name(src->texture->format), + util_format_short_name(dst->texture->format)); debug_assert(0); } @@ -138,7 +138,7 @@ void r300_surface_copy(struct pipe_context* pipe, old_format, src->texture->target, PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW, 0) && - util_format_description(old_format)->layout == UTIL_FORMAT_LAYOUT_PLAIN) { + util_format_is_plain(old_format)) { switch (util_format_get_blocksize(old_format)) { case 1: new_format = PIPE_FORMAT_I8_UNORM; @@ -155,7 +155,7 @@ void r300_surface_copy(struct pipe_context* pipe, default: debug_printf("r300: surface_copy: Unhandled format: %s. Falling back to software.\n" "r300: surface_copy: Software fallback doesn't work for tiled textures.\n", - util_format_name(old_format)); + util_format_short_name(old_format)); } } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index d31e7c53f71..446422ca0f0 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1317,7 +1317,7 @@ static void* r300_create_vertex_elements_state(struct pipe_context* pipe, /* XXX Shouldn't we align the format? */ fprintf(stderr, "r300_create_vertex_elements_state: " "Unaligned format %s:%i isn't supported\n", - util_format_name(*format), size); + util_format_short_name(*format), size); assert(0); abort(); } diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index fcbdb91b67e..715601042fa 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -371,7 +371,7 @@ r300_translate_vertex_data_type(enum pipe_format format) { desc = util_format_description(format); if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) { - fprintf(stderr, "r300: Bad format %s in %s:%d\n", util_format_name(format), + fprintf(stderr, "r300: Bad format %s in %s:%d\n", util_format_short_name(format), __FUNCTION__, __LINE__); assert(0); abort(); @@ -394,7 +394,7 @@ r300_translate_vertex_data_type(enum pipe_format format) { break; default: fprintf(stderr, "r300: Bad format %s in %s:%d\n", - util_format_name(format), __FUNCTION__, __LINE__); + util_format_short_name(format), __FUNCTION__, __LINE__); assert(0); abort(); } @@ -416,7 +416,7 @@ r300_translate_vertex_data_type(enum pipe_format format) { break; default: fprintf(stderr, "r300: Bad format %s in %s:%d\n", - util_format_name(format), __FUNCTION__, __LINE__); + util_format_short_name(format), __FUNCTION__, __LINE__); fprintf(stderr, "r300: desc->channel[0].size == %d\n", desc->channel[0].size); assert(0); @@ -425,7 +425,7 @@ r300_translate_vertex_data_type(enum pipe_format format) { break; default: fprintf(stderr, "r300: Bad format %s in %s:%d\n", - util_format_name(format), __FUNCTION__, __LINE__); + util_format_short_name(format), __FUNCTION__, __LINE__); assert(0); abort(); } @@ -449,7 +449,7 @@ r300_translate_vertex_data_swizzle(enum pipe_format format) { if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) { fprintf(stderr, "r300: Bad format %s in %s:%d\n", - util_format_name(format), __FUNCTION__, __LINE__); + util_format_short_name(format), __FUNCTION__, __LINE__); return 0; } diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 506fb733677..d6f629cf9c6 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -46,18 +46,6 @@ static const unsigned microblock_table[5][3][2] = { {{ 2, 1}, {0, 0}, {0, 0}} /* 128 bits per pixel */ }; -/* Return true for non-compressed and non-YUV formats. */ -static boolean r300_format_is_plain(enum pipe_format format) -{ - const struct util_format_description *desc = util_format_description(format); - - if (!format) { - return FALSE; - } - - return desc->layout == UTIL_FORMAT_LAYOUT_PLAIN; -} - /* Translate a pipe_format into a useful texture format for sampling. * * Some special formats are translated directly using R300_EASY_TX_FORMAT, @@ -620,7 +608,7 @@ void r300_texture_reinterpret_format(struct pipe_screen *screen, struct r300_screen *r300screen = r300_screen(screen); SCREEN_DBG(r300screen, DBG_TEX, "r300: texture_reinterpret_format: %s -> %s\n", - util_format_name(tex->format), util_format_name(new_format)); + util_format_short_name(tex->format), util_format_short_name(new_format)); tex->format = new_format; @@ -711,7 +699,7 @@ unsigned r300_texture_get_stride(struct r300_screen* screen, width = u_minify(tex->b.b.width0, level); - if (r300_format_is_plain(tex->b.b.format)) { + if (util_format_is_plain(tex->b.b.format)) { tile_width = r300_texture_get_tile_size(tex, TILE_WIDTH, tex->mip_macrotile[level]); width = align(width, tile_width); @@ -729,7 +717,7 @@ static unsigned r300_texture_get_nblocksy(struct r300_texture* tex, height = u_minify(tex->b.b.height0, level); - if (r300_format_is_plain(tex->b.b.format)) { + if (util_format_is_plain(tex->b.b.format)) { tile_height = r300_texture_get_tile_size(tex, TILE_HEIGHT, tex->mip_macrotile[level]); height = align(height, tile_height); @@ -772,7 +760,7 @@ static void r300_setup_miptree(struct r300_screen* screen, boolean rv350_mode = screen->caps.is_rv350; SCREEN_DBG(screen, DBG_TEXALLOC, "r300: Making miptree for texture, format %s\n", - util_format_name(base->format)); + util_format_short_name(base->format)); for (i = 0; i <= base->last_level; i++) { /* Let's see if this miplevel can be macrotiled. */ @@ -822,7 +810,7 @@ static void r300_setup_tiling(struct pipe_screen *screen, boolean is_zb = util_format_is_depth_or_stencil(format); boolean dbg_no_tiling = SCREEN_DBG_ON(r300_screen(screen), DBG_NO_TILING); - if (!r300_format_is_plain(format)) { + if (!util_format_is_plain(format)) { return; } @@ -957,7 +945,7 @@ struct pipe_resource* r300_texture_create(struct pipe_screen* screen, tex->microtile ? "YES" : " NO", tex->hwpitch[0], base->width0, base->height0, base->depth0, base->last_level, - util_format_name(base->format)); + util_format_short_name(base->format)); tex->buffer = rws->buffer_create(rws, 2048, PIPE_BIND_SAMPLER_VIEW, /* XXX */ @@ -1063,7 +1051,7 @@ r300_texture_from_handle(struct pipe_screen* screen, tex->microtile ? "YES" : " NO", stride / util_format_get_blocksize(base->format), base->width0, base->height0, - util_format_name(base->format)); + util_format_short_name(base->format)); /* Enforce microtiled zbuffer. */ override_zb_flags = util_format_is_depth_or_stencil(base->format) &&