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

[dxvk] Use default layout for depth-stencil image descriptors

Apparently the image layout matching rules were relaxed at some point,
so just using DEPTH_STENCIL_READ_ONLY_OPTIMAL for descriptors is legal
even if the image is in DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL or
DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL in the current render pass.
This commit is contained in:
Philip Rebohle 2021-02-15 15:42:52 +01:00
parent ec5c324643
commit df76a5252a
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -3791,20 +3791,6 @@ namespace dxvk {
DxvkBindingMask bindMask; DxvkBindingMask bindMask;
bindMask.setFirst(layout->bindingCount()); bindMask.setFirst(layout->bindingCount());
// If the depth attachment is also bound as a shader
// resource, we have to use the appropriate layout
VkImage depthImage = VK_NULL_HANDLE;
VkImageLayout depthLayout = VK_IMAGE_LAYOUT_UNDEFINED;
if (BindPoint == VK_PIPELINE_BIND_POINT_GRAPHICS) {
const auto& depthAttachment = m_state.om.framebuffer->getDepthTarget();
if (depthAttachment.view != nullptr) {
depthImage = depthAttachment.view->imageHandle();
depthLayout = depthAttachment.layout;
}
}
for (uint32_t i = 0; i < layout->bindingCount(); i++) { for (uint32_t i = 0; i < layout->bindingCount(); i++) {
const auto& binding = layout->binding(i); const auto& binding = layout->binding(i);
const auto& res = m_rc[binding.slot]; const auto& res = m_rc[binding.slot];
@ -3828,9 +3814,6 @@ namespace dxvk {
descriptors[i].image.imageView = res.imageView->handle(binding.view); descriptors[i].image.imageView = res.imageView->handle(binding.view);
descriptors[i].image.imageLayout = res.imageView->imageInfo().layout; descriptors[i].image.imageLayout = res.imageView->imageInfo().layout;
if (unlikely(res.imageView->imageHandle() == depthImage))
descriptors[i].image.imageLayout = depthLayout;
if (m_rcTracked.set(binding.slot)) { if (m_rcTracked.set(binding.slot)) {
m_cmd->trackResource<DxvkAccess::None>(res.imageView); m_cmd->trackResource<DxvkAccess::None>(res.imageView);
m_cmd->trackResource<DxvkAccess::Read>(res.imageView->image()); m_cmd->trackResource<DxvkAccess::Read>(res.imageView->image());
@ -3846,9 +3829,6 @@ namespace dxvk {
descriptors[i].image.imageView = res.imageView->handle(binding.view); descriptors[i].image.imageView = res.imageView->handle(binding.view);
descriptors[i].image.imageLayout = res.imageView->imageInfo().layout; descriptors[i].image.imageLayout = res.imageView->imageInfo().layout;
if (unlikely(res.imageView->imageHandle() == depthImage))
descriptors[i].image.imageLayout = depthLayout;
if (m_rcTracked.set(binding.slot)) { if (m_rcTracked.set(binding.slot)) {
m_cmd->trackResource<DxvkAccess::None>(res.imageView); m_cmd->trackResource<DxvkAccess::None>(res.imageView);
m_cmd->trackResource<DxvkAccess::Write>(res.imageView->image()); m_cmd->trackResource<DxvkAccess::Write>(res.imageView->image());
@ -3865,9 +3845,6 @@ namespace dxvk {
descriptors[i].image.imageView = res.imageView->handle(binding.view); descriptors[i].image.imageView = res.imageView->handle(binding.view);
descriptors[i].image.imageLayout = res.imageView->imageInfo().layout; descriptors[i].image.imageLayout = res.imageView->imageInfo().layout;
if (unlikely(res.imageView->imageHandle() == depthImage))
descriptors[i].image.imageLayout = depthLayout;
if (m_rcTracked.set(binding.slot)) { if (m_rcTracked.set(binding.slot)) {
m_cmd->trackResource<DxvkAccess::None>(res.sampler); m_cmd->trackResource<DxvkAccess::None>(res.sampler);
m_cmd->trackResource<DxvkAccess::None>(res.imageView); m_cmd->trackResource<DxvkAccess::None>(res.imageView);