> ## Description
>
> This PR is for review and integration of Direct3D 12 Rendering Pipeline into
> JavaFX mainline. We released three Early Access (EA) versions of this
> implementation while keeping the development ongoing on [JavaFX
> Sandbox](https://github.com/openjdk/jfx-sandbox/tree/direct3d12) and reached
> a stage where it is ready to be integrated into mainline. Any further work
> and potential fixes will be done on mainline.
>
> At the time of writing, this PR is identical to the [JavaFX Sandbox D3D12
> branch](https://github.com/openjdk/jfx-sandbox/tree/direct3d12) with only one
> difference - the Sandbox defaults to D3D12 backend. This PR, however, does
> *NOT* change the default rendering pipeline on Windows. D3D9 remains the
> default rendering pipeline and D3D12 is optional - it can be selected by
> providing `-Dprism.order=d3d12`. To verify which pipeline is actually in use
> `-Dprism.verbose=true` is recommended.
>
> ## Details
>
> Below are general changes introduced by the backend:
>
> ### JSL changes
>
> - Introduced `HLSL6Backend` class which translates JSL shader code into HLSL6
> code. D3D12 introduced HLSL Shader Level 6 support and won't support existing
> HLSL shaders used with D3D9, as those are compiled for unsupported Shader
> Level 3.
> - D3D12-specific shaders are kept in
> `modules/javafx.graphics/src/main/native-prism-d3d12/hlsl6`
> - Shader compilation is done with DXC instead of FXC (FXC does not support
> SL6). DXC is bundled in Windows SDK which JavaFX already integrates with.
> - Backend also generates C++ headers with Shader resource binding
> information, used by the native-side
>
> ### Build changes
>
> - Added new build tasks for generation and compilation of HLSL6 shaders for
> D3D12
> - Added tasks to compile D3D12 native backend code
>
> ### Prism changes
>
> - Added D3D12-specific Java classes (package `com.sun.prism.d3d12`) and a
> Java-to-JNI layer (package `com.sun.prism.d3d12.ni`)
> - Java implementation is mostly similar to D3D9 implementation, with only
> some minor changes needed to accommodate slightly different presentation
> behavior of the new runtime
> - JNI interface is relatively high level to reduce the amount of JNI calls
> for performance
> - Added a native Prism backend implementation using D3D12 runtime (stored in
> `modules/javafx.graphics/src/main/native-prism-d3d12`)
> - Written in C++ 20
> - Uses only interfaces available via Windows API with no third-party
> libraries - WinAPI, Windows COM interface system and "barebones" Direct3D 12
> API/runtime
> - Native layer entry-points...
Lukasz Kostyra has updated the pull request incrementally with four additional
commits since the last revision:
- Review comments from @Maran23
- Device/Context: Remove UnsetTextureIfSet
This caused scrolling issues in WebView. Scrolling there is done by:
- Creating a temp RTT
- Copying contents to the RTT
- Redrawing the temp RTT onto actual WebPage RTT shifted
- Immediately after disposing of the temp RTT by calling dispose()
The last step caused the Texture to be unbound and because we cache the
draw calls and batch-submit them, caused the final redraw to fail.
NativeTexture is held by a shared_ptr instance so it will eventually get
freed anyway once the instances on the Render Thread side get replaced.
- PSOManager: Add missing Rasterizer State MSAA flag
- Cleanup magic numbers and constants
- Added new "common" header - D3D12Types.hpp - which holds all extra
structs/classes/enums used by the backend. This will always be
included by D3D12Common.hpp.
- Moved constants and constant macros from D3D12Common to
D3D12Constants.hpp
- Replaced constant macros with regular constants for type safety and
namespacing
-------------
Changes:
- all: https://git.openjdk.org/jfx/pull/2346/files
- new: https://git.openjdk.org/jfx/pull/2346/files/173095c1..b8ece366
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jfx&pr=2346&range=05
- incr: https://webrevs.openjdk.org/?repo=jfx&pr=2346&range=04-05
Stats: 777 lines in 18 files changed: 389 ins; 358 del; 30 mod
Patch: https://git.openjdk.org/jfx/pull/2346.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/2346/head:pull/2346
PR: https://git.openjdk.org/jfx/pull/2346