Open madewokherd opened 9 months ago
Forgot to mention: the first bad commit is 508d572a675f016df7ec90431e40ce6338854b0d
A quick test shows that Wine was not using the DXGI_FORMAT_R8G8B8A8_UNORM fallback, so I guess DXGI_FORMAT_R8G8B8A8_UNORM_SRGB does work but CheckFormatSupport isn't able to determine that.
Let me know if reporting this to Winehq would be appropriate. I'm kinda in over my head here.
Looks like WineD3D is missing the SUPPORT_DISPLAY flags, which are required for some formats depending on the feature level: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/bb173064(v=vs.85)
This will likely come up more often as HDR adoption in particular increases.
Not sure if the WineHQ Bugzilla has a ticket yet, but I wrote a quick patch that would fix this for WineD3D:
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 061fd57fe09..bfe0a92f805 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -3960,6 +3960,32 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 *
| D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD;
}
+ if (feature_level >= D3D_FEATURE_LEVEL_9_1)
+ {
+ if (format == DXGI_FORMAT_R8G8B8A8_UNORM ||
+ format == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB ||
+ format == DXGI_FORMAT_B8G8R8A8_UNORM ||
+ format == DXGI_FORMAT_B8G8R8A8_UNORM_SRGB)
+ {
+ *format_support |= D3D11_FORMAT_SUPPORT_DISPLAY;
+ }
+ }
+ if (feature_level >= D3D_FEATURE_LEVEL_10_0)
+ {
+ if (format == DXGI_FORMAT_R16G16B16A16_FLOAT ||
+ format == DXGI_FORMAT_R10G10B10A2_UNORM)
+ {
+ *format_support |= D3D11_FORMAT_SUPPORT_DISPLAY;
+ }
+ }
+ if (feature_level >= D3D_FEATURE_LEVEL_11_0)
+ {
+ if (format == DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM)
+ {
+ *format_support |= D3D11_FORMAT_SUPPORT_DISPLAY;
+ }
+ }
+
return *format_support ? S_OK : E_FAIL;
}
I'm sure the WineD3D team would want something more thorough/accurate-to-hardware but this at least covers the surface formats mandated by the D3D feature levels!
They might be OK with a partial solution like this.
Since we didn't have any other commits this month I went ahead and added a quick workaround that should make XNA games happy:
https://github.com/FNA-XNA/FNA3D/commit/085e573d4228ce7bf6abf0e48e2710cbc113f973
We'll undo this when WineD3D is caught up! Will keep this issue open to track on our end.
Thanks, it works so I just merged the update. At some point I'll file a Winehq bug and link it here.
Filed a Winehq bug: https://bugs.winehq.org/show_bug.cgi?id=56383
Tested for merging into Wine Mono, but this most likely affects Wine generally. I used One Finger Death Punch to test.
Excerpt of terminal output:
So it's probably something with Wine's CheckFormatSupport stub.