mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[d3d11] Fixed depth-stencil clear outside renderpasses
Fixes rendering in Tomb Raider (2013).
This commit is contained in:
parent
f53ada57f9
commit
14bb4ed9c2
@ -418,7 +418,7 @@ namespace dxvk {
|
|||||||
clearRect.rect.extent.width = dxvkView->mipLevelExtent(0).width;
|
clearRect.rect.extent.width = dxvkView->mipLevelExtent(0).width;
|
||||||
clearRect.rect.extent.height = dxvkView->mipLevelExtent(0).height;
|
clearRect.rect.extent.height = dxvkView->mipLevelExtent(0).height;
|
||||||
clearRect.baseArrayLayer = 0;
|
clearRect.baseArrayLayer = 0;
|
||||||
clearRect.layerCount = dxvkView->imageInfo().numLayers;
|
clearRect.layerCount = dxvkView->info().numLayers;
|
||||||
|
|
||||||
if (m_parent->GetFeatureLevel() < D3D_FEATURE_LEVEL_10_0)
|
if (m_parent->GetFeatureLevel() < D3D_FEATURE_LEVEL_10_0)
|
||||||
clearRect.layerCount = 1;
|
clearRect.layerCount = 1;
|
||||||
@ -465,6 +465,14 @@ namespace dxvk {
|
|||||||
auto dsv = static_cast<D3D11DepthStencilView*>(pDepthStencilView);
|
auto dsv = static_cast<D3D11DepthStencilView*>(pDepthStencilView);
|
||||||
const Rc<DxvkImageView> dxvkView = dsv->GetImageView();
|
const Rc<DxvkImageView> dxvkView = dsv->GetImageView();
|
||||||
|
|
||||||
|
VkImageAspectFlags aspectMask = 0;
|
||||||
|
|
||||||
|
if (ClearFlags & D3D11_CLEAR_DEPTH)
|
||||||
|
aspectMask |= VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||||
|
|
||||||
|
if (ClearFlags & D3D11_CLEAR_STENCIL)
|
||||||
|
aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||||
|
|
||||||
VkClearDepthStencilValue clearValue;
|
VkClearDepthStencilValue clearValue;
|
||||||
clearValue.depth = Depth;
|
clearValue.depth = Depth;
|
||||||
clearValue.stencil = Stencil;
|
clearValue.stencil = Stencil;
|
||||||
@ -473,16 +481,10 @@ namespace dxvk {
|
|||||||
// Image is bound to the pipeline for rendering. We can
|
// Image is bound to the pipeline for rendering. We can
|
||||||
// use the clear function that operates on attachments.
|
// use the clear function that operates on attachments.
|
||||||
VkClearAttachment clearInfo;
|
VkClearAttachment clearInfo;
|
||||||
clearInfo.aspectMask = 0;
|
clearInfo.aspectMask = aspectMask;
|
||||||
clearInfo.colorAttachment = 0;
|
clearInfo.colorAttachment = 0;
|
||||||
clearInfo.clearValue.depthStencil = clearValue;
|
clearInfo.clearValue.depthStencil = clearValue;
|
||||||
|
|
||||||
if (ClearFlags & D3D11_CLEAR_DEPTH)
|
|
||||||
clearInfo.aspectMask |= VK_IMAGE_ASPECT_DEPTH_BIT;
|
|
||||||
|
|
||||||
if (ClearFlags & D3D11_CLEAR_STENCIL)
|
|
||||||
clearInfo.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT;
|
|
||||||
|
|
||||||
// Clear the full area
|
// Clear the full area
|
||||||
VkClearRect clearRect;
|
VkClearRect clearRect;
|
||||||
clearRect.rect.offset.x = 0;
|
clearRect.rect.offset.x = 0;
|
||||||
@ -490,7 +492,7 @@ namespace dxvk {
|
|||||||
clearRect.rect.extent.width = dxvkView->mipLevelExtent(0).width;
|
clearRect.rect.extent.width = dxvkView->mipLevelExtent(0).width;
|
||||||
clearRect.rect.extent.height = dxvkView->mipLevelExtent(0).height;
|
clearRect.rect.extent.height = dxvkView->mipLevelExtent(0).height;
|
||||||
clearRect.baseArrayLayer = 0;
|
clearRect.baseArrayLayer = 0;
|
||||||
clearRect.layerCount = dxvkView->imageInfo().numLayers;
|
clearRect.layerCount = dxvkView->info().numLayers;
|
||||||
|
|
||||||
// FIXME Is this correct? Docs don't say anything
|
// FIXME Is this correct? Docs don't say anything
|
||||||
if (m_parent->GetFeatureLevel() < D3D_FEATURE_LEVEL_10_0)
|
if (m_parent->GetFeatureLevel() < D3D_FEATURE_LEVEL_10_0)
|
||||||
@ -505,10 +507,14 @@ namespace dxvk {
|
|||||||
} else {
|
} else {
|
||||||
EmitCs([
|
EmitCs([
|
||||||
cClearValue = clearValue,
|
cClearValue = clearValue,
|
||||||
cDstView = dxvkView
|
cDstView = dxvkView,
|
||||||
|
cAspectMask = aspectMask
|
||||||
] (DxvkContext* ctx) {
|
] (DxvkContext* ctx) {
|
||||||
|
VkImageSubresourceRange subresources = cDstView->subresources();
|
||||||
|
subresources.aspectMask = cAspectMask;
|
||||||
|
|
||||||
ctx->clearDepthStencilImage(cDstView->image(),
|
ctx->clearDepthStencilImage(cDstView->image(),
|
||||||
cClearValue, cDstView->subresources());
|
cClearValue, subresources);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user