The previous value of BackBufferFormat for the D3DPRESENT_PARAMETERS for the 
d3d9 swap chain was set to D3DFMT_UNKNOWN by default. This causes the d3d 
implementation to use a default value, which depends on the system 
configuration. The RTT texture by JavaFX always uses D3DFMT_A8R8G8B8.

If the d3d swap chain defaults to D3DFMT_X8R8G8B8, this creates a format 
mismatch. In theory, that shouldn't be a big deal as it's only about the alpha 
channel being used or not in this case. But for whatever reason, the format 
conversion by d3d is completely whack here. This is not only an alpha 
conversion issue, I tested for that. The whole conversion is wrong.

This only occurs when using a translucent background, e.g. with the UNIFIED 
stage style previously. This issue is a blocker for the new translucent 
backdrops and translucent EXTENDED stage style PRs that are open. Because 
without this, you can't guarantee that they will display properly on all 
Windows systems. Most will work fine, but some will be unusable.

Most d3d swap chain implementations I have seen don't set an explicit 
BackBufferFormat. However, in the case of JavaFX, it is easier to set the 
format here than do it for the RTT texture to maintain the same format on all 
platforms.

The most important part about this issue is reproduction and testing: I have 
tested it on multiple Windows 11 systems, Windows 10 1709, and Windows 10 22H2. 
It fixes the issue on the affected systems and maintains the same behavior on 
the other systems.

The reproduction instructions of the original issue are quite old, so it's 
difficult to get this properly set up on modern systems. The hardware that was 
affected back then might have gotten driver updates. The easiest way I found 
was to run Hyper-V on Windows, and create a new MSIX packaging environment VM.

You can do so at Hyper-V Manager -> Action -> Quick Create -> Windows 10 MSIX 
packaging environment. This creates a Windows 10 VM which reproduces the issue 
reliably. The Windows 11 VM does not for some reason.

You can run the BackdropTest from 
https://github.com/openjdk/jfx/pull/2048/changes#diff-c25c5ccf435e59b6bfd593251ab6dfc31a12a782a78191a38b4e9adab31587a3
 with and without the BackBufferFormat line added to compare.

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

Commit messages:
 - Set backbuffer format explicitly

Changes: https://git.openjdk.org/jfx/pull/2058/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=2058&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8154847
  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jfx/pull/2058.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/2058/head:pull/2058

PR: https://git.openjdk.org/jfx/pull/2058

Reply via email to