Skip to content

Commit a172bab

Browse files
authored
Merge pull request #3 from ocornut/master
version 1.91.6
2 parents 262b758 + 993fa34 commit a172bab

Some content is hidden

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

53 files changed

+282
-156
lines changed

backends/imgui_impl_allegro5.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
// Implemented features:
55
// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID!
66
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy ALLEGRO_KEY_* values are obsolete since 1.87 and not supported since 1.91.5]
7-
// [X] Platform: Clipboard support (from Allegro 5.1.12)
8-
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
9-
// Issues:
7+
// [X] Platform: Clipboard support (from Allegro 5.1.12).
8+
// [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
9+
// Missing features or Issues:
1010
// [ ] Renderer: The renderer is suboptimal as we need to convert vertices manually.
1111
// [ ] Platform: Missing gamepad support.
1212

backends/imgui_impl_allegro5.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
// Implemented features:
55
// [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID!
66
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy ALLEGRO_KEY_* values are obsolete since 1.87 and not supported since 1.91.5]
7-
// [X] Platform: Clipboard support (from Allegro 5.1.12)
8-
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
9-
// Issues:
7+
// [X] Platform: Clipboard support (from Allegro 5.1.12).
8+
// [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
9+
// Missing features or Issues:
1010
// [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert vertices manually.
1111
// [ ] Platform: Missing gamepad support.
1212

backends/imgui_impl_android.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
// Implemented features:
55
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy AKEYCODE_* values are obsolete since 1.87 and not supported since 1.91.5]
66
// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen.
7-
// Missing features:
7+
// Missing features or Issues:
88
// [ ] Platform: Clipboard support.
99
// [ ] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
10-
// [ ] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: Check if this is even possible with Android.
10+
// [ ] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: Check if this is even possible with Android.
1111
// Important:
1212
// - Consider using SDL or GLFW backend on Android, which will be more full-featured than this.
1313
// - FIXME: On-screen keyboard currently needs to be enabled by the application (see examples/ and issue #3446)

backends/imgui_impl_android.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
// Implemented features:
55
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy AKEYCODE_* values are obsolete since 1.87 and not supported since 1.91.5]
66
// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen.
7-
// Missing features:
7+
// Missing features or Issues:
88
// [ ] Platform: Clipboard support.
99
// [ ] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
10-
// [ ] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: Check if this is even possible with Android.
10+
// [ ] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: Check if this is even possible with Android.
1111
// Important:
1212
// - Consider using SDL or GLFW backend on Android, which will be more full-featured than this.
1313
// - FIXME: On-screen keyboard currently needs to be enabled by the application (see examples/ and issue #3446)

backends/imgui_impl_dx10.cpp

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Implemented features:
55
// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
6-
// [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
6+
// [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).
77

88
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
99
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
@@ -341,21 +341,16 @@ static void ImGui_ImplDX10_CreateFontsTexture()
341341

342342
// Store our identifier
343343
io.Fonts->SetTexID((ImTextureID)bd->pFontTextureView);
344+
}
344345

345-
// Create texture sampler
346-
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
346+
static void ImGui_ImplDX10_DestroyFontsTexture()
347+
{
348+
ImGui_ImplDX10_Data* bd = ImGui_ImplDX10_GetBackendData();
349+
if (bd->pFontTextureView)
347350
{
348-
D3D10_SAMPLER_DESC desc;
349-
ZeroMemory(&desc, sizeof(desc));
350-
desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR;
351-
desc.AddressU = D3D10_TEXTURE_ADDRESS_CLAMP;
352-
desc.AddressV = D3D10_TEXTURE_ADDRESS_CLAMP;
353-
desc.AddressW = D3D10_TEXTURE_ADDRESS_CLAMP;
354-
desc.MipLODBias = 0.f;
355-
desc.ComparisonFunc = D3D10_COMPARISON_ALWAYS;
356-
desc.MinLOD = 0.f;
357-
desc.MaxLOD = 0.f;
358-
bd->pd3dDevice->CreateSamplerState(&desc, &bd->pFontSampler);
351+
bd->pFontTextureView->Release();
352+
bd->pFontTextureView = nullptr;
353+
ImGui::GetIO().Fonts->SetTexID(0); // We copied bd->pFontTextureView to io.Fonts->TexID so let's clear that as well.
359354
}
360355
}
361356

@@ -508,6 +503,22 @@ bool ImGui_ImplDX10_CreateDeviceObjects()
508503
bd->pd3dDevice->CreateDepthStencilState(&desc, &bd->pDepthStencilState);
509504
}
510505

