mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 10:24:12 +01:00
[dxvk] Fix deferred depth-stencil clears
If a game clears the depth and stencil aspects of a depth-stencil buffer separately, we must not override the load op and clear value of the previously set aspect. Fixes a rendering issue in Hitman Absolution.
This commit is contained in:
parent
974db9712b
commit
4d1a70bd89
@ -493,17 +493,35 @@ namespace dxvk {
|
|||||||
clearRect.baseArrayLayer = 0;
|
clearRect.baseArrayLayer = 0;
|
||||||
clearRect.layerCount = imageView->info().numLayers;
|
clearRect.layerCount = imageView->info().numLayers;
|
||||||
|
|
||||||
m_cmd->cmdClearAttachments(
|
m_cmd->cmdClearAttachments(1, &clearInfo, 1, &clearRect);
|
||||||
1, &clearInfo, 1, &clearRect);
|
|
||||||
} else {
|
} else {
|
||||||
// Perform the clear when starting the render pass
|
// Perform the clear when starting the render pass
|
||||||
if (clearAspects & VK_IMAGE_ASPECT_COLOR_BIT)
|
if (clearAspects & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||||
m_state.om.renderPassOps.colorOps[attachmentIndex] = colorOp;
|
m_state.om.renderPassOps.colorOps[attachmentIndex] = colorOp;
|
||||||
|
m_state.om.clearValues[attachmentIndex].color = clearValue.color;
|
||||||
|
}
|
||||||
|
|
||||||
if (clearAspects & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT))
|
if (clearAspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
||||||
m_state.om.renderPassOps.depthOps = depthOp;
|
m_state.om.renderPassOps.depthOps.loadOpD = depthOp.loadOpD;
|
||||||
|
m_state.om.renderPassOps.depthOps.storeOpD = depthOp.storeOpD;
|
||||||
|
m_state.om.clearValues[attachmentIndex].depthStencil.depth = clearValue.depthStencil.depth;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clearAspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||||
|
m_state.om.renderPassOps.depthOps.loadOpS = depthOp.loadOpS;
|
||||||
|
m_state.om.renderPassOps.depthOps.storeOpS = depthOp.storeOpS;
|
||||||
|
m_state.om.clearValues[attachmentIndex].depthStencil.stencil = clearValue.depthStencil.stencil;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clearAspects & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
|
||||||
|
m_state.om.renderPassOps.depthOps.loadLayout = depthOp.loadLayout;
|
||||||
|
m_state.om.renderPassOps.depthOps.storeLayout = depthOp.storeLayout;
|
||||||
|
|
||||||
|
if (m_state.om.renderPassOps.depthOps.loadOpD == VK_ATTACHMENT_LOAD_OP_CLEAR
|
||||||
|
&& m_state.om.renderPassOps.depthOps.loadOpS == VK_ATTACHMENT_LOAD_OP_CLEAR)
|
||||||
|
m_state.om.renderPassOps.depthOps.loadLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
m_state.om.clearValues[attachmentIndex] = clearValue;
|
|
||||||
m_flags.set(DxvkContextFlag::GpClearRenderTargets);
|
m_flags.set(DxvkContextFlag::GpClearRenderTargets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user