[Mesa-dev] [PATCH] intel: Avoid divide by zero for very small linear blits

Eric Anholt eric at anholt.net
Fri Feb 3 02:11:03 PST 2012


On Thu,  2 Feb 2012 16:50:32 -0700, "Ian Romanick" <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> If size is small (such as 1),
> 
>    pitch = ROUND_DOWN_TO(MIN2(size, (1 << 15) - 1), 4);
> 
> makes pitch = 0.  Then
> 
>    height = size / pitch;
> 
> causes a division-by-zero exception.  If pitch is zero, set height to
> 1 and avoid the division.
> 
> This fixes piglit's bin/getteximage-formats test and glean's
> bufferObject test.

Looks simpler than my patch, while correct.

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- 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/20120203/09640904/attachment.pgp>


More information about the mesa-dev mailing list