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

[d3d9] Handle mismatching vertex layout and vbo strides #3921

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

K0bin
Copy link
Collaborator

@K0bin K0bin commented Mar 21, 2024

Fixes #3919

@K0bin K0bin added the d3d9 label Mar 21, 2024
@K0bin K0bin force-pushed the finalfantasy-fix branch 2 times, most recently from e61584d to 230c169 Compare March 27, 2024 15:10
@K0bin K0bin marked this pull request as ready for review March 27, 2024 15:10
@Joshua-Ashton
Copy link
Collaborator

This seems like a mess

@K0bin K0bin marked this pull request as draft April 21, 2024 13:56
@K0bin K0bin force-pushed the finalfantasy-fix branch 2 times, most recently from a98f0d3 to 6e98206 Compare May 17, 2024 23:34
@K0bin K0bin marked this pull request as ready for review May 17, 2024 23:35
@K0bin
Copy link
Collaborator Author

K0bin commented May 17, 2024

I pushed an updated version of this PR that should hopefully be a bit easier to read. It's still quite complex because we have to be robust against going out of bounds but it's a bit less messy now in my opinion.

@K0bin K0bin requested a review from Joshua-Ashton May 17, 2024 23:36
src/d3d9/d3d9_device.cpp Outdated Show resolved Hide resolved
uint32_t copyElementCount;
uint32_t copyElementSize;
uint32_t copyElementStride;
};
uint32_t upBufferSize = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usage of this variable implies it's a rolling value. Perhaps renaming it into upBufferRollingSize (or something comparable) would make this fact more clear. (Or perhaps there already is a naming convention in similar code that could be applied here too?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's a rolling value?

upBufferSize just sums up the size of the vertex data for all vertex buffers and the index buffer so we can then allocate a single UpBuffer slice rather than needing multiple slices.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. It starts at zero and is incremented in each for loop iteration.
Of course, to you it is probably obvious this is the way this works, but this usage can be seen as a pattern that happens elsewhere as well, and capturing that fact via a naming convention would make this clearer to a reader/maintainer of the code base.
Maybe "rolling" is not the most accurate terminology, perhaps something like "incremental" is the better word to describe this usage, but that's longer.
Feel free to ignore this reasoning, it's just a suggestion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could call it something like totalUpBufferSize. How about that?

... and handle mismatching vertex sizes and vertex strides.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[d3d9] Final Fantasy XIII (dxvk 2.3.1 regression?)
3 participants