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

Avoid creating new List<RectangleI> when no texture uploads are required #5807

Merged
merged 3 commits into from
May 24, 2023

Conversation

peppy
Copy link
Sponsor Member

@peppy peppy commented May 24, 2023

This was triggering on every texture bind operation. Oops.

Loading song select (from an already warmed up glyph cache):

before after
JetBrains Rider 2023-05-24 at 04 01 46 JetBrains Rider 2023-05-24 at 04 03 47

…uired

This was triggering on every texture *bind* operation. Oops.
@peppy peppy requested a review from a team May 24, 2023 04:05
@smoogipoo
Copy link
Contributor

This should also be applied to GLTexture:

public unsafe bool Upload()
{
if (!Available)
return false;
// We should never run raw OGL calls on another thread than the main thread due to race conditions.
ThreadSafety.EnsureDrawThread();
List<RectangleI> uploadedRegions = new List<RectangleI>();
while (tryGetNextUpload(out ITextureUpload upload))
{
using (upload)
{
fixed (Rgba32* ptr = upload.Data)
DoUpload(upload, (IntPtr)ptr);
uploadedRegions.Add(upload.Bounds);
}
}

@peppy
Copy link
Sponsor Member Author

peppy commented May 24, 2023

Good catch, applied.

@smoogipoo smoogipoo enabled auto-merge May 24, 2023 05:22
@smoogipoo smoogipoo merged commit 5d72e48 into ppy:master May 24, 2023
11 checks passed
@peppy peppy deleted the fix-excess-list-allocs branch June 21, 2023 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants