Commit Graph

46 Commits

Author SHA1 Message Date
Henrik Rydgård 28166cb35d Add "allocation slack" to our pushbuffers. Fixes a memory overwrite bug
Reported by Joseph on Discord.

Sometimes, things could align perfectly so allocations happend exactly
at the end of a pushbuffer. At the same time, we allow our vertex decoder to write an extra few
bytes if it needs to for speed. Unfortunately I missed this interaction,
resulting in some uncommon crashes that were especially common with
heavy-geometry things like modified GTA LCS with PS2 assets, for
example.

The problem was reported with Vulkan, but our OpenGL backend had the
same issue too.
2026-05-13 15:55:34 +02:00
Henrik Rydgård 4c2be7f8af More work. Some initialization order problem. 2026-04-23 13:31:51 +02:00
Henrik Rydgård 4335a327cd Hackery to prepare for constant buffers in compute 2026-04-23 13:31:51 +02:00
Henrik Rydgård 33b87578c5 Revive old alignment utility functions, give them better names. 2025-09-03 20:48:51 +02:00
Henrik Rydgård f36173e17f Vulkan: Remove mac specific hack for specifying host coherent memory - we need this everywhere. 2025-04-16 08:42:07 +02:00
Henrik Rydgård c91169e702 Restore removed <algorithm> includes.
Turns out these were needed after all. For some reason, on Windows and
Mac, <algorithm> gets auto-included by something else so I don't notice
when it's missing, and MSVC's include dependency tracker doesn't see it
either.
2024-12-19 09:53:07 +01:00
Henrik Rydgård 4dd3621fa0 Remove some unnecessary <algorithm> includes. 2024-12-18 17:04:27 +01:00
Katharine Chui 49553bcf8d Simplify MacOS AMD GPU workaround
Based on https://github.com/KhronosGroup/MoltenVK/issues/960,
expand MacOS AMD GPU workaround to all dGPU and instead of
changing usage, just append VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
2024-12-09 14:22:56 +01:00
Katharine Chui 286580a6a0 Switch to VMA_MEMORY_USAGE_CPU_ONLY on MacOS AMD
The ideal allocation would be VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
like in 1.12.3, but vma picked an index that's actually not mappable

VMA_MEMORY_USAGE_GPU_TO_CPU selects VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
which seems to hurt performance

VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT + VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
selection with VMA_MEMORY_USAGE_CPU_ONLY would suffice for the
workaround, and get better performance
2024-12-09 12:32:31 +01:00
Katharine Chui 93009a3178 Work around metal buffer bug on MacOS + AMD GPU
With VMA_MEMORY_USAGE_CPU_TO_GPU buffers, metal buffer appears 0
filled in metal trace during vkCmdCopyBufferToImage triggered
MTLBlitCommandEncoder instance method.

