From ae58fe38285ceaf6a9ced4a04e42fb0c9a0ef3c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 8 Oct 2023 16:51:58 +0200 Subject: [PATCH] In GL and Vulkan soft-skin, we might not be fully done decoding when we reach flush. Take that into account. --- GPU/GLES/DrawEngineGLES.cpp | 4 ++-- GPU/GPUCommonHW.cpp | 3 +-- GPU/Vulkan/DrawEngineVulkan.cpp | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index 7aefa970bc..b6f5f8a548 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -277,8 +277,8 @@ void DrawEngineGLES::DoFlush() { bool useElements = true; if (decOptions_.applySkinInDecode && (lastVType_ & GE_VTYPE_WEIGHT_MASK)) { - // If software skinning, we've already predecoded into "decoded_", and indices - // into decIndex_. So push that content. + // If software skinning, we're predecoding into "decoded". So make sure we're done, then push that content. + DecodeVerts(decoded_); uint32_t size = decodedVerts_ * dec_->GetDecVtxFmt().stride; u8 *dest = (u8 *)frameData.pushVertex->Allocate(size, 4, &vertexBuffer, &vertexBufferOffset); memcpy(dest, decoded_, size); diff --git a/GPU/GPUCommonHW.cpp b/GPU/GPUCommonHW.cpp index 369bb19b6d..3030dc5084 100644 --- a/GPU/GPUCommonHW.cpp +++ b/GPU/GPUCommonHW.cpp @@ -1036,7 +1036,6 @@ void GPUCommonHW::Execute_Prim(u32 op, u32 diff) { break; } - // Failed, or can't extend? Do a normal submit. verts = Memory::GetPointerUnchecked(gstate_c.vertexAddr); inds = nullptr; if ((vertexType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { @@ -1055,9 +1054,9 @@ void GPUCommonHW::Execute_Prim(u32 op, u32 diff) { uint32_t diff = data ^ vertexType; // don't mask upper bits, vertexType is unmasked if (diff) { - drawEngineCommon_->FlushSkin(); if (diff & vtypeCheckMask) goto bail; + drawEngineCommon_->FlushSkin(); canExtend = false; // TODO: Might support extending between some vertex types in the future. vertexType = data; vertTypeID = GetVertTypeID(vertexType, gstate.getUVGenMode(), g_Config.bSoftwareSkinning); diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index 5a99d5ae26..54cec45849 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -678,7 +678,8 @@ void DrawEngineVulkan::DoFlush() { useIndexGen = VertexCacheLookup(vertexCount, prim, vbuf, vbOffset, ibuf, ibOffset, useElements, forceIndexed); } else { if (decOptions_.applySkinInDecode && (lastVType_ & GE_VTYPE_WEIGHT_MASK)) { - // If software skinning, we've already predecoded into "decoded". So push that content. + // If software skinning, we're predecoding into "decoded". So make sure we're done, then push that content. + DecodeVerts(decoded_); VkDeviceSize size = decodedVerts_ * dec_->GetDecVtxFmt().stride; u8 *dest = (u8 *)pushVertex_->Allocate(size, 4, &vbuf, &vbOffset); memcpy(dest, decoded_, size);