1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-01 10:54:14 +01:00

[d3d11] Don't clear DSV aspects that are marked as read-only

Saint's Row 4 appears to be doing this. Ref #24.
This commit is contained in:
Philip Rebohle 2019-06-02 16:34:33 +02:00
parent c59a8e6e48
commit 6cbd611190
2 changed files with 14 additions and 6 deletions

View File

@ -883,10 +883,8 @@ namespace dxvk {
if (!dsv)
return;
// Figure out which aspects to clear based
// on the image format and the clear flags.
const Rc<DxvkImageView> view = dsv->GetImageView();
// Figure out which aspects to clear based on
// the image view properties and clear flags.
VkImageAspectFlags aspectMask = 0;
if (ClearFlags & D3D11_CLEAR_DEPTH)
@ -895,7 +893,10 @@ namespace dxvk {
if (ClearFlags & D3D11_CLEAR_STENCIL)
aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT;
aspectMask &= imageFormatInfo(view->info().format)->aspectMask;
aspectMask &= dsv->GetWritableAspectMask();
if (!aspectMask)
return;
VkClearValue clearValue;
clearValue.depthStencil.depth = Depth;
@ -904,7 +905,7 @@ namespace dxvk {
EmitCs([
cClearValue = clearValue,
cAspectMask = aspectMask,
cImageView = view
cImageView = dsv->GetImageView()
] (DxvkContext* ctx) {
ctx->clearRenderTarget(
cImageView,

View File

@ -63,6 +63,13 @@ namespace dxvk {
}
}
VkImageAspectFlags GetWritableAspectMask() const {
VkImageAspectFlags mask = m_view->formatInfo()->aspectMask;
if (m_desc.Flags & D3D11_DSV_READ_ONLY_DEPTH) mask &= ~VK_IMAGE_ASPECT_DEPTH_BIT;
if (m_desc.Flags & D3D11_DSV_READ_ONLY_STENCIL) mask &= ~VK_IMAGE_ASPECT_STENCIL_BIT;
return mask;
}
D3D10DepthStencilView* GetD3D10Iface() {
return &m_d3d10;
}