+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ if (format == GL_RGBA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0xf) << 12)
+ | ((rgba[i][GCOMP] & 0xf) << 8)
+ | ((rgba[i][BCOMP] & 0xf) << 4)
+ | ((rgba[i][ACOMP] & 0xf) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][BCOMP] & 0xf) << 12)
+ | ((rgba[i][GCOMP] & 0xf) << 8)
+ | ((rgba[i][RCOMP] & 0xf) << 4)
+ | ((rgba[i][ACOMP] & 0xf) );
+ }
+ }
+ else {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0xf) << 12)
+ | ((rgba[i][BCOMP] & 0xf) << 8)
+ | ((rgba[i][GCOMP] & 0xf) << 4)
+ | ((rgba[i][RCOMP] & 0xf) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ if (format == GL_RGBA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0xf) << 12)
+ | ((rgba[i][BCOMP] & 0xf) << 8)
+ | ((rgba[i][GCOMP] & 0xf) << 4)
+ | ((rgba[i][RCOMP] & 0xf) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0xf) << 12)
+ | ((rgba[i][RCOMP] & 0xf) << 8)
+ | ((rgba[i][GCOMP] & 0xf) << 4)
+ | ((rgba[i][BCOMP] & 0xf) );
+ }
+ }
+ else {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0xf) << 12)
+ | ((rgba[i][GCOMP] & 0xf) << 8)
+ | ((rgba[i][BCOMP] & 0xf) << 4)
+ | ((rgba[i][ACOMP] & 0xf) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ if (format == GL_RGBA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11)
+ | ((rgba[i][GCOMP] & 0x1f) << 6)
+ | ((rgba[i][BCOMP] & 0x1f) << 1)
+ | ((rgba[i][ACOMP] & 0x1) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][BCOMP] & 0x1f) << 11)
+ | ((rgba[i][GCOMP] & 0x1f) << 6)
+ | ((rgba[i][RCOMP] & 0x1f) << 1)
+ | ((rgba[i][ACOMP] & 0x1) );
+ }
+ }
+ else {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11)
+ | ((rgba[i][BCOMP] & 0x1f) << 6)
+ | ((rgba[i][GCOMP] & 0x1f) << 1)
+ | ((rgba[i][RCOMP] & 0x1) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ if (format == GL_RGBA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11)
+ | ((rgba[i][BCOMP] & 0x1f) << 6)
+ | ((rgba[i][GCOMP] & 0x1f) << 1)
+ | ((rgba[i][RCOMP] & 0x1) );
+ }
+ }
+ else if (format == GL_BGRA) {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][ACOMP] & 0x1f) << 11)
+ | ((rgba[i][RCOMP] & 0x1f) << 6)
+ | ((rgba[i][GCOMP] & 0x1f) << 1)
+ | ((rgba[i][BCOMP] & 0x1) );
+ }
+ }
+ else {
+ GLushort *dst = (GLushort *) destination;
+ GLuint i;
+ ASSERT(format == GL_ABGR_EXT);
+ for (i = 0; i < n; i++) {
+ dst[i] = ((rgba[i][RCOMP] & 0x1f) << 11)
+ | ((rgba[i][GCOMP] & 0x1f) << 6)
+ | ((rgba[i][BCOMP] & 0x1f) << 1)
+ | ((rgba[i][ACOMP] & 0x1) );
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ if (format == GL_RGBA) {