1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[d3d9] Expose adapter/backbuffer formats properly

Matches native behaviour in my testing.
This commit is contained in:
Joshua Ashton 2021-02-06 08:57:32 +00:00
parent 58d6f018bb
commit fcaab6aa46
No known key found for this signature in database
GPG Key ID: C85A08669126BE8D
4 changed files with 28 additions and 14 deletions

View File

@ -90,10 +90,10 @@ namespace dxvk {
D3D9Format AdapterFormat,
D3D9Format BackBufferFormat,
BOOL bWindowed) {
if (!IsSupportedAdapterFormat(AdapterFormat, bWindowed) && !bWindowed)
if (!IsSupportedAdapterFormat(AdapterFormat))
return D3DERR_NOTAVAILABLE;
if (!IsSupportedBackBufferFormat(BackBufferFormat, bWindowed))
if (!IsSupportedBackBufferFormat(AdapterFormat, BackBufferFormat, bWindowed))
return D3DERR_NOTAVAILABLE;
return D3D_OK;
@ -106,7 +106,7 @@ namespace dxvk {
DWORD Usage,
D3DRESOURCETYPE RType,
D3D9Format CheckFormat) {
if (!IsSupportedAdapterFormat(AdapterFormat, false))
if (!IsSupportedAdapterFormat(AdapterFormat))
return D3DERR_NOTAVAILABLE;
const bool dmap = Usage & D3DUSAGE_DMAP;
@ -232,7 +232,7 @@ namespace dxvk {
D3DDEVTYPE DeviceType,
D3D9Format SourceFormat,
D3D9Format TargetFormat) {
bool sourceSupported = IsSupportedBackBufferFormat(SourceFormat, FALSE);
bool sourceSupported = IsSupportedBackBufferFormat(D3D9Format::Unknown, SourceFormat, TRUE);
bool targetSupported = TargetFormat == D3D9Format::X1R5G5B5
|| TargetFormat == D3D9Format::A1R5G5B5
|| TargetFormat == D3D9Format::R5G6B5
@ -757,7 +757,7 @@ namespace dxvk {
m_modeCacheFormat = Format;
// Skip unsupported formats
if (!IsSupportedAdapterFormat(Format, false))
if (!IsSupportedAdapterFormat(Format))
return;
auto& options = m_parent->GetOptions();
@ -808,4 +808,4 @@ namespace dxvk {
});
}
}
}

View File

@ -6873,9 +6873,7 @@ namespace dxvk {
" - Windowed: ", pPresentationParameters->Windowed ? "true" : "false", "\n"));
if (backBufferFmt != D3D9Format::Unknown) {
if (!IsSupportedBackBufferFormat(
backBufferFmt,
pPresentationParameters->Windowed)) {
if (!IsSupportedBackBufferFormat(backBufferFmt)) {
Logger::err(str::format("D3D9DeviceEx::ResetSwapChain: Unsupported backbuffer format: ",
EnumerateFormat(pPresentationParameters->BackBufferFormat)));
return D3DERR_INVALIDCALL;

View File

@ -26,8 +26,7 @@ namespace dxvk {
bool IsSupportedAdapterFormat(
D3D9Format Format,
BOOL Windowed) {
D3D9Format Format) {
return Format == D3D9Format::A2R10G10B10
|| Format == D3D9Format::X8R8G8B8
|| Format == D3D9Format::X1R5G5B5
@ -36,8 +35,23 @@ namespace dxvk {
bool IsSupportedBackBufferFormat(
D3D9Format AdapterFormat,
D3D9Format BackBufferFormat,
BOOL Windowed) {
if (!Windowed) {
return (AdapterFormat == D3D9Format::A2R10G10B10 && BackBufferFormat == D3D9Format::A2R10G10B10) ||
(AdapterFormat == D3D9Format::X8R8G8B8 && BackBufferFormat == D3D9Format::X8R8G8B8) ||
(AdapterFormat == D3D9Format::X8R8G8B8 && BackBufferFormat == D3D9Format::A8R8G8B8) ||
(AdapterFormat == D3D9Format::X1R5G5B5 && BackBufferFormat == D3D9Format::X1R5G5B5) ||
(AdapterFormat == D3D9Format::X1R5G5B5 && BackBufferFormat == D3D9Format::A1R5G5B5) ||
(AdapterFormat == D3D9Format::R5G6B5 && BackBufferFormat == D3D9Format::R5G6B5);
}
return IsSupportedBackBufferFormat(BackBufferFormat);
}
bool IsSupportedBackBufferFormat(
D3D9Format BackBufferFormat) {
return BackBufferFormat == D3D9Format::A2R10G10B10
|| BackBufferFormat == D3D9Format::A8R8G8B8
|| BackBufferFormat == D3D9Format::X8R8G8B8

View File

@ -23,11 +23,13 @@ namespace dxvk {
* \returns If it is supported as a swapchain/backbuffer format.
*/
bool IsSupportedAdapterFormat(
D3D9Format Format,
BOOL Windowed);
D3D9Format Format);
bool IsSupportedBackBufferFormat(
D3D9Format AdapterFormat,
D3D9Format BackBufferFormat,
BOOL Windowed);
}
bool IsSupportedBackBufferFormat(
D3D9Format BackBufferFormat);
}