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
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.
@Saancreed my fault, totally forgot it was already implemented..
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?
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.
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:
RTX Mega Geometry, a.k.a. Cluster Geometry DXR extension
SPV_NV_cluster_acceleration_structureNV_EXTN_OP_RT_GET_CLUSTER_IDused byuint NvRtGetClusterID()could be translated toClusterIDNVNV_EXTN_OP_RT_GET_CANDIDATE_CLUSTER_IDandNV_EXTN_OP_RT_GET_COMMITTED_CLUSTER_IDused byuint __NvRtGetCandidateClusterID(uint rqFlags)anduint __NvRtGetCommittedClusterID(uint rqFlags)respectively could be translated toOpRayQueryGetIntersectionClusterIdNVRTX Character Rendering, a.k.a. Linear Swept Sphere DXR extension
SPV_NV_linear_swept_spheresNV_EXTN_OP_RT_SPHERE_OBJECT_POSITION_AND_RADIUSused byfloat4 NvRtSphereObjectPositionAndRadius()could be translated toHitSpherePositionNV+HitSphereRadiusNVNV_EXTN_OP_RT_LSS_OBJECT_POSITIONS_AND_RADIIused byfloat2x4 NvRtLssObjectPositionsAndRadii()could be translated toHitLSSPositionsNV+HitLSSRadiiNVNV_EXTN_OP_RT_IS_SPHERE_HITused bybool NvRtIsSphereHit()could be translated toHitIsSphereNVNV_EXTN_OP_RT_IS_LSS_HITused bybool NvRtIsLssHit()could be translated toHitIsLSSNVNV_EXTN_OP_RT_CANDIDATE_IS_NONOPAQUE_SPHEREandNV_EXTN_OP_RT_COMMITTED_IS_SPHEREused bybool __NvRtCandidateIsNonOpaqueSphere(uint rqFlags)andbool __NvRtCommittedIsSphere(uint rqFlags)respectively could be translated toOpRayQueryIsSphereHitNVNV_EXTN_OP_RT_CANDIDATE_IS_NONOPAQUE_LSSandNV_EXTN_OP_RT_COMMITTED_IS_LSSused bybool __NvRtCandidateIsNonOpaqueLss(uint rqFlags)andbool __NvRtCommittedIsLss(uint rqFlags)respectively could be translated toOpRayQueryIsLSSHitNVNV_EXTN_OP_RT_CANDIDATE_LSS_HIT_PARAMETERandNV_EXTN_OP_RT_COMMITTED_LSS_HIT_PARAMETERused byfloat __NvRtCandidateLssHitParameter(uint rqFlags)andfloat __NvRtCommittedLssHitParameter(uint rqFlags)respectively could be translated toOpRayQueryGetIntersectionLSSHitValueNVNV_EXTN_OP_RT_CANDIDATE_SPHERE_OBJECT_POSITION_AND_RADIUSandNV_EXTN_OP_RT_COMMITTED_SPHERE_OBJECT_POSITION_AND_RADIUSused byfloat4 __NvRtCandidateSphereObjectPositionAndRadius(uint rqFlags)andfloat4 __NvRtCommittedSphereObjectPositionAndRadius(uint rqFlags)respectively could be translated toOpRayQueryGetIntersectionSpherePositionNV+OpRayQueryGetIntersectionSphereRadiusNVNV_EXTN_OP_RT_CANDIDATE_LSS_OBJECT_POSITIONS_AND_RADIIandNV_EXTN_OP_RT_COMMITTED_LSS_OBJECT_POSITIONS_AND_RADIIused byfloat2x4 __NvRtCandidateLssObjectPositionsAndRadii(uint rqFlags)andfloat2x4 __NvRtCommittedLssObjectPositionsAndRadii(uint rqFlags)respectively could be translated toOpRayQueryGetIntersectionLSSPositionsNV+OpRayQueryGetIntersectionLSSRadiiNVNV_EXTN_OP_RT_CANDIDATE_BUILTIN_PRIMITIVE_RAY_Tused byfloat __NvRtCandidateBuiltinPrimitiveRayT(uint rqFlags)could be translated toOpRayQueryGetIntersectionTKHRNV_EXTN_OP_RT_COMMIT_NONOPAQUE_BUILTIN_PRIMITIVE_HITused byvoid __NvRtCommitNonOpaqueBuiltinPrimitiveHit(uint rqFlags)could be translated toOpRayQueryConfirmIntersectionKHRShader Execution Reordering, a.k.a. DXR HitObject extension
VK_EXT_ray_tracing_invocation_reorderis published and use SPIR-V extension exposed by that instead, as we will need SER support for DXR 1.2 and SM 6.9 anyway?VkPhysicalDeviceNV_EXTN_OP_HIT_OBJECT_GET_CLUSTER_ID/OpHitObjectGetClusterIdNVTriangle object positions DXR extension
SPV_KHR_ray_tracing_position_fetchVK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DATA_ACCESS_BIT_KHRto RTAS buildsNV_EXTN_OP_RT_TRIANGLE_OBJECT_POSITIONSused byfloat3x3 NvRtTriangleObjectPositions()could be translated toHitTriangleVertexPositionsKHRNV_EXTN_OP_RT_CANDIDATE_TRIANGLE_OBJECT_POSITIONSandNV_EXTN_OP_RT_COMMITTED_TRIANGLE_OBJECT_POSITIONSused byfloat3x3 __NvRtCandidateTriangleObjectPositions(uint rqFlags)andfloat3x3 __NvRtCommittedTriangleObjectPositions(uint rqFlags)respectively could be translated toOpRayQueryGetIntersectionTriangleVertexPositionsKHRFinally, 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_micromaphas been deprecated and removed.