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

[dxvk] Only force late clears on older Nvidia drivers

Disables the workaround introduced in 00872e9e4f
on drivers that were not affected by the bug.
This commit is contained in:
Philip Rebohle 2024-11-03 13:15:24 +01:00
parent 3c88591326
commit b7f2bb8bef
3 changed files with 12 additions and 9 deletions

View File

@ -1783,7 +1783,8 @@ namespace dxvk {
}
if (attachmentIndex < 0) {
bool hasViewFormatMismatch = imageView->info().format != imageView->image()->info().format;
bool useLateClear = m_device->perfHints().renderPassClearFormatBug
&& imageView->info().format != imageView->image()->info().format;
flushPendingAccesses(*imageView, DxvkAccess::Write);
@ -1818,9 +1819,7 @@ namespace dxvk {
attachmentInfo.loadOp = colorOp.loadOp;
// We can't use LOAD_OP_CLEAR if the view format does not match the
// underlying image format, so just discard here and use clear later.
if (hasViewFormatMismatch && attachmentInfo.loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
if (useLateClear && attachmentInfo.loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
attachmentInfo.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
renderingInfo.colorAttachmentCount = 1;
@ -1853,9 +1852,9 @@ namespace dxvk {
m_cmd->cmdBeginRendering(&renderingInfo);
if (hasViewFormatMismatch) {
if (useLateClear && clearAspects) {
VkClearAttachment clearInfo = { };
clearInfo.aspectMask = imageView->info().aspects;
clearInfo.aspectMask = clearAspects;
clearInfo.clearValue = clearValue;
VkClearRect clearRect = { };
@ -4661,9 +4660,8 @@ namespace dxvk {
if (ops.colorOps[i].loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR) {
colorInfos[i].clearValue.color = ops.colorOps[i].clearValue;
// We can't use LOAD_OP_CLEAR if the view format does not match the
// underlying image format, so just discard here and use clear later.
if (colorTarget.view->info().format != colorTarget.view->image()->info().format) {
if (m_device->perfHints().renderPassClearFormatBug
&& colorTarget.view->info().format != colorTarget.view->image()->info().format) {
colorInfos[i].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
auto& clear = lateClears[lateClearCount++];

View File

@ -346,6 +346,10 @@ namespace dxvk {
hints.preferFbResolve = m_features.amdShaderFragmentMask
&& (m_adapter->matchesDriver(VK_DRIVER_ID_AMD_OPEN_SOURCE_KHR)
|| m_adapter->matchesDriver(VK_DRIVER_ID_AMD_PROPRIETARY_KHR));
// Older Nvidia drivers sometimes use the wrong format
// to interpret the clear color in render pass clears.
hints.renderPassClearFormatBug = m_adapter->matchesDriver(
VK_DRIVER_ID_NVIDIA_PROPRIETARY, Version(), Version(560, 28, 3));
return hints;
}

View File

@ -36,6 +36,7 @@ namespace dxvk {
struct DxvkDevicePerfHints {
VkBool32 preferFbDepthStencilCopy : 1;
VkBool32 preferFbResolve : 1;
VkBool32 renderPassClearFormatBug : 1;
};
/**