summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2016-08-29 11:18:18 -0600
committerBrian Paul <brianp@vmware.com>2016-08-29 17:46:50 -0600
commitb9b88516f8d3efc902696f1092519e298ceb7cdb (patch)
treea64d17336e424cda8b482ffbde9a5b68bf71884d /src
parentf235dc08ac1dcde6eff87597914583f5b2b9aa70 (diff)
mesa: fix format conversion bug in get_tex_rgba_uncompressed()
We need to set the need_convert flag with each loop iteration, not just when the rgba pointer is null. Bug reported by Markus Müller <mueller@imfusion.de> on mesa-users list. Fixes new piglit arb_texture_float-get-tex3d test. Cc: <mesa-stable@lists.freedesktop.org> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/texgetimage.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index bd44c687769..b9002787344 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -495,13 +495,15 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
*/
if (format == rgba_format) {
rgba = dest;
- } else if (rgba == NULL) { /* Allocate the RGBA buffer only once */
+ } else {
need_convert = true;
- rgba = malloc(height * rgba_stride);
- if (!rgba) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage()");
- ctx->Driver.UnmapTextureImage(ctx, texImage, img);
- return;
+ if (rgba == NULL) { /* Allocate the RGBA buffer only once */
+ rgba = malloc(height * rgba_stride);
+ if (!rgba) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage()");
+ ctx->Driver.UnmapTextureImage(ctx, texImage, img);
+ return;
+ }
}
}