From 6099823697ea03300a5f4c4028d81978a1e558e7 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 7 Dec 2019 16:58:01 -0800 Subject: Added buffer creation test --- UnitTests/DiligentCoreAPITest/CMakeLists.txt | 14 +- .../include/CreateObjFromNativeResD3D11.h | 42 ++++ .../include/CreateObjFromNativeResD3D12.h | 42 ++++ .../include/CreateObjFromNativeResGL.h | 42 ++++ .../include/CreateObjFromNativeResTestBase.h | 50 ++++ .../include/CreateObjFromNativeResVK.h | 43 ++++ .../DiligentCoreAPITest/src/BufferCreationTest.cpp | 253 +++++++++++++++++++++ .../src/CreateObjFromNativeResD3D11.cpp | 126 ++++++++++ .../src/CreateObjFromNativeResD3D12.cpp | 96 ++++++++ .../src/CreateObjFromNativeResGL.cpp | 158 +++++++++++++ .../src/CreateObjFromNativeResVK.cpp | 94 ++++++++ UnitTests/DiligentCoreAPITest/src/main.cpp | 16 ++ 12 files changed, 975 insertions(+), 1 deletion(-) create mode 100644 UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResD3D11.h create mode 100644 UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResD3D12.h create mode 100644 UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResGL.h create mode 100644 UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.h create mode 100644 UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResVK.h create mode 100644 UnitTests/DiligentCoreAPITest/src/BufferCreationTest.cpp create mode 100644 UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResD3D11.cpp create mode 100644 UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResD3D12.cpp create mode 100644 UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResGL.cpp create mode 100644 UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResVK.cpp diff --git a/UnitTests/DiligentCoreAPITest/CMakeLists.txt b/UnitTests/DiligentCoreAPITest/CMakeLists.txt index ef3ac2ee..cbfe3fe8 100644 --- a/UnitTests/DiligentCoreAPITest/CMakeLists.txt +++ b/UnitTests/DiligentCoreAPITest/CMakeLists.txt @@ -23,8 +23,20 @@ PRIVATE ${ENGINE_LIBRARIES} ) +if(GL_SUPPORTED OR GLES_SUPPORTED) + target_link_libraries(DiligentCoreAPITest PRIVATE Diligent-HLSL2GLSLConverterLib) +endif() + +if(GL_SUPPORTED) + target_link_libraries(DiligentCoreAPITest PRIVATE glew-static) +endif() -target_include_directories(DiligentCoreAPITest PRIVATE include) + +target_include_directories(DiligentCoreAPITest +PRIVATE + include + ../../ThirdParty/vulkan +) if(PLATFORM_WIN32) diff --git a/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResD3D11.h b/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResD3D11.h new file mode 100644 index 00000000..2dad233b --- /dev/null +++ b/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResD3D11.h @@ -0,0 +1,42 @@ +/* Copyright 2019 Diligent Graphics LLC + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * 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 +{ + +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 Diligent diff --git a/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResD3D12.h b/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResD3D12.h new file mode 100644 index 00000000..96a47004 --- /dev/null +++ b/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResD3D12.h @@ -0,0 +1,42 @@ +/* Copyright 2019 Diligent Graphics LLC + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * 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 +{ + +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 Diligent diff --git a/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResGL.h b/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResGL.h new file mode 100644 index 00000000..decfc131 --- /dev/null +++ b/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResGL.h @@ -0,0 +1,42 @@ +/* Copyright 2019 Diligent Graphics LLC + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * 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 +{ + +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 Diligent \ No newline at end of file diff --git a/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.h b/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.h new file mode 100644 index 00000000..5f9f23f8 --- /dev/null +++ b/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResTestBase.h @@ -0,0 +1,50 @@ +/* Copyright 2019 Diligent Graphics LLC + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * 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.h" + +namespace Diligent +{ + +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 Diligent diff --git a/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResVK.h b/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResVK.h new file mode 100644 index 00000000..4db3bd8e --- /dev/null +++ b/UnitTests/DiligentCoreAPITest/include/CreateObjFromNativeResVK.h @@ -0,0 +1,43 @@ +/* Copyright 2019 Diligent Graphics LLC + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * 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 +{ + + +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 Diligent diff --git a/UnitTests/DiligentCoreAPITest/src/BufferCreationTest.cpp b/UnitTests/DiligentCoreAPITest/src/BufferCreationTest.cpp new file mode 100644 index 00000000..1c5db70f --- /dev/null +++ b/UnitTests/DiligentCoreAPITest/src/BufferCreationTest.cpp @@ -0,0 +1,253 @@ +/* Copyright 2019 Diligent Graphics LLC + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * 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. + */ + +#if D3D11_SUPPORTED +# include "CreateObjFromNativeResD3D11.h" +#endif + +#if D3D12_SUPPORTED +# include "CreateObjFromNativeResD3D12.h" +#endif + +#if GL_SUPPORTED || GLES_SUPPORTED +# include "CreateObjFromNativeResGL.h" +#endif + +#if VULKAN_SUPPORTED +# include "CreateObjFromNativeResVK.h" +#endif + +#include "TestingEnvironment.h" + +#include "gtest/gtest.h" + +using namespace Diligent; + +namespace +{ + +class BufferCreationTest : public ::testing::Test +{ +protected: + static void SetUpTestSuite() + { + auto* pEnv = TestingEnvironment::GetInstance(); + auto* pDevice = pEnv->GetDevice(); + + const auto DevCaps = pDevice->GetDeviceCaps(); + switch (DevCaps.DevType) + { +#if D3D11_SUPPORTED + case DeviceType::D3D11: + pCreateObjFromNativeRes.reset(new TestCreateObjFromNativeResD3D11(pDevice)); + break; + +#endif + +#if D3D12_SUPPORTED + case DeviceType::D3D12: + pCreateObjFromNativeRes.reset(new TestCreateObjFromNativeResD3D12(pDevice)); + break; +#endif + +#if GL_SUPPORTED || GLES_SUPPORTED + case DeviceType::OpenGL: + case DeviceType::OpenGLES: + pCreateObjFromNativeRes.reset(new TestCreateObjFromNativeResGL(pDevice)); + break; +#endif + +#if VULKAN_SUPPORTED + case DeviceType::Vulkan: + pCreateObjFromNativeRes.reset(new TestCreateObjFromNativeResVK(pDevice)); + break; +#endif + + default: UNEXPECTED("Unexpected device type"); + } + } + + static void TearDownTestSuite() + { + pCreateObjFromNativeRes.reset(); + TestingEnvironment::GetInstance()->Reset(); + } + + static std::unique_ptr pCreateObjFromNativeRes; +}; + +std::unique_ptr BufferCreationTest::pCreateObjFromNativeRes; + +TEST_F(BufferCreationTest, CreateVertexBuffer) +{ + auto* pEnv = TestingEnvironment::GetInstance(); + auto* pDevice = pEnv->GetDevice(); + + BufferDesc BuffDesc; + BuffDesc.Name = "Vertex buffer"; + BuffDesc.uiSizeInBytes = 256; + BuffDesc.BindFlags = BIND_VERTEX_BUFFER; + + BufferData InitData; + InitData.DataSize = BuffDesc.uiSizeInBytes; + std::vector DummyData(InitData.DataSize); + InitData.pData = DummyData.data(); + RefCntAutoPtr pBuffer; + pDevice->CreateBuffer(BuffDesc, &InitData, &pBuffer); + ASSERT_NE(pBuffer, nullptr); + + pCreateObjFromNativeRes->CreateBuffer(pBuffer); +} + +TEST_F(BufferCreationTest, CreateIndexBuffer) +{ + auto* pEnv = TestingEnvironment::GetInstance(); + auto* pDevice = pEnv->GetDevice(); + + BufferDesc BuffDesc; + BuffDesc.Name = "Index"; + BuffDesc.uiSizeInBytes = 256; + BuffDesc.BindFlags = BIND_VERTEX_BUFFER; + + BufferData NullData; + + RefCntAutoPtr pBuffer; + pDevice->CreateBuffer(BuffDesc, &NullData, &pBuffer); + ASSERT_NE(pBuffer, nullptr); + + pCreateObjFromNativeRes->CreateBuffer(pBuffer); +} + +TEST_F(BufferCreationTest, CreateFormattedBuffer) +{ + auto* pEnv = TestingEnvironment::GetInstance(); + auto* pDevice = pEnv->GetDevice(); + + const auto& DevCaps = pDevice->GetDeviceCaps(); + if (!(DevCaps.bComputeShadersSupported && DevCaps.bIndirectRenderingSupported)) + { + GTEST_SKIP(); + } + + BufferDesc BuffDesc; + BuffDesc.Name = "Formatted buffer"; + BuffDesc.uiSizeInBytes = 256; + BuffDesc.BindFlags = BIND_UNORDERED_ACCESS | BIND_SHADER_RESOURCE; + BuffDesc.Mode = BUFFER_MODE_FORMATTED; + BuffDesc.ElementByteStride = 16; + + RefCntAutoPtr pBuffer; + pDevice->CreateBuffer(BuffDesc, nullptr, &pBuffer); + ASSERT_NE(pBuffer, nullptr); + + BufferViewDesc ViewDesc; + ViewDesc.ViewType = BUFFER_VIEW_SHADER_RESOURCE; + ViewDesc.ByteOffset = 32; + ViewDesc.Format.NumComponents = 4; + ViewDesc.Format.ValueType = VT_FLOAT32; + ViewDesc.Format.IsNormalized = false; + RefCntAutoPtr pBufferSRV; + pBuffer->CreateView(ViewDesc, &pBufferSRV); + EXPECT_NE(pBufferSRV, nullptr); + + ViewDesc.ViewType = BUFFER_VIEW_UNORDERED_ACCESS; + RefCntAutoPtr pBufferUAV; + pBuffer->CreateView(ViewDesc, &pBufferUAV); + EXPECT_NE(pBufferUAV, nullptr); + + pCreateObjFromNativeRes->CreateBuffer(pBuffer); +} + +TEST_F(BufferCreationTest, CreateStructuedBuffer) +{ + auto* pEnv = TestingEnvironment::GetInstance(); + auto* pDevice = pEnv->GetDevice(); + + const auto& DevCaps = pDevice->GetDeviceCaps(); + if (!DevCaps.bComputeShadersSupported) + { + GTEST_SKIP(); + } + + BufferDesc BuffDesc; + BuffDesc.Name = "Structured buffer"; + BuffDesc.uiSizeInBytes = 256; + BuffDesc.BindFlags = BIND_SHADER_RESOURCE | BIND_UNORDERED_ACCESS; + BuffDesc.Mode = BUFFER_MODE_STRUCTURED; + BuffDesc.ElementByteStride = 16; + RefCntAutoPtr pBuffer; + pDevice->CreateBuffer(BuffDesc, nullptr, &pBuffer); + ASSERT_NE(pBuffer, nullptr); + + pCreateObjFromNativeRes->CreateBuffer(pBuffer); +} + +TEST_F(BufferCreationTest, CreateUniformBuffer) +{ + auto* pEnv = TestingEnvironment::GetInstance(); + auto* pDevice = pEnv->GetDevice(); + + BufferDesc BuffDesc; + BuffDesc.Name = "Uniform buffer"; + BuffDesc.uiSizeInBytes = 256; + BuffDesc.BindFlags = BIND_UNIFORM_BUFFER; + RefCntAutoPtr pBuffer; + pDevice->CreateBuffer(BuffDesc, nullptr, &pBuffer); + ASSERT_NE(pBuffer, nullptr); + + pCreateObjFromNativeRes->CreateBuffer(pBuffer); +} + +TEST_F(BufferCreationTest, CreateRawBuffer) +{ + auto* pEnv = TestingEnvironment::GetInstance(); + auto* pDevice = pEnv->GetDevice(); + + BufferDesc BuffDesc; + BuffDesc.Name = "Raw buffer"; + BuffDesc.uiSizeInBytes = 256; + BuffDesc.BindFlags = BIND_VERTEX_BUFFER | BIND_INDEX_BUFFER | BIND_UNORDERED_ACCESS | BIND_SHADER_RESOURCE; + BuffDesc.Mode = BUFFER_MODE_RAW; + BuffDesc.ElementByteStride = 16; + RefCntAutoPtr pBuffer; + pDevice->CreateBuffer(BuffDesc, nullptr, &pBuffer); + ASSERT_NE(pBuffer, nullptr); + + BufferViewDesc ViewDesc; + ViewDesc.ViewType = BUFFER_VIEW_UNORDERED_ACCESS; + ViewDesc.ByteOffset = 32; + ViewDesc.Format.NumComponents = 4; + ViewDesc.Format.ValueType = VT_FLOAT32; + RefCntAutoPtr pBufferUAV; + pBuffer->CreateView(ViewDesc, &pBufferUAV); + ASSERT_NE(pBufferUAV, nullptr); + + ViewDesc.ViewType = BUFFER_VIEW_SHADER_RESOURCE; + RefCntAutoPtr pBufferSRV; + pBuffer->CreateView(ViewDesc, &pBufferSRV); + ASSERT_NE(pBufferSRV, nullptr); + + pCreateObjFromNativeRes->CreateBuffer(pBuffer); +} + +} // namespace diff --git a/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResD3D11.cpp b/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResD3D11.cpp new file mode 100644 index 00000000..5b3a1782 --- /dev/null +++ b/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResD3D11.cpp @@ -0,0 +1,126 @@ +/* Copyright 2019 Diligent Graphics LLC + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * 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 "CreateObjFromNativeResD3D11.h" + +#include +#include "RenderDeviceD3D11.h" +#include "TextureD3D11.h" +#include "BufferD3D11.h" + +#include "gtest/gtest.h" + +namespace Diligent +{ + +void TestCreateObjFromNativeResD3D11::CreateTexture(ITexture* pTexture) +{ + RefCntAutoPtr pDeviceD3D11(m_pDevice, IID_RenderDeviceD3D11); + RefCntAutoPtr pTextureD3D11(pTexture, IID_TextureD3D11); + ASSERT_NE(pDeviceD3D11, nullptr); + ASSERT_NE(pTextureD3D11, nullptr); + + const auto& SrcTexDesc = pTexture->GetDesc(); + auto* pd3d11Texture = pTextureD3D11->GetD3D11Texture(); + ASSERT_NE(pd3d11Texture, nullptr); + + RefCntAutoPtr pTextureFromNativeD3D11Handle; + if (SrcTexDesc.Type == RESOURCE_DIM_TEX_1D || + SrcTexDesc.Type == RESOURCE_DIM_TEX_1D_ARRAY) + { + pDeviceD3D11->CreateTextureFromD3DResource(static_cast(pd3d11Texture), RESOURCE_STATE_UNKNOWN, &pTextureFromNativeD3D11Handle); + } + else if (SrcTexDesc.Type == RESOURCE_DIM_TEX_2D || + SrcTexDesc.Type == RESOURCE_DIM_TEX_2D_ARRAY || + SrcTexDesc.Type == RESOURCE_DIM_TEX_CUBE || + SrcTexDesc.Type == RESOURCE_DIM_TEX_CUBE_ARRAY) + { + pDeviceD3D11->CreateTextureFromD3DResource(static_cast(pd3d11Texture), RESOURCE_STATE_UNKNOWN, &pTextureFromNativeD3D11Handle); + } + else if (SrcTexDesc.Type == RESOURCE_DIM_TEX_3D) + { + pDeviceD3D11->CreateTextureFromD3DResource(static_cast(pd3d11Texture), RESOURCE_STATE_UNKNOWN, &pTextureFromNativeD3D11Handle); + } + else + { + ADD_FAILURE(); + } + + ASSERT_NE(pTextureFromNativeD3D11Handle, nullptr); + + auto TestTexDesc = pTextureFromNativeD3D11Handle->GetDesc(); + if (SrcTexDesc.Type == RESOURCE_DIM_TEX_CUBE || SrcTexDesc.Type == RESOURCE_DIM_TEX_CUBE_ARRAY) + { + EXPECT_EQ(TestTexDesc.Type, RESOURCE_DIM_TEX_2D_ARRAY); + TestTexDesc.Type = SrcTexDesc.Type; + } + EXPECT_EQ(TestTexDesc, SrcTexDesc); + RefCntAutoPtr pTestTextureD3D11(pTextureFromNativeD3D11Handle, IID_TextureD3D11); + ASSERT_NE(pTestTextureD3D11, nullptr); + EXPECT_EQ(pTestTextureD3D11->GetD3D11Texture(), pd3d11Texture); + EXPECT_EQ(pTestTextureD3D11->GetNativeHandle(), pd3d11Texture); +} + +void TestCreateObjFromNativeResD3D11::CreateBuffer(IBuffer* pBuffer) +{ + RefCntAutoPtr pDeviceD3D11(m_pDevice, IID_RenderDeviceD3D11); + RefCntAutoPtr pBufferD3D11(pBuffer, IID_BufferD3D11); + ASSERT_NE(pDeviceD3D11, nullptr); + ASSERT_NE(pBufferD3D11, nullptr); + + auto* pd3d11Buffer = pBufferD3D11->GetD3D11Buffer(); + ASSERT_NE(pd3d11Buffer, nullptr); + + const auto& SrcBuffDesc = pBuffer->GetDesc(); + { + RefCntAutoPtr pBufferFromNativeD3D11Handle; + pDeviceD3D11->CreateBufferFromD3DResource(pd3d11Buffer, SrcBuffDesc, RESOURCE_STATE_UNKNOWN, &pBufferFromNativeD3D11Handle); + ASSERT_NE(pBufferFromNativeD3D11Handle, nullptr); + + const auto& TestBufferDesc = pBufferFromNativeD3D11Handle->GetDesc(); + EXPECT_EQ(TestBufferDesc, SrcBuffDesc); + + RefCntAutoPtr pTestBufferD3D11(pBufferFromNativeD3D11Handle, IID_BufferD3D11); + EXPECT_EQ(pTestBufferD3D11->GetD3D11Buffer(), pd3d11Buffer); + EXPECT_EQ(pTestBufferD3D11->GetNativeHandle(), pd3d11Buffer); + } + + { + BufferDesc BuffDesc; + BuffDesc.Name = "Test buffer from D3D11 buffer"; + BuffDesc.ElementByteStride = SrcBuffDesc.ElementByteStride; + RefCntAutoPtr pBufferFromNativeD3D11Handle; + pDeviceD3D11->CreateBufferFromD3DResource(pd3d11Buffer, BuffDesc, RESOURCE_STATE_UNKNOWN, &pBufferFromNativeD3D11Handle); + ASSERT_NE(pBufferFromNativeD3D11Handle, nullptr); + + const auto& TestBufferDesc = pBufferFromNativeD3D11Handle->GetDesc(); + EXPECT_EQ(TestBufferDesc, SrcBuffDesc); + + RefCntAutoPtr pTestBufferD3D11(pBufferFromNativeD3D11Handle, IID_BufferD3D11); + ASSERT_NE(pTestBufferD3D11, nullptr); + EXPECT_EQ(pTestBufferD3D11->GetD3D11Buffer(), pd3d11Buffer); + EXPECT_EQ(pTestBufferD3D11->GetNativeHandle(), pd3d11Buffer); + } +} + +} // namespace Diligent diff --git a/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResD3D12.cpp b/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResD3D12.cpp new file mode 100644 index 00000000..f5ffae02 --- /dev/null +++ b/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResD3D12.cpp @@ -0,0 +1,96 @@ +/* Copyright 2019 Diligent Graphics LLC + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * 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 "CreateObjFromNativeResD3D12.h" +#include +#include "RenderDeviceD3D12.h" +#include "TextureD3D12.h" +#include "BufferD3D12.h" + +#include "gtest/gtest.h" + +namespace Diligent +{ + +void TestCreateObjFromNativeResD3D12::CreateTexture(Diligent::ITexture* pTexture) +{ + RefCntAutoPtr pDeviceD3D12(m_pDevice, IID_RenderDeviceD3D12); + RefCntAutoPtr pTextureD3D12(pTexture, IID_TextureD3D12); + ASSERT_NE(pDeviceD3D12, nullptr); + ASSERT_NE(pTextureD3D12, nullptr); + + const auto& SrcTexDesc = pTexture->GetDesc(); + auto* pD3D12Texture = pTextureD3D12->GetD3D12Texture(); + ASSERT_NE(pD3D12Texture, nullptr); + + RefCntAutoPtr pTextureFromNativeD3D12Handle; + pDeviceD3D12->CreateTextureFromD3DResource(pD3D12Texture, RESOURCE_STATE_UNKNOWN, &pTextureFromNativeD3D12Handle); + ASSERT_NE(pTextureFromNativeD3D12Handle, nullptr); + + auto TestTexDesc = pTextureFromNativeD3D12Handle->GetDesc(); + if (SrcTexDesc.Type == RESOURCE_DIM_TEX_CUBE || SrcTexDesc.Type == RESOURCE_DIM_TEX_CUBE_ARRAY) + { + EXPECT_EQ(TestTexDesc.Type, RESOURCE_DIM_TEX_2D_ARRAY); + TestTexDesc.Type = SrcTexDesc.Type; + } + EXPECT_EQ(TestTexDesc, SrcTexDesc); + + RefCntAutoPtr pTestTextureD3D12(pTextureFromNativeD3D12Handle, IID_TextureD3D12); + ASSERT_NE(pTestTextureD3D12, nullptr); + EXPECT_EQ(pTestTextureD3D12->GetD3D12Texture(), pD3D12Texture); + EXPECT_EQ(pTestTextureD3D12->GetNativeHandle(), pD3D12Texture); +} + +void TestCreateObjFromNativeResD3D12::CreateBuffer(Diligent::IBuffer* pBuffer) +{ + RefCntAutoPtr pDeviceD3D12(m_pDevice, IID_RenderDeviceD3D12); + RefCntAutoPtr pBufferD3D12(pBuffer, IID_BufferD3D12); + ASSERT_NE(pDeviceD3D12, nullptr); + ASSERT_NE(pBufferD3D12, nullptr); + + + Uint64 DataStartByteOffset; + auto* pD3D12Buffer = pBufferD3D12->GetD3D12Buffer(DataStartByteOffset, nullptr); + ASSERT_NE(pD3D12Buffer, nullptr); + EXPECT_EQ(DataStartByteOffset, 0); + + const auto& SrcBuffDesc = pBuffer->GetDesc(); + { + RefCntAutoPtr pBufferFromNativeD3D12Handle; + pDeviceD3D12->CreateBufferFromD3DResource(pD3D12Buffer, SrcBuffDesc, RESOURCE_STATE_UNKNOWN, &pBufferFromNativeD3D12Handle); + ASSERT_NE(pBufferFromNativeD3D12Handle, nullptr); + + const auto& TestBufferDesc = pBufferFromNativeD3D12Handle->GetDesc(); + EXPECT_EQ(TestBufferDesc, SrcBuffDesc); + + RefCntAutoPtr pTestBufferD3D12(pBufferFromNativeD3D12Handle, IID_BufferD3D12); + ASSERT_NE(pTestBufferD3D12, nullptr); + + Uint64 TestBuffDataStartByteOffset; + EXPECT_EQ(pTestBufferD3D12->GetD3D12Buffer(TestBuffDataStartByteOffset, nullptr), pD3D12Buffer); + EXPECT_EQ(TestBuffDataStartByteOffset, 0); + EXPECT_EQ(pTestBufferD3D12->GetNativeHandle(), pD3D12Buffer); + } +} + +} // namespace Diligent diff --git a/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResGL.cpp b/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResGL.cpp new file mode 100644 index 00000000..48187a16 --- /dev/null +++ b/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResGL.cpp @@ -0,0 +1,158 @@ +/* Copyright 2019 Diligent Graphics LLC + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * 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. + */ + +#if PLATFORM_WIN32 + +# ifndef GLEW_STATIC +# define GLEW_STATIC // Must be defined to use static version of glew +# endif +# include "GL/glew.h" +#elif PLATFORM_LINUX + +# 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" + +// Undefine beautiful defines from GL/glx.h -> X11/Xlib.h +# ifdef Bool +# undef Bool +# endif +# ifdef True +# undef True +# endif +# ifdef False +# undef False +# endif +# ifdef Status +# undef Status +# endif +# ifdef Success +# undef Success +# endif + +#elif PLATFORM_MACOS + +# 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" + +#elif PLATFORM_ANDROID + +# include +# include + +#elif PLATFORM_IOS + +# include + +#else +# error Unsupported platform +#endif + +#include "RenderDeviceGL.h" +#include "TextureGL.h" +#include "BufferGL.h" + +#include "CreateObjFromNativeResGL.h" + +#include "gtest/gtest.h" + +namespace Diligent +{ + +void TestCreateObjFromNativeResGL::CreateTexture(Diligent::ITexture* pTexture) +{ +#if PLATFORM_WIN32 || PLATFORM_LINUX || PLATFORM_ANDROID + RefCntAutoPtr pDeviceGL(m_pDevice, IID_RenderDeviceGL); + RefCntAutoPtr pTextureGL(pTexture, IID_TextureGL); + ASSERT_NE(pDeviceGL, nullptr); + ASSERT_NE(pTextureGL, nullptr); + + const auto& SrcTexDesc = pTexture->GetDesc(); + if (SrcTexDesc.Type == RESOURCE_DIM_TEX_CUBE_ARRAY) + return; + + auto GLHandle = pTextureGL->GetGLTextureHandle(); + ASSERT_NE(GLHandle, (GLuint)0); + + auto TmpTexDesc = SrcTexDesc; + + TmpTexDesc.Width = 0; + TmpTexDesc.Height = 0; + TmpTexDesc.MipLevels = 0; + TmpTexDesc.Format = TEX_FORMAT_UNKNOWN; + + RefCntAutoPtr pAttachedTexture; + pDeviceGL->CreateTextureFromGLHandle(GLHandle, TmpTexDesc, RESOURCE_STATE_UNKNOWN, &pAttachedTexture); + ASSERT_NE(pAttachedTexture, nullptr); + + auto TestTexDesc = pAttachedTexture->GetDesc(); + if (m_pDevice->GetTextureFormatInfo(SrcTexDesc.Format).IsTypeless) + TestTexDesc.Format = SrcTexDesc.Format; + + EXPECT_EQ(TestTexDesc, SrcTexDesc); + RefCntAutoPtr pAttachedTextureGL(pAttachedTexture, IID_TextureGL); + ASSERT_NE(pAttachedTextureGL, nullptr); + EXPECT_EQ(pAttachedTextureGL->GetGLTextureHandle(), GLHandle); + EXPECT_EQ(pAttachedTextureGL->GetBindTarget(), pTextureGL->GetBindTarget()); + EXPECT_EQ(reinterpret_cast(pAttachedTextureGL->GetNativeHandle()), GLHandle); +#endif +} + +void TestCreateObjFromNativeResGL::CreateBuffer(Diligent::IBuffer* pBuffer) +{ +#if PLATFORM_WIN32 || PLATFORM_LINUX || PLATFORM_ANDROID + RefCntAutoPtr pDeviceGL(m_pDevice, IID_RenderDeviceGL); + RefCntAutoPtr pBufferGL(pBuffer, IID_BufferGL); + ASSERT_NE(pDeviceGL, nullptr); + ASSERT_NE(pBufferGL, nullptr); + + const auto& SrcBuffDesc = pBuffer->GetDesc(); + auto GLBufferHandle = pBufferGL->GetGLBufferHandle(); + ASSERT_NE(GLBufferHandle, (GLuint)0); + + RefCntAutoPtr pBufferFromNativeGLHandle; + pDeviceGL->CreateBufferFromGLHandle(GLBufferHandle, SrcBuffDesc, RESOURCE_STATE_UNKNOWN, &pBufferFromNativeGLHandle); + ASSERT_NE(pBufferFromNativeGLHandle, nullptr); + + const auto& TestBufferDesc = pBufferFromNativeGLHandle->GetDesc(); + EXPECT_EQ(TestBufferDesc, SrcBuffDesc); + + RefCntAutoPtr pTestBufferGL(pBufferFromNativeGLHandle, IID_BufferGL); + ASSERT_NE(pTestBufferGL, nullptr); + EXPECT_EQ(pTestBufferGL->GetGLBufferHandle(), GLBufferHandle); + EXPECT_EQ(reinterpret_cast(pTestBufferGL->GetNativeHandle()), GLBufferHandle); +#endif +} + +} // namespace Diligent diff --git a/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResVK.cpp b/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResVK.cpp new file mode 100644 index 00000000..8807f9b7 --- /dev/null +++ b/UnitTests/DiligentCoreAPITest/src/CreateObjFromNativeResVK.cpp @@ -0,0 +1,94 @@ +/* Copyright 2019 Diligent Graphics LLC + * + * 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 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including neVkigence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly neVkigent 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. + */ + +#if VULKAN_SUPPORTED +# include "vulkan.h" +#endif + +#include "RenderDeviceVk.h" +#include "TextureVk.h" +#include "BufferVk.h" + +#include "CreateObjFromNativeResVK.h" + +#include "gtest/gtest.h" + +namespace Diligent +{ + +void TestCreateObjFromNativeResVK::CreateTexture(Diligent::ITexture* pTexture) +{ +#if VULKAN_SUPPORTED + RefCntAutoPtr pDeviceVk(m_pDevice, IID_RenderDeviceVk); + RefCntAutoPtr pTextureVk(pTexture, IID_TextureVk); + ASSERT_NE(pDeviceVk, nullptr); + ASSERT_NE(pTextureVk, nullptr); + + const auto& SrcTexDesc = pTexture->GetDesc(); + if (SrcTexDesc.Type == RESOURCE_DIM_TEX_CUBE_ARRAY) + return; + + auto VkHandle = pTextureVk->GetVkImage(); + ASSERT_NE(VkHandle, (VkImage)VK_NULL_HANDLE); + + RefCntAutoPtr pAttachedTexture; + pDeviceVk->CreateTextureFromVulkanImage(VkHandle, SrcTexDesc, RESOURCE_STATE_UNKNOWN, &pAttachedTexture); + ASSERT_NE(pAttachedTexture, nullptr); + + const auto& TestTexDesc = pAttachedTexture->GetDesc(); + EXPECT_EQ(TestTexDesc, SrcTexDesc); + RefCntAutoPtr pAttachedTextureVk(pAttachedTexture, IID_TextureVk); + ASSERT_NE(pAttachedTextureVk, nullptr); + EXPECT_EQ(pAttachedTextureVk->GetVkImage(), VkHandle); + EXPECT_EQ(reinterpret_cast(pAttachedTextureVk->GetNativeHandle()), VkHandle); +#endif +} + +void TestCreateObjFromNativeResVK::CreateBuffer(Diligent::IBuffer* pBuffer) +{ +#if VULKAN_SUPPORTED + RefCntAutoPtr pDeviceVk(m_pDevice, IID_RenderDeviceVk); + RefCntAutoPtr pBufferVk(pBuffer, IID_BufferVk); + ASSERT_NE(pDeviceVk, nullptr); + ASSERT_NE(pBufferVk, nullptr); + + auto VkBufferHandle = pBufferVk->GetVkBuffer(); + ASSERT_NE(VkBufferHandle, (VkBuffer)VK_NULL_HANDLE); + + const auto& SrcBuffDesc = pBuffer->GetDesc(); + + RefCntAutoPtr pBufferFromNativeVkHandle; + pDeviceVk->CreateBufferFromVulkanResource(VkBufferHandle, SrcBuffDesc, RESOURCE_STATE_UNKNOWN, &pBufferFromNativeVkHandle); + ASSERT_NE(pBufferFromNativeVkHandle, nullptr); + + const auto& TestBufferDesc = pBufferFromNativeVkHandle->GetDesc(); + EXPECT_EQ(TestBufferDesc, SrcBuffDesc); + + RefCntAutoPtr pTestBufferVk(pBufferFromNativeVkHandle, IID_BufferVk); + ASSERT_NE(pTestBufferVk, nullptr); + EXPECT_EQ(pTestBufferVk->GetVkBuffer(), VkBufferHandle); + EXPECT_EQ(reinterpret_cast(pTestBufferVk->GetNativeHandle()), VkBufferHandle); +#endif +} + +} // namespace Diligent diff --git a/UnitTests/DiligentCoreAPITest/src/main.cpp b/UnitTests/DiligentCoreAPITest/src/main.cpp index 022badf6..d012300f 100644 --- a/UnitTests/DiligentCoreAPITest/src/main.cpp +++ b/UnitTests/DiligentCoreAPITest/src/main.cpp @@ -21,13 +21,23 @@ * of the possibility of such damages. */ +#include + #include "gtest/gtest.h" #include "TestingEnvironment.h" +#if PLATFORM_WIN32 +# include +#endif + using namespace Diligent; int main(int argc, char** argv) { +#if PLATFORM_WIN32 + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); +#endif + ::testing::InitGoogleTest(&argc, argv); DeviceType deviceType = DeviceType::Undefined; @@ -38,28 +48,34 @@ int main(int argc, char** argv) if (strcmp(arg, "--mode=d3d11") == 0) { deviceType = DeviceType::D3D11; + std::cout << "\n\n\n================== Testing Diligent Core API in Direct3D11 mode ==================\n\n"; } else if (strcmp(arg, "--mode=d3d11_sw") == 0) { deviceType = DeviceType::D3D11; AdapterType = ADAPTER_TYPE_SOFTWARE; + std::cout << "\n\n\n================ Testing Diligent Core API in Direct3D11-SW mode =================\n\n"; } else if (strcmp(arg, "--mode=d3d12") == 0) { deviceType = DeviceType::D3D12; + std::cout << "\n\n\n================== Testing Diligent Core API in Direct3D12 mode ==================\n\n"; } else if (strcmp(arg, "--mode=d3d12_sw") == 0) { deviceType = DeviceType::D3D12; AdapterType = ADAPTER_TYPE_SOFTWARE; + std::cout << "\n\n\n================ Testing Diligent Core API in Direct3D12-SW mode =================\n\n"; } else if (strcmp(arg, "--mode=vk") == 0) { deviceType = DeviceType::Vulkan; + std::cout << "\n\n\n==================== Testing Diligent Core API in Vulkan mode ====================\n\n"; } else if (strcmp(arg, "--mode=gl") == 0) { deviceType = DeviceType::OpenGL; + std::cout << "\n\n\n==================== Testing Diligent Core API in OpenGL mode ====================\n\n"; } } -- cgit v1.2.3