|
@@ -7,9 +7,13 @@
|
|
|
|
|
|
// Important: to compile on 32-bit systems, this backend requires code to be compiled with '#define ImTextureID ImU64'.
|
|
|
// This is because we need ImTextureID to carry a 64-bit value and by default ImTextureID is defined as void*.
|
|
|
-// This define is set in the example .vcxproj file and need to be replicated in your app or by adding it to your imconfig.h file.
|
|
|
+// To build this on 32-bit systems:
|
|
|
+// - [Solution 1] IDE/msbuild: in "Properties/C++/Preprocessor Definitions" add 'ImTextureID=ImU64' (this is what we do in the 'example_win32_direct12/example_win32_direct12.vcxproj' project file)
|
|
|
+// - [Solution 2] IDE/msbuild: in "Properties/C++/Preprocessor Definitions" add 'IMGUI_USER_CONFIG="my_imgui_config.h"' and inside 'my_imgui_config.h' add '#define ImTextureID ImU64' and as many other options as you like.
|
|
|
+// - [Solution 3] IDE/msbuild: edit imconfig.h and add '#define ImTextureID ImU64' (prefer solution 2 to create your own config file!)
|
|
|
+// - [Solution 4] command-line: add '/D ImTextureID=ImU64' to your cl.exe command-line (this is what we do in the example_win32_direct12/build_win32.bat file)
|
|
|
|
|
|
-// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
|
|
+// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
|
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
|
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
|
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
|
@@ -242,7 +246,7 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
|
|
|
if (r.right > r.left && r.bottom > r.top)
|
|
|
{
|
|
|
D3D12_GPU_DESCRIPTOR_HANDLE texture_handle = {};
|
|
|
- texture_handle.ptr = (UINT64)(intptr_t)pcmd->GetTexID();
|
|
|
+ texture_handle.ptr = (UINT64)pcmd->GetTexID();
|
|
|
ctx->SetGraphicsRootDescriptorTable(1, texture_handle);
|
|
|
ctx->RSSetScissorRects(1, &r);
|
|
|
ctx->DrawIndexedInstanced(pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
|
|
@@ -399,6 +403,13 @@ static void ImGui_ImplDX12_CreateFontsTexture()
|
|
|
}
|
|
|
|
|
|
// Store our identifier
|
|
|
+ // READ THIS IF THE STATIC_ASSERT() TRIGGERS:
|
|
|
+ // - Important: to compile on 32-bit systems, this backend requires code to be compiled with '#define ImTextureID ImU64'.
|
|
|
+ // - This is because we need ImTextureID to carry a 64-bit value and by default ImTextureID is defined as void*.
|
|
|
+ // [Solution 1] IDE/msbuild: in "Properties/C++/Preprocessor Definitions" add 'ImTextureID=ImU64' (this is what we do in the 'example_win32_direct12/example_win32_direct12.vcxproj' project file)
|
|
|
+ // [Solution 2] IDE/msbuild: in "Properties/C++/Preprocessor Definitions" add 'IMGUI_USER_CONFIG="my_imgui_config.h"' and inside 'my_imgui_config.h' add '#define ImTextureID ImU64' and as many other options as you like.
|
|
|
+ // [Solution 3] IDE/msbuild: edit imconfig.h and add '#define ImTextureID ImU64' (prefer solution 2 to create your own config file!)
|
|
|
+ // [Solution 4] command-line: add '/D ImTextureID=ImU64' to your cl.exe command-line (this is what we do in the example_win32_direct12/build_win32.bat file)
|
|
|
static_assert(sizeof(ImTextureID) >= sizeof(g_hFontSrvGpuDescHandle.ptr), "Can't pack descriptor handle into TexID, 32-bit not supported yet.");
|
|
|
io.Fonts->SetTexID((ImTextureID)g_hFontSrvGpuDescHandle.ptr);
|
|
|
}
|