- /* We use a bunch of heuristics here. If this gets too ugly we could
- * just encode the info the in the gl_format_info structures.
- */
- if (info->BaseFormat == GL_RGB ||
- info->BaseFormat == GL_RGBA ||
- info->BaseFormat == GL_ALPHA) {
- *comps = ((info->RedBits > 0) +
- (info->GreenBits > 0) +
- (info->BlueBits > 0) +
- (info->AlphaBits > 0));
-
- if (info->DataType== GL_FLOAT) {
- if (info->RedBits == 32)
- *datatype = GL_FLOAT;
- else
- *datatype = GL_HALF_FLOAT;
- }
- else if (info->GreenBits == 3) {
- *datatype = GL_UNSIGNED_BYTE_3_3_2;
- }
- else if (info->GreenBits == 4) {
- *datatype = GL_UNSIGNED_SHORT_4_4_4_4;
- }
- else if (info->GreenBits == 6) {
- *datatype = GL_UNSIGNED_SHORT_5_6_5;
- }
- else if (info->GreenBits == 5) {
- *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV;
- }
- else if (info->RedBits == 8) {
- *datatype = GL_UNSIGNED_BYTE;
- }
- else {
- ASSERT(info->RedBits == 16);
- *datatype = GL_UNSIGNED_SHORT;
- }
- }
- else if (info->BaseFormat == GL_LUMINANCE ||
- info->BaseFormat == GL_LUMINANCE_ALPHA) {
- *comps = ((info->LuminanceBits > 0) +
- (info->AlphaBits > 0));
- if (info->LuminanceBits == 8) {
- *datatype = GL_UNSIGNED_BYTE;
- }
- else if (info->LuminanceBits == 16) {
- *datatype = GL_UNSIGNED_SHORT;
- }
- else {
- *datatype = GL_FLOAT;
- }
- }
- else if (info->BaseFormat == GL_INTENSITY) {
- *comps = 1;
- if (info->IntensityBits == 8) {
- *datatype = GL_UNSIGNED_BYTE;
- }
- else if (info->IntensityBits == 16) {
- *datatype = GL_UNSIGNED_SHORT;
- }
- else {
- *datatype = GL_FLOAT;
- }
- }
- else if (info->BaseFormat == GL_COLOR_INDEX) {
+ case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_ARGB4444_REV:
+ *datatype = GL_UNSIGNED_SHORT_4_4_4_4;
+ *comps = 4;
+ return;
+
+ case MESA_FORMAT_ARGB1555:
+ case MESA_FORMAT_ARGB1555_REV:
+ *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV;
+ *comps = 4;
+ return;
+
+ case MESA_FORMAT_ARGB2101010:
+ *datatype = GL_UNSIGNED_INT_2_10_10_10_REV;
+ *comps = 4;
+ return;
+
+ case MESA_FORMAT_RGBA5551:
+ *datatype = GL_UNSIGNED_SHORT_5_5_5_1;
+ *comps = 4;
+ return;
+
+ case MESA_FORMAT_AL44: /* XXX this isn't plain GL_UNSIGNED_BYTE */
+ case MESA_FORMAT_AL88:
+ case MESA_FORMAT_AL88_REV:
+ case MESA_FORMAT_RG88:
+ case MESA_FORMAT_RG88_REV:
+ *datatype = GL_UNSIGNED_BYTE;
+ *comps = 2;
+ return;
+
+ case MESA_FORMAT_AL1616:
+ case MESA_FORMAT_AL1616_REV:
+ case MESA_FORMAT_RG1616:
+ case MESA_FORMAT_RG1616_REV:
+ *datatype = GL_UNSIGNED_SHORT;
+ *comps = 2;
+ return;
+
+ case MESA_FORMAT_R16:
+ case MESA_FORMAT_A16:
+ case MESA_FORMAT_L16:
+ case MESA_FORMAT_I16:
+ *datatype = GL_UNSIGNED_SHORT;