On Sat, 14 Nov 2026 01:01:11 GMT, Kevin Rushforth <[email protected]> wrote:
>> Lukasz Kostyra has updated the pull request with a new target base due to a
>> merge or a rebase. The incremental webrev excludes the unrelated changes
>> brought in by the merge/rebase. The pull request contains eight additional
>> commits since the last revision:
>>
>> - MeshView: Use weak_ptr for Mesh and Material references
>>
>> Changed in-line with NativePhongMaterial change in previous commit
>> - Review fixes from general comments from @kevinrushforth
>>
>> - D3D12Context.java correctly handles NULL destination RTT now
>> - D3D12SwapChain.java prevents potential NPE when disposing
>> - D3D12RenderingContext.cpp:
>> - Shader assignments are now checked based on stored Shader parameter
>> instead of PSO's bound Shader (fixes incorrect shader resource
>> assignments after restoring the Context after Blit)
>> - Clear now handles dirty bboxes better (fixes unnecessary and/or
>> incorrect bbox estimation)
>> - D3D12Graphics.java now provides premultiplied clear parameters
>> - D3D12NativeSwapChain.cpp now checks for tearing support when VSync is
>> requested disabled, will fall-back to enabled VSync if device does not
>> support it or we cannot poll DXGI for support
>> - D3D12NativeRenderTarget.cpp sets underlying Texture's sampling to
>> linear to match D3D's settings
>> - D3D12NativePhongMaterial.cpp now uses weak pointers to refer to
>> texture maps - prevents keeping strong references and keeping the
>> resources alive despite NativeTexture being released
>>
>> Additionally:
>> - Added logic to unbind Textures from RenderingContext when they are
>> disposed
>> - Added a missing Clear call to createRTTexture (found it in D3D backend)
>> - RenderPerfTest will respect java.animation.fullspeed pre-set when
>> it is set via a JVM argument
>> - DXGIFormat: Remove extra newline
>> - Review comments from @crschnick
>>
>> Doesn't contain SwapChain flag adjustment, as this will be solved
>> separately with SwapChain changes requested by @kevinrushforth
>> - Update CompileHLSL6Task to latest build fixes
>> - Merge remote-tracking branch 'upstream/master' into feature/direct3d12
>> - Review fixes from @kevinrushforth
>> - Implement Direct3D12 Rendering Pipeline
>
> modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12RTTexture.java
> line 55:
>
>> 53: PixelFormat format, WrapMode
>> wrapMode, int aaSamples, boolean enableDirtyBBox) {
>> 54: D3D12NativeTexture tex =
>> context.getDevice().createTexture(physWidth, physHeight, format,
>> Usage.DEFAULT, wrapMode, aaSamples, false, true);
>> 55: if (tex == null) {
>
> `createTexture` never returns null, so checking the Java reference for null
> is ineffective. Instead, check `!tex.isValid()`.
Done
> modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12RTTexture.java
> line 60:
>
>> 58:
>> 59: D3D12NativeRenderTarget rt =
>> context.getDevice().createRenderTarget(tex, enableDirtyBBox);
>> 60: if (rt == null) {
>
> `createRenderTarget` never returns null, so checking the Java reference for
> null is ineffective. Instead, check `!rt.isValid()`.
Done
> modules/javafx.graphics/src/main/java/com/sun/prism/d3d12/D3D12Texture.java
> line 81:
>
>> 79: System.err.println("update cancelled, resource not valid");
>> 80: return;
>> 81: }
>
> No, this won't work. It will skip the intended short-circuit return unless
> verbose is set.
>
> Suggestion:
>
> if (!resource.isValid()) {
> if (PrismSettings.verbose) {
> System.err.println("update cancelled, resource not valid");
> }
> return;
> }
Oh! Definitely, silly mistake on my end
> modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeDevice.cpp
> line 636:
>
>> 634: // create intermediate tex, use ResolveSubresource() to
>> populate it
>> 635: intermediateTexture =
>> std::make_shared<NativeTexture>(shared_from_this());
>> 636: if
>> (!intermediateTexture->Init(static_cast<uint32_t>(srcRT->GetWidth()),
>> static_cast<uint32_t>(srcRT->GetHeight()), srcRT->GetFormat(),
>
> I think this will create a new texture without setting linear filtering,
> since it doesn't go through `NativeRenderTarget::Init`.
Correct, I'll change it. In retrospect, to make this closer to D3D9 behavior
(and to what JavaFX expects) sampling parameters shouldn't be associated with
individual textures, but rather with texture slots in `RenderingContext`. I'll
add a follow-up to rework that part.
> modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeInstance.cpp
> line 85:
>
>> 83: D3D12NI_LOG_DEBUG("DXGI enumerated adapters:");
>> 84: while ((hr = mDXGIFactory->EnumAdapters1(i, &adapter)) !=
>> DXGI_ERROR_NOT_FOUND) {
>> 85: if (FAILED(hr) && hr != DXGI_ERROR_NOT_FOUND)
>
> Minor: The `&& hr != DXGI_ERROR_NOT_FOUND` on this line is redundant given
> that the same test is done in the while loop condition on the immediately
> preceding line.
Done
> modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeInstance.cpp
> line 144:
>
>> 142: DXGIOutputPtr output;
>> 143: while ((hr = mDXGIAdapters[adapterIdx]->EnumOutputs(outputIdx,
>> &output)) != DXGI_ERROR_NOT_FOUND) {
>> 144: if (FAILED(hr) && hr != DXGI_ERROR_NOT_FOUND)
>
> Minor: The `&& hr != DXGI_ERROR_NOT_FOUND` on this line is redundant given
> that the same test is done in the while loop condition on the immediately
> preceding line.
Done
> modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeRenderTarget.cpp
> line 87:
>
>> 85: // in case RTTs are reused as a source texture for rendering - set
>> filtering to Linear
>> 86: // D3D does this globally via D3DContext::setDeviceParametersFor3D()
>> because of how 9's API was designed
>> 87: mTexture->SetSamplerParameters(mTexture->GetSamplerDesc().wrapMode,
>> true);
>
> This will work for ordinary RTTs, but I don't think it is sufficient for
> intermediate MSAA RTTs. I left a comment in `D3D12NativeDevice.cpp`.
Done
> modules/javafx.graphics/src/main/native-prism-d3d12/internal/D3D12DescriptorHeap.cpp
> line 155:
>
>> 153:
>> 154: uint32_t freed = 0;
>> 155: for (slot; slot < finalSlot; ++slot)
>
> Minor: the first term is a no-op. This could be replaced with:
>
> Suggestion:
>
> for (; slot < finalSlot; ++slot)
Correct, it's mostly my habit of putting the iterated value in the first field
in a loop, even as a noop. I'll remove it.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4585486045
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4585486441
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4585473720
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4585501035
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4585452525
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4585451638
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4585506881
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4585464971