Fix buffers getting copied with a closed command list.

This commit is contained in:
Skyth 2024-12-25 22:12:17 +03:00
parent 659f3700ee
commit b054e16461

View file

@ -563,6 +563,14 @@ static void DestructTempResources()
} }
static std::thread::id g_mainThreadId; static std::thread::id g_mainThreadId;
static std::thread::id g_presentThreadId = std::this_thread::get_id();
PPC_FUNC_IMPL(__imp__sub_824ECA00);
PPC_FUNC(sub_824ECA00)
{
g_presentThreadId = std::this_thread::get_id();
__imp__sub_824ECA00(ctx, base);
}
static ankerl::unordered_dense::map<RenderTexture*, RenderTextureLayout> g_barrierMap; static ankerl::unordered_dense::map<RenderTexture*, RenderTextureLayout> g_barrierMap;
@ -1814,7 +1822,7 @@ static void UnlockBuffer(GuestBuffer* buffer)
{ {
if (!buffer->lockedReadOnly) if (!buffer->lockedReadOnly)
{ {
if (std::this_thread::get_id() == g_mainThreadId) if (std::this_thread::get_id() == g_presentThreadId)
{ {
RenderCommand cmd; RenderCommand cmd;
cmd.type = (sizeof(T) == 2) ? RenderCommandType::UnlockBuffer16 : RenderCommandType::UnlockBuffer32; cmd.type = (sizeof(T) == 2) ? RenderCommandType::UnlockBuffer16 : RenderCommandType::UnlockBuffer32;