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
216219typedef struct ID3D12Device ;
220+ typedef struct ID3D12CommandQueue ;
217221typedef struct ID3D12DescriptorHeap ;
218222typedef 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 ;
221229typedef 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 );
230260CIMGUI_API void CImGui_ImplDX12_Shutdown ();
231261CIMGUI_API void CImGui_ImplDX12_NewFrame ();
232262CIMGUI_API void CImGui_ImplDX12_RenderDrawData (ImDrawData * draw_data , ID3D12GraphicsCommandList * graphics_command_list );
@@ -266,6 +296,8 @@ typedef int VkResult;
266296typedef unsigned int VkSampleCountFlagBits ;
267297typedef 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.
0 commit comments