diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 11:27:39 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-12 13:22:02 -0300 |
| commit | 00605f7a109845a99f16621b267305a8b995dddc (patch) | |
| tree | 223c7f89506279b4129f5592ece782b306f2eda3 /build.zig | |
| parent | 86ffca0024326110962f0880727f4eb84e6a48d1 (diff) | |
| download | sketchbook-00605f7a109845a99f16621b267305a8b995dddc.tar.gz sketchbook-00605f7a109845a99f16621b267305a8b995dddc.zip | |
sketchbook: shapes antialiased up to 3840x2160; SDL's Vulkan backend no longer defragments (it lost a frame's first draws)
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -302,6 +302,16 @@ fn fixSdlThreadCleanup(b: *Build, sdl: *Build.Module, source: Build.LazyPath) vo /// another memory type. Many headless hosts at once (parallel `e2e`) run /// small heaps out, and the leak check failed random scripts. The file is /// compiled from a copy with the two frees added. +/// +/// The copy also never defragments memory. A defragmentation runs inside +/// whichever command buffer is submitted next, moves the textures of a +/// fragmented allocation to new ones and re-points their handles, and the +/// host submits a sketch's GPU passes while the 2D renderer's command +/// buffer for the frame is still being recorded: what that had drawn so +/// far went to the old texture and the rest to the copy, which shows the +/// previous frame under it (seen after a large texture was freed, at +/// 1920x1080 and up). Freed memory is still reused; it is only not +/// compacted. fn fixSdlVulkanAllocationLeak(b: *Build, sdl: *Build.Module, source: Build.LazyPath) void { const file = "src/gpu/vulkan/SDL_gpu_vulkan.c"; var found = false; @@ -333,6 +343,9 @@ fn fixSdlVulkanAllocationLeak(b: *Build, sdl: *Build.Module, source: Build.LazyP "SDL_gpu_vulkan.c", " // Uh oh, we couldn't allocate, time to clean up\n SDL_free(allocation->freeRegions);\n", " // Uh oh, we couldn't allocate, time to clean up\n SDL_free(allocation->freeRegions);\n SDL_free(allocation->usedRegions);\n SDL_DestroyMutex(allocation->memoryLock);\n", + "SDL_gpu_vulkan.c", + " VULKAN_INTERNAL_MarkAllocationsForDefrag(renderer);\n", + " (void)VULKAN_INTERNAL_MarkAllocationsForDefrag;\n", }); // The copy's relative includes (`../SDL_sysgpu.h`) resolve from the // original directory. |
