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

Cache computed planes used for BBOX culling #17810

Merged
merged 3 commits into from
Jul 30, 2023
Merged

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Jul 30, 2023

This isn't a huge performance boost for the games that use BBOX (like Tekken), although it does cut down these particular computations to a quarter-ish, but it'll be more valuable if we start using soft culling more widely automatically without BBOX, see #17808 . It's starting to look pretty interesting for performance in many games (though definitely not all).

EDIT: Hm, this fails the tests, interestingly..

This isn't a huge performance boost for the games that use BBOX (like
Tekken), but it'll be more valuable if we start using soft culling more
widely automatically, see #17808
@hrydgard hrydgard added the GE emulation Backend-independent GPU issues label Jul 30, 2023
@hrydgard hrydgard added this to the v1.16.0 milestone Jul 30, 2023
Copy link
Collaborator

@unknownbrackets unknownbrackets left a comment

Choose a reason for hiding this comment

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

This is missing:

  • GPUgstate::Reset() needs to dirty.
  • GPUgstate::Restore() needs to dirty.
  • GPUStateCache::DoState() maybe too on load?
  • SoftGPU::Execute_*Mtx*() which is probably key to the test failing, i.e. your changes are only in GPUCommonHW. SoftGPU updates "visible" matrices more accurately and has separate dirty flags for flushing software rendering.

-[Unknown]

@hrydgard
Copy link
Owner Author

Ah, thanks for the list :)

@unknownbrackets
Copy link
Collaborator

It still doesn't use the "normal" dirtying flags from HW, i.e. for scissor. These are mostly useless to softgpu because it sends primitives to the queue right away, but tries to flush as inoften as possible. I think we could just override Execute_BoundingBox and always mark dirty there, or else check the SoftDirty::BINNER_RANGE flag (which covers everything here) and translate it to the cull dirty flag.

-[Unknown]

@hrydgard
Copy link
Owner Author

hrydgard commented Jul 30, 2023

Right.. I like the option of checking SoftDirty::BINNER_RANGE flags and translating, though what would be good place to do that? Or I suppose could just do that in an overridden Execute_BoundingBox handler.

Actually I'll just do the simpler thing and always set it, for now.

@unknownbrackets
Copy link
Collaborator

This would be the place, since it's where the flag is checked and cleared:

ClearDirty(SoftDirty::BINNER_RANGE);

But it's only done on submit to the binner, so it'd also need to be checked before testing the bounding box (and couldn't be cleared then.) Not super simple... well, we could add another dirty flag, but I'm not sure how much this would even help softgpu, for bbox tests alone. And it's already culling verts on intake.

-[Unknown]

@hrydgard
Copy link
Owner Author

That seems to work and should be safe, so I'll go with that.

@hrydgard hrydgard merged commit 4c560e4 into master Jul 30, 2023
19 checks passed
@hrydgard hrydgard deleted the bbox-cache-planes branch July 30, 2023 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GE emulation Backend-independent GPU issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants