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 bounding box values between register reads in DX11/GL #9648

Merged
merged 2 commits into from May 28, 2021

Conversation

stenzek
Copy link
Contributor

@stenzek stenzek commented Apr 17, 2021

This was present in the Vulkan and DX12 renderers, but not DX11/GL.

Quick test shows 60fps->90fps at 1x, and 55fps->80fps at 3x on an AMD GPU.

Bounding box is broken on OpenGL/AMD due to what seems to be a driver bug - the atomic only works on one of the fields, so I can't test it.

@@ -36,43 +50,101 @@ void BoundingBox::Shutdown()
glDeleteBuffers(1, &s_bbox_buffer_id);
}

void BoundingBox::Set(int index, int value)
void BoundingBox::Flush()
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know enough about BoundingBox stuff to know if this is worth it but longer term it makes me wonder if we could split some of this out to a AbstractBoundingBox class that does some of this common logic and calls into the backend specific functionality. This is near identical to the D3D11::Flush() . I haven't looked at the other backends to know if they are similar but you mentioned there is caching there too..

@Techjar
Copy link
Contributor

Techjar commented Apr 18, 2021

This makes bounding box effects much faster in Paper Mario TTYD on D3D11 with an NVIDIA GPU. OpenGL got a marginal performance gain as well. However, despite what the PR description seems to imply, D3D12 is very slow.

Copy link
Member

@phire phire left a comment

Choose a reason for hiding this comment

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

One thing I'm noticing (and it seems to extend to the VK and DX12 cache implementations too) is that bounding box behaviour is ill-defined during save-state load.

At the very least, perhaps the caches should be flushed after a save-state load to prevent dirty cached bbox values from being loaded. But even that could produce invalid results if there is a save state between the finish of a draw and the bbox values being read.

I'm not sure if this is worth worrying about. This shouldn't effect regular users, just people doing debugging with save-states, which is already a hairy proposition with lots of edge cases

@Techjar
Copy link
Contributor

Techjar commented May 27, 2021

@stenzek Can you please rebase this? It conflcits as a result of #9736.

@dolphin-emu-bot
Copy link
Contributor

FifoCI detected that this change impacts graphical rendering. Here are the behavior differences detected by the system:

  • viewitful-joe-distortion on ogl-lin-mesa: diff
  • viewitful-joe-distortion on ogl-lin-radeon: diff
  • viewitful-joe-distortion on uberogl-lin-radeon: diff

automated-fifoci-reporter

@stenzek
Copy link
Contributor Author

stenzek commented May 28, 2021

^ I think this fifoci diff is a false herring, bounding box shouldn't affect anything here.

@stenzek stenzek merged commit 37d0559 into dolphin-emu:master May 28, 2021
@stenzek stenzek deleted the dx11-gl-bbox-caching branch May 28, 2021 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants