Skip to content

Commit

Permalink
Merge pull request #18321 from hrydgard/fix-triangle-errors
Browse files Browse the repository at this point in the history
In GL and Vulkan soft-skin, we might not be fully done decoding when we reach flush. Take that into account.
  • Loading branch information
hrydgard committed Oct 8, 2023
2 parents 43cdb88 + ae58fe3 commit d280495
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions GPU/GLES/DrawEngineGLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions GPU/GPUCommonHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion GPU/Vulkan/DrawEngineVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d280495

Please sign in to comment.