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

GE Debugger: Normalize framebuffer texture preview #16201

Merged
merged 7 commits into from
Oct 11, 2022

Conversation

unknownbrackets
Copy link
Collaborator

It's long been confusing that the texture preview shows framebuffers at their actual size, even though the area it textures from is different (especially confusing if it's using an offset.) This also screwed up the texture preview source coordinates, since they were [0, 1] based on the correct size.

To fix this:

  • Crop, offset, or pad the framebuffer data returned and shown in the debugger.
  • Centralize this logic, and cleanup D3D9 in the process, so it's all common.
  • Also show the depth buffer bound, if depth is being used.
  • Explicitly display "FB Tex" instead of "Texture" if it's a framebuffer, so we can still tell.

Since I was messing around with this, I also cleaned up the calls and made it use GL 3.3+ where available, mainly so RenderDoc will stop giving up on life if I open the GE debugger while it's attached.

It's nice to remove a bunch of lines of code every once and again. This no longer caches offscreen surfaces, which I'm no longer convinced was ever a good idea - I quickly searched and saw ANGLE, etc. don't do that. I think we (I?) just assumed because we were caching framebufs, caching offscreen surfaces was a good idea.

Because this normalizes a bunch of D3D9 code, it may fix some D3D9 bugs but I'm not specifically aware of any. Hopefully it doesn't create any either...

-[Unknown]

This works like other backends, including D3D11.  This allows us to get
rid of the old implementation and reuse more code.
We can just use Draw now.  Keep depth, though, since it applies scale.
Previously, we would show the render-to-texture with its original
dimensions.  While useful, this skewed the preview coordinates and was
sometimes confusing.  Additionally, depth texturing didn't preview.

This pads and subsets the texture preview so it's the right size.
Note: still a separate context from Draw, since it's drawn to an entirely
separate window.

This stops RenderDoc from getting angry.
Rather than guessing based on size, let's show explicitly.
@unknownbrackets unknownbrackets added this to the v1.14.0 milestone Oct 11, 2022
@hrydgard
Copy link
Owner

Very nice to get rid of all that d3d9-specialized code! Yeah agree that caching the offscreen surfaces probably isn't worth it.

@hrydgard hrydgard merged commit 901f698 into hrydgard:master Oct 11, 2022
@unknownbrackets unknownbrackets deleted the gedebugger branch October 11, 2022 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants