protonscr

Support NVAPI shader intrinsics in DXIL

vkd3dopen
HansKristian-Work/vkd3d-proton#2420 · opened 2025-03-27 by Saancreed · updated 2026-01-04 · 5 comments · github
SSaancreed 2025-03-27 github

Seeing as implementing support for undocumented AMD AGS shader intrinsics is something actually happening, even though it's currently not possible to encounter them on Linux without borrowing libraries shipped with AMD's D3D12 driver, it would be great to also have support for NVAPI intrinsics that already have equivalent SPIR-V extensions.

To avoid having to deal with DXBC nonsense, this feature request is limited to intrinsics that can only be reasonably used in DXIL / SM 6.* shaders. When this is done and some interface to query intrinsic support is added, dxvk-nvapi could report some intrinsics as supported for existing games/applications to take advantage of.

Current candidates for consideration, grouped into features they represent:

Finally, there exists a Micro-map DXR extension but the closest SPIR-V extension it could be mapped to, SPV_NV_displacement_micromap, is probably dead and gone now that VK_NV_displacement_micromap has been deprecated and removed.

Ooscarbg 2025-04-22 github

EDIT: good resume of current NV NVAPI extensions..
also not forget the OMM NVAPI DXR extension
can be implemented via VK_EXT_opacity_micromap..
a sample using it:
https://github.com/NVIDIA-RTX/OMM-Samples
and also soon to be in DXR1.2 so I asked this OMM SDK and sample to be ported to DXR1.2 ASAP:
https://github.com/NVIDIA-RTX/OMM-Samples/issues/8

SSaancreed 2025-04-22 github

also not forget the OMM NVAPI DXR extension
can be implemented via VK_EXT_opacity_micromap..

@oscarbg If you are talking about the "force OMM 2 state" ray flag then I omitted it on purpose because I PR'ed support for it (which got merged) years ago.

And as far as I know, there is nothing else that can be implemented there using SPV_EXT_opacity_micromap, that ray flag is the only functionality exposed by that ext. Which kind of makes sense as the entire purpose of opacity micromaps is to have less shader code, not more.

Ooscarbg 2025-04-25 github

@Saancreed my fault, totally forgot it was already implemented..

Ffarnoy 2026-01-03 github

SER is part of SM 6.9 (still in preview, I think) https://devblogs.microsoft.com/directx/ser/

vkd3d-proton would need to support both the NVAPI & 6.9 opcodes, but all apps thus far have used NVAPI ones?

There's now a cross-vendor VK_EXT for it https://www.khronos.org/blog/boosting-ray-tracing-performance-with-shader-execution-reordering-introducing-vk-ext-ray-tracing-invocation-reorder

All the pieces seem to be there, it's just going to take a lot of work? Is this something a first-time contributor could tackle?

SSaancreed 2026-01-04 github

Well, yes. I have already implemented rudimentary support for NVAPI SER in dxil-spirv on top of NV extension, which mostly works with existing games when combined with my branches of dxvk-nvapi and vkd3d-proton. The First Descendant successfully uses that path, and Black Myth Wukong greatly benefits from SER and OMMs.

However, NVIDIA's recent Bonsai Diorama demo (available here) has uncovered a limitation in the current implementation, namely HitObjects cannot be used in Phi operations in SPIR-V but they can in NVAPI flavor of SER in DXIL. I haven't yet figured how to address this (my idea would be to add an analysis pass that would map hit objects created on different branches to a single pointer variable, except I'm too demotivated to actually make an attempt), but with this the implementation would be mostly complete. You still wouldn't be able to try it with Cyberpunk 2077 because it's doing naughty things, but oh well.

If you want to take a look at it, feel free to build my branches and run this demo with VKD3D_DISABLE_EXTENSIONS=VK_NV_cluster_acceleration_structure, because apparently my attempt at implementing RTXMG has another, unrelated problem (😩). Other than that, it's a matter of discussing and implementing an interface in vkd3d-proton that would expose access to NVAPI shader intrinsics, which could be used by dxvk-nvapi.

On the other hand, SER from SM 6.9 should be fairly implementable on top of EXT extension, but I believe since it's core D3D12 feature now, Hans-Kristian is simply waiting for it to be declared stable before starting work on it himself. Of course, none of the games that already launched with NVAPI SER would benefit from this unless their developers migrate them to D3D12 SER.