Allocate VMA_MEMORY_USAGE_GPU_TO_CPU instead on MacOS + AMD GPU
2024-12-08 22:13:33 +01:00
Henrik Rydgård 2c283fbb07 Minor cleanups, crashfixes 2024-10-14 23:57:19 +02:00
Henrik Rydgård f1cbf1ba96 Android TextRenderer: Add try {} around loading the Roboto font. Also improve an unrelated assert. 2024-10-10 16:01:00 +02:00
Henrik Rydgård e01ca5b057 Logging API change (refactor) (#19324)
* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
2024-07-14 14:42:59 +02:00
Henrik Rydgård 126d88ecfc Back out clearly inconsequential/useless .reserve() calls 2023-12-29 08:27:56 +01:00
Herman Semenov b8748ae9e5 [Common/File/GPU/Render/Input] Using reserve if possible 2023-12-15 14:00:51 +03:00
Henrik Rydgård 2ac14f555d Remove VulkanPushBuffer (keeping our newer replacement VulkanPushPool) 2023-10-11 09:06:24 +02:00
Henrik Rydgård 34fbbf2c2a Split out the descriptorset pool from VulkanMemory.cpp/h 2023-10-08 11:45:00 +02:00
Henrik Rydgård 6a8f65b566 Some assert paranoia, remove unused "failed_" variable 2023-09-23 10:09:32 +02:00
Henrik Rydgård 875112e9c2 Improve an assert 2023-09-11 14:18:55 +02:00
Henrik Rydgård dfb446f89d Allow other backends than Vulkan to have GPU memory stats. Implement for GL. 2023-05-24 14:33:01 +02:00
Henrik Rydgård 7e1f907826 VulkanPushPool: Sprinkle a couple of asserts. 2023-05-04 10:25:16 +02:00
Henrik Rydgård a41fc74dba Add a debug assert in VulkanPushPool 2023-05-01 11:41:25 +02:00
Henrik Rydgård ae8c804328 Merge pull request #17134 from hrydgard/more-replacement-work
Refactor the replacement cache
2023-03-16 12:37:48 +01:00
Unknown W. Brackets de4eb64298 Build: Fix MSVC 2019 again. 2023-03-15 21:28:46 -07:00
Henrik Rydgård 34926472aa Log fix 2023-03-16 00:30:20 +01:00
Henrik Rydgård 87a16b0386 Fix the stats 2023-03-15 10:19:00 +01:00
Henrik Rydgård 089b63c22f Address feedback, except the stats. 2023-03-15 10:09:39 +01:00
Henrik Rydgård 2ac74e3d37 Remove the PushBufferType enum 2023-03-15 09:59:00 +01:00
Henrik Rydgård f3bdf324f9 Garbage collect old buffers in push pool. 2023-03-15 01:25:03 +01:00
Henrik Rydgård c8b25e50b0 Better debug vis for push pools 2023-03-15 01:25:03 +01:00
Henrik Rydgård 9fcd6d6612 Use thin3d's push pool in the draw engine too. 2023-03-15 01:25:03 +01:00
Henrik Rydgård 56d792f422 Sketch the new VulkanPushPool 2023-03-15 01:25:00 +01:00
Henrik Rydgård ef4f17e998 Resurrect the Vulkan memory visualizer, but now it's global stats and pushbuffer stats. 2023-02-27 01:11:11 +01:00
Henrik Rydgård 31fd928a5c Name more image views. Very useful with a little patch to the Vulkan debug layers. 2022-10-27 11:05:59 +02:00
Henrik Rydgård 974cd38b1f Some more debug names to vulkan objects 2022-09-08 09:16:40 +02:00
Henrik Rydgård b85a7e9a46 Name uniform buffers, add more asserts. Used this to track down the bug fixed in the previous commit. 2021-12-10 21:01:01 +01:00
Unknown W. Brackets 8d06431ea7 Vulkan: Use new desc sets in Draw and VulkanUtil.
It seems like a bug that destory device objects wasn't clearing descSets.
2021-12-09 19:03:17 -08:00
Unknown W. Brackets 1010d7ac0e Vulkan: Refactor common desc pool handling. 2021-12-09 18:39:55 -08:00
Henrik Rydgård f991f6a789 Remove the old allocator visualizer. Keep the setting but hide it. Other feedback 2021-11-23 08:55:12 +01:00
Henrik Rydgård 8d5247ddf3 Convert the PushBuffer to use VMA. 2021-11-22 18:54:09 +01:00
Henrik Rydgård 0cbb7ab027 Change the PushBuffer API a bit to not take explicit memory types. 2021-11-22 18:54:09 +01:00
Henrik Rydgård c2f594cc73 Remove the VulkanDeviceAllocator 2021-11-22 18:54:09 +01:00
Bram Verweij a31cbe42d2 Rename namespace to PPSSPP_VK, remove indentation 2021-08-21 12:39:15 +02:00
Bram Verweij cc00a4132d Prevent dlopen collisions between ppsspp_libretro.so and libvulkan.so 2021-08-20 11:22:57 +02:00
Unknown W. Brackets f32f89dd90 Global: Remove some unused variables. 2021-02-15 11:59:45 -08:00
Henrik Rydgård 0e3a84b4a8 Move most GPU things to Common.
It works after the move, on Windows and Android at least.

Deletes the D3DX9 shader compiler loader, which was not used.
2020-10-04 23:39:02 +02:00