From: Marek Olšák Date: Thu, 14 Feb 2013 13:59:01 +0000 (+0100) Subject: r300g: add support for red-alpha render targets X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ec5376f5d8b588bc3c147189059178f47aed3503;p=mesa.git r300g: add support for red-alpha render targets --- diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index d644ebb6153..06ed1cb5b5b 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -410,6 +410,7 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, format == PIPE_FORMAT_A16_FLOAT || format == PIPE_FORMAT_L16_FLOAT || format == PIPE_FORMAT_L16A16_FLOAT || + format == PIPE_FORMAT_R16A16_FLOAT || format == PIPE_FORMAT_I16_FLOAT; boolean is_half_float = format == PIPE_FORMAT_R16_FLOAT || format == PIPE_FORMAT_R16G16_FLOAT || diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index bf4163cea42..ad93510ab3f 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -604,6 +604,7 @@ static void r300_set_blend_color(struct pipe_context* pipe, break; case PIPE_FORMAT_L8A8_UNORM: + case PIPE_FORMAT_R8A8_UNORM: c.color[2] = c.color[3]; break; diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index d9657306c88..13e9bc3f66a 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -415,6 +415,8 @@ static uint32_t r300_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_L8A8_SNORM: case PIPE_FORMAT_R8G8_UNORM: case PIPE_FORMAT_R8G8_SNORM: + case PIPE_FORMAT_R8A8_UNORM: + case PIPE_FORMAT_R8A8_SNORM: /* These formats work fine with UV88 if US_OUT_FMT is set correctly. */ case PIPE_FORMAT_A16_UNORM: case PIPE_FORMAT_A16_SNORM: @@ -458,6 +460,9 @@ static uint32_t r300_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_L16A16_UNORM: case PIPE_FORMAT_L16A16_SNORM: case PIPE_FORMAT_L16A16_FLOAT: + case PIPE_FORMAT_R16A16_UNORM: + case PIPE_FORMAT_R16A16_SNORM: + case PIPE_FORMAT_R16A16_FLOAT: case PIPE_FORMAT_A32_FLOAT: case PIPE_FORMAT_L32_FLOAT: case PIPE_FORMAT_I32_FLOAT: @@ -481,6 +486,7 @@ static uint32_t r300_translate_colorformat(enum pipe_format format) * correctly. */ case PIPE_FORMAT_R32G32_FLOAT: case PIPE_FORMAT_L32A32_FLOAT: + case PIPE_FORMAT_R32A32_FLOAT: return R300_COLOR_FORMAT_ARGB16161616; /* 128-bit buffers. */ @@ -630,6 +636,8 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format) * COLORFORMAT_UV88 stores ZX (C2 and C0). */ case PIPE_FORMAT_L8A8_SNORM: case PIPE_FORMAT_L8A8_UNORM: + case PIPE_FORMAT_R8A8_SNORM: + case PIPE_FORMAT_R8A8_UNORM: return modifier | R300_C0_SEL_A | R300_C2_SEL_R; case PIPE_FORMAT_R8G8_SNORM: case PIPE_FORMAT_R8G8_UNORM: @@ -705,7 +713,11 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format) case PIPE_FORMAT_L16A16_UNORM: case PIPE_FORMAT_L16A16_SNORM: case PIPE_FORMAT_L16A16_FLOAT: + case PIPE_FORMAT_R16A16_UNORM: + case PIPE_FORMAT_R16A16_SNORM: + case PIPE_FORMAT_R16A16_FLOAT: case PIPE_FORMAT_L32A32_FLOAT: + case PIPE_FORMAT_R32A32_FLOAT: return modifier | R300_C0_SEL_R | R300_C1_SEL_A; @@ -738,10 +750,16 @@ static uint32_t r300_translate_colormask_swizzle(enum pipe_format format) case PIPE_FORMAT_L8A8_SNORM: case PIPE_FORMAT_L8A8_UNORM: + case PIPE_FORMAT_R8A8_UNORM: + case PIPE_FORMAT_R8A8_SNORM: case PIPE_FORMAT_L16A16_UNORM: case PIPE_FORMAT_L16A16_SNORM: case PIPE_FORMAT_L16A16_FLOAT: + case PIPE_FORMAT_R16A16_UNORM: + case PIPE_FORMAT_R16A16_SNORM: + case PIPE_FORMAT_R16A16_FLOAT: case PIPE_FORMAT_L32A32_FLOAT: + case PIPE_FORMAT_R32A32_FLOAT: return COLORMASK_ARRA; case PIPE_FORMAT_R8G8_SNORM: