From ce1d453ac264c9c088a24fb3d7388f76db2a1aed Mon Sep 17 00:00:00 2001 From: praydog Date: Sat, 25 Jan 2025 23:05:33 -0800 Subject: [PATCH] D3D12: Fix error occurring under debug layer --- src/uevr-imgui/imgui_impl_dx12.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/uevr-imgui/imgui_impl_dx12.cpp b/src/uevr-imgui/imgui_impl_dx12.cpp index 2e390d20..d8e41561 100644 --- a/src/uevr-imgui/imgui_impl_dx12.cpp +++ b/src/uevr-imgui/imgui_impl_dx12.cpp @@ -273,9 +273,12 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL const D3D12_RECT r = { (LONG)clip_min.x, (LONG)clip_min.y, (LONG)clip_max.x, (LONG)clip_max.y }; D3D12_GPU_DESCRIPTOR_HANDLE texture_handle = {}; 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); + + if (texture_handle.ptr != 0) { + 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); + } } } global_idx_offset += cmd_list->IdxBuffer.Size;