git: openjdk/jfx-sandbox: direct3d12: 3 new changesets

duke duke at openjdk.org
Tue Jun 10 14:02:37 UTC 2025


Changeset: 7021452e
Branch: direct3d12
Author:    Lukasz Kostyra <lukasz.kostyra at oracle.com>
Date:      2025-05-22 15:28:30 +0000
URL:       https://git.openjdk.org/jfx-sandbox/commit/7021452e3639036ceb866194f7a6683900a0c497

Rework synchronization and Waitable logic

This change reworks some looser bits and pieces that were in the backend
related to synchronization logic and as a result fixes some issues:
- All Waitable logic (Midframe etc.) was moved to newly created
  CheckpointQueue. Its goal is to queue up any Signal() operations and
  resulting Waitable objects, categorize them and allow to wait for next
  Checkpoint of selected category if needed. This allows us to optimize
  some operations and reduce waiting, thus reducing potential framerate
  stutters.
- SwapChain logic was slightly reworked to adapt it to CheckpointQueue.
- Move semantics were enforced in Waitable to prevent WinAPI Event from
  being freed.
- Reworked Ring Container flush logic - in some cases, most notably in
  3D, there was a possibility for following (or similar) scenario:
    - Phong InternalShader allocates needed CBVs
    - That allocation crosses RingContainer's threshold, which triggers
      a Signal()
    - Phong InternalShader allocates more needed SRVs
  This would eventually cause first CBV batch and following SRVs to be
  considered "free" even though they still were not consumed by the Draw
  call. To prevent this RingContainers now notify NativeDevice about the
  need to submit current Command List for execution and it will do so
  after the Draw call is recorded, ensuring CBVs/SRVs belonging to that
  Draw Call are actually available for writing.

! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12Common.hpp
! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeDevice.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeDevice.hpp
! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeSwapChain.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeSwapChain.hpp
+ modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12CheckpointQueue.cpp
+ modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12CheckpointQueue.hpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12CommandListPool.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12DescriptorData.hpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12InternalShader.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12InternalShader.hpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12ResourceManager.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12RingContainer.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12RingContainer.hpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12Waitable.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12Waitable.hpp

Changeset: 9e3b50f0
Branch: direct3d12
Author:    Lukasz Kostyra <lukasz.kostyra at oracle.com>
Date:      2025-06-05 10:27:29 +0000
URL:       https://git.openjdk.org/jfx-sandbox/commit/9e3b50f03369864032bc4bedd77ec3b00e30340b

Properly refcount/release DXGI Adapter

When enumerating adapters DXGI will return raw pointers to them and
those have to be manually managed. DXGI API only guarantees first
reference count increase (when EnumAdapters() returns the pointer).

This adds:
  - Properly releasing the Adapter when destroying NativeInstance
  - Calling AddRef() when initializing NativeDevice and calling
    Release() when destroying it

! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeDevice.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeInstance.cpp

Changeset: 3b64e7ae
Branch: direct3d12
Author:    Lukasz Kostyra <lukasz.kostyra at oracle.com>
Date:      2025-06-05 12:35:56 +0000
URL:       https://git.openjdk.org/jfx-sandbox/commit/3b64e7aecb8a02f14b1c75a52ca84235dd901bcf

Improve D3D12 cleanup on application close

This change introduces a few upgrades related to how resources are
released when JavaFX app closes on D3D12 backend:
- Java-side D3D12NativeObject's "implements AutoCloseable" was removed.
  It was not used in its proper form, D3D12 objects are explicitly
  disposed anyway. To follow a Prism backend design, close() was renamed
  to dispose()
- Ensured that all resources are freed properly when application closes
  normally
  - This does not always succeed because it seems that D3D12ResourcePool
    is not explicitly disposed of when application closes... this
    requires a closer look into in a follow-up task.
- Debug facilities now have ReleaseAndReportLiveObjects() function which
  allows us to manually do more detailed leak reporting, plus frees
  remaining D3D12 objects.
- Improved destructor logs in some places

! modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12Context.java
! modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12Mesh.java
! modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12MeshView.java
! modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12PhongMaterial.java
! modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12Pipeline.java
! modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12ResourcePool.java
! modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12ShaderData.java
! modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12SwapChain.java
! modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12TextureData.java
! modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/ni/D3D12NativeObject.java
! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12Common.hpp
! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeDevice.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeDevice.hpp
! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeInstance.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeRenderTarget.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeShader.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12Debug.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12Debug.hpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12InternalShader.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12RenderingContext.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12ResourceManager.cpp
! modules/javafx.graphics/src/main/native-prism-d3d12/Internal/D3D12ResourceManager.hpp



More information about the openjfx-changes mailing list