diff options
| author | lbavoil <[email protected]> | 2018-03-15 11:08:34 +0100 |
|---|---|---|
| committer | lbavoil <[email protected]> | 2018-03-15 11:08:34 +0100 |
| commit | 636807e68a85a978473764d171ed0c7cc36f9be6 (patch) | |
| tree | 784a3d4fa8f48b4c085dd959678505b2af12f425 /src/InputDepthInfo.h | |
| parent | Remove test folder (diff) | |
| download | hbaoplus-636807e68a85a978473764d171ed0c7cc36f9be6.tar.xz hbaoplus-636807e68a85a978473764d171ed0c7cc36f9be6.zip | |
HBAO+ 4.0.0.23740451
Diffstat (limited to 'src/InputDepthInfo.h')
| -rw-r--r-- | src/InputDepthInfo.h | 97 |
1 files changed, 44 insertions, 53 deletions
diff --git a/src/InputDepthInfo.h b/src/InputDepthInfo.h index 977b53f..7d1f504 100644 --- a/src/InputDepthInfo.h +++ b/src/InputDepthInfo.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation @@ -57,13 +57,31 @@ struct InputDepthInfo : SSAO::InputDepthInfo return Status; } - Status = Texture.Init(DepthData.pFullResDepthTextureSRV); + Status = Texture0.Init(DepthData.pFullResDepthTextureSRV); if (Status != GFSDK_SSAO_OK) { return Status; } - Status = Viewport.Init(DepthData.Viewport, Texture); + if (DepthData.pFullResDepthTexture2ndLayerSRV) // the second texture can be nullptr if DualLayer is not enabled + { + Status = Texture1.Init(DepthData.pFullResDepthTexture2ndLayerSRV); + if (Status != GFSDK_SSAO_OK) + { + return Status; + } + if (Texture1.Width != Texture0.Width || + Texture1.Height != Texture0.Height) + { + return GFSDK_SSAO_INVALID_SECOND_DEPTH_TEXTURE_RESOLUTION; + } + if (Texture1.SampleCount != Texture0.SampleCount) + { + return GFSDK_SSAO_INVALID_SECOND_DEPTH_TEXTURE_RESOLUTION; + } + } + + Status = Viewport.Init(DepthData.Viewport, Texture0); if (Status != GFSDK_SSAO_OK) { return Status; @@ -75,7 +93,8 @@ struct InputDepthInfo : SSAO::InputDepthInfo return GFSDK_SSAO_OK; } - SSAO::D3D11::UserTextureSRV Texture; + SSAO::D3D11::UserTextureSRV Texture0; + SSAO::D3D11::UserTextureSRV Texture1; }; } // namespace D3D11 @@ -103,60 +122,31 @@ struct InputDepthInfo : SSAO::InputDepthInfo return Status; } - Status = Texture.Init(&DepthData.FullResDepthTextureSRV); - if (Status != GFSDK_SSAO_OK) - { - return Status; - } - - Status = Viewport.Init(DepthData.Viewport, Texture); - if (Status != GFSDK_SSAO_OK) - { - return Status; - } - - DepthTextureType = DepthData.DepthTextureType; - MetersToViewSpaceUnits = Max(DepthData.MetersToViewSpaceUnits, 0.f); - - return GFSDK_SSAO_OK; - } - - SSAO::D3D12::UserTextureSRV Texture; -}; - -} // namespace D3D12 -#endif // SUPPORT_D3D12 - -//-------------------------------------------------------------------------------- -#if SUPPORT_GL -namespace GL -{ - -//-------------------------------------------------------------------------------- -struct InputDepthInfo : SSAO::InputDepthInfo -{ - InputDepthInfo() - : SSAO::InputDepthInfo() - { - } - - GFSDK_SSAO_Status SetData(const GFSDK_SSAO_GLFunctions& GL, const GFSDK_SSAO_InputDepthData_GL& DepthData) - { - GFSDK_SSAO_Status Status; - - Status = ProjectionMatrixInfo.Init(DepthData.ProjectionMatrix, API_GL); + Status = Texture0.Init(&DepthData.FullResDepthTextureSRV); if (Status != GFSDK_SSAO_OK) { return Status; } - Status = Texture.Init(GL, DepthData.FullResDepthTexture); - if (Status != GFSDK_SSAO_OK) + if (DepthData.FullResDepthTexture2ndLayerSRV.pResource) { - return Status; + Status = Texture1.Init(&DepthData.FullResDepthTexture2ndLayerSRV); + if (Status != GFSDK_SSAO_OK) + { + return Status; + } + if (Texture1.Width != Texture0.Width || + Texture1.Height != Texture0.Height) + { + return GFSDK_SSAO_INVALID_SECOND_DEPTH_TEXTURE_RESOLUTION; + } + if (Texture1.SampleCount != Texture0.SampleCount) + { + return GFSDK_SSAO_INVALID_SECOND_DEPTH_TEXTURE_RESOLUTION; + } } - Status = Viewport.InitFromTexture(DepthData.Viewport, Texture); + Status = Viewport.Init(DepthData.Viewport, Texture0); if (Status != GFSDK_SSAO_OK) { return Status; @@ -168,11 +158,12 @@ struct InputDepthInfo : SSAO::InputDepthInfo return GFSDK_SSAO_OK; } - SSAO::GL::UserTexture Texture; + SSAO::D3D12::UserTextureSRV Texture0; + SSAO::D3D12::UserTextureSRV Texture1; }; -} // namespace GL -#endif // SUPPORT_GL +} // namespace D3D12 +#endif // SUPPORT_D3D12 } // namespace SSAO } // namespace GFSDK |