PCSamples/Raytracing/RaytracingAO_PC12/RayTracingHelper.h
// Create a wrapped pointer for the Fallback Layer path.

Create a wrapped pointer for the Fallback Layer path.
Create a wrapped pointer for the Fallback Layer path .
inline WRAPPED_GPU_POINTER CreateFallbackWrappedPointer(
    ID3D12Device* pDevice,
    ID3D12RaytracingFallbackDevice* pFallbackDevice,
    ID3D12Resource* resource,
    D3D12_CPU_DESCRIPTOR_HANDLE descriptorHeapStart,
    unsigned int resourceOffset,
    unsigned int bufferNumElements,
    unsigned int descSize)
{
    D3D12_UNORDERED_ACCESS_VIEW_DESC rawBufferUavDesc = {};
    rawBufferUavDesc.ViewDimension = D3D12_UAV_DIMENSION_BUFFER;
    rawBufferUavDesc.Buffer.Flags = D3D12_BUFFER_UAV_FLAG_RAW;
    rawBufferUavDesc.Format = DXGI_FORMAT_R32_TYPELESS;
    rawBufferUavDesc.Buffer.NumElements = bufferNumElements;
    unsigned int descriptorHeapIndex = 0;
    if (!pFallbackDevice->UsingRaytracingDriver())
    {
        descriptorHeapIndex = resourceOffset;
        D3D12_CPU_DESCRIPTOR_HANDLE bottomLevelDescriptor
            = CD3DX12_CPU_DESCRIPTOR_HANDLE(descriptorHeapStart, descriptorHeapIndex, descSize);
        pDevice->CreateUnorderedAccessView(resource, nullptr, &rawBufferUavDesc, bottomLevelDescriptor);
    }
    return pFallbackDevice->GetWrappedPointerSimple(descriptorHeapIndex, resource->GetGPUVirtualAddress());
}
inline WRAPPED_GPU_POINTER CreateFallbackWrappedPointer ( ID3D12Device * pDevice , ID3D12RaytracingFallbackDevice * pFallbackDevice , ID3D12Resource * resource , D3D12_CPU_DESCRIPTOR_HANDLE descriptorHeapStart , unsigned int resourceOffset , unsigned int bufferNumElements , unsigned int descSize ) { D3D12_UNORDERED_ACCESS_VIEW_DESC rawBufferUavDesc = { } ; rawBufferUavDesc . ViewDimension = D3D12_UAV_DIMENSION_BUFFER ; rawBufferUavDesc . Buffer . Flags = D3D12_BUFFER_UAV_FLAG_RAW ; rawBufferUavDesc . Format = DXGI_FORMAT_R32_TYPELESS ; rawBufferUavDesc . Buffer . NumElements = bufferNumElements ; unsigned int descriptorHeapIndex = 0 ; if ( ! pFallbackDevice -> UsingRaytracingDriver ( ) ) { descriptorHeapIndex = resourceOffset ; D3D12_CPU_DESCRIPTOR_HANDLE bottomLevelDescriptor = CD3DX12_CPU_DESCRIPTOR_HANDLE ( descriptorHeapStart , descriptorHeapIndex , descSize ) ; pDevice -> CreateUnorderedAccessView ( resource , nullptr , & rawBufferUavDesc , bottomLevelDescriptor ) ; } return pFallbackDevice -> GetWrappedPointerSimple ( descriptorHeapIndex , resource -> GetGPUVirtualAddress ( ) ) ; }
Create a wrapped pointer for the Fallback Layer path.
Create a wrapped pointer for the Fallback Layer path .
// Only compute fallback requires a valid descriptor index when creating a wrapped pointer.
