diff options
Diffstat (limited to 'src/mesa/main/pack.c')
-rw-r--r-- | src/mesa/main/pack.c | 282 |
1 files changed, 26 insertions, 256 deletions
diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c index 06993d497f9..de6ab2717cb 100644 --- a/src/mesa/main/pack.c +++ b/src/mesa/main/pack.c @@ -529,6 +529,8 @@ _mesa_pack_rgba_span_from_uints(struct gl_context *ctx, GLuint n, GLuint rgba[][ GLenum dstFormat, GLenum dstType, GLvoid *dstAddr) { + uint32_t dstMesaFormat; + switch(dstType) { case GL_UNSIGNED_INT: pack_uint_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, NULL, n); @@ -549,109 +551,24 @@ _mesa_pack_rgba_span_from_uints(struct gl_context *ctx, GLuint n, GLuint rgba[][ pack_byte_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, NULL, n); break; case GL_UNSIGNED_BYTE_3_3_2: - if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_B2G3R3_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_BYTE_2_3_3_REV: - if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_R3G3B2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_5_6_5: - if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_B5G6R5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_5_6_5_REV: - if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_R5G6B5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_4_4_4_4: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A4B4G4R4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A4R4G4B4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_uint_rgba_row(MESA_FORMAT_R4G4B4A4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_4_4_4_4_REV: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_R4G4B4A4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_B4G4R4A4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A4B4G4R4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_5_5_5_1: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A1B5G5R5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A1R5G5B5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_uint_rgba_row(MESA_FORMAT_R1G5B5A5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_1_5_5_5_REV: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_R5G5B5A1_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_B5G5R5A1_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A5B5G5R1_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_INT_8_8_8_8: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A8B8G8R8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A8R8G8B8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_uint_rgba_row(MESA_FORMAT_R8G8B8A8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_INT_8_8_8_8_REV: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_R8G8B8A8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_B8G8R8A8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A8B8G8R8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_INT_10_10_10_2: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A2B10G10R10_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A2R10G10B10_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_uint_rgba_row(MESA_FORMAT_R2G10B10A10_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_INT_2_10_10_10_REV: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_R10G10B10A2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_uint_rgba_row(MESA_FORMAT_B10G10R10A2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_uint_rgba_row(MESA_FORMAT_A10B10G10R2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); - break; + dstMesaFormat = _mesa_format_from_format_and_type(dstFormat, dstType); + if (!(dstMesaFormat & MESA_ARRAY_FORMAT_BIT)) { + _mesa_pack_uint_rgba_row(dstMesaFormat, n, (void *)rgba[0], (void *)dstAddr); + break; + } else { + /* Fall through */ + } default: _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType); return; @@ -720,6 +637,8 @@ _mesa_pack_rgba_span_from_ints(struct gl_context *ctx, GLuint n, GLint rgba[][4] GLenum dstFormat, GLenum dstType, GLvoid *dstAddr) { + uint32_t dstMesaFormat; + switch(dstType) { case GL_UNSIGNED_INT: pack_uint_from_int_rgba(ctx, dstAddr, dstFormat, rgba, NULL, n); @@ -741,109 +660,24 @@ _mesa_pack_rgba_span_from_ints(struct gl_context *ctx, GLuint n, GLint rgba[][4] pack_byte_from_int_rgba(ctx, dstAddr, dstFormat, rgba, NULL, n); break; case GL_UNSIGNED_BYTE_3_3_2: - if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_B2G3R3_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_BYTE_2_3_3_REV: - if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_R3G3B2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_5_6_5: - if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_B5G6R5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_5_6_5_REV: - if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_R5G6B5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_4_4_4_4: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_int_rgba_row(MESA_FORMAT_A4B4G4R4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_A4R4G4B4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_int_rgba_row(MESA_FORMAT_R4G4B4A4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_4_4_4_4_REV: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_int_rgba_row(MESA_FORMAT_R4G4B4A4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_B4G4R4A4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_int_rgba_row(MESA_FORMAT_A4B4G4R4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_5_5_5_1: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_int_rgba_row(MESA_FORMAT_A1B5G5R5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_A1R5G5B5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_int_rgba_row(MESA_FORMAT_R1G5B5A5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_SHORT_1_5_5_5_REV: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_int_rgba_row(MESA_FORMAT_R5G5B5A1_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_B5G5R5A1_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_int_rgba_row(MESA_FORMAT_A5B5G5R1_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_INT_8_8_8_8: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_int_rgba_row(MESA_FORMAT_A8B8G8R8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_A8R8G8B8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_int_rgba_row(MESA_FORMAT_R8G8B8A8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_INT_8_8_8_8_REV: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_int_rgba_row(MESA_FORMAT_R8G8B8A8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_B8G8R8A8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_int_rgba_row(MESA_FORMAT_A8B8G8R8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_INT_10_10_10_2: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_int_rgba_row(MESA_FORMAT_A2B10G10R10_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_A2R10G10B10_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_int_rgba_row(MESA_FORMAT_R2G10B10A10_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; case GL_UNSIGNED_INT_2_10_10_10_REV: - if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) - _mesa_pack_int_rgba_row(MESA_FORMAT_R10G10B10A2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) - _mesa_pack_int_rgba_row(MESA_FORMAT_B10G10R10A2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_int_rgba_row(MESA_FORMAT_A10B10G10R2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else - _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); - break; + dstMesaFormat = _mesa_format_from_format_and_type(dstFormat, dstType); + if (!(dstMesaFormat & MESA_ARRAY_FORMAT_BIT)) { + _mesa_pack_int_rgba_row(dstMesaFormat, n, (void *)rgba[0], (void *)dstAddr); + break; + } else { + /* Fall through */ + } default: _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType); return; @@ -947,6 +781,7 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4], const GLint comps = _mesa_components_in_format(dstFormat); const GLboolean intDstFormat = _mesa_is_enum_format_integer(dstFormat); GLuint i; + uint32_t dstMesaFormat; if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA || @@ -1181,91 +1016,26 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4], pack_half_float_from_float_rgba(ctx, dstAddr, dstFormat, rgba, luminance, n); break; case GL_UNSIGNED_BYTE_3_3_2: - if (dstFormat == GL_RGB) - _mesa_pack_float_rgba_row(MESA_FORMAT_B2G3R3_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_BYTE_2_3_3_REV: - if (dstFormat == GL_RGB) - _mesa_pack_float_rgba_row(MESA_FORMAT_R3G3B2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_SHORT_5_6_5: - if (dstFormat == GL_RGB) - _mesa_pack_float_rgba_row(MESA_FORMAT_B5G6R5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_SHORT_5_6_5_REV: - if (dstFormat == GL_RGB) - _mesa_pack_float_rgba_row(MESA_FORMAT_R5G6B5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_SHORT_4_4_4_4: - if (dstFormat == GL_RGBA) - _mesa_pack_float_rgba_row(MESA_FORMAT_A4B4G4R4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_BGRA) - _mesa_pack_float_rgba_row(MESA_FORMAT_A4R4G4B4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_float_rgba_row(MESA_FORMAT_R4G4B4A4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_SHORT_4_4_4_4_REV: - if (dstFormat == GL_RGBA) - _mesa_pack_float_rgba_row(MESA_FORMAT_R4G4B4A4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_BGRA) - _mesa_pack_float_rgba_row(MESA_FORMAT_B4G4R4A4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_float_rgba_row(MESA_FORMAT_A4B4G4R4_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_SHORT_5_5_5_1: - if (dstFormat == GL_RGBA) - _mesa_pack_float_rgba_row(MESA_FORMAT_A1B5G5R5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_BGRA) - _mesa_pack_float_rgba_row(MESA_FORMAT_A1R5G5B5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_float_rgba_row(MESA_FORMAT_R1G5B5A5_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_SHORT_1_5_5_5_REV: - if (dstFormat == GL_RGBA) - _mesa_pack_float_rgba_row(MESA_FORMAT_R5G5B5A1_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_BGRA) - _mesa_pack_float_rgba_row(MESA_FORMAT_B5G5R5A1_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_float_rgba_row(MESA_FORMAT_A5B5G5R1_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_INT_8_8_8_8: - if (dstFormat == GL_RGBA) - _mesa_pack_float_rgba_row(MESA_FORMAT_A8B8G8R8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_BGRA) - _mesa_pack_float_rgba_row(MESA_FORMAT_A8R8G8B8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_float_rgba_row(MESA_FORMAT_R8G8B8A8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_INT_8_8_8_8_REV: - if (dstFormat == GL_RGBA) - _mesa_pack_float_rgba_row(MESA_FORMAT_R8G8B8A8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_BGRA) - _mesa_pack_float_rgba_row(MESA_FORMAT_B8G8R8A8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_float_rgba_row(MESA_FORMAT_A8B8G8R8_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_INT_10_10_10_2: - if (dstFormat == GL_RGBA) - _mesa_pack_float_rgba_row(MESA_FORMAT_A2B10G10R10_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_BGRA) - _mesa_pack_float_rgba_row(MESA_FORMAT_A2R10G10B10_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_float_rgba_row(MESA_FORMAT_R2G10B10A10_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_INT_2_10_10_10_REV: - if (dstFormat == GL_RGBA) - _mesa_pack_float_rgba_row(MESA_FORMAT_R10G10B10A2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_BGRA) - _mesa_pack_float_rgba_row(MESA_FORMAT_B10G10R10A2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - else if (dstFormat == GL_ABGR_EXT) - _mesa_pack_float_rgba_row(MESA_FORMAT_A10B10G10R2_UNORM, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_INT_5_9_9_9_REV: - _mesa_pack_float_rgba_row(MESA_FORMAT_R9G9B9E5_FLOAT, n, (void *)rgba[0], (void *)dstAddr); - break; case GL_UNSIGNED_INT_10F_11F_11F_REV: - _mesa_pack_float_rgba_row(MESA_FORMAT_R11G11B10_FLOAT, n, (void *)rgba[0], (void *)dstAddr); - break; + dstMesaFormat = _mesa_format_from_format_and_type(dstFormat, dstType); + if (!(dstMesaFormat & MESA_ARRAY_FORMAT_BIT)) { + _mesa_pack_float_rgba_row(dstMesaFormat, n, (void *)rgba[0], (void *)dstAddr); + break; + } else { + /* Fall through */ + } default: _mesa_problem(ctx, "bad type in _mesa_pack_rgba_span_float"); free(luminance); |