From 0e52be58f05eaa5762b9a03ac860da4d9581cead Mon Sep 17 00:00:00 2001
From: Ian Romanick <ian.d.romanick@intel.com>
Date: Wed, 4 Jan 2012 16:08:20 -0800
Subject: mesa: Add missing GL_RG_INTEGER cases

Adds two missing '|| srcFormat == GL_RG_INTEGER' in assertions and a
bunch of missing pixel converions cases.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
---
 src/mesa/main/pack.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

(limited to 'src')

diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 2933ff638fc..8f2c8fd974f 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -692,6 +692,12 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i] = (GLubyte) rgba[i][ACOMP];
                   }
                   break;
+               case GL_RG_INTEGER:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = (GLubyte) rgba[i][RCOMP];
+                     dst[i*2+1] = (GLubyte) rgba[i][GCOMP];
+                  }
+                  break;
                case GL_RGB_INTEGER_EXT:
                   for (i=0;i<n;i++) {
                      dst[i*3+0] = (GLubyte) rgba[i][RCOMP];
@@ -843,6 +849,12 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i] = (GLbyte) rgba[i][ACOMP];
                   }
                   break;
+               case GL_RG_INTEGER:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = (GLbyte) rgba[i][RCOMP];
+                     dst[i*2+1] = (GLbyte) rgba[i][GCOMP];
+                  }
+                  break;
                case GL_RGB_INTEGER_EXT:
                   for (i=0;i<n;i++) {
                      dst[i*3+0] = (GLbyte) rgba[i][RCOMP];
@@ -994,6 +1006,12 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i] = (GLushort) rgba[i][ACOMP];
                   }
                   break;
+               case GL_RG_INTEGER:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = (GLushort) rgba[i][RCOMP];
+                     dst[i*2+1] = (GLushort) rgba[i][GCOMP];
+                  }
+                  break;
                case GL_RGB_INTEGER_EXT:
                   for (i=0;i<n;i++) {
                      dst[i*3+0] = (GLushort) rgba[i][RCOMP];
@@ -1145,6 +1163,13 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i] = (GLshort) rgba[i][ACOMP];
                   }
                   break;
+               case GL_RG_INTEGER:
+                  for (i=0;i<n;i++) {
+                     dst[i*3+0] = (GLshort) rgba[i][RCOMP];
+                     dst[i*3+1] = (GLshort) rgba[i][GCOMP];
+                     dst[i*3+2] = (GLshort) rgba[i][BCOMP];
+                  }
+                  break;
                case GL_RGB_INTEGER_EXT:
                   for (i=0;i<n;i++) {
                      dst[i*3+0] = (GLshort) rgba[i][RCOMP];
@@ -1296,6 +1321,12 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i] = (GLuint) rgba[i][ACOMP];
                   }
                   break;
+               case GL_RG_INTEGER:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = (GLuint) rgba[i][RCOMP];
+                     dst[i*2+1] = (GLuint) rgba[i][GCOMP];
+                  }
+                  break;
                case GL_RGB_INTEGER_EXT:
                   for (i=0;i<n;i++) {
                      dst[i*3+0] = (GLuint) rgba[i][RCOMP];
@@ -1454,6 +1485,12 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
                      dst[i] = (GLint) rgba[i][ACOMP];
                   }
                   break;
+               case GL_RG_INTEGER:
+                  for (i=0;i<n;i++) {
+                     dst[i*2+0] = (GLint) rgba[i][RCOMP];
+                     dst[i*2+1] = (GLint) rgba[i][GCOMP];
+                  }
+                  break;
                case GL_RGB_INTEGER_EXT:
                   for (i=0;i<n;i++) {
                      dst[i*3+0] = (GLint) rgba[i][RCOMP];
@@ -2397,6 +2434,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
           srcFormat == GL_GREEN_INTEGER_EXT ||
           srcFormat == GL_BLUE_INTEGER_EXT ||
           srcFormat == GL_ALPHA_INTEGER_EXT ||
+          srcFormat == GL_RG_INTEGER ||
           srcFormat == GL_RGB_INTEGER_EXT ||
           srcFormat == GL_RGBA_INTEGER_EXT ||
           srcFormat == GL_BGR_INTEGER_EXT ||
@@ -3778,6 +3816,7 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
           srcFormat == GL_GREEN_INTEGER_EXT ||
           srcFormat == GL_BLUE_INTEGER_EXT ||
           srcFormat == GL_ALPHA_INTEGER_EXT ||
+          srcFormat == GL_RG_INTEGER ||
           srcFormat == GL_RGB_INTEGER_EXT ||
           srcFormat == GL_RGBA_INTEGER_EXT ||
           srcFormat == GL_BGR_INTEGER_EXT ||
-- 
cgit v1.2.3