From 914b4bb80c28c81101941d5533361ae0108eb771 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 29 Feb 2012 13:09:51 +0100 Subject: [PATCH] r600g: add support for missing colorbuffer formats MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Alex Deucher Reviewed-by: Christian König --- src/gallium/drivers/r600/evergreen_state.c | 80 +++++++++++++++++++++- src/gallium/drivers/r600/r600_state.c | 80 +++++++++++++++++++++- 2 files changed, 158 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 114689fad37..53fe81dfa9a 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -215,17 +215,44 @@ static uint32_t r600_translate_colorswap(enum pipe_format format) return V_028C70_SWAP_ALT; case PIPE_FORMAT_A8_UNORM: + case PIPE_FORMAT_A8_SNORM: case PIPE_FORMAT_A8_UINT: case PIPE_FORMAT_A8_SINT: + case PIPE_FORMAT_A16_UNORM: + case PIPE_FORMAT_A16_SNORM: + case PIPE_FORMAT_A16_UINT: + case PIPE_FORMAT_A16_SINT: + case PIPE_FORMAT_A16_FLOAT: + case PIPE_FORMAT_A32_UINT: + case PIPE_FORMAT_A32_SINT: + case PIPE_FORMAT_A32_FLOAT: case PIPE_FORMAT_R4A4_UNORM: return V_028C70_SWAP_ALT_REV; case PIPE_FORMAT_I8_UNORM: - case PIPE_FORMAT_L8_UNORM: + case PIPE_FORMAT_I8_SNORM: case PIPE_FORMAT_I8_UINT: case PIPE_FORMAT_I8_SINT: + case PIPE_FORMAT_I16_UNORM: + case PIPE_FORMAT_I16_SNORM: + case PIPE_FORMAT_I16_UINT: + case PIPE_FORMAT_I16_SINT: + case PIPE_FORMAT_I16_FLOAT: + case PIPE_FORMAT_I32_UINT: + case PIPE_FORMAT_I32_SINT: + case PIPE_FORMAT_I32_FLOAT: + case PIPE_FORMAT_L8_UNORM: + case PIPE_FORMAT_L8_SNORM: case PIPE_FORMAT_L8_UINT: case PIPE_FORMAT_L8_SINT: case PIPE_FORMAT_L8_SRGB: + case PIPE_FORMAT_L16_UNORM: + case PIPE_FORMAT_L16_SNORM: + case PIPE_FORMAT_L16_UINT: + case PIPE_FORMAT_L16_SINT: + case PIPE_FORMAT_L16_FLOAT: + case PIPE_FORMAT_L32_UINT: + case PIPE_FORMAT_L32_SINT: + case PIPE_FORMAT_L32_FLOAT: case PIPE_FORMAT_R8_UNORM: case PIPE_FORMAT_R8_SNORM: case PIPE_FORMAT_R8_UINT: @@ -248,16 +275,27 @@ static uint32_t r600_translate_colorswap(enum pipe_format format) return V_028C70_SWAP_STD; case PIPE_FORMAT_L8A8_UNORM: + case PIPE_FORMAT_L8A8_SNORM: case PIPE_FORMAT_L8A8_UINT: case PIPE_FORMAT_L8A8_SINT: case PIPE_FORMAT_L8A8_SRGB: + case PIPE_FORMAT_L16A16_UNORM: + case PIPE_FORMAT_L16A16_SNORM: + case PIPE_FORMAT_L16A16_UINT: + case PIPE_FORMAT_L16A16_SINT: + case PIPE_FORMAT_L16A16_FLOAT: + case PIPE_FORMAT_L32A32_UINT: + case PIPE_FORMAT_L32A32_SINT: + case PIPE_FORMAT_L32A32_FLOAT: return V_028C70_SWAP_ALT; case PIPE_FORMAT_R8G8_UNORM: + case PIPE_FORMAT_R8G8_SNORM: case PIPE_FORMAT_R8G8_UINT: case PIPE_FORMAT_R8G8_SINT: return V_028C70_SWAP_STD; case PIPE_FORMAT_R16_UNORM: + case PIPE_FORMAT_R16_SNORM: case PIPE_FORMAT_R16_UINT: case PIPE_FORMAT_R16_SINT: case PIPE_FORMAT_R16_FLOAT: @@ -312,6 +350,7 @@ static uint32_t r600_translate_colorswap(enum pipe_format format) case PIPE_FORMAT_Z32_FLOAT: case PIPE_FORMAT_R16G16_FLOAT: case PIPE_FORMAT_R16G16_UNORM: + case PIPE_FORMAT_R16G16_SNORM: case PIPE_FORMAT_R16G16_UINT: case PIPE_FORMAT_R16G16_SINT: return V_028C70_SWAP_STD; @@ -346,12 +385,15 @@ static uint32_t r600_translate_colorformat(enum pipe_format format) switch (format) { /* 8-bit buffers. */ case PIPE_FORMAT_A8_UNORM: + case PIPE_FORMAT_A8_SNORM: case PIPE_FORMAT_A8_UINT: case PIPE_FORMAT_A8_SINT: case PIPE_FORMAT_I8_UNORM: + case PIPE_FORMAT_I8_SNORM: case PIPE_FORMAT_I8_UINT: case PIPE_FORMAT_I8_SINT: case PIPE_FORMAT_L8_UNORM: + case PIPE_FORMAT_L8_SNORM: case PIPE_FORMAT_L8_UINT: case PIPE_FORMAT_L8_SINT: case PIPE_FORMAT_L8_SRGB: @@ -377,20 +419,38 @@ static uint32_t r600_translate_colorformat(enum pipe_format format) return V_028C70_COLOR_16; case PIPE_FORMAT_L8A8_UNORM: + case PIPE_FORMAT_L8A8_SNORM: case PIPE_FORMAT_L8A8_UINT: case PIPE_FORMAT_L8A8_SINT: case PIPE_FORMAT_L8A8_SRGB: case PIPE_FORMAT_R8G8_UNORM: + case PIPE_FORMAT_R8G8_SNORM: case PIPE_FORMAT_R8G8_UINT: case PIPE_FORMAT_R8G8_SINT: return V_028C70_COLOR_8_8; case PIPE_FORMAT_R16_UNORM: + case PIPE_FORMAT_R16_SNORM: case PIPE_FORMAT_R16_UINT: case PIPE_FORMAT_R16_SINT: + case PIPE_FORMAT_A16_UNORM: + case PIPE_FORMAT_A16_SNORM: + case PIPE_FORMAT_A16_UINT: + case PIPE_FORMAT_A16_SINT: + case PIPE_FORMAT_L16_UNORM: + case PIPE_FORMAT_L16_SNORM: + case PIPE_FORMAT_L16_UINT: + case PIPE_FORMAT_L16_SINT: + case PIPE_FORMAT_I16_UNORM: + case PIPE_FORMAT_I16_SNORM: + case PIPE_FORMAT_I16_UINT: + case PIPE_FORMAT_I16_SINT: return V_028C70_COLOR_16; case PIPE_FORMAT_R16_FLOAT: + case PIPE_FORMAT_A16_FLOAT: + case PIPE_FORMAT_L16_FLOAT: + case PIPE_FORMAT_I16_FLOAT: return V_028C70_COLOR_16_FLOAT; /* 32-bit buffers. */ @@ -431,18 +491,33 @@ static uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_R32_UINT: case PIPE_FORMAT_R32_SINT: + case PIPE_FORMAT_A32_UINT: + case PIPE_FORMAT_A32_SINT: + case PIPE_FORMAT_L32_UINT: + case PIPE_FORMAT_L32_SINT: + case PIPE_FORMAT_I32_UINT: + case PIPE_FORMAT_I32_SINT: return V_028C70_COLOR_32; case PIPE_FORMAT_R32_FLOAT: + case PIPE_FORMAT_A32_FLOAT: + case PIPE_FORMAT_L32_FLOAT: + case PIPE_FORMAT_I32_FLOAT: case PIPE_FORMAT_Z32_FLOAT: return V_028C70_COLOR_32_FLOAT; case PIPE_FORMAT_R16G16_FLOAT: + case PIPE_FORMAT_L16A16_FLOAT: return V_028C70_COLOR_16_16_FLOAT; case PIPE_FORMAT_R16G16_UNORM: + case PIPE_FORMAT_R16G16_SNORM: case PIPE_FORMAT_R16G16_UINT: case PIPE_FORMAT_R16G16_SINT: + case PIPE_FORMAT_L16A16_UNORM: + case PIPE_FORMAT_L16A16_SNORM: + case PIPE_FORMAT_L16A16_UINT: + case PIPE_FORMAT_L16A16_SINT: return V_028C70_COLOR_16_16; case PIPE_FORMAT_R11G11B10_FLOAT: @@ -460,10 +535,13 @@ static uint32_t r600_translate_colorformat(enum pipe_format format) return V_028C70_COLOR_16_16_16_16_FLOAT; case PIPE_FORMAT_R32G32_FLOAT: + case PIPE_FORMAT_L32A32_FLOAT: return V_028C70_COLOR_32_32_FLOAT; case PIPE_FORMAT_R32G32_SINT: case PIPE_FORMAT_R32G32_UINT: + case PIPE_FORMAT_L32A32_UINT: + case PIPE_FORMAT_L32A32_SINT: return V_028C70_COLOR_32_32; /* 96-bit buffers. */ diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index c859f09a2ac..38a9830c35e 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -156,17 +156,44 @@ static uint32_t r600_translate_colorswap(enum pipe_format format) switch (format) { /* 8-bit buffers. */ case PIPE_FORMAT_A8_UNORM: + case PIPE_FORMAT_A8_SNORM: case PIPE_FORMAT_A8_UINT: case PIPE_FORMAT_A8_SINT: + case PIPE_FORMAT_A16_UNORM: + case PIPE_FORMAT_A16_SNORM: + case PIPE_FORMAT_A16_UINT: + case PIPE_FORMAT_A16_SINT: + case PIPE_FORMAT_A16_FLOAT: + case PIPE_FORMAT_A32_UINT: + case PIPE_FORMAT_A32_SINT: + case PIPE_FORMAT_A32_FLOAT: case PIPE_FORMAT_R4A4_UNORM: return V_0280A0_SWAP_ALT_REV; case PIPE_FORMAT_I8_UNORM: - case PIPE_FORMAT_L8_UNORM: + case PIPE_FORMAT_I8_SNORM: case PIPE_FORMAT_I8_UINT: case PIPE_FORMAT_I8_SINT: + case PIPE_FORMAT_L8_UNORM: + case PIPE_FORMAT_L8_SNORM: case PIPE_FORMAT_L8_UINT: case PIPE_FORMAT_L8_SINT: case PIPE_FORMAT_L8_SRGB: + case PIPE_FORMAT_L16_UNORM: + case PIPE_FORMAT_L16_SNORM: + case PIPE_FORMAT_L16_UINT: + case PIPE_FORMAT_L16_SINT: + case PIPE_FORMAT_L16_FLOAT: + case PIPE_FORMAT_L32_UINT: + case PIPE_FORMAT_L32_SINT: + case PIPE_FORMAT_L32_FLOAT: + case PIPE_FORMAT_I16_UNORM: + case PIPE_FORMAT_I16_SNORM: + case PIPE_FORMAT_I16_UINT: + case PIPE_FORMAT_I16_SINT: + case PIPE_FORMAT_I16_FLOAT: + case PIPE_FORMAT_I32_UINT: + case PIPE_FORMAT_I32_SINT: + case PIPE_FORMAT_I32_FLOAT: case PIPE_FORMAT_R8_UNORM: case PIPE_FORMAT_R8_SNORM: case PIPE_FORMAT_R8_UINT: @@ -193,16 +220,27 @@ static uint32_t r600_translate_colorswap(enum pipe_format format) return V_0280A0_SWAP_STD; case PIPE_FORMAT_L8A8_UNORM: + case PIPE_FORMAT_L8A8_SNORM: case PIPE_FORMAT_L8A8_UINT: case PIPE_FORMAT_L8A8_SINT: case PIPE_FORMAT_L8A8_SRGB: + case PIPE_FORMAT_L16A16_UNORM: + case PIPE_FORMAT_L16A16_SNORM: + case PIPE_FORMAT_L16A16_UINT: + case PIPE_FORMAT_L16A16_SINT: + case PIPE_FORMAT_L16A16_FLOAT: + case PIPE_FORMAT_L32A32_UINT: + case PIPE_FORMAT_L32A32_SINT: + case PIPE_FORMAT_L32A32_FLOAT: return V_0280A0_SWAP_ALT; case PIPE_FORMAT_R8G8_UNORM: + case PIPE_FORMAT_R8G8_SNORM: case PIPE_FORMAT_R8G8_UINT: case PIPE_FORMAT_R8G8_SINT: return V_0280A0_SWAP_STD; case PIPE_FORMAT_R16_UNORM: + case PIPE_FORMAT_R16_SNORM: case PIPE_FORMAT_R16_UINT: case PIPE_FORMAT_R16_SINT: case PIPE_FORMAT_R16_FLOAT: @@ -253,6 +291,7 @@ static uint32_t r600_translate_colorswap(enum pipe_format format) case PIPE_FORMAT_R11G11B10_FLOAT: case PIPE_FORMAT_R16G16_UNORM: + case PIPE_FORMAT_R16G16_SNORM: case PIPE_FORMAT_R16G16_FLOAT: case PIPE_FORMAT_R16G16_UINT: case PIPE_FORMAT_R16G16_SINT: @@ -297,12 +336,15 @@ static uint32_t r600_translate_colorformat(enum pipe_format format) /* 8-bit buffers. */ case PIPE_FORMAT_A8_UNORM: + case PIPE_FORMAT_A8_SNORM: case PIPE_FORMAT_A8_UINT: case PIPE_FORMAT_A8_SINT: case PIPE_FORMAT_I8_UNORM: + case PIPE_FORMAT_I8_SNORM: case PIPE_FORMAT_I8_UINT: case PIPE_FORMAT_I8_SINT: case PIPE_FORMAT_L8_UNORM: + case PIPE_FORMAT_L8_SNORM: case PIPE_FORMAT_L8_UINT: case PIPE_FORMAT_L8_SINT: case PIPE_FORMAT_L8_SRGB: @@ -328,20 +370,38 @@ static uint32_t r600_translate_colorformat(enum pipe_format format) return V_0280A0_COLOR_16; case PIPE_FORMAT_L8A8_UNORM: + case PIPE_FORMAT_L8A8_SNORM: case PIPE_FORMAT_L8A8_UINT: case PIPE_FORMAT_L8A8_SINT: case PIPE_FORMAT_L8A8_SRGB: case PIPE_FORMAT_R8G8_UNORM: + case PIPE_FORMAT_R8G8_SNORM: case PIPE_FORMAT_R8G8_UINT: case PIPE_FORMAT_R8G8_SINT: return V_0280A0_COLOR_8_8; case PIPE_FORMAT_R16_UNORM: + case PIPE_FORMAT_R16_SNORM: case PIPE_FORMAT_R16_UINT: case PIPE_FORMAT_R16_SINT: + case PIPE_FORMAT_A16_UNORM: + case PIPE_FORMAT_A16_SNORM: + case PIPE_FORMAT_A16_UINT: + case PIPE_FORMAT_A16_SINT: + case PIPE_FORMAT_L16_UNORM: + case PIPE_FORMAT_L16_SNORM: + case PIPE_FORMAT_L16_UINT: + case PIPE_FORMAT_L16_SINT: + case PIPE_FORMAT_I16_UNORM: + case PIPE_FORMAT_I16_SNORM: + case PIPE_FORMAT_I16_UINT: + case PIPE_FORMAT_I16_SINT: return V_0280A0_COLOR_16; case PIPE_FORMAT_R16_FLOAT: + case PIPE_FORMAT_A16_FLOAT: + case PIPE_FORMAT_L16_FLOAT: + case PIPE_FORMAT_I16_FLOAT: return V_0280A0_COLOR_16_FLOAT; /* 32-bit buffers. */ @@ -382,18 +442,33 @@ static uint32_t r600_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_R32_UINT: case PIPE_FORMAT_R32_SINT: + case PIPE_FORMAT_A32_UINT: + case PIPE_FORMAT_A32_SINT: + case PIPE_FORMAT_L32_UINT: + case PIPE_FORMAT_L32_SINT: + case PIPE_FORMAT_I32_UINT: + case PIPE_FORMAT_I32_SINT: return V_0280A0_COLOR_32; case PIPE_FORMAT_R32_FLOAT: + case PIPE_FORMAT_A32_FLOAT: + case PIPE_FORMAT_L32_FLOAT: + case PIPE_FORMAT_I32_FLOAT: case PIPE_FORMAT_Z32_FLOAT: return V_0280A0_COLOR_32_FLOAT; case PIPE_FORMAT_R16G16_FLOAT: + case PIPE_FORMAT_L16A16_FLOAT: return V_0280A0_COLOR_16_16_FLOAT; case PIPE_FORMAT_R16G16_UNORM: + case PIPE_FORMAT_R16G16_SNORM: case PIPE_FORMAT_R16G16_UINT: case PIPE_FORMAT_R16G16_SINT: + case PIPE_FORMAT_L16A16_UNORM: + case PIPE_FORMAT_L16A16_SNORM: + case PIPE_FORMAT_L16A16_UINT: + case PIPE_FORMAT_L16A16_SINT: return V_0280A0_COLOR_16_16; case PIPE_FORMAT_R11G11B10_FLOAT: @@ -411,10 +486,13 @@ static uint32_t r600_translate_colorformat(enum pipe_format format) return V_0280A0_COLOR_16_16_16_16_FLOAT; case PIPE_FORMAT_R32G32_FLOAT: + case PIPE_FORMAT_L32A32_FLOAT: return V_0280A0_COLOR_32_32_FLOAT; case PIPE_FORMAT_R32G32_SINT: case PIPE_FORMAT_R32G32_UINT: + case PIPE_FORMAT_L32A32_UINT: + case PIPE_FORMAT_L32A32_SINT: return V_0280A0_COLOR_32_32; /* 96-bit buffers. */ -- 2.30.2