HansKristian-Work / dxil-spirv

DXIL conversion to SPIR-V for D3D12 translation libraries
Other
166 stars 32 forks source link

Add an option to emit RT opacity micromap cap. #172

Closed Saancreed closed 1 year ago

Saancreed commented 1 year ago

Now that we actually have a game that uses it (Cyberpunk 2077 after 2.0 update), perhaps it's worth investigating if properly implementing support for it gives any measurable benefits (on Nvidia Ada GPUs mostly, that is).

All this PR does is add an option to emit RayTracingOpacityMicromapEXT capability and its related SPV_EXT_opacity_micromap extension if requested. This is all we currently need on dxil-spirv side of things (as long as we don't consider NVAPI shader extensions :weary:) because new NVAPI_RAY_FLAG_FORCE_OMM_2_STATE_EX ray flag happens to have the same value as SpvRayFlagsForceOpacityMicromap2StateEXT, we just have to enable using it. Even if vkd3d-proton doesn't make use of this feature anytime soon, I hope it's non-invasive enough to make it upstreamable in its current form anyway.

Alternatively, we might also try detecting if any ray flag we emit contains the bit in question; but I'm not sure if ray flags are always emitted as constants so this could be tricky.