From 66e2439e45ac92c9f3a6bfa204d97d638bd5fa2d Mon Sep 17 00:00:00 2001 From: assiduous Date: Fri, 9 Jun 2023 13:08:13 -0700 Subject: [PATCH] Reworked Diligent Imgui initialization API --- Imgui/interface/ImGuiDiligentRenderer.hpp | 8 ++--- Imgui/interface/ImGuiImplAndroid.hpp | 30 ++++++++-------- Imgui/interface/ImGuiImplDiligent.hpp | 31 +++++++++++----- Imgui/interface/ImGuiImplEmscripten.hpp | 10 +++--- Imgui/interface/ImGuiImplIOS.hpp | 30 ++++++++-------- Imgui/interface/ImGuiImplLinuxX11.hpp | 16 ++++----- Imgui/interface/ImGuiImplLinuxXCB.hpp | 19 +++++----- Imgui/interface/ImGuiImplMacOS.hpp | 30 ++++++++-------- Imgui/interface/ImGuiImplTVOS.hpp | 10 +++--- Imgui/interface/ImGuiImplUWP.hpp | 30 ++++++++-------- Imgui/interface/ImGuiImplWin32.hpp | 11 +++--- Imgui/src/ImGuiDiligentRenderer.cpp | 21 +++++------ Imgui/src/ImGuiImplAndroid.cpp | 35 +++++++++--------- Imgui/src/ImGuiImplDiligent.cpp | 25 +++++++++---- Imgui/src/ImGuiImplEmscripten.cpp | 15 ++++---- Imgui/src/ImGuiImplIOS.mm | 35 +++++++++--------- Imgui/src/ImGuiImplLinuxX11.cpp | 41 +++++++++++---------- Imgui/src/ImGuiImplLinuxXCB.cpp | 44 ++++++++++++----------- Imgui/src/ImGuiImplMacOS.mm | 35 +++++++++--------- Imgui/src/ImGuiImplTVOS.mm | 35 +++++++++--------- Imgui/src/ImGuiImplUWP.cpp | 35 +++++++++--------- Imgui/src/ImGuiImplWin32.cpp | 16 ++++----- 22 files changed, 291 insertions(+), 271 deletions(-) diff --git a/Imgui/interface/ImGuiDiligentRenderer.hpp b/Imgui/interface/ImGuiDiligentRenderer.hpp index 4e4685ca..2a433b7b 100644 --- a/Imgui/interface/ImGuiDiligentRenderer.hpp +++ b/Imgui/interface/ImGuiDiligentRenderer.hpp @@ -46,18 +46,16 @@ struct IPipelineState; struct ITextureView; struct IShaderResourceBinding; struct IShaderResourceVariable; +struct ImGuiDiligentCreateInfo; enum TEXTURE_FORMAT : Uint16; enum SURFACE_TRANSFORM : Uint32; class ImGuiDiligentRenderer { public: - ImGuiDiligentRenderer(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize); + ImGuiDiligentRenderer(const ImGuiDiligentCreateInfo& CI); ~ImGuiDiligentRenderer(); + void NewFrame(Uint32 RenderSurfaceWidth, Uint32 RenderSurfaceHeight, SURFACE_TRANSFORM SurfacePreTransform); diff --git a/Imgui/interface/ImGuiImplAndroid.hpp b/Imgui/interface/ImGuiImplAndroid.hpp index b5473c46..5ab8316e 100644 --- a/Imgui/interface/ImGuiImplAndroid.hpp +++ b/Imgui/interface/ImGuiImplAndroid.hpp @@ -1,27 +1,27 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 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 + * 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 + * 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. */ @@ -38,11 +38,9 @@ namespace Diligent class ImGuiImplAndroid final : public ImGuiImplDiligent { public: - ImGuiImplAndroid(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize = ImGuiImplDiligent::DefaultInitialVBSize, - Uint32 InitialIndexBufferSize = ImGuiImplDiligent::DefaultInitialIBSize); + static std::unique_ptr Create(const ImGuiDiligentCreateInfo& CI); + + ImGuiImplAndroid(const ImGuiDiligentCreateInfo& CI); ~ImGuiImplAndroid(); // clang-format off diff --git a/Imgui/interface/ImGuiImplDiligent.hpp b/Imgui/interface/ImGuiImplDiligent.hpp index 5f12f5ce..22655b58 100644 --- a/Imgui/interface/ImGuiImplDiligent.hpp +++ b/Imgui/interface/ImGuiImplDiligent.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 Diligent Graphics LLC * Copyright 2015-2019 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,22 +35,37 @@ namespace Diligent struct IRenderDevice; struct IDeviceContext; +struct SwapChainDesc; enum TEXTURE_FORMAT : Uint16; enum SURFACE_TRANSFORM : Uint32; class ImGuiDiligentRenderer; -class ImGuiImplDiligent +struct ImGuiDiligentCreateInfo { -public: static constexpr Uint32 DefaultInitialVBSize = 1024; static constexpr Uint32 DefaultInitialIBSize = 2048; - ImGuiImplDiligent(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize = DefaultInitialVBSize, - Uint32 InitialIndexBufferSize = DefaultInitialIBSize); + IRenderDevice* pDevice = nullptr; + + TEXTURE_FORMAT BackBufferFmt = {}; + TEXTURE_FORMAT DepthBufferFmt = {}; + + Uint32 InitialVertexBufferSize = DefaultInitialVBSize; + Uint32 InitialIndexBufferSize = DefaultInitialIBSize; + + ImGuiDiligentCreateInfo() noexcept {} + ImGuiDiligentCreateInfo(IRenderDevice* _pDevice, + TEXTURE_FORMAT _BackBufferFmt, + TEXTURE_FORMAT _DepthBufferFmt) noexcept; + ImGuiDiligentCreateInfo(IRenderDevice* _pDevice, + const SwapChainDesc& _SCDesc) noexcept; +}; + +class ImGuiImplDiligent +{ +public: + ImGuiImplDiligent(const ImGuiDiligentCreateInfo& CI); virtual ~ImGuiImplDiligent(); // clang-format off diff --git a/Imgui/interface/ImGuiImplEmscripten.hpp b/Imgui/interface/ImGuiImplEmscripten.hpp index f0f43938..25a830b5 100644 --- a/Imgui/interface/ImGuiImplEmscripten.hpp +++ b/Imgui/interface/ImGuiImplEmscripten.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 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. @@ -39,11 +39,9 @@ namespace Diligent class ImGuiImplEmscripten final : public ImGuiImplDiligent { public: - ImGuiImplEmscripten(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize = ImGuiImplDiligent::DefaultInitialVBSize, - Uint32 InitialIndexBufferSize = ImGuiImplDiligent::DefaultInitialIBSize); + static std::unique_ptr Create(const ImGuiDiligentCreateInfo& CI); + + ImGuiImplEmscripten(const ImGuiDiligentCreateInfo& CI); ~ImGuiImplEmscripten(); // clang-format off diff --git a/Imgui/interface/ImGuiImplIOS.hpp b/Imgui/interface/ImGuiImplIOS.hpp index b5ef9261..d7581cbe 100644 --- a/Imgui/interface/ImGuiImplIOS.hpp +++ b/Imgui/interface/ImGuiImplIOS.hpp @@ -1,27 +1,27 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 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 + * 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 + * 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. */ @@ -36,11 +36,9 @@ namespace Diligent class ImGuiImplIOS final : public ImGuiImplDiligent { public: - ImGuiImplIOS(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize = ImGuiImplDiligent::DefaultInitialVBSize, - Uint32 InitialIndexBufferSize = ImGuiImplDiligent::DefaultInitialIBSize); + static std::unique_ptr Create(const ImGuiDiligentCreateInfo& CI); + + ImGuiImplIOS(const ImGuiDiligentCreateInfo& CI); ~ImGuiImplIOS(); // clang-format off diff --git a/Imgui/interface/ImGuiImplLinuxX11.hpp b/Imgui/interface/ImGuiImplLinuxX11.hpp index 793f3096..aa21e265 100644 --- a/Imgui/interface/ImGuiImplLinuxX11.hpp +++ b/Imgui/interface/ImGuiImplLinuxX11.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 Diligent Graphics LLC * Copyright 2015-2019 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,13 +40,13 @@ namespace Diligent class ImGuiImplLinuxX11 final : public ImGuiImplDiligent { public: - ImGuiImplLinuxX11(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 DisplayWidht, - Uint32 DisplayHeight, - Uint32 InitialVertexBufferSize = ImGuiImplDiligent::DefaultInitialVBSize, - Uint32 InitialIndexBufferSize = ImGuiImplDiligent::DefaultInitialIBSize); + static std::unique_ptr Create(const ImGuiDiligentCreateInfo& CI, + Uint32 DisplayWidth, + Uint32 DisplayHeight); + + ImGuiImplLinuxX11(const ImGuiDiligentCreateInfo& CI, + Uint32 DisplayWidth, + Uint32 DisplayHeight); ~ImGuiImplLinuxX11(); // clang-format off diff --git a/Imgui/interface/ImGuiImplLinuxXCB.hpp b/Imgui/interface/ImGuiImplLinuxXCB.hpp index d814cfa0..12e059ee 100644 --- a/Imgui/interface/ImGuiImplLinuxXCB.hpp +++ b/Imgui/interface/ImGuiImplLinuxXCB.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 Diligent Graphics LLC * Copyright 2015-2019 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -41,14 +41,15 @@ namespace Diligent class ImGuiImplLinuxXCB final : public ImGuiImplDiligent { public: - ImGuiImplLinuxXCB(xcb_connection_t* connection, - IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 DisplayWidht, - Uint32 DisplayHeight, - Uint32 InitialVertexBufferSize = ImGuiImplDiligent::DefaultInitialVBSize, - Uint32 InitialIndexBufferSize = ImGuiImplDiligent::DefaultInitialIBSize); + static std::unique_ptr Create(const ImGuiDiligentCreateInfo& CI, + xcb_connection_t* connection, + Uint32 DisplayWidth, + Uint32 DisplayHeight); + + ImGuiImplLinuxXCB(const ImGuiDiligentCreateInfo& CI, + xcb_connection_t* connection, + Uint32 DisplayWidth, + Uint32 DisplayHeight); ~ImGuiImplLinuxXCB(); // clang-format off diff --git a/Imgui/interface/ImGuiImplMacOS.hpp b/Imgui/interface/ImGuiImplMacOS.hpp index ff38e03b..7a34cd6e 100644 --- a/Imgui/interface/ImGuiImplMacOS.hpp +++ b/Imgui/interface/ImGuiImplMacOS.hpp @@ -1,27 +1,27 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 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 + * 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 + * 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. */ @@ -39,11 +39,9 @@ namespace Diligent class ImGuiImplMacOS final : public ImGuiImplDiligent { public: - ImGuiImplMacOS(IRenderDevice* _Nonnull pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize = ImGuiImplDiligent::DefaultInitialVBSize, - Uint32 InitialIndexBufferSize = ImGuiImplDiligent::DefaultInitialIBSize); + static std::unique_ptr Create(const ImGuiDiligentCreateInfo& CI); + + ImGuiImplMacOS(const ImGuiDiligentCreateInfo& CI); ~ImGuiImplMacOS(); // clang-format off diff --git a/Imgui/interface/ImGuiImplTVOS.hpp b/Imgui/interface/ImGuiImplTVOS.hpp index ba172a06..ad9b8c6f 100644 --- a/Imgui/interface/ImGuiImplTVOS.hpp +++ b/Imgui/interface/ImGuiImplTVOS.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 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. @@ -35,11 +35,9 @@ namespace Diligent class ImGuiImplTVOS final : public ImGuiImplDiligent { public: - ImGuiImplTVOS(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize = ImGuiImplDiligent::DefaultInitialVBSize, - Uint32 InitialIndexBufferSize = ImGuiImplDiligent::DefaultInitialIBSize); + static std::unique_ptr Create(const ImGuiDiligentCreateInfo& CI); + + ImGuiImplTVOS(const ImGuiDiligentCreateInfo& CI); ~ImGuiImplTVOS(); // clang-format off diff --git a/Imgui/interface/ImGuiImplUWP.hpp b/Imgui/interface/ImGuiImplUWP.hpp index 7fdcdaf1..534ca70a 100644 --- a/Imgui/interface/ImGuiImplUWP.hpp +++ b/Imgui/interface/ImGuiImplUWP.hpp @@ -1,27 +1,27 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 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 + * 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 + * 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. */ @@ -36,11 +36,9 @@ namespace Diligent class ImGuiImplUWP final : public ImGuiImplDiligent { public: - ImGuiImplUWP(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize = ImGuiImplDiligent::DefaultInitialVBSize, - Uint32 InitialIndexBufferSize = ImGuiImplDiligent::DefaultInitialIBSize); + static std::unique_ptr Create(const ImGuiDiligentCreateInfo& CI); + + ImGuiImplUWP(const ImGuiDiligentCreateInfo& CI); ~ImGuiImplUWP(); // clang-format off diff --git a/Imgui/interface/ImGuiImplWin32.hpp b/Imgui/interface/ImGuiImplWin32.hpp index e6f02d7e..f3facda5 100644 --- a/Imgui/interface/ImGuiImplWin32.hpp +++ b/Imgui/interface/ImGuiImplWin32.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 Diligent Graphics LLC * Copyright 2015-2019 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,12 +36,9 @@ namespace Diligent class ImGuiImplWin32 final : public ImGuiImplDiligent { public: - ImGuiImplWin32(HWND hWnd, - IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize = ImGuiImplDiligent::DefaultInitialVBSize, - Uint32 InitialIndexBufferSize = ImGuiImplDiligent::DefaultInitialIBSize); + static std::unique_ptr Create(const ImGuiDiligentCreateInfo& CI, HWND hWnd); + + ImGuiImplWin32(const ImGuiDiligentCreateInfo& CI, HWND hWnd); ~ImGuiImplWin32(); LRESULT Win32_ProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/Imgui/src/ImGuiDiligentRenderer.cpp b/Imgui/src/ImGuiDiligentRenderer.cpp index 7478915a..0a22e569 100644 --- a/Imgui/src/ImGuiDiligentRenderer.cpp +++ b/Imgui/src/ImGuiDiligentRenderer.cpp @@ -27,6 +27,7 @@ #include #include "ImGuiDiligentRenderer.hpp" +#include "ImGuiImplDiligent.hpp" #include "RenderDevice.h" #include "DeviceContext.h" #include "MapHelper.hpp" @@ -408,21 +409,17 @@ fragment PSOut ps_main(VSOut in [[stage_in]], } )"; -ImGuiDiligentRenderer::ImGuiDiligentRenderer(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize) : +ImGuiDiligentRenderer::ImGuiDiligentRenderer(const ImGuiDiligentCreateInfo& CI) : // clang-format off - m_pDevice {pDevice}, - m_BackBufferFmt {BackBufferFmt}, - m_DepthBufferFmt {DepthBufferFmt}, - m_VertexBufferSize{InitialVertexBufferSize}, - m_IndexBufferSize {InitialIndexBufferSize} + m_pDevice {CI.pDevice}, + m_BackBufferFmt {CI.BackBufferFmt}, + m_DepthBufferFmt {CI.DepthBufferFmt}, + m_VertexBufferSize{CI.InitialVertexBufferSize}, + m_IndexBufferSize {CI.InitialIndexBufferSize} // clang-format on { - //Check support vertex offset - m_BaseVertexSupported = pDevice->GetAdapterInfo().DrawCommand.CapFlags & DRAW_COMMAND_CAP_FLAG_BASE_VERTEX; + //Check base vertex support + m_BaseVertexSupported = m_pDevice->GetAdapterInfo().DrawCommand.CapFlags & DRAW_COMMAND_CAP_FLAG_BASE_VERTEX; // Setup back-end capabilities flags IMGUI_CHECKVERSION(); diff --git a/Imgui/src/ImGuiImplAndroid.cpp b/Imgui/src/ImGuiImplAndroid.cpp index d1dceff8..435b6a43 100644 --- a/Imgui/src/ImGuiImplAndroid.cpp +++ b/Imgui/src/ImGuiImplAndroid.cpp @@ -1,27 +1,27 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 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 + * 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 + * 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. */ @@ -34,12 +34,13 @@ namespace Diligent { -ImGuiImplAndroid::ImGuiImplAndroid(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize) : - ImGuiImplDiligent{pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize} +std::unique_ptr ImGuiImplAndroid::Create(const ImGuiDiligentCreateInfo& CI) +{ + return std::make_unique(CI); +} + +ImGuiImplAndroid::ImGuiImplAndroid(const ImGuiDiligentCreateInfo& CI) : + ImGuiImplDiligent{CI} { auto& io = ImGui::GetIO(); diff --git a/Imgui/src/ImGuiImplDiligent.cpp b/Imgui/src/ImGuiImplDiligent.cpp index aa422fb4..7ec75601 100644 --- a/Imgui/src/ImGuiImplDiligent.cpp +++ b/Imgui/src/ImGuiImplDiligent.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 Diligent Graphics LLC * Copyright 2015-2019 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -38,16 +38,27 @@ namespace Diligent { -ImGuiImplDiligent::ImGuiImplDiligent(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize) +ImGuiDiligentCreateInfo::ImGuiDiligentCreateInfo(IRenderDevice* _pDevice, + TEXTURE_FORMAT _BackBufferFmt, + TEXTURE_FORMAT _DepthBufferFmt) noexcept : + pDevice{_pDevice}, + BackBufferFmt{_BackBufferFmt}, + DepthBufferFmt{_DepthBufferFmt} +{} + +ImGuiDiligentCreateInfo::ImGuiDiligentCreateInfo(IRenderDevice* _pDevice, + const SwapChainDesc& _SCDesc) noexcept : + ImGuiDiligentCreateInfo{_pDevice, _SCDesc.ColorBufferFormat, _SCDesc.DepthBufferFormat} +{} + + +ImGuiImplDiligent::ImGuiImplDiligent(const ImGuiDiligentCreateInfo& CI) { ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); io.IniFilename = nullptr; - m_pRenderer.reset(new ImGuiDiligentRenderer(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize)); + + m_pRenderer = std::make_unique(CI); } ImGuiImplDiligent::~ImGuiImplDiligent() diff --git a/Imgui/src/ImGuiImplEmscripten.cpp b/Imgui/src/ImGuiImplEmscripten.cpp index f119686e..df5e620b 100644 --- a/Imgui/src/ImGuiImplEmscripten.cpp +++ b/Imgui/src/ImGuiImplEmscripten.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 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. @@ -34,12 +34,13 @@ namespace Diligent { -ImGuiImplEmscripten::ImGuiImplEmscripten(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize) : - ImGuiImplDiligent(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize) +std::unique_ptr ImGuiImplEmscripten::Create(const ImGuiDiligentCreateInfo& CI) +{ + return std::make_unique(CI); +} + +ImGuiImplEmscripten::ImGuiImplEmscripten(const ImGuiDiligentCreateInfo& CI) : + ImGuiImplDiligent{CI} { ImGuiIO& io = ImGui::GetIO(); io.BackendPlatformName = "Diligent-ImGuiImplEmscripten"; diff --git a/Imgui/src/ImGuiImplIOS.mm b/Imgui/src/ImGuiImplIOS.mm index fe730d9c..c8e77c37 100644 --- a/Imgui/src/ImGuiImplIOS.mm +++ b/Imgui/src/ImGuiImplIOS.mm @@ -1,23 +1,23 @@ -/* Copyright 2019 Diligent Graphics LLC - * +/* Copyright 2019-2023 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 + * 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 + * 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. */ @@ -28,12 +28,13 @@ namespace Diligent { -ImGuiImplIOS::ImGuiImplIOS(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize) : - ImGuiImplDiligent(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize) +std::unique_ptr ImGuiImplIOS::Create(const ImGuiDiligentCreateInfo& CI) +{ + return std::make_unique(CI); +} + +ImGuiImplIOS::ImGuiImplIOS(const ImGuiDiligentCreateInfo& CI) : + ImGuiImplDiligent{CI} { ImGuiIO& io = ImGui::GetIO(); //io.FontGlobalScale = 2; diff --git a/Imgui/src/ImGuiImplLinuxX11.cpp b/Imgui/src/ImGuiImplLinuxX11.cpp index 2a7c944d..cb0b2629 100644 --- a/Imgui/src/ImGuiImplLinuxX11.cpp +++ b/Imgui/src/ImGuiImplLinuxX11.cpp @@ -1,27 +1,27 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 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 + * 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 + * 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. */ @@ -52,14 +52,17 @@ namespace Diligent { -ImGuiImplLinuxX11::ImGuiImplLinuxX11(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 DisplayWidth, - Uint32 DisplayHeight, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize) : - ImGuiImplDiligent(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize) +std::unique_ptr ImGuiImplLinuxX11::Create(const ImGuiDiligentCreateInfo& CI, + Uint32 DisplayWidth, + Uint32 DisplayHeight) +{ + return std::make_unique(CI, DisplayWidth, DisplayHeight); +} + +ImGuiImplLinuxX11::ImGuiImplLinuxX11(const ImGuiDiligentCreateInfo& CI, + Uint32 DisplayWidth, + Uint32 DisplayHeight) : + ImGuiImplDiligent{CI} { auto& io = ImGui::GetIO(); diff --git a/Imgui/src/ImGuiImplLinuxXCB.cpp b/Imgui/src/ImGuiImplLinuxXCB.cpp index d35f7816..3c22933f 100644 --- a/Imgui/src/ImGuiImplLinuxXCB.cpp +++ b/Imgui/src/ImGuiImplLinuxXCB.cpp @@ -1,27 +1,27 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 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 + * 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 + * 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. */ @@ -37,15 +37,19 @@ namespace Diligent { -ImGuiImplLinuxXCB::ImGuiImplLinuxXCB(xcb_connection_t* connection, - IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 DisplayWidth, - Uint32 DisplayHeight, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize) : - ImGuiImplDiligent{pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize} +std::unique_ptr ImGuiImplLinuxXCB::Create(const ImGuiDiligentCreateInfo& CI, + xcb_connection_t* connection, + Uint32 DisplayWidth, + Uint32 DisplayHeight) +{ + return std::make_unique(CI, connection, DisplayWidth, DisplayHeight); +} + +ImGuiImplLinuxXCB::ImGuiImplLinuxXCB(const ImGuiDiligentCreateInfo& CI, + xcb_connection_t* connection, + Uint32 DisplayWidth, + Uint32 DisplayHeight) : + ImGuiImplDiligent{CI} { m_syms = xcb_key_symbols_alloc((xcb_connection_t*)connection); diff --git a/Imgui/src/ImGuiImplMacOS.mm b/Imgui/src/ImGuiImplMacOS.mm index 88f31942..0a4ec00b 100644 --- a/Imgui/src/ImGuiImplMacOS.mm +++ b/Imgui/src/ImGuiImplMacOS.mm @@ -1,23 +1,23 @@ -/* Copyright 2019 Diligent Graphics LLC - * +/* Copyright 2019-2023 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 + * 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 + * 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. */ @@ -29,12 +29,13 @@ namespace Diligent { -ImGuiImplMacOS::ImGuiImplMacOS(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize) : - ImGuiImplDiligent(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize) +std::unique_ptr ImGuiImplMacOS::Create(const ImGuiDiligentCreateInfo& CI) +{ + return std::make_unique(CI); +} + +ImGuiImplMacOS::ImGuiImplMacOS(const ImGuiDiligentCreateInfo& CI) : + ImGuiImplDiligent{CI} { ImGui_ImplOSX_Init(); ImGuiIO& io = ImGui::GetIO(); diff --git a/Imgui/src/ImGuiImplTVOS.mm b/Imgui/src/ImGuiImplTVOS.mm index 06261c27..bfd1624c 100644 --- a/Imgui/src/ImGuiImplTVOS.mm +++ b/Imgui/src/ImGuiImplTVOS.mm @@ -1,23 +1,23 @@ -/* Copyright 2019 Diligent Graphics LLC - * +/* Copyright 2019-2023 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 + * 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 + * 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. */ @@ -28,12 +28,13 @@ namespace Diligent { -ImGuiImplTVOS::ImGuiImplTVOS(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize) : - ImGuiImplDiligent(pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize) +std::unique_ptr ImGuiImplTVOS::Create(const ImGuiDiligentCreateInfo& CI) +{ + return std::make_unique(CI); +} + +ImGuiImplTVOS::ImGuiImplTVOS(const ImGuiDiligentCreateInfo& CI) : + ImGuiImplDiligent{CI} { ImGuiIO& io = ImGui::GetIO(); //io.FontGlobalScale = 2; diff --git a/Imgui/src/ImGuiImplUWP.cpp b/Imgui/src/ImGuiImplUWP.cpp index 1c7aea03..1feac56c 100644 --- a/Imgui/src/ImGuiImplUWP.cpp +++ b/Imgui/src/ImGuiImplUWP.cpp @@ -1,27 +1,27 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 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 + * 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 + * 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. */ @@ -37,12 +37,13 @@ namespace Diligent { -ImGuiImplUWP::ImGuiImplUWP(IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize) : - ImGuiImplDiligent{pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize} +std::unique_ptr ImGuiImplUWP::Create(const ImGuiDiligentCreateInfo& CI) +{ + return std::make_unique(CI); +} + +ImGuiImplUWP::ImGuiImplUWP(const ImGuiDiligentCreateInfo& CI) : + ImGuiImplDiligent{CI} { ::QueryPerformanceFrequency((LARGE_INTEGER*)&m_TicksPerSecond); ::QueryPerformanceCounter((LARGE_INTEGER*)&m_Time); diff --git a/Imgui/src/ImGuiImplWin32.cpp b/Imgui/src/ImGuiImplWin32.cpp index b72d1db3..4be4d63e 100644 --- a/Imgui/src/ImGuiImplWin32.cpp +++ b/Imgui/src/ImGuiImplWin32.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 Diligent Graphics LLC + * Copyright 2019-2023 Diligent Graphics LLC * Copyright 2015-2019 Egor Yusov * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -40,13 +40,13 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA namespace Diligent { -ImGuiImplWin32::ImGuiImplWin32(HWND hWnd, - IRenderDevice* pDevice, - TEXTURE_FORMAT BackBufferFmt, - TEXTURE_FORMAT DepthBufferFmt, - Uint32 InitialVertexBufferSize, - Uint32 InitialIndexBufferSize) : - ImGuiImplDiligent{pDevice, BackBufferFmt, DepthBufferFmt, InitialVertexBufferSize, InitialIndexBufferSize} +std::unique_ptr ImGuiImplWin32::Create(const ImGuiDiligentCreateInfo& CI, HWND hWnd) +{ + return std::make_unique(CI, hWnd); +} + +ImGuiImplWin32::ImGuiImplWin32(const ImGuiDiligentCreateInfo& CI, HWND hWnd) : + ImGuiImplDiligent{CI} { ImGui_ImplWin32_Init(hWnd); }