فهرست منبع

Backends: SDLGPU: fixes call to SDL_MapGPUTransferBuffer(). Fixes artifacts on OSX/Metal. (#8465, #8703)

ocornut 1 ماه پیش
والد
کامیت
dcf14505e2
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      backends/imgui_impl_sdlgpu3.cpp

+ 2 - 1
backends/imgui_impl_sdlgpu3.cpp

@@ -22,6 +22,7 @@
 //   Calling the function is MANDATORY, otherwise the ImGui will not upload neither the vertex nor the index buffer for the GPU. See imgui_impl_sdlgpu3.cpp for more info.
 
 // CHANGELOG
+//  2025-06-25: Mapping transfer buffer for texture update use cycle=true. Fixes artifacts e.g. on Metal backend.
 //  2025-06-11: Added support for ImGuiBackendFlags_RendererHasTextures, for dynamic font atlas. Removed ImGui_ImplSDLGPU3_CreateFontsTexture() and ImGui_ImplSDLGPU3_DestroyFontsTexture().
 //  2025-04-28: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
 //  2025-03-30: Made ImGui_ImplSDLGPU3_PrepareDrawData() reuse GPU Transfer Buffers which were unusually slow to recreate every frame. Much faster now.
@@ -373,7 +374,7 @@ void ImGui_ImplSDLGPU3_UpdateTexture(ImTextureData* tex)
 
         // Copy to transfer buffer
         {
-            void* texture_ptr = SDL_MapGPUTransferBuffer(v->Device, bd->TexTransferBuffer, false);
+            void* texture_ptr = SDL_MapGPUTransferBuffer(v->Device, bd->TexTransferBuffer, true);
             for (int y = 0; y < upload_h; y++)
                 memcpy((void*)((uintptr_t)texture_ptr + y * upload_pitch), tex->GetPixelsAt(upload_x, upload_y + y), upload_pitch);
             SDL_UnmapGPUTransferBuffer(v->Device, bd->TexTransferBuffer);