diff options
| author | Louis Bavoil <[email protected]> | 2018-03-30 21:31:25 +0200 |
|---|---|---|
| committer | Louis Bavoil <[email protected]> | 2018-03-30 21:31:25 +0200 |
| commit | 7dfdbb54a778d4d9184037fdc74c85debd68011b (patch) | |
| tree | 15c8800522d8bd5a5153d21a36989aba0b4d4565 /src | |
| parent | HBAO+ 4.0.0.23740451 (diff) | |
| download | hbaoplus-7dfdbb54a778d4d9184037fdc74c85debd68011b.tar.xz hbaoplus-7dfdbb54a778d4d9184037fdc74c85debd68011b.zip | |
HBAO+ 4.0.0.23827312
Diffstat (limited to 'src')
| -rw-r--r-- | src/Common.h | 2 | ||||
| -rw-r--r-- | src/Common_DX12.h | 2 | ||||
| -rw-r--r-- | src/Renderer_DX12.cpp | 64 | ||||
| -rw-r--r-- | src/Renderer_DX12.h | 2 |
4 files changed, 52 insertions, 18 deletions
diff --git a/src/Common.h b/src/Common.h index 30be88d..59030a8 100644 --- a/src/Common.h +++ b/src/Common.h @@ -23,10 +23,8 @@ #if _DEBUG #define ASSERT(exp) assert(exp) -#define ASSERT_GL_ERROR(GL) assert(!GL.glGetError()) #else #define ASSERT(exp) ((void)0) -#define ASSERT_GL_ERROR(GL) #endif #ifndef ANDROID diff --git a/src/Common_DX12.h b/src/Common_DX12.h index 17dbe83..945d3ce 100644 --- a/src/Common_DX12.h +++ b/src/Common_DX12.h @@ -68,7 +68,7 @@ struct GFSDK_D3D12_DescriptorHeap void InitDescriptorHeap(ID3D12Device* pDevice, D3D12_DESCRIPTOR_HEAP_TYPE HeapType, const GFSDK_SSAO_DescriptorHeapRange_D3D12* pHeapInfo, bool bShaderVisible) { - NumDescriptors = pHeapInfo->NumDescriptors; + NumDescriptors = pHeapInfo->pDescHeap->GetDesc().NumDescriptors; pDescHeap = pHeapInfo->pDescHeap; BaseIndex = pHeapInfo->BaseIndex; diff --git a/src/Renderer_DX12.cpp b/src/Renderer_DX12.cpp index 5fb4ea5..573350e 100644 --- a/src/Renderer_DX12.cpp +++ b/src/Renderer_DX12.cpp @@ -79,6 +79,52 @@ void GFSDK::SSAO::D3D12::Renderer::ReleaseResources() } //-------------------------------------------------------------------------------- +GFSDK_SSAO_Status GFSDK::SSAO::D3D12::Renderer::ValidateDescriptorHeap( + const GFSDK_SSAO_DescriptorHeapRange_D3D12& DescHeapRange, + D3D12_DESCRIPTOR_HEAP_TYPE RequiredHeapType, + UINT RequiredNumDescriptors) +{ + if (!DescHeapRange.pDescHeap) + { + return GFSDK_SSAO_NULL_ARGUMENT; + } + + D3D12_DESCRIPTOR_HEAP_DESC HeapDesc = DescHeapRange.pDescHeap->GetDesc(); + + if (HeapDesc.Type != RequiredHeapType) + { + return GFSDK_SSAO_D3D12_INVALID_HEAP_TYPE; + } + + if (HeapDesc.NumDescriptors < DescHeapRange.BaseIndex + RequiredNumDescriptors) + { + return GFSDK_SSAO_D3D12_INSUFFICIENT_DESCRIPTORS; + } + + return GFSDK_SSAO_OK; +} + +//-------------------------------------------------------------------------------- +GFSDK_SSAO_Status GFSDK::SSAO::D3D12::Renderer::ValidateDescriptorHeaps(const GFSDK_SSAO_DescriptorHeaps_D3D12& DescriptorHeaps) +{ + GFSDK_SSAO_Status Status; + + Status = ValidateDescriptorHeap(DescriptorHeaps.CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, CBVSRVUAVLayoutBase::eCBVSRVUAVLayoutBaseMax); + if (Status != GFSDK_SSAO_OK) + { + return Status; + } + + Status = ValidateDescriptorHeap(DescriptorHeaps.RTV, D3D12_DESCRIPTOR_HEAP_TYPE_RTV, RTVLayoutBase::eRTVLayoutBaseMax); + if (Status != GFSDK_SSAO_OK) + { + return Status; + } + + return GFSDK_SSAO_OK; +} + +//-------------------------------------------------------------------------------- GFSDK_SSAO_Status GFSDK::SSAO::D3D12::Renderer::Create( ID3D12Device* pDevice, GFSDK_SSAO_UINT NodeMask, @@ -107,22 +153,10 @@ GFSDK_SSAO_Status GFSDK::SSAO::D3D12::Renderer::Create( return GFSDK_SSAO_D3D12_INVALID_NODE_MASK; } - if (!DescriptorHeaps.CBV_SRV_UAV.pDescHeap || - !DescriptorHeaps.RTV.pDescHeap) - { - return GFSDK_SSAO_NULL_ARGUMENT; - } - - if (DescriptorHeaps.CBV_SRV_UAV.pDescHeap->GetDesc().Type != D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV || - DescriptorHeaps.RTV.pDescHeap->GetDesc().Type != D3D12_DESCRIPTOR_HEAP_TYPE_RTV) - { - return GFSDK_SSAO_D3D12_INVALID_HEAP_TYPE; - } - - if (DescriptorHeaps.CBV_SRV_UAV.NumDescriptors < GFSDK_SSAO_NUM_DESCRIPTORS_CBV_SRV_UAV_HEAP_D3D12 || - DescriptorHeaps.RTV.NumDescriptors < GFSDK_SSAO_NUM_DESCRIPTORS_RTV_HEAP_D3D12) + GFSDK_SSAO_Status Status = ValidateDescriptorHeaps(DescriptorHeaps); + if (Status != GFSDK_SSAO_OK) { - return GFSDK_SSAO_D3D12_INSUFFICIENT_DESCRIPTORS; + return Status; } m_GraphicsContext.Init(pDevice, DescriptorHeaps, NodeMask); diff --git a/src/Renderer_DX12.h b/src/Renderer_DX12.h index fa2100d..88d8e41 100644 --- a/src/Renderer_DX12.h +++ b/src/Renderer_DX12.h @@ -144,6 +144,8 @@ private: GFSDK_SSAO_Status SetAOParameters(const GFSDK_SSAO_Parameters& Parameters); GFSDK_SSAO_Status SetOutput(const GFSDK_SSAO_Output_D3D12& Output); GFSDK_SSAO_Status ValidateDataFlow(); + GFSDK_SSAO_Status ValidateDescriptorHeap(const GFSDK_SSAO_DescriptorHeapRange_D3D12& DescHeapRange, D3D12_DESCRIPTOR_HEAP_TYPE RequiredHeapType, UINT RequiredNumDescriptors); + GFSDK_SSAO_Status ValidateDescriptorHeaps(const GFSDK_SSAO_DescriptorHeaps_D3D12& DescriptorHeaps); void DrawLinearDepthPS(GFSDK_D3D12_GraphicsContext* pGraphicsContext); void DrawDeinterleavedDepthPS(GFSDK_D3D12_GraphicsContext* pGraphicsContext); |