[Mesa-dev] [PATCH] mesa: generate error if pbo offset is not aligned with the size of specified type

Liu Aleaxander aleaxander at gmail.com
Fri Oct 14 08:14:25 PDT 2011


On Oct 14, 2011 10:38 PM, "Brian Paul" <brianp at vmware.com> wrote:
>
> On 10/13/2011 09:47 PM, Yuanhan Liu wrote:
>>
>> v2: quote the spec; explicitly exclude the GL_BITMAP case to make code
>> more readable. (comments from Ian)
>>
>> Signed-off-by: Yuanhan Liu<yuanhan.liu at linux.intel.com>
>> ---
>>  src/mesa/main/pbo.c |   12 ++++++++++++
>>  1 files changed, 12 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c
>> index 4e7e6f9..6a4ae09 100644
>> --- a/src/mesa/main/pbo.c
>> +++ b/src/mesa/main/pbo.c
>> @@ -82,6 +82,18 @@ _mesa_validate_pbo_access(GLuint dimensions,
>>     } else {
>>        offset = ptr;
>>        sizeAddr = ((const GLubyte *) 0) + pack->BufferObj->Size;
>> +      /* The ARB_pixel_buffer_object spec says:
>> +       *    "INVALID_OPERATION is generated by ColorTable,
ColorSubTable,
>> +       *    ConvolutionFilter2D, ConvolutionFilter1D, SeparableFilter2D,
>> +       *    TexImage1D, TexImage2D, TexImage3D, TexSubImage1D,
>> +       *    TexSubImage2D, TexSubImage3D, and DrawPixels if the current
>> +       *    PIXEL_UNPACK_BUFFER_BINDING_ARB value is non-zero and the
data
>> +       *    parameter is not evenly divisible into the number of basic
machine
>> +       *    units needed to store in memory a datum indicated by the
type
>> +       *    parameter."
>> +       */
>> +      if (type != GL_BITMAP&&  ((GLuint)offset %
_mesa_sizeof_type(type)))
>> +         return GL_FALSE;
>
>
> Casting the 64-bit offset pointer to a 32-bit GLuint is going to cause
compiler warnings.

Oh, right, I didn't notice that. Sorry about that.

>
> Using GLintptr instead of GLuint there should do the trick.

Will fix it next week.

Thanks,
Yuanhan Liu

>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111014/f4549b51/attachment.html>


More information about the mesa-dev mailing list