diff --git a/GPU/Common/DrawEngineCommon.cpp b/GPU/Common/DrawEngineCommon.cpp index 6847ca75a3..9079666ed7 100644 --- a/GPU/Common/DrawEngineCommon.cpp +++ b/GPU/Common/DrawEngineCommon.cpp @@ -1038,10 +1038,10 @@ bool DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti return true; } -void DrawEngineCommon::DecodeVerts(u8 *dest) { +void DrawEngineCommon::DecodeVerts(VertexDecoder *dec, u8 *dest) { // Note that this should be able to continue a partial decode - we don't necessarily start from zero here (although we do most of the time). int i = decodeVertsCounter_; - int stride = (int)dec_->GetDecVtxFmt().stride; + int stride = (int)dec->GetDecVtxFmt().stride; for (; i < numDrawVerts_; i++) { DeferredVerts &dv = drawVerts_[i]; @@ -1056,7 +1056,7 @@ void DrawEngineCommon::DecodeVerts(u8 *dest) { } // Decode the verts (and at the same time apply morphing/skinning). Simple. - dec_->DecodeVerts(dest + numDecodedVerts_ * stride, dv.verts, &dv.uvScale, indexLowerBound, indexUpperBound); + dec->DecodeVerts(dest + numDecodedVerts_ * stride, dv.verts, &dv.uvScale, indexLowerBound, indexUpperBound); numDecodedVerts_ += indexUpperBound - indexLowerBound + 1; } decodeVertsCounter_ = i; diff --git a/GPU/Common/DrawEngineCommon.h b/GPU/Common/DrawEngineCommon.h index a1cea4ebe0..19f26749a5 100644 --- a/GPU/Common/DrawEngineCommon.h +++ b/GPU/Common/DrawEngineCommon.h @@ -109,7 +109,7 @@ public: void FlushSkin() { if (dec_->skinInDecode) { - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); } } @@ -153,7 +153,7 @@ protected: virtual bool UpdateUseHWTessellation(bool enabled) const { return enabled; } void UpdatePlanes(); - void DecodeVerts(u8 *dest); + void DecodeVerts(VertexDecoder *dec, u8 *dest); int DecodeInds(); // Preprocessing for spline/bezier diff --git a/GPU/D3D11/DrawEngineD3D11.cpp b/GPU/D3D11/DrawEngineD3D11.cpp index c770531f3d..78d45e1cfb 100644 --- a/GPU/D3D11/DrawEngineD3D11.cpp +++ b/GPU/D3D11/DrawEngineD3D11.cpp @@ -282,7 +282,7 @@ void DrawEngineD3D11::Flush() { int vertexCount; int maxIndex; bool useElements; - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); DecodeIndsAndGetData(&prim, &vertexCount, &maxIndex, &useElements, false); gpuStats.numUncachedVertsDrawn += vertexCount; @@ -351,7 +351,7 @@ void DrawEngineD3D11::Flush() { lastVType_ |= (1 << 26); dec_ = GetVertexDecoder(lastVType_); } - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); int vertexCount = DecodeInds(); bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE; diff --git a/GPU/D3D11/DrawEngineD3D11.h b/GPU/D3D11/DrawEngineD3D11.h index d870ae1850..b43cc50a53 100644 --- a/GPU/D3D11/DrawEngineD3D11.h +++ b/GPU/D3D11/DrawEngineD3D11.h @@ -80,7 +80,7 @@ public: void Flush() override; void FinishDeferred() { - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); } void NotifyConfigChanged() override; diff --git a/GPU/Directx9/DrawEngineDX9.cpp b/GPU/Directx9/DrawEngineDX9.cpp index 62bd815b07..3f31075454 100644 --- a/GPU/Directx9/DrawEngineDX9.cpp +++ b/GPU/Directx9/DrawEngineDX9.cpp @@ -256,7 +256,7 @@ void DrawEngineDX9::Flush() { int vertexCount; int maxIndex; bool useElements; - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); DecodeIndsAndGetData(&prim, &vertexCount, &maxIndex, &useElements, false); gpuStats.numUncachedVertsDrawn += vertexCount; @@ -306,7 +306,7 @@ void DrawEngineDX9::Flush() { lastVType_ |= (1 << 26); dec_ = GetVertexDecoder(lastVType_); } - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); int vertexCount = DecodeInds(); bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE; diff --git a/GPU/Directx9/DrawEngineDX9.h b/GPU/Directx9/DrawEngineDX9.h index 6bbf6ffcab..6073ed4494 100644 --- a/GPU/Directx9/DrawEngineDX9.h +++ b/GPU/Directx9/DrawEngineDX9.h @@ -71,7 +71,7 @@ public: void Flush() override; void FinishDeferred() { - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); } protected: diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index b3621c6e5f..dfff8b395b 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -274,7 +274,7 @@ void DrawEngineGLES::Flush() { if (vshader->UseHWTransform()) { if (applySkinInDecode_ && (lastVType_ & GE_VTYPE_WEIGHT_MASK)) { // If software skinning, we're predecoding into "decoded". So make sure we're done, then push that content. - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); uint32_t size = numDecodedVerts_ * dec_->GetDecVtxFmt().stride; u8 *dest = (u8 *)frameData.pushVertex->Allocate(size, 4, &vertexBuffer, &vertexBufferOffset); memcpy(dest, decoded_, size); @@ -282,13 +282,13 @@ void DrawEngineGLES::Flush() { // Figure out how much pushbuffer space we need to allocate. int vertsToDecode = ComputeNumVertsToDecode(); u8 *dest = (u8 *)frameData.pushVertex->Allocate(vertsToDecode * dec_->GetDecVtxFmt().stride, 4, &vertexBuffer, &vertexBufferOffset); - DecodeVerts(dest); + DecodeVerts(dec_, dest); } int vertexCount; int maxIndex; bool useElements; - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); DecodeIndsAndGetData(&prim, &vertexCount, &maxIndex, &useElements, false); if (useElements) { @@ -333,7 +333,7 @@ void DrawEngineGLES::Flush() { lastVType_ |= (1 << 26); dec_ = GetVertexDecoder(lastVType_); } - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); int vertexCount = DecodeInds(); bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE; diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index ec1e7a6b87..43917028b6 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -260,7 +260,7 @@ void DrawEngineVulkan::Flush() { VkBuffer vbuf = VK_NULL_HANDLE; if (applySkinInDecode_ && (lastVType_ & GE_VTYPE_WEIGHT_MASK)) { // If software skinning, we're predecoding into "decoded". So make sure we're done, then push that content. - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); VkDeviceSize size = numDecodedVerts_ * dec_->GetDecVtxFmt().stride; u8 *dest = (u8 *)pushVertex_->Allocate(size, 4, &vbuf, &vbOffset); memcpy(dest, decoded_, size); @@ -269,7 +269,7 @@ void DrawEngineVulkan::Flush() { int vertsToDecode = ComputeNumVertsToDecode(); // Decode directly into the pushbuffer u8 *dest = pushVertex_->Allocate(vertsToDecode * dec_->GetDecVtxFmt().stride, 4, &vbuf, &vbOffset); - DecodeVerts(dest); + DecodeVerts(dec_, dest); } int vertexCount; @@ -381,6 +381,7 @@ void DrawEngineVulkan::Flush() { } } else { PROFILE_THIS_SCOPE("soft"); + if (!applySkinInDecode_) { applySkinInDecode_ = true; lastVType_ |= (1 << 26); @@ -388,7 +389,7 @@ void DrawEngineVulkan::Flush() { } int prevDecodedVerts = numDecodedVerts_; - DecodeVerts(decoded_); + DecodeVerts(dec_, decoded_); int vertexCount = DecodeInds(); bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE;