[Mesa-dev] [PATCH 09/17] i965: Expose support for L/I/A/LA integer textures.
Eric Anholt
eric at anholt.net
Fri Jan 20 15:39:21 PST 2012
Before, we were mapping them to RGBA integer textures using
ChooseTexFormat, but core Mesa doesn't handle enforcing texture
swizzling to get the right channels out, and core Mesa doesn't remap
channels on the way out of ReadPixels -- it just does format_unpack to
RGBA and then packs RGBA to the user requested type.
Handle these formats natively by mapping them to R/RG textures and
doing the swizzles ourselves.
Fixes some more failures in EXT_texture_integer/fbo-blending
NOTE: This is a candidate for the 8.0 branch.
---
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 58 ++++++++++++----------
1 files changed, 31 insertions(+), 27 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 0296f25..b16ce6f 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -365,33 +365,37 @@ brw_format_for_mesa_format(gl_format mesa_format)
[MESA_FORMAT_RG_FLOAT32] = BRW_SURFACEFORMAT_R32G32_FLOAT,
[MESA_FORMAT_RG_FLOAT16] = BRW_SURFACEFORMAT_R16G16_FLOAT,
- [MESA_FORMAT_ALPHA_UINT8] = 0,
- [MESA_FORMAT_ALPHA_UINT16] = 0,
- [MESA_FORMAT_ALPHA_UINT32] = 0,
- [MESA_FORMAT_ALPHA_INT8] = 0,
- [MESA_FORMAT_ALPHA_INT16] = 0,
- [MESA_FORMAT_ALPHA_INT32] = 0,
-
- [MESA_FORMAT_INTENSITY_UINT8] = 0,
- [MESA_FORMAT_INTENSITY_UINT16] = 0,
- [MESA_FORMAT_INTENSITY_UINT32] = 0,
- [MESA_FORMAT_INTENSITY_INT8] = 0,
- [MESA_FORMAT_INTENSITY_INT16] = 0,
- [MESA_FORMAT_INTENSITY_INT32] = 0,
-
- [MESA_FORMAT_LUMINANCE_UINT8] = 0,
- [MESA_FORMAT_LUMINANCE_UINT16] = 0,
- [MESA_FORMAT_LUMINANCE_UINT32] = 0,
- [MESA_FORMAT_LUMINANCE_INT8] = 0,
- [MESA_FORMAT_LUMINANCE_INT16] = 0,
- [MESA_FORMAT_LUMINANCE_INT32] = 0,
-
- [MESA_FORMAT_LUMINANCE_ALPHA_UINT8] = 0,
- [MESA_FORMAT_LUMINANCE_ALPHA_UINT16] = 0,
- [MESA_FORMAT_LUMINANCE_ALPHA_UINT32] = 0,
- [MESA_FORMAT_LUMINANCE_ALPHA_INT8] = 0,
- [MESA_FORMAT_LUMINANCE_ALPHA_INT16] = 0,
- [MESA_FORMAT_LUMINANCE_ALPHA_INT32] = 0,
+ /* These GL_EXT_texture_integer formats get handled by treating them as
+ * R/RG, swizzling their results from sampling, and swizzling color
+ * outputs into them in the fragment shader.
+ */
+ [MESA_FORMAT_ALPHA_UINT8] = BRW_SURFACEFORMAT_R8_UINT,
+ [MESA_FORMAT_ALPHA_UINT16] = BRW_SURFACEFORMAT_R16_UINT,
+ [MESA_FORMAT_ALPHA_UINT32] = BRW_SURFACEFORMAT_R32_UINT,
+ [MESA_FORMAT_ALPHA_INT8] = BRW_SURFACEFORMAT_R8_SINT,
+ [MESA_FORMAT_ALPHA_INT16] = BRW_SURFACEFORMAT_R16_SINT,
+ [MESA_FORMAT_ALPHA_INT32] = BRW_SURFACEFORMAT_R32_SINT,
+
+ [MESA_FORMAT_INTENSITY_UINT8] = BRW_SURFACEFORMAT_R8_UINT,
+ [MESA_FORMAT_INTENSITY_UINT16] = BRW_SURFACEFORMAT_R16_UINT,
+ [MESA_FORMAT_INTENSITY_UINT32] = BRW_SURFACEFORMAT_R32_UINT,
+ [MESA_FORMAT_INTENSITY_INT8] = BRW_SURFACEFORMAT_R8_SINT,
+ [MESA_FORMAT_INTENSITY_INT16] = BRW_SURFACEFORMAT_R16_SINT,
+ [MESA_FORMAT_INTENSITY_INT32] = BRW_SURFACEFORMAT_R32_SINT,
+
+ [MESA_FORMAT_LUMINANCE_UINT8] = BRW_SURFACEFORMAT_R8_UINT,
+ [MESA_FORMAT_LUMINANCE_UINT16] = BRW_SURFACEFORMAT_R16_UINT,
+ [MESA_FORMAT_LUMINANCE_UINT32] = BRW_SURFACEFORMAT_R32_UINT,
+ [MESA_FORMAT_LUMINANCE_INT8] = BRW_SURFACEFORMAT_R8_SINT,
+ [MESA_FORMAT_LUMINANCE_INT16] = BRW_SURFACEFORMAT_R16_SINT,
+ [MESA_FORMAT_LUMINANCE_INT32] = BRW_SURFACEFORMAT_R32_SINT,
+
+ [MESA_FORMAT_LUMINANCE_ALPHA_UINT8] = BRW_SURFACEFORMAT_R8G8_UINT,
+ [MESA_FORMAT_LUMINANCE_ALPHA_UINT16] = BRW_SURFACEFORMAT_R16G16_UINT,
+ [MESA_FORMAT_LUMINANCE_ALPHA_UINT32] = BRW_SURFACEFORMAT_R32G32_UINT,
+ [MESA_FORMAT_LUMINANCE_ALPHA_INT8] = BRW_SURFACEFORMAT_R8G8_SINT,
+ [MESA_FORMAT_LUMINANCE_ALPHA_INT16] = BRW_SURFACEFORMAT_R16G16_SINT,
+ [MESA_FORMAT_LUMINANCE_ALPHA_INT32] = BRW_SURFACEFORMAT_R32G32_SINT,
[MESA_FORMAT_R_INT8] = BRW_SURFACEFORMAT_R8_SINT,
[MESA_FORMAT_RG_INT8] = BRW_SURFACEFORMAT_R8G8_SINT,
--
1.7.7.3
More information about the mesa-dev
mailing list