<div dir="ltr">This is exciting news!<div><br></div><div>I looked at the code quickly. Here are my thoughts.</div><div><br></div><div>My biggest remark is that JNI is still being used, which is being more and more restricted. Recently, Kevin announced that we will be FFM-ready, surely by the time this pipeline is released. I would like to see (and can help, having used FFM since incubation) D3D12 being based on FFM.</div><div><br></div><div>This will also allow less cluttered code to be written with less effort. Consider this mess in D3D12NativeMeshView (exists in D3D9 also, not blaming you for this :) ):</div><div><br></div><div> private native void nSetLight(long ptr, int index, float x, float y, float z, float r, float g, float b,<br> float enabled, float ca, float la, float qa, float isAttenuated, float maxRange,<br> float dirX, float dirY, float dirZ, float innerAngle, float outerAngle, float falloff);<br></div><div><br></div><div>That, in a pure Java world, would be `void nSetLight(Light)` with `Light` holding all its parameters. In fact, this could make whole files that just prepare the data for the native layer redundant. At least I know this is the case in the current D3D9 implementation.</div><div><br></div><div>It might also be the case that the pointer juggling that we do currently (using `long ptr` everywhere) will not be needed because FFM does it for us (Arena takes care of the lifecycle context). However, when it comes to resource deallocation there are many caveats, so I'm speculating here.</div><div><br></div><div>Another design element that I think we can get rid of is the duplication of data structures in the Java and native sides. if Java has a Light, Material, and Mesh, the native side doesn't need them in reality, but in D3D9 (and somewhat in D3D12) it does have them. Without checking, I suspect that this duplication leads to inefficient memory usage. I speculate that it was done to minimize the number of native calls, a consideration that could be overturned with FFM. In general, a lot of the code in C++ can be potentially moved to Java, with only the calls to DirectX being left of course.</div><div><br></div><div>Thanks for this herculean effort!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 14, 2024 at 7:10 PM Lukasz Kostyra <<a href="mailto:lukasz.kostyra@oracle.com">lukasz.kostyra@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-4926311396406024869">
<div lang="en-NL" style="overflow-wrap: break-word;">
<div class="m_-4926311396406024869WordSection1">
<p class="MsoNormal">Hello openjfx-dev,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">we just pushed a prototype of a new JavaFX Direct3D 12 rendering pipeline<u></u><u></u></p>
<p class="MsoNormal">for Windows to a new "direct3d12" branch on jfx-sandbox. It is more than an<u></u><u></u></p>
<p class="MsoNormal">experiment branch - we intend to fully develop the D3D12 backend there.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">We're not necessarily looking for contributions at this point, but if anyone<u></u><u></u></p>
<p class="MsoNormal">has early feedback about it or wants to try it by building it themselves,<u></u><u></u></p>
<p class="MsoNormal">that would be fine. We also did not test it on a wider range of hardware, so<u></u><u></u></p>
<p class="MsoNormal">your mileage may vary. While D3D12 pipeline will build by default, D3D9<u></u><u></u></p>
<p class="MsoNormal">pipeline is still the default pick at runtime. To run anything on D3D12<u></u><u></u></p>
<p class="MsoNormal">pipeline you need to force it with ex.:<u></u><u></u></p>
<p class="MsoNormal"> java -Dprism.order=d3d12 ...<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Backend supports 2D rendering (albeit with some graphical issues here and there<u></u><u></u></p>
<p class="MsoNormal">that need to be ironed out) and basic 3D rendering. Expect not everything fully<u></u><u></u></p>
<p class="MsoNormal">working yet (ex. some gradients on 2D controls are incorrect, or 3D-in-2D will<u></u><u></u></p>
<p class="MsoNormal">straight up not work) and the performance not matching D3D9 yet. Our goal is to<u></u><u></u></p>
<p class="MsoNormal">first reach feature completion and then focus on performance.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Lukasz<u></u><u></u></p>
</div>
</div>
</div></blockquote></div>