506+
// Create texture sampler
507+
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
508+
{
509+
D3D10_SAMPLER_DESC desc;
510+
ZeroMemory(&desc, sizeof(desc));
511+
desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR;
512+
desc.AddressU = D3D10_TEXTURE_ADDRESS_CLAMP;
513+
desc.AddressV = D3D10_TEXTURE_ADDRESS_CLAMP;
514+
desc.AddressW = D3D10_TEXTURE_ADDRESS_CLAMP;
515+
desc.MipLODBias = 0.f;
516+
desc.ComparisonFunc = D3D10_COMPARISON_ALWAYS;
517+
desc.MinLOD = 0.f;
518+
desc.MaxLOD = 0.f;
519+
bd->pd3dDevice->CreateSamplerState(&desc, &bd->pFontSampler);
520+
}
521+
511522
ImGui_ImplDX10_CreateFontsTexture();
512523

513524
return true;
@@ -519,8 +530,9 @@ void ImGui_ImplDX10_InvalidateDeviceObjects()
519530
if (!bd->pd3dDevice)
520531
return;
521532

533+
ImGui_ImplDX10_DestroyFontsTexture();
534+
522535
if (bd->pFontSampler) { bd->pFontSampler->Release(); bd->pFontSampler = nullptr; }
523-
if (bd->pFontTextureView) { bd->pFontTextureView->Release(); bd->pFontTextureView = nullptr; ImGui::GetIO().Fonts->SetTexID(0); } // We copied bd->pFontTextureView to io.Fonts->TexID so let's clear that as well.
524536
if (bd->pIB) { bd->pIB->Release(); bd->pIB = nullptr; }
525537
if (bd->pVB) { bd->pVB->Release(); bd->pVB = nullptr; }
526538
if (bd->pBlendState) { bd->pBlendState->Release(); bd->pBlendState = nullptr; }
@@ -582,7 +594,7 @@ void ImGui_ImplDX10_NewFrame()
582594
ImGui_ImplDX10_Data* bd = ImGui_ImplDX10_GetBackendData();
583595
IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplDX10_Init()?");
584596

585-
if (!bd->pFontSampler)
597+
if (!bd->pVertexShader)
586598
ImGui_ImplDX10_CreateDeviceObjects();
587599
}
588600

backends/imgui_impl_dx10.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Implemented features:
55
// [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
6-
// [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
6+
// [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).
77

88
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
99
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.

backends/imgui_impl_dx11.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Implemented features:
55
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
6-
// [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
6+
// [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).
77
// [X] Renderer: Expose selected render state for draw callbacks to use. Access in '(ImGui_ImplXXXX_RenderState*)GetPlatformIO().Renderer_RenderState'.
88

99
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
@@ -298,7 +298,7 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
298298
global_idx_offset += draw_list->IdxBuffer.Size;
299299
global_vtx_offset += draw_list->VtxBuffer.Size;
300300
}
301-
platform_io.Renderer_RenderState = NULL;
301+
platform_io.Renderer_RenderState = nullptr;
302302

303303
// Restore modified DX state
304304
device->RSSetScissorRects(old.ScissorRectsCount, old.ScissorRects);

backends/imgui_impl_dx11.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Implemented features:
55
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
6-
// [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
6+
// [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).
77
// [X] Renderer: Expose selected render state for draw callbacks to use. Access in '(ImGui_ImplXXXX_RenderState*)GetPlatformIO().Renderer_RenderState'.
88

99
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.

backends/imgui_impl_dx12.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Implemented features:
55
// [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.
6+
// [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).
77
// [X] Renderer: Expose selected render state for draw callbacks to use. Access in '(ImGui_ImplXXXX_RenderState*)GetPlatformIO().Renderer_RenderState'.
88

99
// The aim of imgui_impl_dx12.h/.cpp is to be usable in your engine without any modification.
@@ -19,6 +19,7 @@
1919

