On Tue, 30 Jun 2020 09:44:33 GMT, Frederic Thevenet
<[email protected]> 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:
>
> Prevent attempt to render tiles with a 0 sized dimension.
I've finished my testing on 4 platforms: Windows 10, macOS 10.15, Ubuntu 16.10
(physical), Ubuntu 20.04 (VM with
forceGPU set to true). All looks good.
The code looks good too with a couple questions below.
tests/system/src/test/java/test/javafx/scene/Snapshot2Test.java line 31:
> 30: import java.util.concurrent.ThreadLocalRandom;
> 31: import java.util.stream.IntStream;
> 32:
These are now unused imports.
modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java
line 1569:
> 1568: }
> 1569: // Find out if it is possible to divide up the
> image in tiles of the same size
> 1570: int tileWidth = computeTileSize(w,
> maxTextureSize);
Very minor: this comment seems like a hold-over from when the method was
computing an optimum size. Now the caller
doesn't know about "tiles of the same size".
modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java
line 1557:
> 1556: // A temp QuantumImage used only as a RTT cache for
> rendering tiles.
> 1557: var tileRttCache = new
> QuantumImage((com.sun.prism.Image) null);
> 1558: try {
In the case of a snapshot that isn't tiled, you will end up creating and
disposing a dummy `QuantumImage` that is never
used. Maybe it would be worth initializing it to null here, constructing the
object in the `if (h > maxTextureSize ||
w > maxTextureSize)` block, and checking for null before disposing in the
finally block?
-------------
PR: https://git.openjdk.java.net/jfx/pull/112