[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: RFR: 8238954: Improve performance of tiled snapshot rendering [v14]
From:       Ambarish Rapte <arapte () openjdk ! java ! net>
Date:       2020-06-30 21:31:36
Message-ID: YVJRe5pKTlnyx-IypRqqEk9gC1Kpf-Mi7ATWV5ByYuA=.b469ac89-a5a4-4683-9f55-9694af82d637 () github ! com
[Download RAW message or body]

On Tue, 30 Jun 2020 09:44:33 GMT, Frederic Thevenet \
<github.com+7450507+fthevenet@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: 
> Prevent attempt to render tiles with a 0 sized dimension.

The code looks good to me too, suggested minor change.

modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java \
line 1638:

> 1637:                         renderWholeImage(x, y, w, h, rf, pImage);
> 1638:                     }
> 1639:                     params.platformImage = pImage;

I tried to write this code using for loop to make it little easy for reader to \
understand. This is just a suggestion, I leave it to you to whether replace it or \
not,

	int mTileWidth = computeTileSize(w, maxTextureSize);
	int mTileHeight = computeTileSize(h, maxTextureSize);
	IntBuffer buffer = IntBuffer.allocate(mTileWidth * mTileHeight);

	int mTileXOffset = 0;
	int mTileYOffset = 0;
	for (mTileXOffset = 0; (mTileXOffset + mTileWidth) <= w; mTileXOffset += mTileWidth) \
{  for (mTileYOffset = 0; (mTileYOffset + mTileHeight) <= h; mTileYOffset += \
mTileHeight) {  renderTile(x, mTileXOffset, y, mTileYOffset, mTileWidth, mTileHeight,
					buffer, rf, tileRttCache, pImage);
		}
	}

	int rTileXOffset = mTileXOffset;
	int rTileWidth = w - rTileXOffset;
	if (rTileWidth > 0) {
		for (int rTileYOffset = 0; (rTileYOffset + mTileHeight) <= h; rTileYOffset += \
mTileHeight) {  renderTile(x, rTileXOffset, y, rTileYOffset, rTileWidth, mTileHeight,
					buffer, rf, tileRttCache, pImage);
		}
	}

	int bTileYOffset = mTileYOffset;
	int bTileHeight = h - bTileYOffset;
	if (bTileHeight > 0) {
		for (int bTileXOffset = 0; (bTileXOffset + mTileWidth) <= w; bTileXOffset += \
mTileWidth) {  renderTile(x, bTileXOffset, y, bTileYOffset, mTileWidth, bTileHeight,
					buffer, rf, tileRttCache, pImage);
		}
	}

	if (rTileWidth > 0 &&  bTileHeight > 0) {
		renderTile(x, rTileXOffset, y, bTileYOffset, rTileWidth, bTileHeight,
				buffer, rf, tileRttCache, pImage);
	}

modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java \
line 1564:

> 1563:                     if (h > maxTextureSize || w > maxTextureSize) {
> 1564:                         // The requested size for the screenshot is too big \
>                 to fit a single texture,
> 1565:                         // so we need to take several snapshot tiles and \
> merge them into pImage

Very minor: screenshot should be changed to snapshot.

modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java \
line 1635:

> 1634:                     else {
> 1635:                         // The requested size for the screenshot fits max \
>                 texture size,
> 1636:                         // so we can directly render it in the target image.

Very minor: screenshot should be changed to snapshot.

-------------

PR: https://git.openjdk.java.net/jfx/pull/112


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic