diff options
author | Marek Olšák <[email protected]> | 2013-01-12 04:44:37 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-01-14 03:12:01 +0100 |
commit | e102b665e60f7a8d2bb4ef2c5d313e22105ae22f (patch) | |
tree | 68c457ffe002c3017b4b9d149303ca1af57c3522 /src/gallium | |
parent | 5fc83101fbb9b7dd0d7f0b91a9b1c1c1bc0250b6 (diff) |
r300g: advertise MSAA support for the RGB10_A2 format on r500
It seems to be working just fine.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.c | 54 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_texture_desc.c | 5 |
2 files changed, 47 insertions, 12 deletions
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 2a196350c88..8e479532fdd 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -351,6 +351,32 @@ static int r300_get_video_param(struct pipe_screen *screen, } } +/** + * Whether the format matches: + * PIPE_FORMAT_?10?10?10?2_UNORM + */ +static INLINE boolean +util_format_is_rgba1010102_variant(const struct util_format_description *desc) +{ + static const unsigned size[4] = {10, 10, 10, 2}; + unsigned chan; + + if (desc->block.width != 1 || + desc->block.height != 1 || + desc->block.bits != 32) + return FALSE; + + for (chan = 0; chan < 4; ++chan) { + if(desc->channel[chan].type != UTIL_FORMAT_TYPE_UNSIGNED && + desc->channel[chan].type != UTIL_FORMAT_TYPE_VOID) + return FALSE; + if (desc->channel[chan].size != size[chan]) + return FALSE; + } + + return TRUE; +} + static boolean r300_is_format_supported(struct pipe_screen* screen, enum pipe_format format, enum pipe_texture_target target, @@ -383,6 +409,7 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, format == PIPE_FORMAT_R16G16_FLOAT || format == PIPE_FORMAT_R16G16B16_FLOAT || format == PIPE_FORMAT_R16G16B16A16_FLOAT; + const struct util_format_description *desc; if (!util_format_is_supported(format, usage)) return FALSE; @@ -410,16 +437,23 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, PIPE_BIND_SCANOUT)) { return FALSE; } - /* Only allow depth/stencil, RGBA8, RGBA16F */ - if (!util_format_is_depth_or_stencil(format) && - !util_format_is_rgba8_variant( - util_format_description(format)) && - format != PIPE_FORMAT_R16G16B16A16_FLOAT) { - return FALSE; - } - /* RGBA16F AA is only supported on R500. */ - if (format == PIPE_FORMAT_R16G16B16A16_FLOAT && !is_r500) { - return FALSE; + + desc = util_format_description(format); + + if (is_r500) { + /* Only allow depth/stencil, RGBA8, RGBA1010102, RGBA16F. */ + if (!util_format_is_depth_or_stencil(format) && + !util_format_is_rgba8_variant(desc) && + !util_format_is_rgba1010102_variant(desc) && + format != PIPE_FORMAT_R16G16B16A16_FLOAT) { + return FALSE; + } + } else { + /* Only allow depth/stencil, RGBA8. */ + if (!util_format_is_depth_or_stencil(format) && + !util_format_is_rgba8_variant(desc)) { + return FALSE; + } } break; default: diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index cdb56cc1b5e..e9623eea608 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -464,14 +464,15 @@ static void r300_tex_print_info(struct r300_resource *tex, { fprintf(stderr, "r300: %s: Macro: %s, Micro: %s, Pitch: %i, Dim: %ix%ix%i, " - "LastLevel: %i, Size: %i, Format: %s\n", + "LastLevel: %i, Size: %i, Format: %s, Samples: %i\n", func, tex->tex.macrotile[0] ? "YES" : " NO", tex->tex.microtile ? "YES" : " NO", r300_stride_to_width(tex->b.b.format, tex->tex.stride_in_bytes[0]), tex->b.b.width0, tex->b.b.height0, tex->b.b.depth0, tex->b.b.last_level, tex->tex.size_in_bytes, - util_format_short_name(tex->b.b.format)); + util_format_short_name(tex->b.b.format), + tex->b.b.nr_samples); } void r300_texture_desc_init(struct r300_screen *rscreen, |