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

Limit the amount of texture scaling done per frame to reduce stutters #6310

Merged
merged 3 commits into from
Jun 14, 2014

Conversation

hrydgard
Copy link
Owner

Scaling causes really bad stutters in some games on some hardware.

This should also reduce the impact of pathological cases like the first boss of FF Type-0 to be more bearable.

Causes some extra work but the heavy work gets spread over more frames. This probably will need some testing tuning before merge.

It should do nothing to speed if scaling is not enabled.

Scaling causes really bad stutters in some games on some hardware.

This should also reduce the impact of pathological cases like the first
boss of FF Type-0 to be more bearable.
@hrydgard hrydgard changed the title Limit the amount of scaling done per frame to reduce stutters Limit the amount of texture scaling done per frame to reduce stutters Jun 13, 2014
scaleFactor = 1;
// INFO_LOG(G3D, "Skipped scaling for now..");
} else {
texelsScaledThisFrame_ += w * h;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this clear TexCacheEntry::STATUS_TO_SCALE here instead? Consider this case:

  1. 20 large textures appear on a frame, each 256x256 (so 20 frames to scale all.)
  2. By the 20th frame, the final texture to scale has changed. This is less frequent than 15 frames, so does not disable scaling.
  3. The status is never cleared, so it gets rescaled on frame 21.

I'm not sure, there may be other cases. That or we should clear it up where we reset all the fields / always when !match.

-[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.

Hm yes, this is better. Should be fine to just clear the flag here I think..

@daniel229
Copy link
Collaborator

Yeah, less stutters in Dai-2-Ji Super Robot Taisen Z.Another way to reduce stutters is make sure cpu is active all the time,the "Force real clock sync" does that thing.

@hrydgard
Copy link
Owner Author

I've found that this isn't really noticeable in other games and greatly helps with the crazy slowdowns in FF-Type-0 so I'll merge. Slowdowns aren't completely eliminated though of course because the issue is that the game modifies the CLUTs of all textures every frame for a little while, completely messing up the texture cache.

hrydgard added a commit that referenced this pull request Jun 14, 2014
Limit the amount of texture scaling done per frame to reduce stutters
@hrydgard hrydgard merged commit 5fa331b into master Jun 14, 2014
@hrydgard hrydgard deleted the deferred-scaling branch June 14, 2014 06:59
@unknownbrackets
Copy link
Collaborator

I tested this in a few games. Almost all cap at 5 flips of deferring.

Valkyria Chronicles 3 probably gets the most deferring, at about 32 flips (might just be the texture was not used every frame, otherwise it was 20-25 iirc.) Type-0 gets 20. 3rd Birthday gets 25.

So, that's up to about a full second in a few games, but it's not too bad.

-[Unknown]

@RadarNyan
Copy link

Have empty/flat textures been considered?

@hrydgard
Copy link
Owner Author

@RadarNyan , considered how? What difference would that make?

@RadarNyan
Copy link

@hrydgard I'm wondering if a texture is empty/flat (which will not be actually scaled) will it still be counted in texelsScaledThisFrame_ (IMO, it shouldn't)

@hrydgard
Copy link
Owner Author

It will, but it hardly matters as such textures aren't that common, and it will just delay scaling a tiny bit.

@RadarNyan
Copy link

@hrydgard If it will, then if there's one 256_256 plain texture (or some smaller ones combines bigger than 256_256) added first, doesn't it mean that all textures after that will be considered exceeding TEXCACHE_MAX_TEXELS_SCALED and not getting scaled within this frame?

Of course I haven't seen a lot game (actually only one of my games, ULJM05889) updating plain/empty textures (more than) once per frame, and like you said it will get scaled after the plain/empty textures stops updating. Not really a big deal though.

@hrydgard
Copy link
Owner Author

It's indeed so, but should be rare and not really anything to worry about. If you see some scaling getting heavily delayed by that, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants