diff options
author | Iago Toral Quiroga <[email protected]> | 2014-11-26 10:20:55 +0100 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2015-01-12 11:20:29 +0100 |
commit | a55f67fcb064b4ed3019259a711b5be07f4e72ff (patch) | |
tree | e703167fdc2b1fb1048da6995dd40a6f29229056 | |
parent | 84eb402c01962e3ff4b70c9948c85a61ed81678f (diff) |
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 <[email protected]>
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 17 |
1 files changed, 13 insertions, 4 deletions
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; |