On Mon, 29 Jun 2020 16:27:19 GMT, Frederic Thevenet <github.com+7450507+ftheve...@openjdk.org> wrote:
>> Issue JDK-8088198, where an exception would be thrown when trying to capture >> a snapshot whose final dimensions would be >> larger than the running platform's maximum supported texture size, was >> addressed in openjfx14. The fix, based around >> the idea of capturing as many tiles of the maximum possible size and >> re-compositing the final snapshot out of these, is >> currently only attempted after the original, non-tiled, strategy has already >> failed. This was decided to avoid any risk >> of regressions, either in terms of performances and correctness, while still >> offering some relief to the original >> issue. This follow-on issue aims to propose a fix to the original issue, >> that is able to correctly decide on the best >> snapshot strategy (tiled or not) to adopt before applying it and ensure best >> performances possible when tiling is >> necessary while still introducing no regressions compared to the original >> solution. > > Frederic Thevenet has updated the pull request incrementally with one > additional commit since the last revision: > > Fill test image with a bilinear gradient instead of random noise. I think I found the problem in the tiling logic that leads to the macOS failures. You need to check that the remainder width or height is > 0. Also, it looks like you have the "B" and "R" loops backwards, which is a bit confusing. modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java line 1612: > 1611: int bTileHeight = tileHeight; > 1612: while (bTileHeight == tileHeight && bOffset < > h) { > 1613: renderTile(x, xOffset, y, bOffset, > mTileWidth, bTileHeight, buffer, rf, tileRttCache, > pImage); It looks like the "B" and the "R" loops are reversed. This isn't causing any actual problems, but is confusing since it doesn't match the comment or the diagram above. The comment for this block says "B" tiles, but actually, it is the "R" tiles in the diagram that this is looping over. At the end of the main loop, `mTileWIdth` and `mTileHeight` will be set to the size of the corner tile. Given this, the tiles of `mTileWidth` X `tileHeight` will be the right hand column. Once you fix this, you will need to surround this `while` loop in a check for `if (mTileWidth > 0)` modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java line 1620: > 1619: int rTileWidth = tileWidth; > 1620: while (rTileWidth == tileWidth && rOffset < w) { > 1621: renderTile(x, rOffset, y, yOffset, > rTileWidth, mTileHeight, buffer, rf, tileRttCache, > pImage); Similarly, you will need to surround this `while` loop in a check for `if (mTileHeight > 0)` modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java line 1626: > 1625: // Render corner "C" tile if needed > 1626: if (bOffset > 0 && rOffset > 0) { > 1627: renderTile(x, rOffset, y, bOffset, > rTileWidth, bTileHeight, buffer, rf, tileRttCache, > pImage); I might recommend to also add a check for `mTileWidth > 0 && mTileHeight > 0` ------------- PR: https://git.openjdk.java.net/jfx/pull/112