[Mesa-dev] [PATCH 1/7] mesa: Hide weirdness of 1D_ARRAY textures from Driver.CopyTexSubImage().

Brian Paul brianp at vmware.com
Fri Jun 7 14:02:11 PDT 2013


On 06/07/2013 12:13 PM, Eric Anholt wrote:
> Brian Paul <brianp at vmware.com> writes:
>> On 06/05/2013 10:14 AM, Eric Anholt wrote:

>>> -   /* 1D array textures need special treatment.
>>> -    * Blit rows from the source to layers in the destination. */
>>> -   if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
>>> -      int y, layer;
>>> -
>>> -      for (y = srcY0, layer = 0; layer < height; y += yStep, layer++) {
>>> -         blit.src.box.y = y;
>>> -         blit.src.box.height = 1;
>>> -         blit.dst.box.y = 0;
>>> -         blit.dst.box.height = 1;
>>> -         blit.dst.box.z = destY + layer;
>>> -
>>> -         pipe->blit(pipe, &blit);
>>> -      }
>>> -   }
>>> -   else {
>>> -      /* All the other texture targets. */
>>> -      pipe->blit(pipe, &blit);
>>> -   }
>>> +   pipe->blit(pipe, &blit);
>>>       return;
>>>
>>>    fallback:
>>>       /* software fallback */
>>>       fallback_copy_texsubimage(ctx,
>>>                                 strb, stImage, texImage->_BaseFormat,
>>> -                             destX, destY, destZ,
>>> +                             destX, destY, slice,
>>>                                 srcX, srcY, width, height);
>>>    }
>>
>> Thanks for updating the state tracker code.  You removed the code above
>> on the premise that height will always be 1 if we're copying to a 1D
>> array texture, right?  Maybe we should assert that just to be safe.
>
> I think instead of putting an assert like that in the places we think of
> it at the middle levels, we should do so in our drivers at the bottom
> level of mapping or blitting a particular slice, so that we catch
> mistakes with slices or clipping wherever they may happen.

But in this case, one assert here would be easier than an assert in all 
the various drivers.

I could add that later.

-Brian



More information about the mesa-dev mailing list