[Mesa-dev] [PATCH 1/7] mesa: Hide weirdness of 1D_ARRAY textures from Driver.CopyTexSubImage().
Eric Anholt
eric at anholt.net
Fri Jun 7 12:25:29 PDT 2013
Paul Berry <stereotype441 at gmail.com> writes:
> On 5 June 2013 10:14, Eric Anholt <eric at anholt.net> wrote:
>
>> Intel had brokenness here, and I'd like to continue moving Mesa toward
>> hiding 1D_ARRAY's ridiculousness inside of the core, like we did with
>> MapTextureImage. Fixes copyteximage 1D_ARRAY on intel.
>>
>> There's still an impedance mismatch in meta when falling back to read and
>> texsubimage, since texsubimage expects coordinates into 1D_ARRAY as
>> (width, slice, 0) instead of (width, 0, slice).
>> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
>> index 13c7a83..846d5d0 100644
>> --- a/src/mesa/main/dd.h
>> +++ b/src/mesa/main/dd.h
>> @@ -249,10 +249,15 @@ struct dd_function_table {
>>
>> /**
>> * Called by glCopyTex[Sub]Image[123]D().
>> + *
>> + * In the case of 1D array textures, the driver will be called to copy
>> each
>> + * appropriate scanline from the rb to each destination slice. For 3D
>> or
>> + * other array textures, only one slice may be copied, but @slice may
>> be
>> + * nonzero.
>>
>
> I'm having trouble following this comment, especially the second sentence.
> Would this be clearer?
>
> "This function should copy a rectangular region in the rb to a single
> destination slice, specified by @slice. In the case of 1D array textures
> (where one GL call can potentially affect multiple destination slices),
> core mesa takes care of calling this function multiple times, once for each
> scanline to be copied."
When I first wrote the comment, I was thinking there was going to be
multi-slice code for 2d arrays/3d/cubemaps, then I didn't rewrite from
scratch when I discovered things were simpler. Your text is much
better.
>> +static void
>> +copytexsubimage_by_slice(struct gl_context *ctx,
>> + struct gl_texture_image *texImage,
>> + GLuint dims,
>> + GLint xoffset, GLint yoffset, GLint zoffset,
>> + struct gl_renderbuffer *rb,
>> + GLint x, GLint y,
>> + GLsizei width, GLsizei height)
>> +{
>> + if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
>> + int slice;
>> +
>> + /* For 1D arrays, we copy each scanline of the source rectangle
>> into the
>> + * next array slice.
>> + */
>> + assert(zoffset == 0);
>> +
>> + for (slice = 0; slice < height; slice++) {
>> + if (yoffset + slice >= texImage->Height)
>> + break;
>>
>
> Shouldn't the error check in error_check_subtexture_dimensions() prevent
> this from ever occurring? If so, I think this should be an assertion.
I failed to find the error case when I was writing the code. Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130607/48ffd716/attachment.pgp>
More information about the mesa-dev
mailing list