[Mesa-users] glGetTexImage with GL_TEXTURE_3D

Brian Paul brianp at vmware.com
Mon Aug 29 23:47:54 UTC 2016


On 08/29/2016 11:20 AM, Brian Paul wrote:
> On 08/29/2016 01:43 AM, Markus Müller wrote:
>> Hello,
>>
>> I'm using the Gallium llvmpipe software renderer on Windows and have the
>> problem that when downloading 3D textures with glGetTexImage, only the
>> first slice is copied to the provided buffer. I attached a small example
>> that works with the default nvidia driver and Mesa 10.3.1 but fails with
>> Mesa 10.6.9 (also 11 and 12).
>>
>> The following patch seems to fix this but I'm not sure if it breaks
>> something else:
>>
>> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
>> index f97d0ef..83bf122 100644
>> --- a/src/mesa/main/texgetimage.c
>> +++ b/src/mesa/main/texgetimage.c
>> @@ -509,14 +509,16 @@ 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;
>> +                               }
>> +                       }
>>            }
>>            _mesa_format_convert(rgba, rgba_format, rgba_stride,
>>
>
> Thanks.  Yeah, we need to set the need_convert flag on each loop
> iteration, not just when the rgba pointer is null.  I'll clean up your
> patch and post it for review.

Patch committed to master branch.

>
> I've also written a new piglit test which exercises this code path.

Still out for review.

-Brian



More information about the mesa-users mailing list