[Mesa-dev] [PATCH V3 2/7] i965: support 2_10_10_10 formats in get_surface_type.

Chris Forbes chrisf at ijw.co.nz
Wed Nov 21 19:23:20 PST 2012


Always use R10G10B10A2_UINT; Most of the other formats we'd like
don't actually work on the hardware. Will emit w/a for scaling,
sign recovery and BGRA swizzle in the VS.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 src/mesa/drivers/dri/i965/brw_draw_upload.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 58803f5..b0e02db 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -252,10 +252,26 @@ static GLuint get_surface_type( GLenum type, GLuint size,
          else {
             return ubyte_types_norm[size];
          }
+      /* See GL_ARB_vertex_type_2_10_10_10_rev */
+      /* W/A: the hardware doesn't really support the formats we'd
+       * like to use here, so upload everything as UINT and fix
+       * it in the shader */
+      case GL_INT_2_10_10_10_REV:
+      case GL_UNSIGNED_INT_2_10_10_10_REV:
+         assert(size == 4);
+         return BRW_SURFACEFORMAT_R10G10B10A2_UINT;
       default: assert(0); return 0;
-      }      
+      }
    }
    else {
+      /* See GL_ARB_vertex_type_2_10_10_10_rev */
+      /* W/A: the hardware doesn't really support the formats we'd
+       * like to use here, so upload everything as UINT and fix
+       * it in the shader */
+      if (type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) {
+         assert(size == 4);
+		 return BRW_SURFACEFORMAT_R10G10B10A2_UINT;
+      }
       assert(format == GL_RGBA); /* sanity check */
       switch (type) {
       case GL_DOUBLE: return double_types[size];
-- 
1.8.0



More information about the mesa-dev mailing list