Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DrawEngineCommon: Enforce the limit on vertex decoding #19491

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion GPU/Common/DrawEngineCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,6 @@ bool DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti

void DrawEngineCommon::DecodeVerts(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;
for (; i < numDrawVerts_; i++) {
Expand All @@ -981,6 +980,12 @@ void DrawEngineCommon::DecodeVerts(u8 *dest) {
drawVertexOffsets_[i] = numDecodedVerts_ - indexLowerBound;

int indexUpperBound = dv.indexUpperBound;

if (indexUpperBound + 1 - indexLowerBound + numDecodedVerts_ >= VERTEX_BUFFER_MAX) {
// Hit our limit! Stop decoding in this draw.
break;
}

// Decode the verts (and at the same time apply morphing/skinning). Simple.
dec_->DecodeVerts(dest + numDecodedVerts_ * stride, dv.verts, &dv.uvScale, indexLowerBound, indexUpperBound);
numDecodedVerts_ += indexUpperBound - indexLowerBound + 1;
Expand Down
Loading