[Mesa-dev] Blits with huge widths/heights

Ilia Mirkin imirkin at alum.mit.edu
Sat Oct 6 20:01:08 UTC 2018


There's a WebGL test here

https://www.khronos.org/registry/webgl/sdk/tests/conformance2/rendering/blitframebuffer-size-overflow.html

which does a fairly ridiculous blit:

    srcX0=-1, srcY0=-1, srcX1=2147483647, srcY1=2147483647,
    dstX0=-1, dstY0=-1, dstX1=2147483647, dstY1=2147483647

The underlying src and dst textures are 8x8. We hit some precision
issues in _mesa_clip_blit, but after fixing those, I run into the
st_BlitFramebuffer logic which has this comment:

   /* NOTE: If the src and dst dimensions don't match, we cannot simply adjust
    * the integer coordinates to account for clipping (or scissors) because that
    * would make us cut off fractional parts, affecting the result of the blit.
    */

That means that the height gets set to srcY0 - srcY1, which obviously
overflows the int16_t.

Is there any reasonable way of clipping it down without running into
the fraction parts issue mentioned in the comment? Otherwise we have
to go back to 32-bit height. (Not 100% sure that most drivers would do
anything particularly reasonable here either...)

Cheers,

  -ilia


More information about the mesa-dev mailing list