1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00

[d3d9] Don't set IMAGE_USAGE_SAMPLED_BIT for non-msaa depth stencil surfaces

This commit is contained in:
Robin Kertels 2024-08-08 17:48:01 +02:00 committed by Joshie
parent 7f8cfec46f
commit daccde7643

View File

@ -295,8 +295,7 @@ namespace dxvk {
imageInfo.numLayers = m_desc.ArraySize;
imageInfo.mipLevels = m_desc.MipLevels;
imageInfo.usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT
| VK_IMAGE_USAGE_TRANSFER_DST_BIT
| VK_IMAGE_USAGE_SAMPLED_BIT;
| VK_IMAGE_USAGE_TRANSFER_DST_BIT;
imageInfo.stages = VK_PIPELINE_STAGE_TRANSFER_BIT
| m_device->GetEnabledShaderStages();
imageInfo.access = VK_ACCESS_TRANSFER_READ_BIT
@ -324,6 +323,12 @@ namespace dxvk {
DecodeMultiSampleType(m_device->GetDXVKDevice(), m_desc.MultiSample, m_desc.MultisampleQuality, &imageInfo.sampleCount);
// We need SAMPLED_BIT for StretchRect.
// However, StretchRect does not allow stretching for DS formats,
// so unless we need to resolve, it should always hit code paths that only need TRANSFER_BIT.
if (!m_desc.IsAttachmentOnly || !IsDepthStencilFormat(m_desc.Format) || imageInfo.sampleCount != VK_SAMPLE_COUNT_1_BIT)
imageInfo.usage |= VK_IMAGE_USAGE_SAMPLED_BIT;
// The image must be marked as mutable if it can be reinterpreted
// by a view with a different format. Depth-stencil formats cannot
// be reinterpreted in Vulkan, so we'll ignore those.
@ -524,11 +529,6 @@ namespace dxvk {
Usage &= ~(VK_IMAGE_USAGE_TRANSFER_DST_BIT
| VK_IMAGE_USAGE_TRANSFER_SRC_BIT
| VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT);
// Ignore sampled bit in case the image was created with
// an image flag that only allows attachment usage
if (m_desc.IsAttachmentOnly)
Usage &= ~VK_IMAGE_USAGE_SAMPLED_BIT;
// If the image is used only as an attachment, we never
// have to transform the image back to a different layout