[Mesa-dev] [PATCH] mesa: only copy the requested teximage faces

Ilia Mirkin imirkin at alum.mit.edu
Thu Aug 27 20:23:35 PDT 2015


On Thu, Aug 27, 2015 at 11:14 PM, Timothy Arceri <t_arceri at yahoo.com.au> wrote:
> On Thu, 2015-08-27 at 15:43 -0400, Ilia Mirkin wrote:
>> Cube maps are special in that they have separate teximages for each
>> face. We handled that by copying the data to them separately, but in
>> case zoffset != 0 or depth != 6 we would read off the end of the client
>> array or modify the wrong images.
>>
>> zoffset/depth have already been verified by the time the code gets to
>> this stage, so no need to double-check.
>>
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> ---
>>  src/mesa/main/teximage.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
>> index 253e881..d7b4304 100644
>> --- a/src/mesa/main/teximage.c
>> +++ b/src/mesa/main/teximage.c
>> @@ -3711,12 +3711,12 @@ texturesubimage(struct gl_context *ctx, GLuint dims,
>>        rowStride = _mesa_image_image_stride(&ctx->Unpack, width, height,
>>                                             format, type);
>>        /* Copy in each face. */
>
> I see you already pushed this but shouldn't you have updated the above
> comment.

I thought about it, but I think it still makes sense as-is.

>
>> -      for (i = 0; i < 6; ++i) {
>> +      for (i = zoffset; i < zoffset + depth; ++i) {
>>           texImage = texObj->Image[i][level];
>>           assert(texImage);
>>
>>           _mesa_texture_sub_image(ctx, 3, texObj, texImage, texObj->Target,
>> -                                 level, xoffset, yoffset, zoffset,
>> +                                 level, xoffset, yoffset, 0,
>>                                   width, height, 1, format,
>>                                   type, pixels, true);
>>           pixels = (GLubyte *) pixels + rowStride;


More information about the mesa-dev mailing list