1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[d3d9] Expose support for D16_LOCKABLE only on AMD

This commit is contained in:
WinterSnowfall 2024-06-23 03:43:14 +03:00 committed by Joshie
parent 18035820de
commit b03de97f1b
6 changed files with 27 additions and 2 deletions

View File

@ -570,6 +570,17 @@
# d3d9.supportX4R4G4B4 = True
# Support D16_LOCKABLE
#
# Support the D16_LOCKABLE format.
# Always enabled on AMD, or when spoofing an AMD GPU
# via customVendorId, disabled by default on Nvidia and Intel.
#
# Supported values:
# - True/False
# d3d9.supportD16Lockable = False
# Disable A8 as a Render Target
#
# Disable support for A8 format render targets

View File

@ -227,14 +227,14 @@ namespace dxvk {
if (!IsDepthFormat(DepthStencilFormat))
return D3DERR_NOTAVAILABLE;
auto dsfMapping = ConvertFormatUnfixed(DepthStencilFormat);
auto dsfMapping = GetFormatMapping(DepthStencilFormat);
if (dsfMapping.FormatColor == VK_FORMAT_UNDEFINED)
return D3DERR_NOTAVAILABLE;
if (RenderTargetFormat == dxvk::D3D9Format::NULL_FORMAT)
return D3D_OK;
auto rtfMapping = ConvertFormatUnfixed(RenderTargetFormat);
auto rtfMapping = GetFormatMapping(RenderTargetFormat);
if (rtfMapping.FormatColor == VK_FORMAT_UNDEFINED)
return D3DERR_NOTAVAILABLE;

View File

@ -438,8 +438,14 @@ namespace dxvk {
D3D9VkFormatTable::D3D9VkFormatTable(
const Rc<DxvkAdapter>& adapter,
const D3D9Options& options) {
const auto& props = adapter->deviceProperties();
uint32_t vendorId = options.customVendorId == -1 ? props.vendorID : uint32_t(options.customVendorId);
m_dfSupport = options.supportDFFormats;
m_x4r4g4b4Support = options.supportX4R4G4B4;
// Only AMD supports D16_LOCKABLE natively
m_d16lockableSupport = vendorId == uint32_t(DxvkGpuVendor::Amd) ? true : options.supportD16Lockable;
// AMD do not support 24-bit depth buffers on Vulkan,
// so we have to fall back to a 32-bit depth format.
@ -472,6 +478,9 @@ namespace dxvk {
if (Format == D3D9Format::X4R4G4B4 && !m_x4r4g4b4Support)
return D3D9_VK_FORMAT_MAPPING();
if (Format == D3D9Format::D16_LOCKABLE && !m_d16lockableSupport)
return D3D9_VK_FORMAT_MAPPING();
if (Format == D3D9Format::DF16 && !m_dfSupport)
return D3D9_VK_FORMAT_MAPPING();

View File

@ -217,6 +217,7 @@ namespace dxvk {
bool m_dfSupport;
bool m_x4r4g4b4Support;
bool m_d16lockableSupport;
};
inline bool IsFourCCFormat(D3D9Format format) {

View File

@ -55,6 +55,7 @@ namespace dxvk {
this->maxAvailableMemory = config.getOption<int32_t> ("d3d9.maxAvailableMemory", 4096);
this->supportDFFormats = config.getOption<bool> ("d3d9.supportDFFormats", vendorId != uint32_t(DxvkGpuVendor::Nvidia));
this->supportX4R4G4B4 = config.getOption<bool> ("d3d9.supportX4R4G4B4", true);
this->supportD16Lockable = config.getOption<bool> ("d3d9.supportD16Lockable", false);
this->useD32forD24 = config.getOption<bool> ("d3d9.useD32forD24", false);
this->disableA8RT = config.getOption<bool> ("d3d9.disableA8RT", false);
this->invariantPosition = config.getOption<bool> ("d3d9.invariantPosition", true);

View File

@ -78,6 +78,9 @@ namespace dxvk {
/// Support X4R4G4B4
bool supportX4R4G4B4;
/// Support D16_LOCKABLE
bool supportD16Lockable;
/// Use D32f for D24
bool useD32forD24;