mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 05:52:11 +01:00
[d3d9] Expose adapter/backbuffer formats properly
Matches native behaviour in my testing.
This commit is contained in:
parent
58d6f018bb
commit
fcaab6aa46
@ -90,10 +90,10 @@ namespace dxvk {
|
|||||||
D3D9Format AdapterFormat,
|
D3D9Format AdapterFormat,
|
||||||
D3D9Format BackBufferFormat,
|
D3D9Format BackBufferFormat,
|
||||||
BOOL bWindowed) {
|
BOOL bWindowed) {
|
||||||
if (!IsSupportedAdapterFormat(AdapterFormat, bWindowed) && !bWindowed)
|
if (!IsSupportedAdapterFormat(AdapterFormat))
|
||||||
return D3DERR_NOTAVAILABLE;
|
return D3DERR_NOTAVAILABLE;
|
||||||
|
|
||||||
if (!IsSupportedBackBufferFormat(BackBufferFormat, bWindowed))
|
if (!IsSupportedBackBufferFormat(AdapterFormat, BackBufferFormat, bWindowed))
|
||||||
return D3DERR_NOTAVAILABLE;
|
return D3DERR_NOTAVAILABLE;
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
@ -106,7 +106,7 @@ namespace dxvk {
|
|||||||
DWORD Usage,
|
DWORD Usage,
|
||||||
D3DRESOURCETYPE RType,
|
D3DRESOURCETYPE RType,
|
||||||
D3D9Format CheckFormat) {
|
D3D9Format CheckFormat) {
|
||||||
if (!IsSupportedAdapterFormat(AdapterFormat, false))
|
if (!IsSupportedAdapterFormat(AdapterFormat))
|
||||||
return D3DERR_NOTAVAILABLE;
|
return D3DERR_NOTAVAILABLE;
|
||||||
|
|
||||||
const bool dmap = Usage & D3DUSAGE_DMAP;
|
const bool dmap = Usage & D3DUSAGE_DMAP;
|
||||||
@ -232,7 +232,7 @@ namespace dxvk {
|
|||||||
D3DDEVTYPE DeviceType,
|
D3DDEVTYPE DeviceType,
|
||||||
D3D9Format SourceFormat,
|
D3D9Format SourceFormat,
|
||||||
D3D9Format TargetFormat) {
|
D3D9Format TargetFormat) {
|
||||||
bool sourceSupported = IsSupportedBackBufferFormat(SourceFormat, FALSE);
|
bool sourceSupported = IsSupportedBackBufferFormat(D3D9Format::Unknown, SourceFormat, TRUE);
|
||||||
bool targetSupported = TargetFormat == D3D9Format::X1R5G5B5
|
bool targetSupported = TargetFormat == D3D9Format::X1R5G5B5
|
||||||
|| TargetFormat == D3D9Format::A1R5G5B5
|
|| TargetFormat == D3D9Format::A1R5G5B5
|
||||||
|| TargetFormat == D3D9Format::R5G6B5
|
|| TargetFormat == D3D9Format::R5G6B5
|
||||||
@ -757,7 +757,7 @@ namespace dxvk {
|
|||||||
m_modeCacheFormat = Format;
|
m_modeCacheFormat = Format;
|
||||||
|
|
||||||
// Skip unsupported formats
|
// Skip unsupported formats
|
||||||
if (!IsSupportedAdapterFormat(Format, false))
|
if (!IsSupportedAdapterFormat(Format))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto& options = m_parent->GetOptions();
|
auto& options = m_parent->GetOptions();
|
||||||
@ -808,4 +808,4 @@ namespace dxvk {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6873,9 +6873,7 @@ namespace dxvk {
|
|||||||
" - Windowed: ", pPresentationParameters->Windowed ? "true" : "false", "\n"));
|
" - Windowed: ", pPresentationParameters->Windowed ? "true" : "false", "\n"));
|
||||||
|
|
||||||
if (backBufferFmt != D3D9Format::Unknown) {
|
if (backBufferFmt != D3D9Format::Unknown) {
|
||||||
if (!IsSupportedBackBufferFormat(
|
if (!IsSupportedBackBufferFormat(backBufferFmt)) {
|
||||||
backBufferFmt,
|
|
||||||
pPresentationParameters->Windowed)) {
|
|
||||||
Logger::err(str::format("D3D9DeviceEx::ResetSwapChain: Unsupported backbuffer format: ",
|
Logger::err(str::format("D3D9DeviceEx::ResetSwapChain: Unsupported backbuffer format: ",
|
||||||
EnumerateFormat(pPresentationParameters->BackBufferFormat)));
|
EnumerateFormat(pPresentationParameters->BackBufferFormat)));
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
@ -26,8 +26,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
bool IsSupportedAdapterFormat(
|
bool IsSupportedAdapterFormat(
|
||||||
D3D9Format Format,
|
D3D9Format Format) {
|
||||||
BOOL Windowed) {
|
|
||||||
return Format == D3D9Format::A2R10G10B10
|
return Format == D3D9Format::A2R10G10B10
|
||||||
|| Format == D3D9Format::X8R8G8B8
|
|| Format == D3D9Format::X8R8G8B8
|
||||||
|| Format == D3D9Format::X1R5G5B5
|
|| Format == D3D9Format::X1R5G5B5
|
||||||
@ -36,8 +35,23 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
bool IsSupportedBackBufferFormat(
|
bool IsSupportedBackBufferFormat(
|
||||||
|
D3D9Format AdapterFormat,
|
||||||
D3D9Format BackBufferFormat,
|
D3D9Format BackBufferFormat,
|
||||||
BOOL Windowed) {
|
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
|
return BackBufferFormat == D3D9Format::A2R10G10B10
|
||||||
|| BackBufferFormat == D3D9Format::A8R8G8B8
|
|| BackBufferFormat == D3D9Format::A8R8G8B8
|
||||||
|| BackBufferFormat == D3D9Format::X8R8G8B8
|
|| BackBufferFormat == D3D9Format::X8R8G8B8
|
||||||
|
@ -23,11 +23,13 @@ namespace dxvk {
|
|||||||
* \returns If it is supported as a swapchain/backbuffer format.
|
* \returns If it is supported as a swapchain/backbuffer format.
|
||||||
*/
|
*/
|
||||||
bool IsSupportedAdapterFormat(
|
bool IsSupportedAdapterFormat(
|
||||||
D3D9Format Format,
|
D3D9Format Format);
|
||||||
BOOL Windowed);
|
|
||||||
|
|
||||||
bool IsSupportedBackBufferFormat(
|
bool IsSupportedBackBufferFormat(
|
||||||
|
D3D9Format AdapterFormat,
|
||||||
D3D9Format BackBufferFormat,
|
D3D9Format BackBufferFormat,
|
||||||
BOOL Windowed);
|
BOOL Windowed);
|
||||||
|
|
||||||
}
|
bool IsSupportedBackBufferFormat(
|
||||||
|
D3D9Format BackBufferFormat);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user