2020
// CHANGELOG
2121
// (minor and older changes stripped away, please see git history for details)
22+
// 2024-12-09: DirectX12: Let user specifies the DepthStencilView format by setting ImGui_ImplDX12_InitInfo::DSVFormat.
2223
// 2024-11-15: DirectX12: *BREAKING CHANGE* Changed ImGui_ImplDX12_Init() signature to take a ImGui_ImplDX12_InitInfo struct. Legacy ImGui_ImplDX12_Init() signature is still supported (will obsolete).
2324
// 2024-11-15: DirectX12: *BREAKING CHANGE* User is now required to pass function pointers to allocate/free SRV Descriptors. We provide convenience legacy fields to pass a single descriptor, matching the old API, but upcoming features will want multiple.
2425
// 2024-10-23: DirectX12: Unmap() call specify written range. The range is informational and may be used by debug tools.
@@ -72,6 +73,7 @@ struct ImGui_ImplDX12_Data
7273
ID3D12RootSignature* pRootSignature;
7374
ID3D12PipelineState* pPipelineState;
7475
DXGI_FORMAT RTVFormat;
76+
DXGI_FORMAT DSVFormat;
7577
ID3D12DescriptorHeap* pd3dSrvDescHeap;
7678
UINT numFramesInFlight;
7779

@@ -311,7 +313,7 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
311313
global_idx_offset += draw_list->IdxBuffer.Size;
312314
global_vtx_offset += draw_list->VtxBuffer.Size;
313315
}
314-
platform_io.Renderer_RenderState = NULL;
316+
platform_io.Renderer_RenderState = nullptr;
315317
}
316318

317319
static void ImGui_ImplDX12_CreateFontsTexture()
@@ -569,6 +571,7 @@ bool ImGui_ImplDX12_CreateDeviceObjects()
569571
psoDesc.SampleMask = UINT_MAX;
570572
psoDesc.NumRenderTargets = 1;
571573
psoDesc.RTVFormats[0] = bd->RTVFormat;
574+
psoDesc.DSVFormat = bd->DSVFormat;
572575
psoDesc.SampleDesc.Count = 1;
573576
psoDesc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
574577

@@ -735,6 +738,7 @@ bool ImGui_ImplDX12_Init(ImGui_ImplDX12_InitInfo* init_info)
735738

736739
bd->pd3dDevice = init_info->Device;
737740
bd->RTVFormat = init_info->RTVFormat;
741+
bd->DSVFormat = init_info->DSVFormat;
738742
bd->numFramesInFlight = init_info->NumFramesInFlight;
739743
bd->pd3dSrvDescHeap = init_info->SrvDescriptorHeap;
740744

@@ -743,7 +747,7 @@ bool ImGui_ImplDX12_Init(ImGui_ImplDX12_InitInfo* init_info)
743747
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
744748

745749
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
746-
if (init_info->SrvDescriptorAllocFn == NULL)
750+
if (init_info->SrvDescriptorAllocFn == nullptr)
747751
{
748752
// Wrap legacy behavior of passing space for a single descriptor
749753
IM_ASSERT(init_info->LegacySingleSrvCpuDescriptor.ptr != 0 && init_info->LegacySingleSrvGpuDescriptor.ptr != 0);
@@ -765,7 +769,7 @@ bool ImGui_ImplDX12_Init(ImGui_ImplDX12_InitInfo* init_info)
765769
#endif
766770

767771
// Allocate 1 SRV descriptor for the font texture
768-
IM_ASSERT(init_info->SrvDescriptorAllocFn != NULL && init_info->SrvDescriptorFreeFn != NULL);
772+
IM_ASSERT(init_info->SrvDescriptorAllocFn != nullptr && init_info->SrvDescriptorFreeFn != nullptr);
769773
init_info->SrvDescriptorAllocFn(&bd->InitInfo, &bd->FontTexture.hFontSrvCpuDescHandle, &bd->FontTexture.hFontSrvGpuDescHandle);
770774

771775
// Create buffers with a default size (they will later be grown as needed)

backends/imgui_impl_dx12.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// Implemented features:
55
// [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.
6+
// [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).
77
// [X] Renderer: Expose selected render state for draw callbacks to use. Access in '(ImGui_ImplXXXX_RenderState*)GetPlatformIO().Renderer_RenderState'.
88

99
// The aim of imgui_impl_dx12.h/.cpp is to be usable in your engine without any modification.
@@ -29,7 +29,8 @@ struct ImGui_ImplDX12_InitInfo
2929
ID3D12Device* Device;
3030
ID3D12CommandQueue* CommandQueue;
3131
int NumFramesInFlight;
32-
DXGI_FORMAT RTVFormat;
32+
DXGI_FORMAT RTVFormat; // RenderTarget format.
33+
DXGI_FORMAT DSVFormat; // DepthStencilView format.
3334
void* UserData;
3435

3536
// Allocating SRV descriptors for textures is up to the application, so we provide callbacks.

0 commit comments

Comments
 (0)