Skip to content

Commit

Permalink
Reworked Diligent Imgui initialization API
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Jun 9, 2023
1 parent ea06955 commit 66e2439
Show file tree
Hide file tree
Showing 22 changed files with 291 additions and 271 deletions.
8 changes: 3 additions & 5 deletions Imgui/interface/ImGuiDiligentRenderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
30 changes: 14 additions & 16 deletions Imgui/interface/ImGuiImplAndroid.hpp
Original file line number Diff line number Diff line change
@@ -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.
*/

Expand All @@ -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<ImGuiImplAndroid> Create(const ImGuiDiligentCreateInfo& CI);

ImGuiImplAndroid(const ImGuiDiligentCreateInfo& CI);
~ImGuiImplAndroid();

// clang-format off
Expand Down
31 changes: 23 additions & 8 deletions Imgui/interface/ImGuiImplDiligent.hpp
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions Imgui/interface/ImGuiImplEmscripten.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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<ImGuiImplEmscripten> Create(const ImGuiDiligentCreateInfo& CI);

ImGuiImplEmscripten(const ImGuiDiligentCreateInfo& CI);
~ImGuiImplEmscripten();

// clang-format off
Expand Down
30 changes: 14 additions & 16 deletions Imgui/interface/ImGuiImplIOS.hpp
Original file line number Diff line number Diff line change
@@ -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.
*/

Expand All @@ -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<ImGuiImplIOS> Create(const ImGuiDiligentCreateInfo& CI);

ImGuiImplIOS(const ImGuiDiligentCreateInfo& CI);
~ImGuiImplIOS();

// clang-format off
Expand Down
16 changes: 8 additions & 8 deletions Imgui/interface/ImGuiImplLinuxX11.hpp
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -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<ImGuiImplLinuxX11> Create(const ImGuiDiligentCreateInfo& CI,
Uint32 DisplayWidth,
Uint32 DisplayHeight);

ImGuiImplLinuxX11(const ImGuiDiligentCreateInfo& CI,
Uint32 DisplayWidth,
Uint32 DisplayHeight);
~ImGuiImplLinuxX11();

// clang-format off
Expand Down
19 changes: 10 additions & 9 deletions Imgui/interface/ImGuiImplLinuxXCB.hpp
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -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<ImGuiImplLinuxXCB> 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
Expand Down
30 changes: 14 additions & 16 deletions Imgui/interface/ImGuiImplMacOS.hpp
Original file line number Diff line number Diff line change
@@ -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.
*/

Expand All @@ -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<ImGuiImplMacOS> Create(const ImGuiDiligentCreateInfo& CI);

ImGuiImplMacOS(const ImGuiDiligentCreateInfo& CI);
~ImGuiImplMacOS();

// clang-format off
Expand Down
10 changes: 4 additions & 6 deletions Imgui/interface/ImGuiImplTVOS.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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<ImGuiImplTVOS> Create(const ImGuiDiligentCreateInfo& CI);

ImGuiImplTVOS(const ImGuiDiligentCreateInfo& CI);
~ImGuiImplTVOS();

// clang-format off
Expand Down
30 changes: 14 additions & 16 deletions Imgui/interface/ImGuiImplUWP.hpp
Original file line number Diff line number Diff line change
@@ -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.
*/

Expand All @@ -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<ImGuiImplUWP> Create(const ImGuiDiligentCreateInfo& CI);

ImGuiImplUWP(const ImGuiDiligentCreateInfo& CI);
~ImGuiImplUWP();

// clang-format off
Expand Down
Loading

0 comments on commit 66e2439

Please sign in to comment.