From e339aa92c0154ecb30a24d082ab67928aaea3ba0 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sun, 26 Jan 2020 17:16:33 -0800 Subject: Renamed .h -> .hpp in DiligentCoreAPITest project --- Tests/DiligentCoreAPITest/CMakeLists.txt | 8 +- .../include/CreateObjFromNativeResTestBase.h | 59 ------ .../include/CreateObjFromNativeResTestBase.hpp | 59 ++++++ .../include/D3D11/CreateObjFromNativeResD3D11.h | 51 ----- .../include/D3D11/CreateObjFromNativeResD3D11.hpp | 51 +++++ .../include/D3D11/TestingEnvironmentD3D11.h | 128 ------------ .../include/D3D11/TestingEnvironmentD3D11.hpp | 128 ++++++++++++ .../include/D3D11/TestingSwapChainD3D11.h | 91 -------- .../include/D3D11/TestingSwapChainD3D11.hpp | 91 ++++++++ .../include/D3D12/CreateObjFromNativeResD3D12.h | 51 ----- .../include/D3D12/CreateObjFromNativeResD3D12.hpp | 51 +++++ .../D3D12/D3D12DebugLayerSetNameBugWorkaround.h | 61 ------ .../D3D12/D3D12DebugLayerSetNameBugWorkaround.hpp | 61 ++++++ .../include/D3D12/TestingEnvironmentD3D12.h | 85 -------- .../include/D3D12/TestingEnvironmentD3D12.hpp | 85 ++++++++ .../include/D3D12/TestingSwapChainD3D12.h | 103 --------- .../include/D3D12/TestingSwapChainD3D12.hpp | 103 +++++++++ .../include/GL/CreateObjFromNativeResGL.h | 51 ----- .../include/GL/CreateObjFromNativeResGL.hpp | 51 +++++ .../include/GL/TestingEnvironmentGL.h | 70 ------- .../include/GL/TestingEnvironmentGL.hpp | 70 +++++++ .../include/GL/TestingSwapChainGL.h | 63 ------ .../include/GL/TestingSwapChainGL.hpp | 63 ++++++ Tests/DiligentCoreAPITest/include/PSOTestBase.h | 66 ------ Tests/DiligentCoreAPITest/include/PSOTestBase.hpp | 66 ++++++ .../include/TestingEnvironment.h | 127 ----------- .../include/TestingEnvironment.hpp | 127 +++++++++++ .../include/TestingSwapChainBase.h | 231 --------------------- .../include/TestingSwapChainBase.hpp | 231 +++++++++++++++++++++ .../include/Vulkan/CreateObjFromNativeResVK.h | 51 ----- .../include/Vulkan/CreateObjFromNativeResVK.hpp | 51 +++++ .../include/Vulkan/TestingEnvironmentVk.h | 106 ---------- .../include/Vulkan/TestingEnvironmentVk.hpp | 106 ++++++++++ .../include/Vulkan/TestingSwapChainVk.h | 105 ---------- .../include/Vulkan/TestingSwapChainVk.hpp | 105 ++++++++++ Tests/DiligentCoreAPITest/src/BlendStateTest.cpp | 2 +- Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp | 2 +- Tests/DiligentCoreAPITest/src/BufferAccessTest.cpp | 2 +- .../DiligentCoreAPITest/src/BufferCreationTest.cpp | 10 +- Tests/DiligentCoreAPITest/src/CInterfaceTest.cpp | 2 +- .../src/ClearRenderTargetTest.cpp | 4 +- .../DiligentCoreAPITest/src/ComputeShaderTest.cpp | 4 +- Tests/DiligentCoreAPITest/src/CopyTextureTest.cpp | 2 +- .../src/D3D11/ClearRenderTargetRefenceD3D11.cpp | 4 +- .../src/D3D11/ComputeShaderRefenceD3D11.cpp | 4 +- .../src/D3D11/CreateObjFromNativeResD3D11.cpp | 2 +- .../src/D3D11/DrawCommandReferenceD3D11.cpp | 4 +- .../src/D3D11/GeometryShaderRefenceD3D11.cpp | 4 +- .../src/D3D11/TessellationRefenceD3D11.cpp | 4 +- .../src/D3D11/TestingEnvironmentD3D11.cpp | 2 +- .../src/D3D11/TestingSwapChainD3D11.cpp | 2 +- .../src/D3D12/ClearRenderTargetRefenceD3D12.cpp | 4 +- .../src/D3D12/ComputeShaderRefenceD3D12.cpp | 4 +- .../src/D3D12/CreateObjFromNativeResD3D12.cpp | 2 +- .../D3D12/D3D12DebugLayerSetNameBugWorkaround.cpp | 2 +- .../src/D3D12/DrawCommandReferenceD3D12.cpp | 4 +- .../src/D3D12/GeometryShaderRefenceD3D12.cpp | 4 +- .../src/D3D12/TessellationRefenceD3D12.cpp | 4 +- .../src/D3D12/TestingEnvironmentD3D12.cpp | 2 +- .../src/D3D12/TestingSwapChainD3D12.cpp | 4 +- .../src/DepthStencilStateTest.cpp | 4 +- Tests/DiligentCoreAPITest/src/DrawCommandTest.cpp | 4 +- .../src/GL/ClearRenderTargetRefenceGL.cpp | 4 +- .../src/GL/ComputeShaderRefenceGL.cpp | 4 +- .../src/GL/CreateObjFromNativeResGL.cpp | 2 +- .../src/GL/DrawCommandReferenceGL.cpp | 4 +- .../src/GL/GeometryShaderRefenceGL.cpp | 4 +- .../src/GL/TessellationRefenceGL.cpp | 4 +- .../src/GL/TestingEnvironmentGL.cpp | 2 +- .../src/GL/TestingSwapChainGL.cpp | 4 +- Tests/DiligentCoreAPITest/src/GenerateMipsTest.cpp | 2 +- .../DiligentCoreAPITest/src/GeometryShaderTest.cpp | 4 +- .../src/HLSL2GLSLConverterTest.cpp | 2 +- .../src/MTResourceCreationTest.cpp | 4 +- .../src/PSOCompatibilityTest.cpp | 2 +- Tests/DiligentCoreAPITest/src/PSOTestBase.cpp | 4 +- Tests/DiligentCoreAPITest/src/QueryTest.cpp | 2 +- .../src/RasterizerStateTest.cpp | 4 +- .../src/SamplerCreationTest.cpp | 2 +- .../src/SeparateTextureSamplerTest.cpp | 2 +- .../src/ShaderResourceArrayTest.cpp | 2 +- .../src/ShaderResourceLayoutTest.cpp | 2 +- .../src/ShaderVariableAccessTest.cpp | 2 +- Tests/DiligentCoreAPITest/src/TessellationTest.cpp | 4 +- .../DiligentCoreAPITest/src/TestingEnvironment.cpp | 4 +- .../src/TestingSwapChainBase.cpp | 2 +- .../src/TextureCreationTest.cpp | 10 +- .../src/Vulkan/ClearRenderTargetReferenceVk.cpp | 4 +- .../src/Vulkan/ComputeShaderReferenceVk.cpp | 4 +- .../src/Vulkan/CreateObjFromNativeResVK.cpp | 2 +- .../src/Vulkan/DrawCommandReferenceVk.cpp | 4 +- .../src/Vulkan/GeometryShaderReferenceVk.cpp | 4 +- .../src/Vulkan/TessellationReferenceVk.cpp | 4 +- .../src/Vulkan/TestingEnvironmentVk.cpp | 2 +- .../src/Vulkan/TestingSwapChainVk.cpp | 4 +- .../src/Win32/TestingEnvironmentWin32.cpp | 2 +- Tests/DiligentCoreAPITest/src/main.cpp | 2 +- 97 files changed, 1606 insertions(+), 1606 deletions(-) delete mode 100644 Tests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.h create mode 100644 Tests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/D3D11/CreateObjFromNativeResD3D11.h create mode 100644 Tests/DiligentCoreAPITest/include/D3D11/CreateObjFromNativeResD3D11.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/D3D11/TestingEnvironmentD3D11.h create mode 100644 Tests/DiligentCoreAPITest/include/D3D11/TestingEnvironmentD3D11.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/D3D11/TestingSwapChainD3D11.h create mode 100644 Tests/DiligentCoreAPITest/include/D3D11/TestingSwapChainD3D11.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/D3D12/CreateObjFromNativeResD3D12.h create mode 100644 Tests/DiligentCoreAPITest/include/D3D12/CreateObjFromNativeResD3D12.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/D3D12/D3D12DebugLayerSetNameBugWorkaround.h create mode 100644 Tests/DiligentCoreAPITest/include/D3D12/D3D12DebugLayerSetNameBugWorkaround.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/D3D12/TestingEnvironmentD3D12.h create mode 100644 Tests/DiligentCoreAPITest/include/D3D12/TestingEnvironmentD3D12.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/D3D12/TestingSwapChainD3D12.h create mode 100644 Tests/DiligentCoreAPITest/include/D3D12/TestingSwapChainD3D12.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/GL/CreateObjFromNativeResGL.h create mode 100644 Tests/DiligentCoreAPITest/include/GL/CreateObjFromNativeResGL.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/GL/TestingEnvironmentGL.h create mode 100644 Tests/DiligentCoreAPITest/include/GL/TestingEnvironmentGL.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/GL/TestingSwapChainGL.h create mode 100644 Tests/DiligentCoreAPITest/include/GL/TestingSwapChainGL.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/PSOTestBase.h create mode 100644 Tests/DiligentCoreAPITest/include/PSOTestBase.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/TestingEnvironment.h create mode 100644 Tests/DiligentCoreAPITest/include/TestingEnvironment.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/TestingSwapChainBase.h create mode 100644 Tests/DiligentCoreAPITest/include/TestingSwapChainBase.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/Vulkan/CreateObjFromNativeResVK.h create mode 100644 Tests/DiligentCoreAPITest/include/Vulkan/CreateObjFromNativeResVK.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/Vulkan/TestingEnvironmentVk.h create mode 100644 Tests/DiligentCoreAPITest/include/Vulkan/TestingEnvironmentVk.hpp delete mode 100644 Tests/DiligentCoreAPITest/include/Vulkan/TestingSwapChainVk.h create mode 100644 Tests/DiligentCoreAPITest/include/Vulkan/TestingSwapChainVk.hpp diff --git a/Tests/DiligentCoreAPITest/CMakeLists.txt b/Tests/DiligentCoreAPITest/CMakeLists.txt index 86ac26bf..64006ed3 100644 --- a/Tests/DiligentCoreAPITest/CMakeLists.txt +++ b/Tests/DiligentCoreAPITest/CMakeLists.txt @@ -17,22 +17,22 @@ if(NOT GL_SUPPORTED AND NOT GLES_SUPPORTED) list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/HLSL2GLSLConverterTest.cpp) list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/CreateObjFromNativeResGL.cpp) - list(REMOVE_ITEM INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/CreateObjFromNativeResGL.h) + list(REMOVE_ITEM INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/CreateObjFromNativeResGL.hpp) endif() if(NOT D3D11_SUPPORTED) list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/CreateObjFromNativeResD3D11.cpp) - list(REMOVE_ITEM INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/CreateObjFromNativeResD3D11.h) + list(REMOVE_ITEM INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/CreateObjFromNativeResD3D11.hpp) endif() if(NOT D3D12_SUPPORTED) list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/CreateObjFromNativeResD3D12.cpp) - list(REMOVE_ITEM INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/CreateObjFromNativeResD3D12.h) + list(REMOVE_ITEM INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/CreateObjFromNativeResD3D12.hpp) endif() if(NOT VULKAN_SUPPORTED) list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/CreateObjFromNativeResVK.cpp) - list(REMOVE_ITEM INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/CreateObjFromNativeResVK.h) + list(REMOVE_ITEM INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/CreateObjFromNativeResVK.hpp) endif() if(PLATFORM_WIN32) diff --git a/Tests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.h b/Tests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.h deleted file mode 100644 index 55c7de4a..00000000 --- a/Tests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#pragma once - -#include "RenderDevice.h" -#include "Texture.h" -#include "Buffer.h" -#include "RefCntAutoPtr.hpp" - -namespace Diligent -{ - -namespace Testing -{ - -class CreateObjFromNativeResTestBase -{ -public: - CreateObjFromNativeResTestBase(IRenderDevice* pDevice) : - m_pDevice{pDevice} - {} - - virtual ~CreateObjFromNativeResTestBase() {} - - virtual void CreateTexture(ITexture* pTexture) = 0; - virtual void CreateBuffer(IBuffer* pBuffer) = 0; - -protected: - RefCntAutoPtr m_pDevice; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.hpp b/Tests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.hpp new file mode 100644 index 00000000..55c7de4a --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.hpp @@ -0,0 +1,59 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include "RenderDevice.h" +#include "Texture.h" +#include "Buffer.h" +#include "RefCntAutoPtr.hpp" + +namespace Diligent +{ + +namespace Testing +{ + +class CreateObjFromNativeResTestBase +{ +public: + CreateObjFromNativeResTestBase(IRenderDevice* pDevice) : + m_pDevice{pDevice} + {} + + virtual ~CreateObjFromNativeResTestBase() {} + + virtual void CreateTexture(ITexture* pTexture) = 0; + virtual void CreateBuffer(IBuffer* pBuffer) = 0; + +protected: + RefCntAutoPtr m_pDevice; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D11/CreateObjFromNativeResD3D11.h b/Tests/DiligentCoreAPITest/include/D3D11/CreateObjFromNativeResD3D11.h deleted file mode 100644 index a9f0db64..00000000 --- a/Tests/DiligentCoreAPITest/include/D3D11/CreateObjFromNativeResD3D11.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#pragma once - -#include "CreateObjFromNativeResTestBase.h" - -namespace Diligent -{ - -namespace Testing -{ - -class TestCreateObjFromNativeResD3D11 : public CreateObjFromNativeResTestBase -{ -public: - TestCreateObjFromNativeResD3D11(IRenderDevice* pDevice) : - CreateObjFromNativeResTestBase(pDevice) - {} - - virtual void CreateTexture(ITexture* pTexture) override final; - virtual void CreateBuffer(IBuffer* pBuffer) override final; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D11/CreateObjFromNativeResD3D11.hpp b/Tests/DiligentCoreAPITest/include/D3D11/CreateObjFromNativeResD3D11.hpp new file mode 100644 index 00000000..cb7aa0c9 --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/D3D11/CreateObjFromNativeResD3D11.hpp @@ -0,0 +1,51 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include "CreateObjFromNativeResTestBase.hpp" + +namespace Diligent +{ + +namespace Testing +{ + +class TestCreateObjFromNativeResD3D11 : public CreateObjFromNativeResTestBase +{ +public: + TestCreateObjFromNativeResD3D11(IRenderDevice* pDevice) : + CreateObjFromNativeResTestBase(pDevice) + {} + + virtual void CreateTexture(ITexture* pTexture) override final; + virtual void CreateBuffer(IBuffer* pBuffer) override final; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D11/TestingEnvironmentD3D11.h b/Tests/DiligentCoreAPITest/include/D3D11/TestingEnvironmentD3D11.h deleted file mode 100644 index c554c344..00000000 --- a/Tests/DiligentCoreAPITest/include/D3D11/TestingEnvironmentD3D11.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#pragma once - -#include - -#include "TestingEnvironment.h" - -#ifndef NOMINMAX -# define NOMINMAX -#endif - -#include -#include - -namespace Diligent -{ - -namespace Testing -{ - -HRESULT CompileD3DShader(const std::string& Source, - LPCSTR strFunctionName, - const D3D_SHADER_MACRO* pDefines, - LPCSTR profile, - ID3DBlob** ppBlobOut); - -class TestingEnvironmentD3D11 final : public TestingEnvironment -{ -public: - TestingEnvironmentD3D11(RENDER_DEVICE_TYPE deviceType, ADAPTER_TYPE AdapterType, const SwapChainDesc& SCDesc); - - ID3D11Device* GetD3D11Device() - { - return m_pd3d11Device; - } - - ID3D11DeviceContext* GetD3D11Context() - { - return m_pd3d11Context; - } - - ID3D11RasterizerState* GetNoCullRS() - { - return m_pd3d11NoCullRS; - } - - ID3D11DepthStencilState* GetDisableDepthDSS() - { - return m_pd3d11DisableDepthDSS; - } - - ID3D11BlendState* GetDefaultBS() - { - return m_pd3d11DefaultBS; - } - - CComPtr CreateVertexShader(const std::string& Source, - LPCSTR strFunctionName = "main", - const D3D_SHADER_MACRO* pDefines = nullptr, - LPCSTR profile = "vs_5_0"); - - CComPtr CreatePixelShader(const std::string& Source, - LPCSTR strFunctionName = "main", - const D3D_SHADER_MACRO* pDefines = nullptr, - LPCSTR profile = "ps_5_0"); - - CComPtr CreateGeometryShader(const std::string& Source, - LPCSTR strFunctionName = "main", - const D3D_SHADER_MACRO* pDefines = nullptr, - LPCSTR profile = "gs_5_0"); - - CComPtr CreateDomainShader(const std::string& Source, - LPCSTR strFunctionName = "main", - const D3D_SHADER_MACRO* pDefines = nullptr, - LPCSTR profile = "ds_5_0"); - - CComPtr CreateHullShader(const std::string& Source, - LPCSTR strFunctionName = "main", - const D3D_SHADER_MACRO* pDefines = nullptr, - LPCSTR profile = "hs_5_0"); - - CComPtr CreateComputeShader(const std::string& Source, - LPCSTR strFunctionName = "main", - const D3D_SHADER_MACRO* pDefines = nullptr, - LPCSTR profile = "cs_5_0"); - - static TestingEnvironmentD3D11* GetInstance() { return ValidatedCast(TestingEnvironment::GetInstance()); } - - virtual void Reset() override final; - -private: - CComPtr m_pd3d11Device; - CComPtr m_pd3d11Context; - - CComPtr m_pd3d11NoCullRS; - CComPtr m_pd3d11DisableDepthDSS; - CComPtr m_pd3d11DefaultBS; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D11/TestingEnvironmentD3D11.hpp b/Tests/DiligentCoreAPITest/include/D3D11/TestingEnvironmentD3D11.hpp new file mode 100644 index 00000000..1ea58049 --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/D3D11/TestingEnvironmentD3D11.hpp @@ -0,0 +1,128 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include + +#include "TestingEnvironment.hpp" + +#ifndef NOMINMAX +# define NOMINMAX +#endif + +#include +#include + +namespace Diligent +{ + +namespace Testing +{ + +HRESULT CompileD3DShader(const std::string& Source, + LPCSTR strFunctionName, + const D3D_SHADER_MACRO* pDefines, + LPCSTR profile, + ID3DBlob** ppBlobOut); + +class TestingEnvironmentD3D11 final : public TestingEnvironment +{ +public: + TestingEnvironmentD3D11(RENDER_DEVICE_TYPE deviceType, ADAPTER_TYPE AdapterType, const SwapChainDesc& SCDesc); + + ID3D11Device* GetD3D11Device() + { + return m_pd3d11Device; + } + + ID3D11DeviceContext* GetD3D11Context() + { + return m_pd3d11Context; + } + + ID3D11RasterizerState* GetNoCullRS() + { + return m_pd3d11NoCullRS; + } + + ID3D11DepthStencilState* GetDisableDepthDSS() + { + return m_pd3d11DisableDepthDSS; + } + + ID3D11BlendState* GetDefaultBS() + { + return m_pd3d11DefaultBS; + } + + CComPtr CreateVertexShader(const std::string& Source, + LPCSTR strFunctionName = "main", + const D3D_SHADER_MACRO* pDefines = nullptr, + LPCSTR profile = "vs_5_0"); + + CComPtr CreatePixelShader(const std::string& Source, + LPCSTR strFunctionName = "main", + const D3D_SHADER_MACRO* pDefines = nullptr, + LPCSTR profile = "ps_5_0"); + + CComPtr CreateGeometryShader(const std::string& Source, + LPCSTR strFunctionName = "main", + const D3D_SHADER_MACRO* pDefines = nullptr, + LPCSTR profile = "gs_5_0"); + + CComPtr CreateDomainShader(const std::string& Source, + LPCSTR strFunctionName = "main", + const D3D_SHADER_MACRO* pDefines = nullptr, + LPCSTR profile = "ds_5_0"); + + CComPtr CreateHullShader(const std::string& Source, + LPCSTR strFunctionName = "main", + const D3D_SHADER_MACRO* pDefines = nullptr, + LPCSTR profile = "hs_5_0"); + + CComPtr CreateComputeShader(const std::string& Source, + LPCSTR strFunctionName = "main", + const D3D_SHADER_MACRO* pDefines = nullptr, + LPCSTR profile = "cs_5_0"); + + static TestingEnvironmentD3D11* GetInstance() { return ValidatedCast(TestingEnvironment::GetInstance()); } + + virtual void Reset() override final; + +private: + CComPtr m_pd3d11Device; + CComPtr m_pd3d11Context; + + CComPtr m_pd3d11NoCullRS; + CComPtr m_pd3d11DisableDepthDSS; + CComPtr m_pd3d11DefaultBS; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D11/TestingSwapChainD3D11.h b/Tests/DiligentCoreAPITest/include/D3D11/TestingSwapChainD3D11.h deleted file mode 100644 index 9f420af9..00000000 --- a/Tests/DiligentCoreAPITest/include/D3D11/TestingSwapChainD3D11.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#include "TestingSwapChainBase.h" - -#ifndef NOMINMAX -# define NOMINMAX -#endif - -#include -#include - -namespace Diligent -{ - -namespace Testing -{ - -class TestingSwapChainD3D11 final : public TestingSwapChainBase -{ -public: - using TBase = TestingSwapChainBase; - TestingSwapChainD3D11(IReferenceCounters* pRefCounters, - IRenderDevice* pDevice, - IDeviceContext* pContext, - const SwapChainDesc& SCDesc); - - virtual void TakeSnapshot() override final; - - ID3D11Texture2D* GetD3D11RenderTarget() - { - return m_pd3d11RenderTarget; - } - - ID3D11Texture2D* GetD3D11DepthBuffer() - { - return m_pd3d11DepthBuffer; - } - - ID3D11RenderTargetView* GetD3D11RTV() - { - return m_pd3d11RTV; - } - - ID3D11UnorderedAccessView* GetD3D11UAV() - { - return m_pd3d11UAV; - } - - ID3D11DepthStencilView* GetD3D11DSV() - { - return m_pd3d11DSV; - } - -private: - CComPtr m_pd3d11Context; - CComPtr m_pd3d11RenderTarget; - CComPtr m_pd3d11DepthBuffer; - CComPtr m_pd3d11RTV; - CComPtr m_pd3d11UAV; - CComPtr m_pd3d11DSV; - CComPtr m_pd3d11StagingTex; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D11/TestingSwapChainD3D11.hpp b/Tests/DiligentCoreAPITest/include/D3D11/TestingSwapChainD3D11.hpp new file mode 100644 index 00000000..eaafcf5a --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/D3D11/TestingSwapChainD3D11.hpp @@ -0,0 +1,91 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "TestingSwapChainBase.hpp" + +#ifndef NOMINMAX +# define NOMINMAX +#endif + +#include +#include + +namespace Diligent +{ + +namespace Testing +{ + +class TestingSwapChainD3D11 final : public TestingSwapChainBase +{ +public: + using TBase = TestingSwapChainBase; + TestingSwapChainD3D11(IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, + IDeviceContext* pContext, + const SwapChainDesc& SCDesc); + + virtual void TakeSnapshot() override final; + + ID3D11Texture2D* GetD3D11RenderTarget() + { + return m_pd3d11RenderTarget; + } + + ID3D11Texture2D* GetD3D11DepthBuffer() + { + return m_pd3d11DepthBuffer; + } + + ID3D11RenderTargetView* GetD3D11RTV() + { + return m_pd3d11RTV; + } + + ID3D11UnorderedAccessView* GetD3D11UAV() + { + return m_pd3d11UAV; + } + + ID3D11DepthStencilView* GetD3D11DSV() + { + return m_pd3d11DSV; + } + +private: + CComPtr m_pd3d11Context; + CComPtr m_pd3d11RenderTarget; + CComPtr m_pd3d11DepthBuffer; + CComPtr m_pd3d11RTV; + CComPtr m_pd3d11UAV; + CComPtr m_pd3d11DSV; + CComPtr m_pd3d11StagingTex; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D12/CreateObjFromNativeResD3D12.h b/Tests/DiligentCoreAPITest/include/D3D12/CreateObjFromNativeResD3D12.h deleted file mode 100644 index b13da532..00000000 --- a/Tests/DiligentCoreAPITest/include/D3D12/CreateObjFromNativeResD3D12.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#pragma once - -#include "CreateObjFromNativeResTestBase.h" - -namespace Diligent -{ - -namespace Testing -{ - -class TestCreateObjFromNativeResD3D12 : public CreateObjFromNativeResTestBase -{ -public: - TestCreateObjFromNativeResD3D12(IRenderDevice* pDevice) : - CreateObjFromNativeResTestBase(pDevice) - {} - - virtual void CreateTexture(ITexture* pTexture) override final; - virtual void CreateBuffer(IBuffer* pBuffer) override final; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D12/CreateObjFromNativeResD3D12.hpp b/Tests/DiligentCoreAPITest/include/D3D12/CreateObjFromNativeResD3D12.hpp new file mode 100644 index 00000000..cc1af257 --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/D3D12/CreateObjFromNativeResD3D12.hpp @@ -0,0 +1,51 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include "CreateObjFromNativeResTestBase.hpp" + +namespace Diligent +{ + +namespace Testing +{ + +class TestCreateObjFromNativeResD3D12 : public CreateObjFromNativeResTestBase +{ +public: + TestCreateObjFromNativeResD3D12(IRenderDevice* pDevice) : + CreateObjFromNativeResTestBase(pDevice) + {} + + virtual void CreateTexture(ITexture* pTexture) override final; + virtual void CreateBuffer(IBuffer* pBuffer) override final; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D12/D3D12DebugLayerSetNameBugWorkaround.h b/Tests/DiligentCoreAPITest/include/D3D12/D3D12DebugLayerSetNameBugWorkaround.h deleted file mode 100644 index 6507c646..00000000 --- a/Tests/DiligentCoreAPITest/include/D3D12/D3D12DebugLayerSetNameBugWorkaround.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#include - -#include "RenderDevice.h" - -namespace Diligent -{ - -namespace Testing -{ - -// There is a bug in D3D12 debug layer as of build version 10.0.18362: SetName() method -// is not protected by a mutex internally. This, in combination with the fact that root signatures are -// de-duplicated by D3D12 runtime, causes the following problem: -// when multiple threads attempt to create the same root signature, the run-time returns the same -// object. Calling SetName() results in a race condition because multiple threads attempt to resize/write -// to the buffer without a mutex. - -// As a workaround, we create the root signature ahead of time and reserve enough space for the name -// to avoid memory allocation. - -class D3D12DebugLayerSetNameBugWorkaround -{ -public: - explicit D3D12DebugLayerSetNameBugWorkaround(IRenderDevice* pDevice); - ~D3D12DebugLayerSetNameBugWorkaround(); - -private: - struct RootSignatureWrapper; - std::unique_ptr m_RootSignature; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D12/D3D12DebugLayerSetNameBugWorkaround.hpp b/Tests/DiligentCoreAPITest/include/D3D12/D3D12DebugLayerSetNameBugWorkaround.hpp new file mode 100644 index 00000000..6507c646 --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/D3D12/D3D12DebugLayerSetNameBugWorkaround.hpp @@ -0,0 +1,61 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include + +#include "RenderDevice.h" + +namespace Diligent +{ + +namespace Testing +{ + +// There is a bug in D3D12 debug layer as of build version 10.0.18362: SetName() method +// is not protected by a mutex internally. This, in combination with the fact that root signatures are +// de-duplicated by D3D12 runtime, causes the following problem: +// when multiple threads attempt to create the same root signature, the run-time returns the same +// object. Calling SetName() results in a race condition because multiple threads attempt to resize/write +// to the buffer without a mutex. + +// As a workaround, we create the root signature ahead of time and reserve enough space for the name +// to avoid memory allocation. + +class D3D12DebugLayerSetNameBugWorkaround +{ +public: + explicit D3D12DebugLayerSetNameBugWorkaround(IRenderDevice* pDevice); + ~D3D12DebugLayerSetNameBugWorkaround(); + +private: + struct RootSignatureWrapper; + std::unique_ptr m_RootSignature; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D12/TestingEnvironmentD3D12.h b/Tests/DiligentCoreAPITest/include/D3D12/TestingEnvironmentD3D12.h deleted file mode 100644 index fcd546a5..00000000 --- a/Tests/DiligentCoreAPITest/include/D3D12/TestingEnvironmentD3D12.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#pragma once - -#include - -#include "TestingEnvironment.h" - -#ifndef NOMINMAX -# define NOMINMAX -#endif - -#include -#include -#include - -namespace Diligent -{ - -namespace Testing -{ - -// Implemented in TestingEnvironmentD3D11.cpp -HRESULT CompileD3DShader(const std::string& Source, - LPCSTR strFunctionName, - const D3D_SHADER_MACRO* pDefines, - LPCSTR profile, - ID3DBlob** ppBlobOut); - -class TestingEnvironmentD3D12 final : public TestingEnvironment -{ -public: - TestingEnvironmentD3D12(RENDER_DEVICE_TYPE deviceType, ADAPTER_TYPE AdapterType, const SwapChainDesc& SCDesc); - ~TestingEnvironmentD3D12(); - - static TestingEnvironmentD3D12* GetInstance() { return ValidatedCast(TestingEnvironment::GetInstance()); } - - ID3D12Device* GetD3D12Device() - { - return m_pd3d12Device; - } - - // The allocator is currently never reset, which is not an issue in this testing system. - CComPtr CreateGraphicsCommandList(); - - void IdleCommandQueue(ID3D12CommandQueue* pd3d12Queue); - -private: - CComPtr m_pd3d12Device; - CComPtr m_pd3d12CmdAllocator; - CComPtr m_pd3d12Fence; - - UINT64 m_NextFenceValue = 1; - - HANDLE m_WaitForGPUEventHandle = {}; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D12/TestingEnvironmentD3D12.hpp b/Tests/DiligentCoreAPITest/include/D3D12/TestingEnvironmentD3D12.hpp new file mode 100644 index 00000000..0f3be5f1 --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/D3D12/TestingEnvironmentD3D12.hpp @@ -0,0 +1,85 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include + +#include "TestingEnvironment.hpp" + +#ifndef NOMINMAX +# define NOMINMAX +#endif + +#include +#include +#include + +namespace Diligent +{ + +namespace Testing +{ + +// Implemented in TestingEnvironmentD3D11.cpp +HRESULT CompileD3DShader(const std::string& Source, + LPCSTR strFunctionName, + const D3D_SHADER_MACRO* pDefines, + LPCSTR profile, + ID3DBlob** ppBlobOut); + +class TestingEnvironmentD3D12 final : public TestingEnvironment +{ +public: + TestingEnvironmentD3D12(RENDER_DEVICE_TYPE deviceType, ADAPTER_TYPE AdapterType, const SwapChainDesc& SCDesc); + ~TestingEnvironmentD3D12(); + + static TestingEnvironmentD3D12* GetInstance() { return ValidatedCast(TestingEnvironment::GetInstance()); } + + ID3D12Device* GetD3D12Device() + { + return m_pd3d12Device; + } + + // The allocator is currently never reset, which is not an issue in this testing system. + CComPtr CreateGraphicsCommandList(); + + void IdleCommandQueue(ID3D12CommandQueue* pd3d12Queue); + +private: + CComPtr m_pd3d12Device; + CComPtr m_pd3d12CmdAllocator; + CComPtr m_pd3d12Fence; + + UINT64 m_NextFenceValue = 1; + + HANDLE m_WaitForGPUEventHandle = {}; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D12/TestingSwapChainD3D12.h b/Tests/DiligentCoreAPITest/include/D3D12/TestingSwapChainD3D12.h deleted file mode 100644 index b5de7d15..00000000 --- a/Tests/DiligentCoreAPITest/include/D3D12/TestingSwapChainD3D12.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#include "TestingSwapChainBase.h" - -#ifndef NOMINMAX -# define NOMINMAX -#endif - -#include -#include - -namespace Diligent -{ - -namespace Testing -{ - -class TestingSwapChainD3D12 : public TestingSwapChainBase -{ -public: - using TBase = TestingSwapChainBase; - TestingSwapChainD3D12(IReferenceCounters* pRefCounters, - IRenderDevice* pDevice, - IDeviceContext* pContext, - const SwapChainDesc& SCDesc); - - virtual void TakeSnapshot() override final; - - void TransitionRenderTarget(ID3D12GraphicsCommandList* pCmdList, - D3D12_RESOURCE_STATES RTVState); - - void TransitionBuffers(ID3D12GraphicsCommandList* pCmdList, - D3D12_RESOURCE_STATES RTVState, - D3D12_RESOURCE_STATES DSVState); - - D3D12_CPU_DESCRIPTOR_HANDLE GetRTVDescriptorHandle() - { - return m_RTVDescriptorHandle; - } - - D3D12_CPU_DESCRIPTOR_HANDLE GetDSVDescriptorHandle() - { - return m_DSVDescriptorHandle; - } - - D3D12_CPU_DESCRIPTOR_HANDLE GetUAVDescriptorHandle() - { - return m_UAVDescriptorHandle; - } - - ID3D12DescriptorHeap* GetUAVDescriptorHeap() - { - return m_pd3d12CbvSrvUavDescriptorHeap; - } - -private: - CComPtr m_pd3d12RenderTaget; - CComPtr m_pd3d12DepthBuffer; - CComPtr m_pd3d12StagingBuffer; - - CComPtr m_pd3d12RTVDescriptorHeap; - CComPtr m_pd3d12DSVDescriptorHeap; - CComPtr m_pd3d12CbvSrvUavDescriptorHeap; - - D3D12_RESOURCE_STATES m_RenderTargetState = D3D12_RESOURCE_STATE_RENDER_TARGET; - D3D12_RESOURCE_STATES m_DepthBufferState = D3D12_RESOURCE_STATE_DEPTH_WRITE; - - D3D12_CPU_DESCRIPTOR_HANDLE m_RTVDescriptorHandle = {}; - D3D12_CPU_DESCRIPTOR_HANDLE m_DSVDescriptorHandle = {}; - D3D12_CPU_DESCRIPTOR_HANDLE m_UAVDescriptorHandle = {}; - - D3D12_PLACED_SUBRESOURCE_FOOTPRINT m_StagingBufferFootprint = {}; - UINT64 m_StagingBufferSize = 0; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/D3D12/TestingSwapChainD3D12.hpp b/Tests/DiligentCoreAPITest/include/D3D12/TestingSwapChainD3D12.hpp new file mode 100644 index 00000000..68a79dfd --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/D3D12/TestingSwapChainD3D12.hpp @@ -0,0 +1,103 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "TestingSwapChainBase.hpp" + +#ifndef NOMINMAX +# define NOMINMAX +#endif + +#include +#include + +namespace Diligent +{ + +namespace Testing +{ + +class TestingSwapChainD3D12 : public TestingSwapChainBase +{ +public: + using TBase = TestingSwapChainBase; + TestingSwapChainD3D12(IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, + IDeviceContext* pContext, + const SwapChainDesc& SCDesc); + + virtual void TakeSnapshot() override final; + + void TransitionRenderTarget(ID3D12GraphicsCommandList* pCmdList, + D3D12_RESOURCE_STATES RTVState); + + void TransitionBuffers(ID3D12GraphicsCommandList* pCmdList, + D3D12_RESOURCE_STATES RTVState, + D3D12_RESOURCE_STATES DSVState); + + D3D12_CPU_DESCRIPTOR_HANDLE GetRTVDescriptorHandle() + { + return m_RTVDescriptorHandle; + } + + D3D12_CPU_DESCRIPTOR_HANDLE GetDSVDescriptorHandle() + { + return m_DSVDescriptorHandle; + } + + D3D12_CPU_DESCRIPTOR_HANDLE GetUAVDescriptorHandle() + { + return m_UAVDescriptorHandle; + } + + ID3D12DescriptorHeap* GetUAVDescriptorHeap() + { + return m_pd3d12CbvSrvUavDescriptorHeap; + } + +private: + CComPtr m_pd3d12RenderTaget; + CComPtr m_pd3d12DepthBuffer; + CComPtr m_pd3d12StagingBuffer; + + CComPtr m_pd3d12RTVDescriptorHeap; + CComPtr m_pd3d12DSVDescriptorHeap; + CComPtr m_pd3d12CbvSrvUavDescriptorHeap; + + D3D12_RESOURCE_STATES m_RenderTargetState = D3D12_RESOURCE_STATE_RENDER_TARGET; + D3D12_RESOURCE_STATES m_DepthBufferState = D3D12_RESOURCE_STATE_DEPTH_WRITE; + + D3D12_CPU_DESCRIPTOR_HANDLE m_RTVDescriptorHandle = {}; + D3D12_CPU_DESCRIPTOR_HANDLE m_DSVDescriptorHandle = {}; + D3D12_CPU_DESCRIPTOR_HANDLE m_UAVDescriptorHandle = {}; + + D3D12_PLACED_SUBRESOURCE_FOOTPRINT m_StagingBufferFootprint = {}; + UINT64 m_StagingBufferSize = 0; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/GL/CreateObjFromNativeResGL.h b/Tests/DiligentCoreAPITest/include/GL/CreateObjFromNativeResGL.h deleted file mode 100644 index a10da04d..00000000 --- a/Tests/DiligentCoreAPITest/include/GL/CreateObjFromNativeResGL.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#pragma once - -#include "CreateObjFromNativeResTestBase.h" - -namespace Diligent -{ - -namespace Testing -{ - -class TestCreateObjFromNativeResGL : public CreateObjFromNativeResTestBase -{ -public: - TestCreateObjFromNativeResGL(IRenderDevice* pDevice) : - CreateObjFromNativeResTestBase(pDevice) - {} - - virtual void CreateTexture(ITexture* pTexture) override final; - virtual void CreateBuffer(IBuffer* pBuffer) override final; -}; - -} // namespace Testing - -} // namespace Diligent \ No newline at end of file diff --git a/Tests/DiligentCoreAPITest/include/GL/CreateObjFromNativeResGL.hpp b/Tests/DiligentCoreAPITest/include/GL/CreateObjFromNativeResGL.hpp new file mode 100644 index 00000000..1b476231 --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/GL/CreateObjFromNativeResGL.hpp @@ -0,0 +1,51 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include "CreateObjFromNativeResTestBase.hpp" + +namespace Diligent +{ + +namespace Testing +{ + +class TestCreateObjFromNativeResGL : public CreateObjFromNativeResTestBase +{ +public: + TestCreateObjFromNativeResGL(IRenderDevice* pDevice) : + CreateObjFromNativeResTestBase(pDevice) + {} + + virtual void CreateTexture(ITexture* pTexture) override final; + virtual void CreateBuffer(IBuffer* pBuffer) override final; +}; + +} // namespace Testing + +} // namespace Diligent \ No newline at end of file diff --git a/Tests/DiligentCoreAPITest/include/GL/TestingEnvironmentGL.h b/Tests/DiligentCoreAPITest/include/GL/TestingEnvironmentGL.h deleted file mode 100644 index 10d97ba7..00000000 --- a/Tests/DiligentCoreAPITest/include/GL/TestingEnvironmentGL.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#pragma once - -#include - -#ifndef GLEW_STATIC -# define GLEW_STATIC // Must be defined to use static version of glew -#endif -#ifndef GLEW_NO_GLU -# define GLEW_NO_GLU -#endif - -#include "GL/glew.h" - -#include "TestingEnvironment.h" - -namespace Diligent -{ - -namespace Testing -{ - -class TestingEnvironmentGL final : public TestingEnvironment -{ -public: - TestingEnvironmentGL(RENDER_DEVICE_TYPE deviceType, ADAPTER_TYPE AdapterType, const SwapChainDesc& SCDesc); - ~TestingEnvironmentGL(); - - static TestingEnvironmentGL* GetInstance() { return ValidatedCast(TestingEnvironment::GetInstance()); } - - GLuint CompileGLShader(const std::string& Source, GLenum ShaderType); - GLuint LinkProgram(GLuint Shaders[], GLuint NumShaders); - - GLuint GetDummyVAO() { return m_DummyVAO; } - - virtual void Reset() override final; - -private: - GLuint m_DummyVAO = 0; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/GL/TestingEnvironmentGL.hpp b/Tests/DiligentCoreAPITest/include/GL/TestingEnvironmentGL.hpp new file mode 100644 index 00000000..ca2a3569 --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/GL/TestingEnvironmentGL.hpp @@ -0,0 +1,70 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include + +#ifndef GLEW_STATIC +# define GLEW_STATIC // Must be defined to use static version of glew +#endif +#ifndef GLEW_NO_GLU +# define GLEW_NO_GLU +#endif + +#include "GL/glew.h" + +#include "TestingEnvironment.hpp" + +namespace Diligent +{ + +namespace Testing +{ + +class TestingEnvironmentGL final : public TestingEnvironment +{ +public: + TestingEnvironmentGL(RENDER_DEVICE_TYPE deviceType, ADAPTER_TYPE AdapterType, const SwapChainDesc& SCDesc); + ~TestingEnvironmentGL(); + + static TestingEnvironmentGL* GetInstance() { return ValidatedCast(TestingEnvironment::GetInstance()); } + + GLuint CompileGLShader(const std::string& Source, GLenum ShaderType); + GLuint LinkProgram(GLuint Shaders[], GLuint NumShaders); + + GLuint GetDummyVAO() { return m_DummyVAO; } + + virtual void Reset() override final; + +private: + GLuint m_DummyVAO = 0; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/GL/TestingSwapChainGL.h b/Tests/DiligentCoreAPITest/include/GL/TestingSwapChainGL.h deleted file mode 100644 index c75ccaaf..00000000 --- a/Tests/DiligentCoreAPITest/include/GL/TestingSwapChainGL.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#include "TestingSwapChainBase.h" - -namespace Diligent -{ - -namespace Testing -{ - -class TestingSwapChainGL : public TestingSwapChainBase -{ -public: - using TBase = TestingSwapChainBase; - TestingSwapChainGL(IReferenceCounters* pRefCounters, - IRenderDevice* pDevice, - IDeviceContext* pContext, - const SwapChainDesc& SCDesc); - ~TestingSwapChainGL(); - - virtual void TakeSnapshot() override final; - - GLuint GetRenderTargetGLHandle() - { - return m_RenderTarget; - } - - void BindFramebuffer(); - -private: - GLuint m_RenderTarget = 0; - GLuint m_DepthBuffer = 0; - GLuint m_FBO = 0; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/GL/TestingSwapChainGL.hpp b/Tests/DiligentCoreAPITest/include/GL/TestingSwapChainGL.hpp new file mode 100644 index 00000000..a651a33f --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/GL/TestingSwapChainGL.hpp @@ -0,0 +1,63 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "TestingSwapChainBase.hpp" + +namespace Diligent +{ + +namespace Testing +{ + +class TestingSwapChainGL : public TestingSwapChainBase +{ +public: + using TBase = TestingSwapChainBase; + TestingSwapChainGL(IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, + IDeviceContext* pContext, + const SwapChainDesc& SCDesc); + ~TestingSwapChainGL(); + + virtual void TakeSnapshot() override final; + + GLuint GetRenderTargetGLHandle() + { + return m_RenderTarget; + } + + void BindFramebuffer(); + +private: + GLuint m_RenderTarget = 0; + GLuint m_DepthBuffer = 0; + GLuint m_FBO = 0; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/PSOTestBase.h b/Tests/DiligentCoreAPITest/include/PSOTestBase.h deleted file mode 100644 index 1e6664d5..00000000 --- a/Tests/DiligentCoreAPITest/include/PSOTestBase.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#include "RenderDevice.h" -#include "DeviceContext.h" -#include "PipelineState.h" -#include "RefCntAutoPtr.hpp" - -namespace Diligent -{ - -namespace Testing -{ - -class PSOTestBase -{ -protected: - static void InitResources(); - static void ReleaseResources(); - - static RefCntAutoPtr CreateTestPSO(const PipelineStateDesc& PSODesc, bool BindPSO); - - static PipelineStateDesc& GetPSODesc() - { - return sm_Resources.PSODesc; - } - -private: - struct Resources - { - RefCntAutoPtr pTrivialVS; - RefCntAutoPtr pTrivialPS; - - PipelineStateDesc PSODesc; - }; - - static Resources sm_Resources; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/PSOTestBase.hpp b/Tests/DiligentCoreAPITest/include/PSOTestBase.hpp new file mode 100644 index 00000000..1e6664d5 --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/PSOTestBase.hpp @@ -0,0 +1,66 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "RenderDevice.h" +#include "DeviceContext.h" +#include "PipelineState.h" +#include "RefCntAutoPtr.hpp" + +namespace Diligent +{ + +namespace Testing +{ + +class PSOTestBase +{ +protected: + static void InitResources(); + static void ReleaseResources(); + + static RefCntAutoPtr CreateTestPSO(const PipelineStateDesc& PSODesc, bool BindPSO); + + static PipelineStateDesc& GetPSODesc() + { + return sm_Resources.PSODesc; + } + +private: + struct Resources + { + RefCntAutoPtr pTrivialVS; + RefCntAutoPtr pTrivialPS; + + PipelineStateDesc PSODesc; + }; + + static Resources sm_Resources; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/TestingEnvironment.h b/Tests/DiligentCoreAPITest/include/TestingEnvironment.h deleted file mode 100644 index fbec2abb..00000000 --- a/Tests/DiligentCoreAPITest/include/TestingEnvironment.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#pragma once - -#include - -#include "RenderDevice.h" -#include "DeviceContext.h" -#include "RefCntAutoPtr.hpp" -#include "SwapChain.h" -#include "GraphicsTypesOutputInserters.hpp" - -#include "gtest/gtest.h" - -namespace Diligent -{ - -namespace Testing -{ - -class TestingEnvironment : public ::testing::Environment -{ -public: - struct NativeWindow - { - void* NativeWindowHandle = nullptr; -#if PLATFORM_LINUX - void* Display = nullptr; -#endif - }; - - - TestingEnvironment(RENDER_DEVICE_TYPE deviceType, ADAPTER_TYPE AdapterType, const SwapChainDesc& SCDesc); - ~TestingEnvironment() override; - - // Override this to define how to set up the environment. - void SetUp() override final; - - // Override this to define how to tear down the environment. - void TearDown() override final; - - virtual void Reset(); - - void ReleaseResources(); - - class ScopedReset - { - public: - ScopedReset() = default; - ~ScopedReset() - { - if (m_pTheEnvironment) - m_pTheEnvironment->Reset(); - } - }; - - class ScopedReleaseResources - { - public: - ScopedReleaseResources() = default; - ~ScopedReleaseResources() - { - if (m_pTheEnvironment) - m_pTheEnvironment->ReleaseResources(); - } - }; - - IRenderDevice* GetDevice() { return m_pDevice; } - IDeviceContext* GetDeviceContext() { return m_pDeviceContext; } - ISwapChain* GetSwapChain() { return m_pSwapChain; } - - static TestingEnvironment* GetInstance() { return m_pTheEnvironment; } - - RefCntAutoPtr CreateTexture(const char* Name, TEXTURE_FORMAT Fmt, BIND_FLAGS BindFlags, Uint32 Width, Uint32 Height); - - static void SetErrorAllowance(int NumErrorsToAllow, const char* InfoMessage = nullptr); - - RefCntAutoPtr CreateShader(const ShaderCreateInfo& ShaderCI, bool ConvertToGLSL); - -protected: - NativeWindow CreateNativeWindow(); - - static void MessageCallback(DEBUG_MESSAGE_SEVERITY Severity, - const Char* Message, - const char* Function, - const char* File, - int Line); - - const RENDER_DEVICE_TYPE m_DeviceType; - - static TestingEnvironment* m_pTheEnvironment; - - RefCntAutoPtr m_pDevice; - RefCntAutoPtr m_pDeviceContext; - RefCntAutoPtr m_pSwapChain; - - static std::atomic_int m_NumAllowedErrors; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/TestingEnvironment.hpp b/Tests/DiligentCoreAPITest/include/TestingEnvironment.hpp new file mode 100644 index 00000000..fbec2abb --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/TestingEnvironment.hpp @@ -0,0 +1,127 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include + +#include "RenderDevice.h" +#include "DeviceContext.h" +#include "RefCntAutoPtr.hpp" +#include "SwapChain.h" +#include "GraphicsTypesOutputInserters.hpp" + +#include "gtest/gtest.h" + +namespace Diligent +{ + +namespace Testing +{ + +class TestingEnvironment : public ::testing::Environment +{ +public: + struct NativeWindow + { + void* NativeWindowHandle = nullptr; +#if PLATFORM_LINUX + void* Display = nullptr; +#endif + }; + + + TestingEnvironment(RENDER_DEVICE_TYPE deviceType, ADAPTER_TYPE AdapterType, const SwapChainDesc& SCDesc); + ~TestingEnvironment() override; + + // Override this to define how to set up the environment. + void SetUp() override final; + + // Override this to define how to tear down the environment. + void TearDown() override final; + + virtual void Reset(); + + void ReleaseResources(); + + class ScopedReset + { + public: + ScopedReset() = default; + ~ScopedReset() + { + if (m_pTheEnvironment) + m_pTheEnvironment->Reset(); + } + }; + + class ScopedReleaseResources + { + public: + ScopedReleaseResources() = default; + ~ScopedReleaseResources() + { + if (m_pTheEnvironment) + m_pTheEnvironment->ReleaseResources(); + } + }; + + IRenderDevice* GetDevice() { return m_pDevice; } + IDeviceContext* GetDeviceContext() { return m_pDeviceContext; } + ISwapChain* GetSwapChain() { return m_pSwapChain; } + + static TestingEnvironment* GetInstance() { return m_pTheEnvironment; } + + RefCntAutoPtr CreateTexture(const char* Name, TEXTURE_FORMAT Fmt, BIND_FLAGS BindFlags, Uint32 Width, Uint32 Height); + + static void SetErrorAllowance(int NumErrorsToAllow, const char* InfoMessage = nullptr); + + RefCntAutoPtr CreateShader(const ShaderCreateInfo& ShaderCI, bool ConvertToGLSL); + +protected: + NativeWindow CreateNativeWindow(); + + static void MessageCallback(DEBUG_MESSAGE_SEVERITY Severity, + const Char* Message, + const char* Function, + const char* File, + int Line); + + const RENDER_DEVICE_TYPE m_DeviceType; + + static TestingEnvironment* m_pTheEnvironment; + + RefCntAutoPtr m_pDevice; + RefCntAutoPtr m_pDeviceContext; + RefCntAutoPtr m_pSwapChain; + + static std::atomic_int m_NumAllowedErrors; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/TestingSwapChainBase.h b/Tests/DiligentCoreAPITest/include/TestingSwapChainBase.h deleted file mode 100644 index 5641e77f..00000000 --- a/Tests/DiligentCoreAPITest/include/TestingSwapChainBase.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#include - -#include "ObjectBase.h" -#include "RefCntAutoPtr.hpp" -#include "RenderDevice.h" -#include "DeviceContext.h" -#include "SwapChain.h" -#include "Texture.h" -#include "TextureView.h" -#include "TestingEnvironment.h" - -namespace Diligent -{ - -namespace Testing -{ - -void CompareTestImages(const Uint8* pReferencePixels, - Uint32 RefPixelsStride, - const Uint8* pPixels, - Uint32 PixelsStride, - Uint32 Width, - Uint32 Height, - TEXTURE_FORMAT Format); - -// {41BF4655-9B33-4E6C-9300-0CB45FBFE104} -static constexpr INTERFACE_ID IID_TestingSwapChain = - {0x41bf4655, 0x9b33, 0x4e6c, {0x93, 0x0, 0xc, 0xb4, 0x5f, 0xbf, 0xe1, 0x4}}; - -class ITestingSwapChain : public IObject -{ -public: - virtual void TakeSnapshot() = 0; - - virtual ITextureView* GetCurrentBackBufferUAV() = 0; -}; - -template -class SwapChainCombinedBaseInterface : public ITestingSwapChain, public SwapChainInterface -{}; - -template -class TestingSwapChainBase : public RefCountedObject> -{ -public: - using TObjectBase = RefCountedObject>; - - TestingSwapChainBase(IReferenceCounters* pRefCounters, - IRenderDevice* pDevice, - IDeviceContext* pContext, - const SwapChainDesc& SCDesc) : - TObjectBase{pRefCounters}, - m_SwapChainDesc{SCDesc}, - m_pDevice{pDevice}, - m_pContext{pContext} - { - VERIFY_EXPR(m_SwapChainDesc.ColorBufferFormat != TEX_FORMAT_UNKNOWN); - VERIFY_EXPR(m_SwapChainDesc.Width != 0); - VERIFY_EXPR(m_SwapChainDesc.Height != 0); - - { - TextureDesc RenderTargetDesc; - RenderTargetDesc.Name = "Testing color buffer"; - RenderTargetDesc.Type = RESOURCE_DIM_TEX_2D; - RenderTargetDesc.Width = m_SwapChainDesc.Width; - RenderTargetDesc.Height = m_SwapChainDesc.Height; - RenderTargetDesc.Format = m_SwapChainDesc.ColorBufferFormat; - RenderTargetDesc.SampleCount = 1; - RenderTargetDesc.Usage = USAGE_DEFAULT; - RenderTargetDesc.BindFlags = BIND_RENDER_TARGET; - if (pDevice->GetDeviceCaps().Features.ComputeShaders) - RenderTargetDesc.BindFlags |= BIND_UNORDERED_ACCESS; - m_pDevice->CreateTexture(RenderTargetDesc, nullptr, static_cast(&m_pRenderTarget)); - VERIFY_EXPR(m_pRenderTarget != nullptr); - m_pRTV = m_pRenderTarget->GetDefaultView(TEXTURE_VIEW_RENDER_TARGET); - VERIFY_EXPR(m_pRTV != nullptr); - - if (pDevice->GetDeviceCaps().Features.ComputeShaders) - { - m_pUAV = m_pRenderTarget->GetDefaultView(TEXTURE_VIEW_UNORDERED_ACCESS); - VERIFY_EXPR(m_pUAV != nullptr); - } - - RenderTargetDesc.Name = "Staging color buffer copy"; - RenderTargetDesc.Usage = USAGE_STAGING; - RenderTargetDesc.CPUAccessFlags = CPU_ACCESS_READ; - RenderTargetDesc.BindFlags = BIND_NONE; - m_pDevice->CreateTexture(RenderTargetDesc, nullptr, static_cast(&m_pStagingTexture)); - } - - if (m_SwapChainDesc.DepthBufferFormat != TEX_FORMAT_UNKNOWN) - { - TextureDesc DepthBufferDesc; - DepthBufferDesc.Name = "Testing depth buffer"; - DepthBufferDesc.Type = RESOURCE_DIM_TEX_2D; - DepthBufferDesc.Width = m_SwapChainDesc.Width; - DepthBufferDesc.Height = m_SwapChainDesc.Height; - DepthBufferDesc.Format = m_SwapChainDesc.DepthBufferFormat; - DepthBufferDesc.SampleCount = 1; - DepthBufferDesc.Usage = USAGE_DEFAULT; - DepthBufferDesc.BindFlags = BIND_DEPTH_STENCIL; - - DepthBufferDesc.ClearValue.Format = DepthBufferDesc.Format; - DepthBufferDesc.ClearValue.DepthStencil.Depth = m_SwapChainDesc.DefaultDepthValue; - DepthBufferDesc.ClearValue.DepthStencil.Stencil = m_SwapChainDesc.DefaultStencilValue; - - m_pDevice->CreateTexture(DepthBufferDesc, nullptr, &m_pDepthBuffer); - VERIFY_EXPR(m_pDepthBuffer != nullptr); - m_pDSV = m_pDepthBuffer->GetDefaultView(TEXTURE_VIEW_DEPTH_STENCIL); - VERIFY_EXPR(m_pDSV != nullptr); - } - } - - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override - { - if (ppInterface == nullptr) - return; - - if (IID == IID_SwapChain || IID == IID_Unknown) - { - *ppInterface = static_cast(this); - (*ppInterface)->AddRef(); - } - if (IID == IID_TestingSwapChain) - { - *ppInterface = static_cast(this); - (*ppInterface)->AddRef(); - } - } - - virtual void Present(Uint32 SyncInterval = 1) override - { - m_pContext->SetRenderTargets(0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_NONE); - - CopyTextureAttribs CopyInfo // - { - m_pRenderTarget, - RESOURCE_STATE_TRANSITION_MODE_TRANSITION, - m_pStagingTexture, - RESOURCE_STATE_TRANSITION_MODE_TRANSITION // - }; - m_pContext->CopyTexture(CopyInfo); - m_pContext->WaitForIdle(); - MappedTextureSubresource MapData; - m_pContext->MapTextureSubresource(m_pStagingTexture, 0, 0, MAP_READ, MAP_FLAG_DO_NOT_WAIT, nullptr, MapData); - CompareTestImages(m_ReferenceData.data(), m_ReferenceDataPitch, reinterpret_cast(MapData.pData), MapData.Stride, - m_SwapChainDesc.Width, m_SwapChainDesc.Height, m_SwapChainDesc.ColorBufferFormat); - - m_pContext->UnmapTextureSubresource(m_pStagingTexture, 0, 0); - } - - virtual void Resize(Uint32 NewWidth, Uint32 NewHeight) override final - { - UNEXPECTED("Resizing testing swap chains is not supported"); - } - - virtual void SetFullscreenMode(const DisplayModeAttribs& DisplayMode) override final - { - UNEXPECTED("Testing swap chain can't go into full screen mode"); - } - - virtual void SetWindowedMode() override final - { - UNEXPECTED("Testing swap chain can't switch between windowed and full screen modes"); - } - - virtual ITextureView* GetCurrentBackBufferRTV() override final - { - return m_pRTV; - } - - virtual ITextureView* GetCurrentBackBufferUAV() override final - { - return m_pUAV; - } - - virtual ITextureView* GetDepthBufferDSV() override final - { - return m_pDSV; - } - - virtual const SwapChainDesc& GetDesc() const override final - { - return m_SwapChainDesc; - } - -protected: - const SwapChainDesc m_SwapChainDesc; - RefCntAutoPtr m_pDevice; - RefCntAutoPtr m_pContext; - RefCntAutoPtr m_pRenderTarget; - RefCntAutoPtr m_pDepthBuffer; - RefCntAutoPtr m_pRTV; - RefCntAutoPtr m_pUAV; - RefCntAutoPtr m_pDSV; - RefCntAutoPtr m_pStagingTexture; - - std::vector m_ReferenceData; - Uint32 m_ReferenceDataPitch = 0; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/TestingSwapChainBase.hpp b/Tests/DiligentCoreAPITest/include/TestingSwapChainBase.hpp new file mode 100644 index 00000000..edd2b30c --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/TestingSwapChainBase.hpp @@ -0,0 +1,231 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include + +#include "ObjectBase.h" +#include "RefCntAutoPtr.hpp" +#include "RenderDevice.h" +#include "DeviceContext.h" +#include "SwapChain.h" +#include "Texture.h" +#include "TextureView.h" +#include "TestingEnvironment.hpp" + +namespace Diligent +{ + +namespace Testing +{ + +void CompareTestImages(const Uint8* pReferencePixels, + Uint32 RefPixelsStride, + const Uint8* pPixels, + Uint32 PixelsStride, + Uint32 Width, + Uint32 Height, + TEXTURE_FORMAT Format); + +// {41BF4655-9B33-4E6C-9300-0CB45FBFE104} +static constexpr INTERFACE_ID IID_TestingSwapChain = + {0x41bf4655, 0x9b33, 0x4e6c, {0x93, 0x0, 0xc, 0xb4, 0x5f, 0xbf, 0xe1, 0x4}}; + +class ITestingSwapChain : public IObject +{ +public: + virtual void TakeSnapshot() = 0; + + virtual ITextureView* GetCurrentBackBufferUAV() = 0; +}; + +template +class SwapChainCombinedBaseInterface : public ITestingSwapChain, public SwapChainInterface +{}; + +template +class TestingSwapChainBase : public RefCountedObject> +{ +public: + using TObjectBase = RefCountedObject>; + + TestingSwapChainBase(IReferenceCounters* pRefCounters, + IRenderDevice* pDevice, + IDeviceContext* pContext, + const SwapChainDesc& SCDesc) : + TObjectBase{pRefCounters}, + m_SwapChainDesc{SCDesc}, + m_pDevice{pDevice}, + m_pContext{pContext} + { + VERIFY_EXPR(m_SwapChainDesc.ColorBufferFormat != TEX_FORMAT_UNKNOWN); + VERIFY_EXPR(m_SwapChainDesc.Width != 0); + VERIFY_EXPR(m_SwapChainDesc.Height != 0); + + { + TextureDesc RenderTargetDesc; + RenderTargetDesc.Name = "Testing color buffer"; + RenderTargetDesc.Type = RESOURCE_DIM_TEX_2D; + RenderTargetDesc.Width = m_SwapChainDesc.Width; + RenderTargetDesc.Height = m_SwapChainDesc.Height; + RenderTargetDesc.Format = m_SwapChainDesc.ColorBufferFormat; + RenderTargetDesc.SampleCount = 1; + RenderTargetDesc.Usage = USAGE_DEFAULT; + RenderTargetDesc.BindFlags = BIND_RENDER_TARGET; + if (pDevice->GetDeviceCaps().Features.ComputeShaders) + RenderTargetDesc.BindFlags |= BIND_UNORDERED_ACCESS; + m_pDevice->CreateTexture(RenderTargetDesc, nullptr, static_cast(&m_pRenderTarget)); + VERIFY_EXPR(m_pRenderTarget != nullptr); + m_pRTV = m_pRenderTarget->GetDefaultView(TEXTURE_VIEW_RENDER_TARGET); + VERIFY_EXPR(m_pRTV != nullptr); + + if (pDevice->GetDeviceCaps().Features.ComputeShaders) + { + m_pUAV = m_pRenderTarget->GetDefaultView(TEXTURE_VIEW_UNORDERED_ACCESS); + VERIFY_EXPR(m_pUAV != nullptr); + } + + RenderTargetDesc.Name = "Staging color buffer copy"; + RenderTargetDesc.Usage = USAGE_STAGING; + RenderTargetDesc.CPUAccessFlags = CPU_ACCESS_READ; + RenderTargetDesc.BindFlags = BIND_NONE; + m_pDevice->CreateTexture(RenderTargetDesc, nullptr, static_cast(&m_pStagingTexture)); + } + + if (m_SwapChainDesc.DepthBufferFormat != TEX_FORMAT_UNKNOWN) + { + TextureDesc DepthBufferDesc; + DepthBufferDesc.Name = "Testing depth buffer"; + DepthBufferDesc.Type = RESOURCE_DIM_TEX_2D; + DepthBufferDesc.Width = m_SwapChainDesc.Width; + DepthBufferDesc.Height = m_SwapChainDesc.Height; + DepthBufferDesc.Format = m_SwapChainDesc.DepthBufferFormat; + DepthBufferDesc.SampleCount = 1; + DepthBufferDesc.Usage = USAGE_DEFAULT; + DepthBufferDesc.BindFlags = BIND_DEPTH_STENCIL; + + DepthBufferDesc.ClearValue.Format = DepthBufferDesc.Format; + DepthBufferDesc.ClearValue.DepthStencil.Depth = m_SwapChainDesc.DefaultDepthValue; + DepthBufferDesc.ClearValue.DepthStencil.Stencil = m_SwapChainDesc.DefaultStencilValue; + + m_pDevice->CreateTexture(DepthBufferDesc, nullptr, &m_pDepthBuffer); + VERIFY_EXPR(m_pDepthBuffer != nullptr); + m_pDSV = m_pDepthBuffer->GetDefaultView(TEXTURE_VIEW_DEPTH_STENCIL); + VERIFY_EXPR(m_pDSV != nullptr); + } + } + + virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override + { + if (ppInterface == nullptr) + return; + + if (IID == IID_SwapChain || IID == IID_Unknown) + { + *ppInterface = static_cast(this); + (*ppInterface)->AddRef(); + } + if (IID == IID_TestingSwapChain) + { + *ppInterface = static_cast(this); + (*ppInterface)->AddRef(); + } + } + + virtual void Present(Uint32 SyncInterval = 1) override + { + m_pContext->SetRenderTargets(0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_NONE); + + CopyTextureAttribs CopyInfo // + { + m_pRenderTarget, + RESOURCE_STATE_TRANSITION_MODE_TRANSITION, + m_pStagingTexture, + RESOURCE_STATE_TRANSITION_MODE_TRANSITION // + }; + m_pContext->CopyTexture(CopyInfo); + m_pContext->WaitForIdle(); + MappedTextureSubresource MapData; + m_pContext->MapTextureSubresource(m_pStagingTexture, 0, 0, MAP_READ, MAP_FLAG_DO_NOT_WAIT, nullptr, MapData); + CompareTestImages(m_ReferenceData.data(), m_ReferenceDataPitch, reinterpret_cast(MapData.pData), MapData.Stride, + m_SwapChainDesc.Width, m_SwapChainDesc.Height, m_SwapChainDesc.ColorBufferFormat); + + m_pContext->UnmapTextureSubresource(m_pStagingTexture, 0, 0); + } + + virtual void Resize(Uint32 NewWidth, Uint32 NewHeight) override final + { + UNEXPECTED("Resizing testing swap chains is not supported"); + } + + virtual void SetFullscreenMode(const DisplayModeAttribs& DisplayMode) override final + { + UNEXPECTED("Testing swap chain can't go into full screen mode"); + } + + virtual void SetWindowedMode() override final + { + UNEXPECTED("Testing swap chain can't switch between windowed and full screen modes"); + } + + virtual ITextureView* GetCurrentBackBufferRTV() override final + { + return m_pRTV; + } + + virtual ITextureView* GetCurrentBackBufferUAV() override final + { + return m_pUAV; + } + + virtual ITextureView* GetDepthBufferDSV() override final + { + return m_pDSV; + } + + virtual const SwapChainDesc& GetDesc() const override final + { + return m_SwapChainDesc; + } + +protected: + const SwapChainDesc m_SwapChainDesc; + RefCntAutoPtr m_pDevice; + RefCntAutoPtr m_pContext; + RefCntAutoPtr m_pRenderTarget; + RefCntAutoPtr m_pDepthBuffer; + RefCntAutoPtr m_pRTV; + RefCntAutoPtr m_pUAV; + RefCntAutoPtr m_pDSV; + RefCntAutoPtr m_pStagingTexture; + + std::vector m_ReferenceData; + Uint32 m_ReferenceDataPitch = 0; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/Vulkan/CreateObjFromNativeResVK.h b/Tests/DiligentCoreAPITest/include/Vulkan/CreateObjFromNativeResVK.h deleted file mode 100644 index de329052..00000000 --- a/Tests/DiligentCoreAPITest/include/Vulkan/CreateObjFromNativeResVK.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#pragma once - -#include "CreateObjFromNativeResTestBase.h" - -namespace Diligent -{ - -namespace Testing -{ - -class TestCreateObjFromNativeResVK : public CreateObjFromNativeResTestBase -{ -public: - TestCreateObjFromNativeResVK(IRenderDevice* pDevice) : - CreateObjFromNativeResTestBase(pDevice) - {} - - virtual void CreateTexture(ITexture* pTexture) override final; - virtual void CreateBuffer(IBuffer* pBuffer) override final; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/Vulkan/CreateObjFromNativeResVK.hpp b/Tests/DiligentCoreAPITest/include/Vulkan/CreateObjFromNativeResVK.hpp new file mode 100644 index 00000000..9c9f8902 --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/Vulkan/CreateObjFromNativeResVK.hpp @@ -0,0 +1,51 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include "CreateObjFromNativeResTestBase.hpp" + +namespace Diligent +{ + +namespace Testing +{ + +class TestCreateObjFromNativeResVK : public CreateObjFromNativeResTestBase +{ +public: + TestCreateObjFromNativeResVK(IRenderDevice* pDevice) : + CreateObjFromNativeResTestBase(pDevice) + {} + + virtual void CreateTexture(ITexture* pTexture) override final; + virtual void CreateBuffer(IBuffer* pBuffer) override final; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/Vulkan/TestingEnvironmentVk.h b/Tests/DiligentCoreAPITest/include/Vulkan/TestingEnvironmentVk.h deleted file mode 100644 index 4a413892..00000000 --- a/Tests/DiligentCoreAPITest/include/Vulkan/TestingEnvironmentVk.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#pragma once - -#include - -#include "TestingEnvironment.h" - -#define VK_NO_PROTOTYPES -#include "vulkan/vulkan.h" - -namespace Diligent -{ - -namespace Testing -{ - -class TestingEnvironmentVk final : public TestingEnvironment -{ -public: - TestingEnvironmentVk(RENDER_DEVICE_TYPE deviceType, ADAPTER_TYPE AdapterType, const SwapChainDesc& SCDesc); - ~TestingEnvironmentVk(); - - static TestingEnvironmentVk* GetInstance() { return ValidatedCast(TestingEnvironment::GetInstance()); } - - void CreateImage2D(uint32_t Width, - uint32_t Height, - VkFormat vkFormat, - VkImageUsageFlags vkUsage, - VkImageLayout vkInitialLayout, - VkDeviceMemory& vkMemory, - VkImage& vkImage); - - void CreateBuffer(VkDeviceSize Size, - VkBufferUsageFlags vkUsage, - VkMemoryPropertyFlags MemoryFlags, - VkDeviceMemory& vkMemory, - VkBuffer& vkBuffer); - - uint32_t GetMemoryTypeIndex(uint32_t memoryTypeBitsRequirement, - VkMemoryPropertyFlags requiredProperties) const; - - VkDevice GetVkDevice() - { - return m_vkDevice; - } - - VkShaderModule CreateShaderModule(const SHADER_TYPE ShaderType, const std::string& ShaderSource); - - static VkRenderPassCreateInfo GetRenderPassCreateInfo( - Uint32 NumRenderTargets, - const VkFormat RTVFormats[], - VkFormat DSVFormat, - Uint32 SampleCount, - VkAttachmentLoadOp DepthAttachmentLoadOp, - VkAttachmentLoadOp ColorAttachmentLoadOp, - std::array& Attachments, - std::array& AttachmentReferences, - VkSubpassDescription& SubpassDesc); - - VkCommandBuffer AllocateCommandBuffer(); - - static void TransitionImageLayout(VkCommandBuffer CmdBuffer, - VkImage Image, - VkImageLayout& CurrentLayout, - VkImageLayout NewLayout, - const VkImageSubresourceRange& SubresRange, - VkPipelineStageFlags EnabledGraphicsShaderStages, - VkPipelineStageFlags SrcStages = 0, - VkPipelineStageFlags DestStages = 0); - -private: - VkDevice m_vkDevice = VK_NULL_HANDLE; - VkCommandPool m_vkCmdPool = VK_NULL_HANDLE; - - VkPhysicalDeviceMemoryProperties m_MemoryProperties = {}; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/Vulkan/TestingEnvironmentVk.hpp b/Tests/DiligentCoreAPITest/include/Vulkan/TestingEnvironmentVk.hpp new file mode 100644 index 00000000..18955139 --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/Vulkan/TestingEnvironmentVk.hpp @@ -0,0 +1,106 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include + +#include "TestingEnvironment.hpp" + +#define VK_NO_PROTOTYPES +#include "vulkan/vulkan.h" + +namespace Diligent +{ + +namespace Testing +{ + +class TestingEnvironmentVk final : public TestingEnvironment +{ +public: + TestingEnvironmentVk(RENDER_DEVICE_TYPE deviceType, ADAPTER_TYPE AdapterType, const SwapChainDesc& SCDesc); + ~TestingEnvironmentVk(); + + static TestingEnvironmentVk* GetInstance() { return ValidatedCast(TestingEnvironment::GetInstance()); } + + void CreateImage2D(uint32_t Width, + uint32_t Height, + VkFormat vkFormat, + VkImageUsageFlags vkUsage, + VkImageLayout vkInitialLayout, + VkDeviceMemory& vkMemory, + VkImage& vkImage); + + void CreateBuffer(VkDeviceSize Size, + VkBufferUsageFlags vkUsage, + VkMemoryPropertyFlags MemoryFlags, + VkDeviceMemory& vkMemory, + VkBuffer& vkBuffer); + + uint32_t GetMemoryTypeIndex(uint32_t memoryTypeBitsRequirement, + VkMemoryPropertyFlags requiredProperties) const; + + VkDevice GetVkDevice() + { + return m_vkDevice; + } + + VkShaderModule CreateShaderModule(const SHADER_TYPE ShaderType, const std::string& ShaderSource); + + static VkRenderPassCreateInfo GetRenderPassCreateInfo( + Uint32 NumRenderTargets, + const VkFormat RTVFormats[], + VkFormat DSVFormat, + Uint32 SampleCount, + VkAttachmentLoadOp DepthAttachmentLoadOp, + VkAttachmentLoadOp ColorAttachmentLoadOp, + std::array& Attachments, + std::array& AttachmentReferences, + VkSubpassDescription& SubpassDesc); + + VkCommandBuffer AllocateCommandBuffer(); + + static void TransitionImageLayout(VkCommandBuffer CmdBuffer, + VkImage Image, + VkImageLayout& CurrentLayout, + VkImageLayout NewLayout, + const VkImageSubresourceRange& SubresRange, + VkPipelineStageFlags EnabledGraphicsShaderStages, + VkPipelineStageFlags SrcStages = 0, + VkPipelineStageFlags DestStages = 0); + +private: + VkDevice m_vkDevice = VK_NULL_HANDLE; + VkCommandPool m_vkCmdPool = VK_NULL_HANDLE; + + VkPhysicalDeviceMemoryProperties m_MemoryProperties = {}; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/Vulkan/TestingSwapChainVk.h b/Tests/DiligentCoreAPITest/include/Vulkan/TestingSwapChainVk.h deleted file mode 100644 index 78245134..00000000 --- a/Tests/DiligentCoreAPITest/include/Vulkan/TestingSwapChainVk.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2019-2020 Diligent Graphics LLC - * Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#include "TestingSwapChainBase.h" - -#define VK_NO_PROTOTYPES -#include "vulkan/vulkan.h" - -namespace Diligent -{ - -namespace Testing -{ - -class TestingEnvironmentVk; - -class TestingSwapChainVk : public TestingSwapChainBase -{ -public: - using TBase = TestingSwapChainBase; - TestingSwapChainVk(IReferenceCounters* pRefCounters, - TestingEnvironmentVk* pEnv, - const SwapChainDesc& SCDesc); - ~TestingSwapChainVk(); - - virtual void TakeSnapshot() override final; - - VkImage GetVkRenderTargetImage() - { - return m_vkRenderTargetImage; - } - - VkImageView GetVkRenderTargetImageView() - { - return m_vkRenderTargetView; - } - - VkImage GetVkDepthBufferImage() - { - return m_vkDepthBufferImage; - } - - VkRenderPass GetRenderPass() - { - return m_vkRenderPass; - } - - void TransitionRenderTarget(VkCommandBuffer vkCmdBuffer, VkImageLayout Layout, VkPipelineStageFlags GraphicsShaderStages); - void TransitionDepthBuffer(VkCommandBuffer vkCmdBuffer, VkImageLayout Layout, VkPipelineStageFlags GraphicsShaderStages); - - void BeginRenderPass(VkCommandBuffer vkCmdBuffer, VkPipelineStageFlags GraphicsShaderStages); - void EndRenderPass(VkCommandBuffer vkCmdBuffer); - -private: - void CreateFramebuffer(); - - VkDevice m_vkDevice = VK_NULL_HANDLE; - - VkDeviceMemory m_vkRenderTargetMemory = VK_NULL_HANDLE; - VkImage m_vkRenderTargetImage = VK_NULL_HANDLE; - VkImageLayout m_vkRenerTargetLayout = VK_IMAGE_LAYOUT_UNDEFINED; - VkImageView m_vkRenderTargetView = VK_NULL_HANDLE; - - VkDeviceMemory m_vkDepthBufferMemory = VK_NULL_HANDLE; - VkImage m_vkDepthBufferImage = VK_NULL_HANDLE; - VkImageLayout m_vkDepthBufferLayout = VK_IMAGE_LAYOUT_UNDEFINED; - VkImageView m_vkDepthBufferView = VK_NULL_HANDLE; - - VkDeviceSize m_StagingBufferSize = 0; - VkDeviceMemory m_vkStagingBufferMemory = VK_NULL_HANDLE; - VkBuffer m_vkStagingBuffer = VK_NULL_HANDLE; - - VkRenderPass m_vkRenderPass = VK_NULL_HANDLE; - VkFramebuffer m_vkFramebuffer = VK_NULL_HANDLE; - - VkPipelineStageFlags m_ActiveGraphicsShaderStages = 0; -}; - -} // namespace Testing - -} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/include/Vulkan/TestingSwapChainVk.hpp b/Tests/DiligentCoreAPITest/include/Vulkan/TestingSwapChainVk.hpp new file mode 100644 index 00000000..a1c552b1 --- /dev/null +++ b/Tests/DiligentCoreAPITest/include/Vulkan/TestingSwapChainVk.hpp @@ -0,0 +1,105 @@ +/* + * Copyright 2019-2020 Diligent Graphics LLC + * Copyright 2015-2019 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "TestingSwapChainBase.hpp" + +#define VK_NO_PROTOTYPES +#include "vulkan/vulkan.h" + +namespace Diligent +{ + +namespace Testing +{ + +class TestingEnvironmentVk; + +class TestingSwapChainVk : public TestingSwapChainBase +{ +public: + using TBase = TestingSwapChainBase; + TestingSwapChainVk(IReferenceCounters* pRefCounters, + TestingEnvironmentVk* pEnv, + const SwapChainDesc& SCDesc); + ~TestingSwapChainVk(); + + virtual void TakeSnapshot() override final; + + VkImage GetVkRenderTargetImage() + { + return m_vkRenderTargetImage; + } + + VkImageView GetVkRenderTargetImageView() + { + return m_vkRenderTargetView; + } + + VkImage GetVkDepthBufferImage() + { + return m_vkDepthBufferImage; + } + + VkRenderPass GetRenderPass() + { + return m_vkRenderPass; + } + + void TransitionRenderTarget(VkCommandBuffer vkCmdBuffer, VkImageLayout Layout, VkPipelineStageFlags GraphicsShaderStages); + void TransitionDepthBuffer(VkCommandBuffer vkCmdBuffer, VkImageLayout Layout, VkPipelineStageFlags GraphicsShaderStages); + + void BeginRenderPass(VkCommandBuffer vkCmdBuffer, VkPipelineStageFlags GraphicsShaderStages); + void EndRenderPass(VkCommandBuffer vkCmdBuffer); + +private: + void CreateFramebuffer(); + + VkDevice m_vkDevice = VK_NULL_HANDLE; + + VkDeviceMemory m_vkRenderTargetMemory = VK_NULL_HANDLE; + VkImage m_vkRenderTargetImage = VK_NULL_HANDLE; + VkImageLayout m_vkRenerTargetLayout = VK_IMAGE_LAYOUT_UNDEFINED; + VkImageView m_vkRenderTargetView = VK_NULL_HANDLE; + + VkDeviceMemory m_vkDepthBufferMemory = VK_NULL_HANDLE; + VkImage m_vkDepthBufferImage = VK_NULL_HANDLE; + VkImageLayout m_vkDepthBufferLayout = VK_IMAGE_LAYOUT_UNDEFINED; + VkImageView m_vkDepthBufferView = VK_NULL_HANDLE; + + VkDeviceSize m_StagingBufferSize = 0; + VkDeviceMemory m_vkStagingBufferMemory = VK_NULL_HANDLE; + VkBuffer m_vkStagingBuffer = VK_NULL_HANDLE; + + VkRenderPass m_vkRenderPass = VK_NULL_HANDLE; + VkFramebuffer m_vkFramebuffer = VK_NULL_HANDLE; + + VkPipelineStageFlags m_ActiveGraphicsShaderStages = 0; +}; + +} // namespace Testing + +} // namespace Diligent diff --git a/Tests/DiligentCoreAPITest/src/BlendStateTest.cpp b/Tests/DiligentCoreAPITest/src/BlendStateTest.cpp index 1bb2b4ab..a1b08ee9 100644 --- a/Tests/DiligentCoreAPITest/src/BlendStateTest.cpp +++ b/Tests/DiligentCoreAPITest/src/BlendStateTest.cpp @@ -27,7 +27,7 @@ #include -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "GraphicsAccessories.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp b/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp index 8fe22c24..9b0997d0 100644 --- a/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp +++ b/Tests/DiligentCoreAPITest/src/BrokenShaderTest.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/BufferAccessTest.cpp b/Tests/DiligentCoreAPITest/src/BufferAccessTest.cpp index 510c00dd..379270cc 100644 --- a/Tests/DiligentCoreAPITest/src/BufferAccessTest.cpp +++ b/Tests/DiligentCoreAPITest/src/BufferAccessTest.cpp @@ -27,7 +27,7 @@ #include -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/BufferCreationTest.cpp b/Tests/DiligentCoreAPITest/src/BufferCreationTest.cpp index 3399f8b5..e7327037 100644 --- a/Tests/DiligentCoreAPITest/src/BufferCreationTest.cpp +++ b/Tests/DiligentCoreAPITest/src/BufferCreationTest.cpp @@ -26,24 +26,24 @@ */ #if D3D11_SUPPORTED -# include "D3D11/CreateObjFromNativeResD3D11.h" +# include "D3D11/CreateObjFromNativeResD3D11.hpp" #endif #if D3D12_SUPPORTED -# include "D3D12/CreateObjFromNativeResD3D12.h" +# include "D3D12/CreateObjFromNativeResD3D12.hpp" #endif #if GL_SUPPORTED || GLES_SUPPORTED -# include "GL/CreateObjFromNativeResGL.h" +# include "GL/CreateObjFromNativeResGL.hpp" #endif #if VULKAN_SUPPORTED -# include "Vulkan/CreateObjFromNativeResVK.h" +# include "Vulkan/CreateObjFromNativeResVK.hpp" #endif #include "GraphicsAccessories.hpp" -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/CInterfaceTest.cpp b/Tests/DiligentCoreAPITest/src/CInterfaceTest.cpp index d1858809..c6dc1bb7 100644 --- a/Tests/DiligentCoreAPITest/src/CInterfaceTest.cpp +++ b/Tests/DiligentCoreAPITest/src/CInterfaceTest.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/ClearRenderTargetTest.cpp b/Tests/DiligentCoreAPITest/src/ClearRenderTargetTest.cpp index adb8e17b..91cccc8d 100644 --- a/Tests/DiligentCoreAPITest/src/ClearRenderTargetTest.cpp +++ b/Tests/DiligentCoreAPITest/src/ClearRenderTargetTest.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" -#include "TestingSwapChainBase.h" +#include "TestingEnvironment.hpp" +#include "TestingSwapChainBase.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/ComputeShaderTest.cpp b/Tests/DiligentCoreAPITest/src/ComputeShaderTest.cpp index e8fd6f05..fa01e815 100644 --- a/Tests/DiligentCoreAPITest/src/ComputeShaderTest.cpp +++ b/Tests/DiligentCoreAPITest/src/ComputeShaderTest.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" -#include "TestingSwapChainBase.h" +#include "TestingEnvironment.hpp" +#include "TestingSwapChainBase.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/CopyTextureTest.cpp b/Tests/DiligentCoreAPITest/src/CopyTextureTest.cpp index 21f1db79..db1bb967 100644 --- a/Tests/DiligentCoreAPITest/src/CopyTextureTest.cpp +++ b/Tests/DiligentCoreAPITest/src/CopyTextureTest.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D11/ClearRenderTargetRefenceD3D11.cpp b/Tests/DiligentCoreAPITest/src/D3D11/ClearRenderTargetRefenceD3D11.cpp index fc679975..38a2f82f 100644 --- a/Tests/DiligentCoreAPITest/src/D3D11/ClearRenderTargetRefenceD3D11.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D11/ClearRenderTargetRefenceD3D11.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "D3D11/TestingEnvironmentD3D11.h" -#include "D3D11/TestingSwapChainD3D11.h" +#include "D3D11/TestingEnvironmentD3D11.hpp" +#include "D3D11/TestingSwapChainD3D11.hpp" namespace Diligent { diff --git a/Tests/DiligentCoreAPITest/src/D3D11/ComputeShaderRefenceD3D11.cpp b/Tests/DiligentCoreAPITest/src/D3D11/ComputeShaderRefenceD3D11.cpp index 0363f55f..10813fae 100644 --- a/Tests/DiligentCoreAPITest/src/D3D11/ComputeShaderRefenceD3D11.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D11/ComputeShaderRefenceD3D11.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "D3D11/TestingEnvironmentD3D11.h" -#include "D3D11/TestingSwapChainD3D11.h" +#include "D3D11/TestingEnvironmentD3D11.hpp" +#include "D3D11/TestingSwapChainD3D11.hpp" #include "InlineShaders/ComputeShaderTestHLSL.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D11/CreateObjFromNativeResD3D11.cpp b/Tests/DiligentCoreAPITest/src/D3D11/CreateObjFromNativeResD3D11.cpp index 3b850010..867be534 100644 --- a/Tests/DiligentCoreAPITest/src/D3D11/CreateObjFromNativeResD3D11.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D11/CreateObjFromNativeResD3D11.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "D3D11/CreateObjFromNativeResD3D11.h" +#include "D3D11/CreateObjFromNativeResD3D11.hpp" #include #include "RenderDeviceD3D11.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D11/DrawCommandReferenceD3D11.cpp b/Tests/DiligentCoreAPITest/src/D3D11/DrawCommandReferenceD3D11.cpp index ada9aa2e..98ca382b 100644 --- a/Tests/DiligentCoreAPITest/src/D3D11/DrawCommandReferenceD3D11.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D11/DrawCommandReferenceD3D11.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "D3D11/TestingEnvironmentD3D11.h" -#include "D3D11/TestingSwapChainD3D11.h" +#include "D3D11/TestingEnvironmentD3D11.hpp" +#include "D3D11/TestingSwapChainD3D11.hpp" #include "InlineShaders/DrawCommandTestHLSL.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D11/GeometryShaderRefenceD3D11.cpp b/Tests/DiligentCoreAPITest/src/D3D11/GeometryShaderRefenceD3D11.cpp index d245e985..61d09d78 100644 --- a/Tests/DiligentCoreAPITest/src/D3D11/GeometryShaderRefenceD3D11.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D11/GeometryShaderRefenceD3D11.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "D3D11/TestingEnvironmentD3D11.h" -#include "D3D11/TestingSwapChainD3D11.h" +#include "D3D11/TestingEnvironmentD3D11.hpp" +#include "D3D11/TestingSwapChainD3D11.hpp" #include "InlineShaders/GeometryShaderTestHLSL.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D11/TessellationRefenceD3D11.cpp b/Tests/DiligentCoreAPITest/src/D3D11/TessellationRefenceD3D11.cpp index 565784b7..d9ba5e21 100644 --- a/Tests/DiligentCoreAPITest/src/D3D11/TessellationRefenceD3D11.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D11/TessellationRefenceD3D11.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "D3D11/TestingEnvironmentD3D11.h" -#include "D3D11/TestingSwapChainD3D11.h" +#include "D3D11/TestingEnvironmentD3D11.hpp" +#include "D3D11/TestingSwapChainD3D11.hpp" #include "InlineShaders/TessellationTestHLSL.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D11/TestingEnvironmentD3D11.cpp b/Tests/DiligentCoreAPITest/src/D3D11/TestingEnvironmentD3D11.cpp index a509bc16..d521ed20 100644 --- a/Tests/DiligentCoreAPITest/src/D3D11/TestingEnvironmentD3D11.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D11/TestingEnvironmentD3D11.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "D3D11/TestingEnvironmentD3D11.h" +#include "D3D11/TestingEnvironmentD3D11.hpp" #include "RenderDeviceD3D11.h" #include "DeviceContextD3D11.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D11/TestingSwapChainD3D11.cpp b/Tests/DiligentCoreAPITest/src/D3D11/TestingSwapChainD3D11.cpp index e0f3f43a..52c492ea 100644 --- a/Tests/DiligentCoreAPITest/src/D3D11/TestingSwapChainD3D11.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D11/TestingSwapChainD3D11.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "../include/D3D11/TestingSwapChainD3D11.h" +#include "../include/D3D11/TestingSwapChainD3D11.hpp" #include "../include/DXGITypeConversions.hpp" #include "RenderDeviceD3D11.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D12/ClearRenderTargetRefenceD3D12.cpp b/Tests/DiligentCoreAPITest/src/D3D12/ClearRenderTargetRefenceD3D12.cpp index eb491240..a9906bbd 100644 --- a/Tests/DiligentCoreAPITest/src/D3D12/ClearRenderTargetRefenceD3D12.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D12/ClearRenderTargetRefenceD3D12.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "D3D12/TestingEnvironmentD3D12.h" -#include "D3D12/TestingSwapChainD3D12.h" +#include "D3D12/TestingEnvironmentD3D12.hpp" +#include "D3D12/TestingSwapChainD3D12.hpp" #include "DeviceContextD3D12.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D12/ComputeShaderRefenceD3D12.cpp b/Tests/DiligentCoreAPITest/src/D3D12/ComputeShaderRefenceD3D12.cpp index 97ea730b..cd79dec9 100644 --- a/Tests/DiligentCoreAPITest/src/D3D12/ComputeShaderRefenceD3D12.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D12/ComputeShaderRefenceD3D12.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "D3D12/TestingEnvironmentD3D12.h" -#include "D3D12/TestingSwapChainD3D12.h" +#include "D3D12/TestingEnvironmentD3D12.hpp" +#include "D3D12/TestingSwapChainD3D12.hpp" #include "DeviceContextD3D12.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D12/CreateObjFromNativeResD3D12.cpp b/Tests/DiligentCoreAPITest/src/D3D12/CreateObjFromNativeResD3D12.cpp index c8c3c308..c48550ae 100644 --- a/Tests/DiligentCoreAPITest/src/D3D12/CreateObjFromNativeResD3D12.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D12/CreateObjFromNativeResD3D12.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "D3D12/CreateObjFromNativeResD3D12.h" +#include "D3D12/CreateObjFromNativeResD3D12.hpp" #include #include "RenderDeviceD3D12.h" #include "TextureD3D12.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D12/D3D12DebugLayerSetNameBugWorkaround.cpp b/Tests/DiligentCoreAPITest/src/D3D12/D3D12DebugLayerSetNameBugWorkaround.cpp index f249fa72..45522964 100644 --- a/Tests/DiligentCoreAPITest/src/D3D12/D3D12DebugLayerSetNameBugWorkaround.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D12/D3D12DebugLayerSetNameBugWorkaround.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "D3D12/D3D12DebugLayerSetNameBugWorkaround.h" +#include "D3D12/D3D12DebugLayerSetNameBugWorkaround.hpp" #include "RefCntAutoPtr.hpp" diff --git a/Tests/DiligentCoreAPITest/src/D3D12/DrawCommandReferenceD3D12.cpp b/Tests/DiligentCoreAPITest/src/D3D12/DrawCommandReferenceD3D12.cpp index b930ac8f..f4655dee 100644 --- a/Tests/DiligentCoreAPITest/src/D3D12/DrawCommandReferenceD3D12.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D12/DrawCommandReferenceD3D12.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "D3D12/TestingEnvironmentD3D12.h" -#include "D3D12/TestingSwapChainD3D12.h" +#include "D3D12/TestingEnvironmentD3D12.hpp" +#include "D3D12/TestingSwapChainD3D12.hpp" #include "../include/DXGITypeConversions.hpp" #include "../include/d3dx12_win.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D12/GeometryShaderRefenceD3D12.cpp b/Tests/DiligentCoreAPITest/src/D3D12/GeometryShaderRefenceD3D12.cpp index 51ebce49..f001bcb6 100644 --- a/Tests/DiligentCoreAPITest/src/D3D12/GeometryShaderRefenceD3D12.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D12/GeometryShaderRefenceD3D12.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "D3D12/TestingEnvironmentD3D12.h" -#include "D3D12/TestingSwapChainD3D12.h" +#include "D3D12/TestingEnvironmentD3D12.hpp" +#include "D3D12/TestingSwapChainD3D12.hpp" #include "../include/DXGITypeConversions.hpp" #include "../include/d3dx12_win.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D12/TessellationRefenceD3D12.cpp b/Tests/DiligentCoreAPITest/src/D3D12/TessellationRefenceD3D12.cpp index f0551e47..5e6235d4 100644 --- a/Tests/DiligentCoreAPITest/src/D3D12/TessellationRefenceD3D12.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D12/TessellationRefenceD3D12.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "D3D12/TestingEnvironmentD3D12.h" -#include "D3D12/TestingSwapChainD3D12.h" +#include "D3D12/TestingEnvironmentD3D12.hpp" +#include "D3D12/TestingSwapChainD3D12.hpp" #include "../include/DXGITypeConversions.hpp" #include "../include/d3dx12_win.h" diff --git a/Tests/DiligentCoreAPITest/src/D3D12/TestingEnvironmentD3D12.cpp b/Tests/DiligentCoreAPITest/src/D3D12/TestingEnvironmentD3D12.cpp index 77aa6da9..6ec17a6a 100644 --- a/Tests/DiligentCoreAPITest/src/D3D12/TestingEnvironmentD3D12.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D12/TestingEnvironmentD3D12.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "D3D12/TestingEnvironmentD3D12.h" +#include "D3D12/TestingEnvironmentD3D12.hpp" #include "RenderDeviceD3D12.h" namespace Diligent diff --git a/Tests/DiligentCoreAPITest/src/D3D12/TestingSwapChainD3D12.cpp b/Tests/DiligentCoreAPITest/src/D3D12/TestingSwapChainD3D12.cpp index 43a3fc33..facb607c 100644 --- a/Tests/DiligentCoreAPITest/src/D3D12/TestingSwapChainD3D12.cpp +++ b/Tests/DiligentCoreAPITest/src/D3D12/TestingSwapChainD3D12.cpp @@ -27,8 +27,8 @@ #include -#include "D3D12/TestingEnvironmentD3D12.h" -#include "D3D12/TestingSwapChainD3D12.h" +#include "D3D12/TestingEnvironmentD3D12.hpp" +#include "D3D12/TestingSwapChainD3D12.hpp" #include "../include/DXGITypeConversions.hpp" #include "RenderDeviceD3D12.h" diff --git a/Tests/DiligentCoreAPITest/src/DepthStencilStateTest.cpp b/Tests/DiligentCoreAPITest/src/DepthStencilStateTest.cpp index 8f32a3c7..84d360be 100644 --- a/Tests/DiligentCoreAPITest/src/DepthStencilStateTest.cpp +++ b/Tests/DiligentCoreAPITest/src/DepthStencilStateTest.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" -#include "PSOTestBase.h" +#include "TestingEnvironment.hpp" +#include "PSOTestBase.hpp" #include "GraphicsAccessories.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/DrawCommandTest.cpp b/Tests/DiligentCoreAPITest/src/DrawCommandTest.cpp index 639397f3..bea6ac31 100644 --- a/Tests/DiligentCoreAPITest/src/DrawCommandTest.cpp +++ b/Tests/DiligentCoreAPITest/src/DrawCommandTest.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" -#include "TestingSwapChainBase.h" +#include "TestingEnvironment.hpp" +#include "TestingSwapChainBase.hpp" #include "BasicMath.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/GL/ClearRenderTargetRefenceGL.cpp b/Tests/DiligentCoreAPITest/src/GL/ClearRenderTargetRefenceGL.cpp index d2fb226a..feff175e 100644 --- a/Tests/DiligentCoreAPITest/src/GL/ClearRenderTargetRefenceGL.cpp +++ b/Tests/DiligentCoreAPITest/src/GL/ClearRenderTargetRefenceGL.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "GL/TestingEnvironmentGL.h" -#include "GL/TestingSwapChainGL.h" +#include "GL/TestingEnvironmentGL.hpp" +#include "GL/TestingSwapChainGL.hpp" namespace Diligent { diff --git a/Tests/DiligentCoreAPITest/src/GL/ComputeShaderRefenceGL.cpp b/Tests/DiligentCoreAPITest/src/GL/ComputeShaderRefenceGL.cpp index 0c92e006..cc95b679 100644 --- a/Tests/DiligentCoreAPITest/src/GL/ComputeShaderRefenceGL.cpp +++ b/Tests/DiligentCoreAPITest/src/GL/ComputeShaderRefenceGL.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "GL/TestingEnvironmentGL.h" -#include "GL/TestingSwapChainGL.h" +#include "GL/TestingEnvironmentGL.hpp" +#include "GL/TestingSwapChainGL.hpp" #include "InlineShaders/ComputeShaderTestGLSL.h" diff --git a/Tests/DiligentCoreAPITest/src/GL/CreateObjFromNativeResGL.cpp b/Tests/DiligentCoreAPITest/src/GL/CreateObjFromNativeResGL.cpp index 13057d01..92774d6d 100644 --- a/Tests/DiligentCoreAPITest/src/GL/CreateObjFromNativeResGL.cpp +++ b/Tests/DiligentCoreAPITest/src/GL/CreateObjFromNativeResGL.cpp @@ -88,7 +88,7 @@ #include "BufferGL.h" #include "GraphicsAccessories.hpp" -#include "GL/CreateObjFromNativeResGL.h" +#include "GL/CreateObjFromNativeResGL.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/GL/DrawCommandReferenceGL.cpp b/Tests/DiligentCoreAPITest/src/GL/DrawCommandReferenceGL.cpp index 0e8254b1..8f3cce31 100644 --- a/Tests/DiligentCoreAPITest/src/GL/DrawCommandReferenceGL.cpp +++ b/Tests/DiligentCoreAPITest/src/GL/DrawCommandReferenceGL.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "GL/TestingEnvironmentGL.h" -#include "GL/TestingSwapChainGL.h" +#include "GL/TestingEnvironmentGL.hpp" +#include "GL/TestingSwapChainGL.hpp" #include "InlineShaders/DrawCommandTestGLSL.h" diff --git a/Tests/DiligentCoreAPITest/src/GL/GeometryShaderRefenceGL.cpp b/Tests/DiligentCoreAPITest/src/GL/GeometryShaderRefenceGL.cpp index 6536719f..ba480463 100644 --- a/Tests/DiligentCoreAPITest/src/GL/GeometryShaderRefenceGL.cpp +++ b/Tests/DiligentCoreAPITest/src/GL/GeometryShaderRefenceGL.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "GL/TestingEnvironmentGL.h" -#include "GL/TestingSwapChainGL.h" +#include "GL/TestingEnvironmentGL.hpp" +#include "GL/TestingSwapChainGL.hpp" #include "InlineShaders/GeometryShaderTestGLSL.h" diff --git a/Tests/DiligentCoreAPITest/src/GL/TessellationRefenceGL.cpp b/Tests/DiligentCoreAPITest/src/GL/TessellationRefenceGL.cpp index f0e48642..8bbbd338 100644 --- a/Tests/DiligentCoreAPITest/src/GL/TessellationRefenceGL.cpp +++ b/Tests/DiligentCoreAPITest/src/GL/TessellationRefenceGL.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "GL/TestingEnvironmentGL.h" -#include "GL/TestingSwapChainGL.h" +#include "GL/TestingEnvironmentGL.hpp" +#include "GL/TestingSwapChainGL.hpp" #include "InlineShaders/TessellationTestGLSL.h" diff --git a/Tests/DiligentCoreAPITest/src/GL/TestingEnvironmentGL.cpp b/Tests/DiligentCoreAPITest/src/GL/TestingEnvironmentGL.cpp index 36592bc8..74f736aa 100644 --- a/Tests/DiligentCoreAPITest/src/GL/TestingEnvironmentGL.cpp +++ b/Tests/DiligentCoreAPITest/src/GL/TestingEnvironmentGL.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "GL/TestingEnvironmentGL.h" +#include "GL/TestingEnvironmentGL.hpp" namespace Diligent { diff --git a/Tests/DiligentCoreAPITest/src/GL/TestingSwapChainGL.cpp b/Tests/DiligentCoreAPITest/src/GL/TestingSwapChainGL.cpp index 79c91714..d6956814 100644 --- a/Tests/DiligentCoreAPITest/src/GL/TestingSwapChainGL.cpp +++ b/Tests/DiligentCoreAPITest/src/GL/TestingSwapChainGL.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "GL/TestingEnvironmentGL.h" -#include "GL/TestingSwapChainGL.h" +#include "GL/TestingEnvironmentGL.hpp" +#include "GL/TestingSwapChainGL.hpp" namespace Diligent { diff --git a/Tests/DiligentCoreAPITest/src/GenerateMipsTest.cpp b/Tests/DiligentCoreAPITest/src/GenerateMipsTest.cpp index ed64ef9e..ff1764aa 100644 --- a/Tests/DiligentCoreAPITest/src/GenerateMipsTest.cpp +++ b/Tests/DiligentCoreAPITest/src/GenerateMipsTest.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/GeometryShaderTest.cpp b/Tests/DiligentCoreAPITest/src/GeometryShaderTest.cpp index 9d7cfd11..85881d9b 100644 --- a/Tests/DiligentCoreAPITest/src/GeometryShaderTest.cpp +++ b/Tests/DiligentCoreAPITest/src/GeometryShaderTest.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" -#include "TestingSwapChainBase.h" +#include "TestingEnvironment.hpp" +#include "TestingSwapChainBase.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/HLSL2GLSLConverterTest.cpp b/Tests/DiligentCoreAPITest/src/HLSL2GLSLConverterTest.cpp index d10123c3..9d48fedf 100644 --- a/Tests/DiligentCoreAPITest/src/HLSL2GLSLConverterTest.cpp +++ b/Tests/DiligentCoreAPITest/src/HLSL2GLSLConverterTest.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "HLSL2GLSLConverter.h" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/MTResourceCreationTest.cpp b/Tests/DiligentCoreAPITest/src/MTResourceCreationTest.cpp index 3f050561..7984ec7b 100644 --- a/Tests/DiligentCoreAPITest/src/MTResourceCreationTest.cpp +++ b/Tests/DiligentCoreAPITest/src/MTResourceCreationTest.cpp @@ -29,10 +29,10 @@ #include #include -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "ThreadSignal.hpp" #if D3D12_SUPPORTED -# include "D3D12/D3D12DebugLayerSetNameBugWorkaround.h" +# include "D3D12/D3D12DebugLayerSetNameBugWorkaround.hpp" #endif #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/PSOCompatibilityTest.cpp b/Tests/DiligentCoreAPITest/src/PSOCompatibilityTest.cpp index 6ad2ab47..06c3254e 100644 --- a/Tests/DiligentCoreAPITest/src/PSOCompatibilityTest.cpp +++ b/Tests/DiligentCoreAPITest/src/PSOCompatibilityTest.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/PSOTestBase.cpp b/Tests/DiligentCoreAPITest/src/PSOTestBase.cpp index 96a71b6d..dbafc458 100644 --- a/Tests/DiligentCoreAPITest/src/PSOTestBase.cpp +++ b/Tests/DiligentCoreAPITest/src/PSOTestBase.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "PSOTestBase.h" -#include "TestingEnvironment.h" +#include "PSOTestBase.hpp" +#include "TestingEnvironment.hpp" namespace Diligent { diff --git a/Tests/DiligentCoreAPITest/src/QueryTest.cpp b/Tests/DiligentCoreAPITest/src/QueryTest.cpp index 2030d827..41c2cfeb 100644 --- a/Tests/DiligentCoreAPITest/src/QueryTest.cpp +++ b/Tests/DiligentCoreAPITest/src/QueryTest.cpp @@ -29,7 +29,7 @@ #include #include -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/RasterizerStateTest.cpp b/Tests/DiligentCoreAPITest/src/RasterizerStateTest.cpp index 86f22c95..c4897cd2 100644 --- a/Tests/DiligentCoreAPITest/src/RasterizerStateTest.cpp +++ b/Tests/DiligentCoreAPITest/src/RasterizerStateTest.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" -#include "PSOTestBase.h" +#include "TestingEnvironment.hpp" +#include "PSOTestBase.hpp" #include "GraphicsAccessories.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/SamplerCreationTest.cpp b/Tests/DiligentCoreAPITest/src/SamplerCreationTest.cpp index 69ab777f..4a21d2de 100644 --- a/Tests/DiligentCoreAPITest/src/SamplerCreationTest.cpp +++ b/Tests/DiligentCoreAPITest/src/SamplerCreationTest.cpp @@ -28,7 +28,7 @@ #include #include -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "Sampler.h" #include "GraphicsAccessories.hpp" diff --git a/Tests/DiligentCoreAPITest/src/SeparateTextureSamplerTest.cpp b/Tests/DiligentCoreAPITest/src/SeparateTextureSamplerTest.cpp index e41b8122..3bbdb1e0 100644 --- a/Tests/DiligentCoreAPITest/src/SeparateTextureSamplerTest.cpp +++ b/Tests/DiligentCoreAPITest/src/SeparateTextureSamplerTest.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/ShaderResourceArrayTest.cpp b/Tests/DiligentCoreAPITest/src/ShaderResourceArrayTest.cpp index 1af10b5d..7461f833 100644 --- a/Tests/DiligentCoreAPITest/src/ShaderResourceArrayTest.cpp +++ b/Tests/DiligentCoreAPITest/src/ShaderResourceArrayTest.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/ShaderResourceLayoutTest.cpp b/Tests/DiligentCoreAPITest/src/ShaderResourceLayoutTest.cpp index a2526714..0f8c0651 100644 --- a/Tests/DiligentCoreAPITest/src/ShaderResourceLayoutTest.cpp +++ b/Tests/DiligentCoreAPITest/src/ShaderResourceLayoutTest.cpp @@ -28,7 +28,7 @@ #include #include -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "ShaderMacroHelper.hpp" #include "GraphicsAccessories.hpp" diff --git a/Tests/DiligentCoreAPITest/src/ShaderVariableAccessTest.cpp b/Tests/DiligentCoreAPITest/src/ShaderVariableAccessTest.cpp index cffd2f9a..c5bd82db 100644 --- a/Tests/DiligentCoreAPITest/src/ShaderVariableAccessTest.cpp +++ b/Tests/DiligentCoreAPITest/src/ShaderVariableAccessTest.cpp @@ -28,7 +28,7 @@ #include "GraphicsAccessories.hpp" #include "../../../Graphics/GraphicsEngineD3DBase/interface/ShaderD3D.h" -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/TessellationTest.cpp b/Tests/DiligentCoreAPITest/src/TessellationTest.cpp index a9f4ae35..05131f86 100644 --- a/Tests/DiligentCoreAPITest/src/TessellationTest.cpp +++ b/Tests/DiligentCoreAPITest/src/TessellationTest.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" -#include "TestingSwapChainBase.h" +#include "TestingEnvironment.hpp" +#include "TestingSwapChainBase.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/TestingEnvironment.cpp b/Tests/DiligentCoreAPITest/src/TestingEnvironment.cpp index 21239c57..88bcdf5e 100644 --- a/Tests/DiligentCoreAPITest/src/TestingEnvironment.cpp +++ b/Tests/DiligentCoreAPITest/src/TestingEnvironment.cpp @@ -25,9 +25,9 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "PlatformDebug.h" -#include "TestingSwapChainBase.h" +#include "TestingSwapChainBase.hpp" #if D3D11_SUPPORTED # include "EngineFactoryD3D11.h" diff --git a/Tests/DiligentCoreAPITest/src/TestingSwapChainBase.cpp b/Tests/DiligentCoreAPITest/src/TestingSwapChainBase.cpp index ea4a4fc4..294dee1b 100644 --- a/Tests/DiligentCoreAPITest/src/TestingSwapChainBase.cpp +++ b/Tests/DiligentCoreAPITest/src/TestingSwapChainBase.cpp @@ -29,7 +29,7 @@ #include #include -#include "TestingSwapChainBase.h" +#include "TestingSwapChainBase.hpp" #include "GraphicsAccessories.hpp" #define STB_IMAGE_WRITE_IMPLEMENTATION diff --git a/Tests/DiligentCoreAPITest/src/TextureCreationTest.cpp b/Tests/DiligentCoreAPITest/src/TextureCreationTest.cpp index 150379ff..a6e4bf8d 100644 --- a/Tests/DiligentCoreAPITest/src/TextureCreationTest.cpp +++ b/Tests/DiligentCoreAPITest/src/TextureCreationTest.cpp @@ -31,22 +31,22 @@ #include "GraphicsAccessories.hpp" #if D3D11_SUPPORTED -# include "D3D11/CreateObjFromNativeResD3D11.h" +# include "D3D11/CreateObjFromNativeResD3D11.hpp" #endif #if D3D12_SUPPORTED -# include "D3D12/CreateObjFromNativeResD3D12.h" +# include "D3D12/CreateObjFromNativeResD3D12.hpp" #endif #if GL_SUPPORTED || GLES_SUPPORTED -# include "GL/CreateObjFromNativeResGL.h" +# include "GL/CreateObjFromNativeResGL.hpp" #endif #if VULKAN_SUPPORTED -# include "Vulkan/CreateObjFromNativeResVK.h" +# include "Vulkan/CreateObjFromNativeResVK.hpp" #endif -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/Vulkan/ClearRenderTargetReferenceVk.cpp b/Tests/DiligentCoreAPITest/src/Vulkan/ClearRenderTargetReferenceVk.cpp index ca16e487..cb52f3d2 100644 --- a/Tests/DiligentCoreAPITest/src/Vulkan/ClearRenderTargetReferenceVk.cpp +++ b/Tests/DiligentCoreAPITest/src/Vulkan/ClearRenderTargetReferenceVk.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "Vulkan/TestingEnvironmentVk.h" -#include "Vulkan/TestingSwapChainVk.h" +#include "Vulkan/TestingEnvironmentVk.hpp" +#include "Vulkan/TestingSwapChainVk.hpp" #include "DeviceContextVk.h" diff --git a/Tests/DiligentCoreAPITest/src/Vulkan/ComputeShaderReferenceVk.cpp b/Tests/DiligentCoreAPITest/src/Vulkan/ComputeShaderReferenceVk.cpp index 0107f385..cef83408 100644 --- a/Tests/DiligentCoreAPITest/src/Vulkan/ComputeShaderReferenceVk.cpp +++ b/Tests/DiligentCoreAPITest/src/Vulkan/ComputeShaderReferenceVk.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "Vulkan/TestingEnvironmentVk.h" -#include "Vulkan/TestingSwapChainVk.h" +#include "Vulkan/TestingEnvironmentVk.hpp" +#include "Vulkan/TestingSwapChainVk.hpp" #include "DeviceContextVk.h" diff --git a/Tests/DiligentCoreAPITest/src/Vulkan/CreateObjFromNativeResVK.cpp b/Tests/DiligentCoreAPITest/src/Vulkan/CreateObjFromNativeResVK.cpp index 238e7183..e3a8bbf2 100644 --- a/Tests/DiligentCoreAPITest/src/Vulkan/CreateObjFromNativeResVK.cpp +++ b/Tests/DiligentCoreAPITest/src/Vulkan/CreateObjFromNativeResVK.cpp @@ -35,7 +35,7 @@ #include "BufferVk.h" #include "GraphicsAccessories.hpp" -#include "Vulkan/CreateObjFromNativeResVK.h" +#include "Vulkan/CreateObjFromNativeResVK.hpp" #include "gtest/gtest.h" diff --git a/Tests/DiligentCoreAPITest/src/Vulkan/DrawCommandReferenceVk.cpp b/Tests/DiligentCoreAPITest/src/Vulkan/DrawCommandReferenceVk.cpp index fa2b1b34..1c049c00 100644 --- a/Tests/DiligentCoreAPITest/src/Vulkan/DrawCommandReferenceVk.cpp +++ b/Tests/DiligentCoreAPITest/src/Vulkan/DrawCommandReferenceVk.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "Vulkan/TestingEnvironmentVk.h" -#include "Vulkan/TestingSwapChainVk.h" +#include "Vulkan/TestingEnvironmentVk.hpp" +#include "Vulkan/TestingSwapChainVk.hpp" #include "DeviceContextVk.h" diff --git a/Tests/DiligentCoreAPITest/src/Vulkan/GeometryShaderReferenceVk.cpp b/Tests/DiligentCoreAPITest/src/Vulkan/GeometryShaderReferenceVk.cpp index 40c19da9..bd24bc55 100644 --- a/Tests/DiligentCoreAPITest/src/Vulkan/GeometryShaderReferenceVk.cpp +++ b/Tests/DiligentCoreAPITest/src/Vulkan/GeometryShaderReferenceVk.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "Vulkan/TestingEnvironmentVk.h" -#include "Vulkan/TestingSwapChainVk.h" +#include "Vulkan/TestingEnvironmentVk.hpp" +#include "Vulkan/TestingSwapChainVk.hpp" #include "DeviceContextVk.h" diff --git a/Tests/DiligentCoreAPITest/src/Vulkan/TessellationReferenceVk.cpp b/Tests/DiligentCoreAPITest/src/Vulkan/TessellationReferenceVk.cpp index d5e55afc..7b8212d5 100644 --- a/Tests/DiligentCoreAPITest/src/Vulkan/TessellationReferenceVk.cpp +++ b/Tests/DiligentCoreAPITest/src/Vulkan/TessellationReferenceVk.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "Vulkan/TestingEnvironmentVk.h" -#include "Vulkan/TestingSwapChainVk.h" +#include "Vulkan/TestingEnvironmentVk.hpp" +#include "Vulkan/TestingSwapChainVk.hpp" #include "DeviceContextVk.h" diff --git a/Tests/DiligentCoreAPITest/src/Vulkan/TestingEnvironmentVk.cpp b/Tests/DiligentCoreAPITest/src/Vulkan/TestingEnvironmentVk.cpp index 8f3b7125..dc56d65c 100644 --- a/Tests/DiligentCoreAPITest/src/Vulkan/TestingEnvironmentVk.cpp +++ b/Tests/DiligentCoreAPITest/src/Vulkan/TestingEnvironmentVk.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "Vulkan/TestingEnvironmentVk.h" +#include "Vulkan/TestingEnvironmentVk.hpp" #include "RenderDeviceVk.h" #include "DeviceContextVk.h" diff --git a/Tests/DiligentCoreAPITest/src/Vulkan/TestingSwapChainVk.cpp b/Tests/DiligentCoreAPITest/src/Vulkan/TestingSwapChainVk.cpp index 3f383161..df5d230e 100644 --- a/Tests/DiligentCoreAPITest/src/Vulkan/TestingSwapChainVk.cpp +++ b/Tests/DiligentCoreAPITest/src/Vulkan/TestingSwapChainVk.cpp @@ -25,8 +25,8 @@ * of the possibility of such damages. */ -#include "Vulkan/TestingSwapChainVk.h" -#include "Vulkan/TestingEnvironmentVk.h" +#include "Vulkan/TestingSwapChainVk.hpp" +#include "Vulkan/TestingEnvironmentVk.hpp" #include "RenderDeviceVk.h" #include "DeviceContextVk.h" diff --git a/Tests/DiligentCoreAPITest/src/Win32/TestingEnvironmentWin32.cpp b/Tests/DiligentCoreAPITest/src/Win32/TestingEnvironmentWin32.cpp index e3629b41..42209988 100644 --- a/Tests/DiligentCoreAPITest/src/Win32/TestingEnvironmentWin32.cpp +++ b/Tests/DiligentCoreAPITest/src/Win32/TestingEnvironmentWin32.cpp @@ -25,7 +25,7 @@ * of the possibility of such damages. */ -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #ifndef NOMINMAX # define NOMINMAX diff --git a/Tests/DiligentCoreAPITest/src/main.cpp b/Tests/DiligentCoreAPITest/src/main.cpp index 13aa5ab8..50e632fe 100644 --- a/Tests/DiligentCoreAPITest/src/main.cpp +++ b/Tests/DiligentCoreAPITest/src/main.cpp @@ -28,7 +28,7 @@ #include #include "gtest/gtest.h" -#include "TestingEnvironment.h" +#include "TestingEnvironment.hpp" #if PLATFORM_WIN32 # include -- cgit v1.2.3