Module: Mesa Branch: 7.11 Commit: 53a3e743ae91457d2259ef2f6eae9d238a48cf0f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=53a3e743ae91457d2259ef2f6eae9d238a48cf0f
Author: Yuanhan Liu <[email protected]> Date: Mon Oct 17 09:57:36 2011 +0800 mesa: generate error if pbo offset is not aligned with the size of specified type v2: quote the spec; explicitly exclude the GL_BITMAP case to make code more readable. (comments from Ian) v3: Cast the offset by GLintptr to remove the compile warning(comments from Brian). I also found that I should use _mesa_sizeof_packed_type() instead, as it includes packed pixel type, like GL_UNSIGNED_SHORT_5_6_5. Signed-off-by: Yuanhan Liu <[email protected]> Reviewed-by: Brian Paul <[email protected]> (cherry picked from commit 9024d8af0ae832a0b4278eb6683bc0e76c69baac) --- src/mesa/main/pbo.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c index 15e0480..cea2322 100644 --- a/src/mesa/main/pbo.c +++ b/src/mesa/main/pbo.c @@ -82,6 +82,19 @@ _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 && + ((GLintptr)offset % _mesa_sizeof_packed_type(type))) + return GL_FALSE; } if (sizeAddr == 0) _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
