Skip to content

Commit eaee727

Browse files
committed
Revert "Merge pull request #970 from dragonzkiller/master"
This reverts commit 4aea400, reversing changes made to ae1cd01.
1 parent 960fa82 commit eaee727

File tree

12 files changed

+533
-2113
lines changed

12 files changed

+533
-2113
lines changed

src/Utils.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ bool IsLuaCData(const sol::object& acpObject)
177177

178178
float GetAlignedItemWidth(const int64_t acItemsCount)
179179
{
180-
return (ImGui::GetContentRegionAvail().x - static_cast<float>(acItemsCount - 1) * ImGui::GetStyle().ItemSpacing.x) /
181-
static_cast<float>(acItemsCount);
180+
return (ImGui::GetWindowContentRegionWidth() - static_cast<float>(acItemsCount - 1) * ImGui::GetStyle().ItemSpacing.x) / static_cast<float>(acItemsCount);
182181
}
183182

184183
float GetCenteredOffsetForText(const char* acpText)

src/d3d12/D3D12_Functions.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ bool D3D12::ResetState(const bool acClearDownlevelBackbuffers, const bool acDest
1919
{
2020
for (auto i = 0; i < drawData.CmdListsCount; ++i)
2121
IM_DELETE(drawData.CmdLists[i]);
22+
delete[] drawData.CmdLists;
23+
drawData.CmdLists = nullptr;
2224
drawData.Clear();
2325
}
2426

@@ -495,16 +497,16 @@ void D3D12::PrepareUpdate()
495497

496498
for (auto i = 0; i < drawData.CmdListsCount; ++i)
497499
IM_DELETE(drawData.CmdLists[i]);
500+
delete[] drawData.CmdLists;
501+
drawData.CmdLists = nullptr;
498502
drawData.Clear();
499503

500504
drawData = *ImGui::GetDrawData();
501505

502-
ImVector<ImDrawList*> copiedDrawLists;
503-
copiedDrawLists.resize(drawData.CmdListsCount);
504-
506+
auto** copiedDrawLists = new ImDrawList*[drawData.CmdListsCount];
505507
for (auto i = 0; i < drawData.CmdListsCount; ++i)
506508
copiedDrawLists[i] = drawData.CmdLists[i]->CloneOutput();
507-
drawData.CmdLists = std::move(copiedDrawLists);
509+
drawData.CmdLists = copiedDrawLists;
508510

509511
std::swap(m_imguiDrawDataBuffers[1], m_imguiDrawDataBuffers[2]);
510512
}

src/imgui_impl/dx12.cpp

Lines changed: 198 additions & 591 deletions
Large diffs are not rendered by default.

src/imgui_impl/dx12.h

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,39 @@
22
// This needs to be used along with a Platform Backend (e.g. Win32)
33

44
// Implemented features:
5-
// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID!
6-
// [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
7-
// [X] Renderer: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
5+
// [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about
6+
// ImTextureID! [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
87

98
// Important: to compile on 32-bit systems, this backend requires code to be compiled with '#define ImTextureID ImU64'.
10-
// See imgui_impl_dx12.cpp file for details.
9+
// This is because we need ImTextureID to carry a 64-bit value and by default ImTextureID is defined as void*.
10+
// This define is set in the example .vcxproj file and need to be replicated in your app or by adding it to your
11+
// imconfig.h file.
1112

12-
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
13-
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
14-
// Learn about Dear ImGui:
15-
// - FAQ https://dearimgui.com/faq
16-
// - Getting Started https://dearimgui.com/getting-started
17-
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
18-
// - Introduction, links and more at the top of imgui.cpp
13+
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
14+
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
15+
// Read online: https://github.com/ocornut/imgui/tree/master/docs
1916

2017
#pragma once
21-
#include "imgui.h" // IMGUI_IMPL_API
22-
#ifndef IMGUI_DISABLE
23-
#include <dxgiformat.h> // DXGI_FORMAT
18+
#include "imgui.h" // IMGUI_IMPL_API
2419

2520
struct ID3D12Device;
2621
struct ID3D12DescriptorHeap;
2722
struct ID3D12GraphicsCommandList;
2823
struct D3D12_CPU_DESCRIPTOR_HANDLE;
2924
struct D3D12_GPU_DESCRIPTOR_HANDLE;
3025

31-
// Follow "Getting Started" link and check examples/ folder to learn about using backends!
32-
3326
// cmd_list is the command list that the implementation will use to render imgui draw lists.
3427
// Before calling the render function, caller must prepare cmd_list by resetting it and setting the appropriate
3528
// render target and descriptor heap that contains font_srv_cpu_desc_handle/font_srv_gpu_desc_handle.
36-
// font_srv_cpu_desc_handle and font_srv_gpu_desc_handle are handles to a single SRV descriptor to use for the internal font texture.
37-
IMGUI_IMPL_API bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format, ID3D12DescriptorHeap* cbv_srv_heap,
38-
D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle);
39-
IMGUI_IMPL_API void ImGui_ImplDX12_Shutdown();
40-
IMGUI_IMPL_API void ImGui_ImplDX12_NewFrame(ID3D12CommandQueue* apCommandQueue);
41-
IMGUI_IMPL_API void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandList* graphics_command_list);
29+
// font_srv_cpu_desc_handle and font_srv_gpu_desc_handle are handles to a single SRV descriptor to use for the internal
30+
// font texture.
31+
IMGUI_IMPL_API bool ImGui_ImplDX12_Init(
32+
ID3D12Device* apDevice, int aNumFramesInFlight, DXGI_FORMAT aRTVFormat, ID3D12DescriptorHeap* apSRVHeapDesc, D3D12_CPU_DESCRIPTOR_HANDLE aFontSRVDescCPU,
33+
D3D12_GPU_DESCRIPTOR_HANDLE aFontSRVDescGPU);
34+
IMGUI_IMPL_API void ImGui_ImplDX12_Shutdown();
35+
IMGUI_IMPL_API void ImGui_ImplDX12_NewFrame(ID3D12CommandQueue* apCommandQueue);
36+
IMGUI_IMPL_API void ImGui_ImplDX12_RenderDrawData(ImDrawData* apDrawData, ID3D12GraphicsCommandList* apCommandLists);
4237

4338
// Use if you want to reset your rendering device without losing Dear ImGui state.
44-
IMGUI_IMPL_API void ImGui_ImplDX12_InvalidateDeviceObjects();
45-
IMGUI_IMPL_API bool ImGui_ImplDX12_CreateDeviceObjects(ID3D12CommandQueue* apCommandQueue);
46-
47-
#endif // #ifndef IMGUI_DISABLE
39+
IMGUI_IMPL_API void ImGui_ImplDX12_InvalidateDeviceObjects();
40+
IMGUI_IMPL_API bool ImGui_ImplDX12_CreateDeviceObjects(ID3D12CommandQueue* apCommandQueue);

src/imgui_impl/imgui_user_config.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// global declaration "Enable ImGui Assertions"
44
extern bool g_ImGuiAssertionsEnabled;
55

6-
#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
7-
86
// runtime assertions which can be enabled/disabled inside CET options
97
void ImGuiAssert(wchar_t const* acpMessage, wchar_t const* acpFile, unsigned aLine);
108

0 commit comments

Comments
 (0)