[Mesa-dev] [PATCH 13/15] i965: Add support for half-float formats.
Eric Anholt
eric at anholt.net
Tue Nov 15 17:56:00 PST 2011
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-formats.
---
Original gen4 should have been totally (instead of just partially
pre-surface-format-table) failing at ARB_texture_float up to this
point. I need to 1) test this series on gen4 to make sure that's the
only change, 2) Put in FLOAT32 -> FLOAT16 fallbacks so gen4
ARB_texture_float actually works.
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 18 +++++++++++-------
1 files 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 9574d1c..03c3892 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
--
1.7.7
More information about the mesa-dev
mailing list