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

Bump the index/vertex cpu-side buffer sizes a little. #17394

Merged
merged 2 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions GPU/Common/DrawEngineCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class VertexDecoder;

enum {
VERTEX_BUFFER_MAX = 65536,
DECODED_VERTEX_BUFFER_SIZE = VERTEX_BUFFER_MAX * 64,
DECODED_INDEX_BUFFER_SIZE = VERTEX_BUFFER_MAX * 16,
DECODED_VERTEX_BUFFER_SIZE = VERTEX_BUFFER_MAX * 2 * 36, // 36 == sizeof(SimpleVertex)
DECODED_INDEX_BUFFER_SIZE = VERTEX_BUFFER_MAX * 6 * 6 * 2, // * 6 for spline tessellation, then * 6 again for converting into points/lines, and * 2 for 2 bytes per index
Copy link
Collaborator

Choose a reason for hiding this comment

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

So 4.5MB each, from previously 4MB + 1MB. I think it's worth the increase in memory of 4MB more. Most will hopefully not be committed anyway.

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

I'm realizing also that the index buffer here is likely now oversized because if we tessellate splines to the extreme and then convert to lines, we'll run out of vertex space first. Though this didn't happen in the crash.. Oh well. I think we can spare the memory, and then be more systematic about it like a better version of the other change in the next version.

};

enum {
Expand Down
4 changes: 3 additions & 1 deletion GPU/Common/SplineCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,9 @@ void DrawEngineCommon::SubmitCurve(const void *control_points, const void *indic
output.indices = decIndex;
output.count = 0;

surface.Init(DECODED_VERTEX_BUFFER_SIZE / 2 / vertexSize);
int maxVerts = DECODED_VERTEX_BUFFER_SIZE / 2 / vertexSize;

surface.Init(maxVerts);

if (CanUseHardwareTessellation(surface.primType)) {
HardwareTessellation(output, surface, origVertType, points, tessDataTransfer);
Expand Down
1 change: 1 addition & 0 deletions GPU/Common/SplineCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define HALF_CEIL(x) (x + 1) / 2 // Integer ceil = (int)ceil((float)x / 2.0f)

// PSP compatible format so we can use the end of the pipeline in beziers etc
// 8 + 4 + 12 + 12 = 36 bytes
struct SimpleVertex {
float uv[2];
union {
Expand Down