Hi Michael!

Answers to your questions inline:


 > Are there any new features that will be enabled by the Direct3D 12 backend? 
 > Having two backends for Windows seems to be twice the maintenance burden.

We're not planning any new features yet, to do that we would first like to see 
a working backend which is a suitable replacement to D3D9 backend. D3D12 
backend will be a replacement for D3D9, but that is quite a long-term goal and 
this prototype is nowhere near ready for that yet.


> What is the reason for doing this? Direct3D 9 is not going away on Windows.

While D3D9 is not officially marked as deprecated, it can easily be considered 
legacy as of right now.

The graphics API world is directed towards lower-level APIs like D3D12, Vulkan 
or Metal. Many new features end up as a part of these APIs, while older APIs 
usually get only very minor upgrades (if any) - even D3D11, a more modern API 
than D3D9, was last updated in 2016 with Windows 10 Anniversary Update (1607). 
Latest stable OpenGL version is 4.6, which was released in 2017.

You can also see this direction with large projects like Unity deprecating 
their D3D9 backends[1]. New applications and video games released nowadays 
target 12, not considering older APIs. Some hardware platforms don't even 
support D3D9 natively anymore but rather rely on having a translation layer 
using D3D12[2].

There's also development time needed. Lower-level APIs require different 
thinking and approach than "classic" APIs like 9.0c or OpenGL. This was 
something we encountered with the Metal backend, where making a backend work is 
one thing, but making it work and perform well is a different, separate can of 
worms. Since we're upgrading all the way from 9.0c it makes more sense to take 
that major step now while we're not pressured by time in form of older API 
being deprecated like OpenGL is on macOS.

An obvious question to the above is - if 12 takes more time to develop, why 
upgrade to 12 rather than for example 11? To which the short answer is 
future-proofing - why use an API last updated in 2016 when we can jump to a 
newer option? JavaFX already requires Windows 10 as a minimum, which guarantees 
access to D3D12 API. Also, development of Metal backend gave us some 
perspective in how to operate these APIs, so it's better to use that experience 
and allocate our time towards the more up-to-date approach that can open more 
doors for JFX in the future. 

Last but not least, low-level APIs like 12 also give us more control over the 
hardware. This would let us make JFX potentially perform better and with more 
stable framerate than 9, which could be a benefit in ex. more sophisticated 
animated 3D scenes.


We can't predict if Microsoft will keep 9.0c supported, and if so then for how 
much longer. The reality is, 9.0c is a 20 year old API at this point. Some 
parts of Windows-XP-era DirectX suites already require manual installation to 
run older applications/games on modern systems like Windows 11[3]. Some require 
enabling them on purpose in Windows as part of legacy features. That of course 
does not apply to 9.0c yet, and I suspect there would be a good enough warning 
from Microsoft if they decided to deprecate it, but we think it's better to 
take our time now, let the D3D12 code mature, squash any inevitable bugs and be 
ready for it rather than be surprised by it.

Lukasz

Links:
[1] - https://discussions.unity.com/t/deprecating-directx-9/670413
[2] - 
https://www.xda-developers.com/intel-withdraws-native-support-for-directx-9-from-arc-and-xe-graphics/
[3] - https://www.microsoft.com/en-ie/download/details.aspx?id=8109

-----Original Message-----
From: openjfx-dev <openjfx-dev-r...@openjdk.org> On Behalf Of Michael Strauß
Sent: Monday, 14 October 2024 18:50
Cc: openjfx-dev <openjfx-dev@openjdk.org>
Subject: Re: JavaFX Direct3D 12 rendering pipeline for Windows

Hi Lukasz!

What is the reason for doing this? Direct3D 9 is not going away on Windows. Are 
there any new features that will be enabled by the Direct3D 12 backend? Having 
two backends for Windows seems to be twice the maintenance burden.

On Mon, Oct 14, 2024 at 6:10 PM Lukasz Kostyra <lukasz.kost...@oracle.com> 
wrote:
>
> Hello openjfx-dev,
>
>
>
> we just pushed a prototype of a new JavaFX Direct3D 12 rendering 
> pipeline
>
> for Windows to a new "direct3d12" branch on jfx-sandbox. It is more 
> than an
>
> experiment branch - we intend to fully develop the D3D12 backend there.
>
>
>
> We're not necessarily looking for contributions at this point, but if 
> anyone
>
> has early feedback about it or wants to try it by building it 
> themselves,
>
> that would be fine. We also did not test it on a wider range of 
> hardware, so
>
> your mileage may vary. While D3D12 pipeline will build by default, 
> D3D9
>
> pipeline is still the default pick at runtime. To run anything on 
> D3D12
>
> pipeline you need to force it with ex.:
>
>   java -Dprism.order=d3d12 ...
>
>
>
> Backend supports 2D rendering (albeit with some graphical issues here 
> and there
>
> that need to be ironed out) and basic 3D rendering. Expect not 
> everything fully
>
> working yet (ex. some gradients on 2D controls are incorrect, or 
> 3D-in-2D will
>
> straight up not work) and the performance not matching D3D9 yet. Our 
> goal is to
>
> first reach feature completion and then focus on performance.
>
>
>
> Lukasz

Reply via email to