From a55f67fcb064b4ed3019259a711b5be07f4e72ff Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 26 Nov 2014 10:20:55 +0100 Subject: st/mesa: Use _mesa_format_convert to implement st_GetTexImage. Instead of using _mesa_pack_rgba_span_float. This should allow us to remove that function in a later patch. Reviewed-by: Jason Ekstrand --- src/mesa/state_tracker/st_cb_texture.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 4b9901a1b0e..1fb9db6fb68 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -29,6 +29,8 @@ #include "main/enums.h" #include "main/fbobject.h" #include "main/formats.h" +#include "main/format_utils.h" +#include "main/glformats.h" #include "main/image.h" #include "main/imports.h" #include "main/macros.h" @@ -1138,6 +1140,8 @@ st_GetTexImage(struct gl_context * ctx, /* format translation via floats */ GLuint row, slice; GLfloat *rgba; + uint32_t dstMesaFormat; + int dstStride, srcStride; assert(util_format_is_compressed(src->format)); @@ -1149,6 +1153,9 @@ st_GetTexImage(struct gl_context * ctx, if (ST_DEBUG & DEBUG_FALLBACK) debug_printf("%s: fallback format translation\n", __FUNCTION__); + dstMesaFormat = _mesa_format_from_format_and_type(format, type); + dstStride = _mesa_image_row_stride(&ctx->Pack, width, format, type); + srcStride = 4 * width * sizeof(GLfloat); for (slice = 0; slice < depth; slice++) { if (gl_target == GL_TEXTURE_1D_ARRAY) { /* 1D array textures. @@ -1162,8 +1169,9 @@ st_GetTexImage(struct gl_context * ctx, pipe_get_tile_rgba_format(tex_xfer, map, 0, 0, width, 1, dst_format, rgba); - _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, - type, dest, &ctx->Pack, 0); + _mesa_format_convert(dest, dstMesaFormat, dstStride, + rgba, RGBA8888_FLOAT, srcStride, + width, 1, NULL); } else { for (row = 0; row < height; row++) { @@ -1175,8 +1183,9 @@ st_GetTexImage(struct gl_context * ctx, pipe_get_tile_rgba_format(tex_xfer, map, 0, row, width, 1, dst_format, rgba); - _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, - type, dest, &ctx->Pack, 0); + _mesa_format_convert(dest, dstMesaFormat, dstStride, + rgba, RGBA8888_FLOAT, srcStride, + width, 1, NULL); } } map += tex_xfer->layer_stride; -- cgit v1.2.3