1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 13:08:50 +01:00

[d3d9] Add feedback loop usage for DS

This commit is contained in:
Joshua Ashton 2022-08-16 10:39:06 +00:00
parent 870dd18f92
commit a78aab147e

View File

@ -283,15 +283,21 @@ namespace dxvk {
imageInfo.viewFormats = m_mapping.Formats; imageInfo.viewFormats = m_mapping.Formats;
} }
const bool hasAttachmentFeedbackLoops =
m_device->GetDXVKDevice()->features().extAttachmentFeedbackLoopLayout.attachmentFeedbackLoopLayout;
const bool isRT = m_desc.Usage & D3DUSAGE_RENDERTARGET;
const bool isDS = m_desc.Usage & D3DUSAGE_DEPTHSTENCIL;
const bool isAutoGen = m_desc.Usage & D3DUSAGE_AUTOGENMIPMAP;
// Are we an RT, need to gen mips or an offscreen plain surface? // Are we an RT, need to gen mips or an offscreen plain surface?
if (m_desc.Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_AUTOGENMIPMAP) || TryOffscreenRT) { if (isRT || isAutoGen || TryOffscreenRT) {
imageInfo.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; imageInfo.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
imageInfo.stages |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; imageInfo.stages |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
imageInfo.access |= VK_ACCESS_COLOR_ATTACHMENT_READ_BIT imageInfo.access |= VK_ACCESS_COLOR_ATTACHMENT_READ_BIT
| VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
} }
if (m_desc.Usage & D3DUSAGE_DEPTHSTENCIL) { if (isDS) {
imageInfo.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; imageInfo.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
imageInfo.stages |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT imageInfo.stages |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT
| VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT; | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
@ -299,11 +305,7 @@ namespace dxvk {
| VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
} }
const bool hasAttachmentFeedbackLoops = if ((isRT || isDS) && hasAttachmentFeedbackLoops)
m_device->GetDXVKDevice()->features().extAttachmentFeedbackLoopLayout.attachmentFeedbackLoopLayout;
const bool isRT = m_desc.Usage & D3DUSAGE_RENDERTARGET;
if (isRT && hasAttachmentFeedbackLoops)
imageInfo.usage |= VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT; imageInfo.usage |= VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT;
if (ResourceType == D3DRTYPE_CUBETEXTURE) if (ResourceType == D3DRTYPE_CUBETEXTURE)