1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-14 11:07:48 +01:00

Backends: DX12: Unmap() call specify written range.

The range is informational and may be used by debug tools.
This commit is contained in:
ocornut 2024-10-23 12:40:20 +02:00
parent 41f02825fc
commit 4994e75852
2 changed files with 12 additions and 2 deletions

View File

@ -16,6 +16,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2024-10-23: DirectX12: Unmap() call specify written range. The range is informational and may be used by debug tools.
// 2024-10-07: DirectX12: Changed default texture sampler to Clamp instead of Repeat/Wrap.
// 2024-10-07: DirectX12: Expose selected render state in ImGui_ImplDX12_RenderState, which you can access in 'void* platform_io.Renderer_RenderState' during draw callbacks.
// 2024-10-07: DirectX12: Compiling with '#define ImTextureID=ImU64' is unnecessary now that dear imgui defaults ImTextureID to u64 instead of void*.
@ -218,9 +219,9 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
}
// Upload vertex/index data into a single contiguous GPU buffer
// During Map() we specify a null read range (as per DX12 API, this is informational and for tooling only)
void* vtx_resource, *idx_resource;
D3D12_RANGE range;
memset(&range, 0, sizeof(D3D12_RANGE));
D3D12_RANGE range = { 0, 0 };
if (fr->VertexBuffer->Map(0, &range, &vtx_resource) != S_OK)
return;
if (fr->IndexBuffer->Map(0, &range, &idx_resource) != S_OK)
@ -235,7 +236,13 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
vtx_dst += draw_list->VtxBuffer.Size;
idx_dst += draw_list->IdxBuffer.Size;
}
// During Unmap() we specify the written range (as per DX12 API, this is informational and for tooling only)
range.End = (SIZE_T)((intptr_t)vtx_dst - (intptr_t)vtx_resource);
IM_ASSERT(range.End == draw_data->TotalVtxCount * sizeof(ImDrawVert));
fr->VertexBuffer->Unmap(0, &range);
range.End = (SIZE_T)((intptr_t)idx_dst - (intptr_t)idx_resource);
IM_ASSERT(range.End == draw_data->TotalIdxCount * sizeof(ImDrawIdx));
fr->IndexBuffer->Unmap(0, &range);
// Setup desired DX state

View File

@ -43,6 +43,9 @@ Breaking changes:
Other changes:
- Backends: DX12: Unmap() call specify written range. The range is informational and may be used by debug tools.
-----------------------------------------------------------------------
VERSION 1.91.4 (Released 2024-10-18)
-----------------------------------------------------------------------