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

Fix issues with CheckDeviceFormat & CheckDeviceFormatConversion #4161

Merged
merged 2 commits into from
Jul 19, 2024

Conversation

K0bin
Copy link
Collaborator

@K0bin K0bin commented Jul 19, 2024

Fixes #4158

Serious Sam 2 has 3 ways of uploading video frames:

  • Lock XRGB texture and write XRGB data to that texture.
    That happens when: YUY2 textures are supported in CheckDeviceFormat. DXVK master hits this code path on Nvidia GPUs because we check for sampling support on VK_FORMAT_G8B8G8R8_422_UNORM and Nvidia supports that.
  • Lock YUY2 offscreen surface and write YUY2 data to that surface. Copy it to a XRGB texture afterwards using StretchRect.
    That happens when: YUY2 textures are unsupported but YUY2 surfaces are supported in CheckDeviceFormat. Additionally YUY2 is supported as a source format in CheckDeviceFormatConversion.
  • Lock XRGB texture and write YUY2 data to that texture.
    That happens when:
    • either YUY2 textures are unsupported in CheckDeviceFormat but YUY2 surfaces are supported in CheckDeviceFormat. At the same time YUY2 is not supported as a source format in CheckDeviceFormatConversion.
    • neither YUY2 textures nor surfaces are supported in CheckDeviceFormat. This is what happens with DXVK master on RADV because it does not support VK_FORMAT_G8B8G8R8_422_UNORM images.

Given that it also manages to get writing to the XRGB texture right in one of the cases, I'm pretty sure this is a game bug because no actual hardware hits that.
I do not know why support for YUY2 textures makes it use the code path where it writes XRGB data.

The case that YUY2 surfaces are supported in CheckDeviceFormat but not as a source format in CheckDeviceFormatConversion is almost certainly wrong anyway.

The first commit is pretty straightforward and should be clear.

The second one is because CheckDeviceFormatConversion also decides whether or not a format is supported in StretchRect. We do support YUY2 there.

The docs say (emphasis mine):

CheckDeviceFormatConversion can also be used to determine which combinations of source surface formats and destination surface formats are permissible in calls to StretchRect.
[...]
The source format must be a FOURCC format or a valid back buffer format.

@K0bin K0bin added the d3d9 label Jul 19, 2024
The docs say:
"The source format must be a FOURCC format or a valid back buffer format."
@mrdeathjr28
Copy link

yeah in my case fix cinematics

ss2fx

@K0bin K0bin requested review from misyltoad and doitsujin July 19, 2024 17:09
@misyltoad misyltoad merged commit 031a98c into doitsujin:master Jul 19, 2024
4 checks passed
@K0bin K0bin deleted the serioussam2 branch July 19, 2024 21:06
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.

Serious Sam 2 Videos are broken
3 participants