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

Partial fix for issue #6427 - GPU screenshot support on D3D11 #16760

Merged
merged 8 commits into from
Jul 8, 2024

Conversation

miguedevel
Copy link
Contributor

Guidelines

  1. Rebase before opening a pull request
  2. If you are sending several unrelated fixes or features, use a branch and a separate pull request for each
  3. If possible try squashing everything in a single commit. This is particularly beneficial in the case of feature merges since it allows easy bisecting when a problem arises

Description

This is a partial fix for issue #6427 . I say partial because only D3D11 screenshot support is implemented.
Also, this method produces incorrect result if using HDR so it will produce nothing instead.
I tested this on Windows 11 and Windows 10 one with NVIDIA GPU and another with AMD GPU.
Does this affect Xbox One or UWP???

Related Issues

Issue #6427
Issue #14432 (not tested)

Related Pull Requests

[Any other PRs from related repositories that might be needed for this pull request to work]

Reviewers

[If possible @mention all the people that should review your pull request]

In my limited testing, the texture is always in the R8G8B8A8 format, but, just incase, added a check for it and if it isn't then bail out.
The current implementation does not produce the right results if HDR is enabled so let's bail out.
@miguedevel miguedevel changed the title Partially fix for issue #6427 - GPU screenshot support on D3D11 Partial fix for issue #6427 - GPU screenshot support on D3D11 Jul 6, 2024
@LibretroAdmin
Copy link
Contributor

The D3D11 driver is also used by UWP/Xbox if that's what you mean.

Also it would be nice if we could figure out a way to get it working with HDR too. This could be a good first step towards that though.

@hizzlekizzle
Copy link
Contributor

IIRC, Vulkan screenshots don't work with HDR, either.

@miguedevel
Copy link
Contributor Author

miguedevel commented Jul 6, 2024

Vulkan does support HDR screenshots and according to the code /* Hdr readback is implemented through format conversion on the GPU */ /shrug
EDIT: With that, I mean it creates a proper non HDR screenshot.

I tried a naive way of just bit-shifting from 10 bits to 8 but it produces a very dim/contrast-less image.

@LibretroAdmin
Copy link
Contributor

I'll merge this for now.

I do hope though you'll take the initiative of researching a solution for HDR since it's pretty important in the long run and increasingly more and more ppl will run RetroArch with it enabled.

@LibretroAdmin LibretroAdmin merged commit 6d2393c into libretro:master Jul 8, 2024
27 checks passed
@miguedevel miguedevel deleted the d3d11_screenshot branch July 9, 2024 00:02
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.

None yet

3 participants