OSDN Git Service

mesa/copyimage: allow width/height to not be multiples of block
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 8 Nov 2015 09:46:38 +0000 (04:46 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Wed, 11 Nov 2015 19:37:55 +0000 (14:37 -0500)
commit912babba7bf1abd3caa49f6372d581ae1afe7e84
treee2a6a6a084d8d8638ca925694920ee7a0ed027d5
parent80890eb0d322483fb13558afddc4feae5210f996
mesa/copyimage: allow width/height to not be multiples of block

For compressed textures, the image size is not necessarily a multiple of
the block size (e.g. the last mip levels). Section 18.3.2 (Copying
Between Images) of the OpenGL 4.5 Core Profile spec says:

    An INVALID_VALUE error is generated if the dimensions of either
    subregion exceeds the boundaries of the corresponding image
    object, or if the image format is compressed and the dimensions of
    the subregion fail to meet the alignment constraints of the
    format.

and Section 8.7 (Compressed Texture Images) says:

    An INVALID_OPERATION error is generated if any of the following
    conditions occurs:

      * width is not a multiple of four, and width + xoffset is not
        equal to the value of TEXTURE_WIDTH.
      * height is not a multiple of four, and height + yoffset is not
        equal to the value of TEXTURE_HEIGHT.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92860
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
src/mesa/main/copyimage.c