From 1e42568bf304e9b3bae9fef8ad8febd25e1ac29f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 15 Nov 2011 16:26:29 -0800 Subject: [PATCH] i965: Add support for half-float formats. Now that all the rest of the driver is driven off of the surface formats table, all we really need to do is add the mapping from MESA_FORMAT to BRW_SURFACEFORMAT. However, we also add format override for I16/L16 render targets at the same time, so that existing users of I16 that were getting promoted to I32 and then getting the I32->R32 override still get FBO support. Fixes failures in piglit gl-3.0-required-sized-texture-formats, and will prevent regressions in ARB_texture_float on gen4 when moving to fully table-driven texture format setup. Reviewed-by: Kenneth Graunke --- .../drivers/dri/i965/brw_wm_surface_state.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 7f32d54a96e..bc261783395 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -347,21 +347,21 @@ brw_format_for_mesa_format(gl_format mesa_format) [MESA_FORMAT_RGBA_DXT5] = BRW_SURFACEFORMAT_BC3_UNORM, [MESA_FORMAT_RGBA_FLOAT32] = BRW_SURFACEFORMAT_R32G32B32A32_FLOAT, - [MESA_FORMAT_RGBA_FLOAT16] = 0, + [MESA_FORMAT_RGBA_FLOAT16] = BRW_SURFACEFORMAT_R16G16B16A16_FLOAT, [MESA_FORMAT_RGB_FLOAT32] = 0, [MESA_FORMAT_RGB_FLOAT16] = 0, [MESA_FORMAT_ALPHA_FLOAT32] = BRW_SURFACEFORMAT_A32_FLOAT, - [MESA_FORMAT_ALPHA_FLOAT16] = 0, + [MESA_FORMAT_ALPHA_FLOAT16] = BRW_SURFACEFORMAT_A16_FLOAT, [MESA_FORMAT_LUMINANCE_FLOAT32] = BRW_SURFACEFORMAT_L32_FLOAT, - [MESA_FORMAT_LUMINANCE_FLOAT16] = 0, + [MESA_FORMAT_LUMINANCE_FLOAT16] = BRW_SURFACEFORMAT_L16_FLOAT, [MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32] = BRW_SURFACEFORMAT_L32A32_FLOAT, - [MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = 0, + [MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = BRW_SURFACEFORMAT_L16A16_FLOAT, [MESA_FORMAT_INTENSITY_FLOAT32] = BRW_SURFACEFORMAT_I32_FLOAT, - [MESA_FORMAT_INTENSITY_FLOAT16] = 0, + [MESA_FORMAT_INTENSITY_FLOAT16] = BRW_SURFACEFORMAT_I16_FLOAT, [MESA_FORMAT_R_FLOAT32] = BRW_SURFACEFORMAT_R32_FLOAT, - [MESA_FORMAT_R_FLOAT16] = 0, + [MESA_FORMAT_R_FLOAT16] = BRW_SURFACEFORMAT_R16_FLOAT, [MESA_FORMAT_RG_FLOAT32] = BRW_SURFACEFORMAT_R32G32_FLOAT, - [MESA_FORMAT_RG_FLOAT16] = 0, + [MESA_FORMAT_RG_FLOAT16] = BRW_SURFACEFORMAT_R16G16_FLOAT, [MESA_FORMAT_ALPHA_UINT8] = 0, [MESA_FORMAT_ALPHA_UINT16] = 0, @@ -499,6 +499,10 @@ brw_init_surface_formats(struct brw_context *brw) case BRW_SURFACEFORMAT_L32_FLOAT: render = BRW_SURFACEFORMAT_R32_FLOAT; break; + case BRW_SURFACEFORMAT_I16_FLOAT: + case BRW_SURFACEFORMAT_L16_FLOAT: + render = BRW_SURFACEFORMAT_R16_FLOAT; + break; case BRW_SURFACEFORMAT_B8G8R8X8_UNORM: /* XRGB is handled as ARGB because the chips in this family * cannot render to XRGB targets. This means that we have to -- 2.30.2