Skip to content

Commit 730b0e9

Browse files
committed
Updated to ImGui 1.91.6 and fixed #31
1 parent 5a4b803 commit 730b0e9

File tree

111 files changed

+4066
-5336
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+4066
-5336
lines changed

ExampleGLFWOpenGL3/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ internal unsafe class BindingsContext : HexaGen.Runtime.IGLContext
124124
public BindingsContext(GLFWwindowPtr window)
125125
{
126126
this.window = window;
127-
128127
}
129128

130129
public nint Handle => (nint)window.Handle;

Generator/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//#define BackendsOnly
1+
#define BackendsOnly
22

33
namespace Generator
44
{

Generator/backends/cimgui_impl.h

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
#ifndef CIMGUI_USE_ANDROID
4141
#define CIMGUI_USE_ANDROID 1
4242
#endif
43+
#ifndef IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING
44+
#define IMGUI_IMPL_VULKAN_HAS_DYNAMIC_RENDERING 1
45+
#endif
4346

4447
#include <stdint.h>
4548
#include <string.h> // For memset
@@ -214,19 +217,46 @@ CIMGUI_API bool CImGui_ImplDX11_CreateDeviceObjects();
214217

215218
#if CIMGUI_USE_D3D12
216219
typedef struct ID3D12Device;
220+
typedef struct ID3D12CommandQueue;
217221
typedef struct ID3D12DescriptorHeap;
218222
typedef struct ID3D12GraphicsCommandList;
219-
typedef struct D3D12_CPU_DESCRIPTOR_HANDLE;
220-
typedef struct D3D12_GPU_DESCRIPTOR_HANDLE;
223+
typedef struct D3D12_CPU_DESCRIPTOR_HANDLE {
224+
size_t ptr;
225+
} D3D12_CPU_DESCRIPTOR_HANDLE;
226+
typedef struct D3D12_GPU_DESCRIPTOR_HANDLE {
227+
uint64_t ptr;
228+
} D3D12_GPU_DESCRIPTOR_HANDLE;
221229
typedef unsigned int DXGI_FORMAT;
222230

231+
struct ImGui_ImplDX12_InitInfo
232+
{
233+
ID3D12Device* Device;
234+
ID3D12CommandQueue* CommandQueue;
235+
int NumFramesInFlight;
236+
DXGI_FORMAT RTVFormat; // RenderTarget format.
237+
DXGI_FORMAT DSVFormat; // DepthStencilView format.
238+
void* UserData;
239+
240+
// Allocating SRV descriptors for textures is up to the application, so we provide callbacks.
241+
// (current version of the backend will only allocate one descriptor, future versions will need to allocate more)
242+
ID3D12DescriptorHeap* SrvDescriptorHeap;
243+
void (*SrvDescriptorAllocFn)(ImGui_ImplDX12_InitInfo* info, D3D12_CPU_DESCRIPTOR_HANDLE* out_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE* out_gpu_desc_handle);
244+
void (*SrvDescriptorFreeFn)(ImGui_ImplDX12_InitInfo* info, D3D12_CPU_DESCRIPTOR_HANDLE cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE gpu_desc_handle);
245+
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
246+
D3D12_CPU_DESCRIPTOR_HANDLE LegacySingleSrvCpuDescriptor; // To facilitate transition from single descriptor to allocator callback, you may use those.
247+
D3D12_GPU_DESCRIPTOR_HANDLE LegacySingleSrvGpuDescriptor;
248+
#endif
249+
250+
ImGui_ImplDX12_InitInfo() { memset(this, 0, sizeof(*this)); }
251+
};
252+
223253
// Follow "Getting Started" link and check examples/ folder to learn about using backends!
224254

225255
// cmd_list is the command list that the implementation will use to render imgui draw lists.
226256
// Before calling the render function, caller must prepare cmd_list by resetting it and setting the appropriate
227257
// render target and descriptor heap that contains font_srv_cpu_desc_handle/font_srv_gpu_desc_handle.
228258
// 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.
229-
CIMGUI_API bool CImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format, ID3D12DescriptorHeap* cbv_srv_heap, D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle);
259+
CIMGUI_API bool CImGui_ImplDX12_Init(ImGui_ImplDX12_InitInfo* info);
230260
CIMGUI_API void CImGui_ImplDX12_Shutdown();
231261
CIMGUI_API void CImGui_ImplDX12_NewFrame();
232262
CIMGUI_API void CImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandList* graphics_command_list);
@@ -266,6 +296,8 @@ typedef int VkResult;
266296
typedef unsigned int VkSampleCountFlagBits;
267297
typedef unsigned long long VkDeviceSize;
268298

299+
typedef enum VkStructureType;
300+
269301
// Vulkan constants
270302
#define VK_NULL_HANDLE nullptr
271303

@@ -286,6 +318,18 @@ typedef struct VkClearValue {
286318
} depthStencil; // For depth/stencil attachments
287319
} VkClearValue;
288320

321+
typedef struct VkPipelineRenderingCreateInfo {
322+
VkStructureType sType;
323+
const void* pNext;
324+
uint32_t viewMask;
325+
uint32_t colorAttachmentCount;
326+
const VkFormat* pColorAttachmentFormats;
327+
VkFormat depthAttachmentFormat;
328+
VkFormat stencilAttachmentFormat;
329+
} VkPipelineRenderingCreateInfo;
330+
331+
typedef VkPipelineRenderingCreateInfo VkPipelineRenderingCreateInfoKHR;
332+
289333
// Initialization data, for ImGui_ImplVulkan_Init()
290334
// - VkDescriptorPool should be created with VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT,
291335
// and must contain a pool size large enough to hold an ImGui VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER descriptor.

Generator/backends/generator.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"igSetCurrentContext",
4141
"igGetCurrentContext"
4242
],
43+
"IgnoredEnums": [ "VkStructureType" ],
4344
"ArrayMappings": [
4445
{
4546
"Primitive": 11,
@@ -58,6 +59,8 @@
5859
}
5960
],
6061
"TypeMappings": {
62+
"VkPipelineRenderingCreateInfoKHR": "VkPipelineRenderingCreateInfo",
63+
"VkStructureType": "uint",
6164
"ImVector_ImDrawCmd": "ImVector<ImDrawCmd>",
6265
"uint8_t": "byte",
6366
"uint16_t": "ushort",

0 commit comments

Comments
 (0)