Skip to content

Commit

Permalink
[d3d9] Don't set IMAGE_USAGE_SAMPLED_BIT for non-msaa depth stencil s…
Browse files Browse the repository at this point in the history
…urfaces
  • Loading branch information
K0bin authored and misyltoad committed Sep 4, 2024
1 parent 7f8cfec commit daccde7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/d3d9/d3d9_common_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit daccde7

Please sign in to comment.