Skip to content

Commit

Permalink
nvapi-d3d12: Report OMM as supported if device ext and interface are …
Browse files Browse the repository at this point in the history
…found
  • Loading branch information
Saancreed committed May 19, 2023
1 parent 3990a6b commit e33de2b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/nvapi_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,21 @@ extern "C" {
*(NVAPI_D3D12_RAYTRACING_THREAD_REORDERING_CAPS*)pData = NVAPI_D3D12_RAYTRACING_THREAD_REORDERING_CAP_NONE;
break;

case NVAPI_D3D12_RAYTRACING_CAPS_TYPE_OPACITY_MICROMAP:
case NVAPI_D3D12_RAYTRACING_CAPS_TYPE_OPACITY_MICROMAP: {
if (dataSize != sizeof(NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAPS))
return InvalidArgument(n);

*(NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAPS*)pData = NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAP_NONE;
auto ommCaps = reinterpret_cast<NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAPS*>(pData);
// even though we can check extension support with DeviceExt(0) interface, DeviceExt1 is needed for actual OMM functions
Com<ID3D12DeviceExt1> deviceExt;

if (!FAILED(pDevice->QueryInterface(IID_PPV_ARGS(&deviceExt))) && deviceExt->GetExtensionSupport(D3D12_VK_EXT_OPACITY_MICROMAP))
*ommCaps = NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAP_STANDARD;
else
*ommCaps = NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAP_NONE;

break;
}

default:
return InvalidArgument(n);
Expand Down

0 comments on commit e33de2b

Please sign in to comment.