WRAPPED_GPU_POINTER RaytracingDevice::GetWrappedPointerFromGpuVA(D3D12_GPU_VIRTUAL_ADDRESS) { // Should never be called when using the Fallback Layer ThrowFailure(E_INVALIDARG, L"GetWrappedPointerFromGpuVA is invalid when using the compute-based Fallback. Apps should either use GetWrappedPointerSimple or " L"GetWrappedPointerFromDescriptorHeapIndex() if it's been verified that ID3D12RaytracingFallbackDevice::UsingRaytracingDriver() == false"); return {}; }
void LoadInstancesPass::LoadInstances(ID3D12GraphicsCommandList *pCommandList, D3D12_GPU_VIRTUAL_ADDRESS outputBVH, D3D12_GPU_VIRTUAL_ADDRESS instancesDesc, D3D12_ELEMENTS_LAYOUT instanceDescLayout, UINT numElements, D3D12_GPU_DESCRIPTOR_HANDLE descriptorHeapBase, D3D12_GPU_VIRTUAL_ADDRESS cachedSortBuffer) { if (numElements == 0) return; const bool performUpdate = cachedSortBuffer != 0; pCommandList->SetComputeRootSignature(m_pRootSignature); ID3D12PipelineState *pLoadAABBPSO = nullptr; switch (instanceDescLayout) { case D3D12_ELEMENTS_LAYOUT_ARRAY: pLoadAABBPSO = m_pLoadAABBsFromArrayOfInstancesPSO; break; case D3D12_ELEMENTS_LAYOUT_ARRAY_OF_POINTERS: pLoadAABBPSO = m_pLoadAABBsFromArrayOfPointersPSO; break; default: ThrowFailure(E_INVALIDARG, L"Unrecognized D3D12_ELEMENTS_LAYOUT provided"); } pCommandList->SetPipelineState(pLoadAABBPSO); LoadInstancesConstants constants = { numElements, (UINT) performUpdate }; pCommandList->SetComputeRoot32BitConstants(Constants, SizeOfInUint32(LoadInstancesConstants), &constants, 0); pCommandList->SetComputeRootDescriptorTable(GlobalDescriptorHeap, descriptorHeapBase); pCommandList->SetComputeRootShaderResourceView(InstanceDescsSRV, instancesDesc); pCommandList->SetComputeRootUnorderedAccessView(OutputBVHRootUAV, outputBVH); if (performUpdate) { pCommandList->SetComputeRootUnorderedAccessView(CachedSortBuffer, cachedSortBuffer); } const UINT dispatchWidth = DivideAndRoundUp<UINT>(numElements, THREAD_GROUP_1D_WIDTH); pCommandList->Dispatch(dispatchWidth, 1, 1); auto uavBarrier = CD3DX12_RESOURCE_BARRIER::UAV(nullptr); pCommandList->ResourceBarrier(1, &uavBarrier); }