1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

[d3d9] Don't expose formats with alpha as adapter formats

Impacts #1440
This commit is contained in:
Joshua Ashton 2020-02-14 00:46:02 +00:00
parent acb3cda1dc
commit cf6142e782
3 changed files with 4 additions and 24 deletions

View File

@ -102,10 +102,7 @@ namespace dxvk {
DWORD Usage, DWORD Usage,
D3DRESOURCETYPE RType, D3DRESOURCETYPE RType,
D3D9Format CheckFormat) { D3D9Format CheckFormat) {
if (!IsSupportedAdapterFormat(AdapterFormat)) if (!IsSupportedAdapterFormat(AdapterFormat, false))
return D3DERR_INVALIDCALL;
if (!IsSupportedDisplayFormat(AdapterFormat, false))
return D3DERR_NOTAVAILABLE; return D3DERR_NOTAVAILABLE;
const bool dmap = Usage & D3DUSAGE_DMAP; const bool dmap = Usage & D3DUSAGE_DMAP;
@ -213,7 +210,7 @@ namespace dxvk {
D3D9Format AdapterFormat, D3D9Format AdapterFormat,
D3D9Format RenderTargetFormat, D3D9Format RenderTargetFormat,
D3D9Format DepthStencilFormat) { D3D9Format DepthStencilFormat) {
if (!IsSupportedAdapterFormat(AdapterFormat)) if (!IsSupportedAdapterFormat(AdapterFormat, false))
return D3DERR_NOTAVAILABLE; return D3DERR_NOTAVAILABLE;
if (!IsDepthFormat(DepthStencilFormat)) if (!IsDepthFormat(DepthStencilFormat))
@ -771,7 +768,7 @@ namespace dxvk {
m_modeCacheFormat = Format; m_modeCacheFormat = Format;
// Skip unsupported formats // Skip unsupported formats
if (!IsSupportedAdapterFormat(Format) || !IsSupportedDisplayFormat(Format, false)) if (!IsSupportedAdapterFormat(Format, false))
return; return;
auto& options = m_parent->GetOptions(); auto& options = m_parent->GetOptions();

View File

@ -26,17 +26,6 @@ namespace dxvk {
bool IsSupportedAdapterFormat( bool IsSupportedAdapterFormat(
D3D9Format Format) {
return Format == D3D9Format::A2R10G10B10
|| Format == D3D9Format::X8R8G8B8
|| Format == D3D9Format::A8R8G8B8
|| Format == D3D9Format::X1R5G5B5
|| Format == D3D9Format::A1R5G5B5
|| Format == D3D9Format::R5G6B5;
}
bool IsSupportedDisplayFormat(
D3D9Format Format, D3D9Format Format,
BOOL Windowed) { BOOL Windowed) {
return (Format == D3D9Format::A2R10G10B10 && !Windowed) return (Format == D3D9Format::A2R10G10B10 && !Windowed)
@ -50,10 +39,7 @@ namespace dxvk {
D3D9Format AdapterFormat, D3D9Format AdapterFormat,
D3D9Format BackBufferFormat, D3D9Format BackBufferFormat,
BOOL Windowed) { BOOL Windowed) {
if (!IsSupportedAdapterFormat(AdapterFormat)) if (!IsSupportedAdapterFormat(AdapterFormat, Windowed))
return false;
if (AdapterFormat == D3D9Format::A2R10G10B10 && Windowed)
return false; return false;
return AdapterFormat == BackBufferFormat return AdapterFormat == BackBufferFormat

View File

@ -23,9 +23,6 @@ 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);
bool IsSupportedDisplayFormat(
D3D9Format Format, D3D9Format Format,
BOOL Windowed); BOOL Windowed);