diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index b386bd68..ae9a0a64 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -836,6 +836,24 @@ namespace dxvk { } + void DxvkContext::discardImage( + const Rc& image, + VkImageSubresourceRange subresources) { + this->spillRenderPass(); + + if (m_barriers.isImageDirty(image, subresources, DxvkAccess::Write)) + m_barriers.recordCommands(m_cmd); + + m_barriers.accessImage(image, subresources, + VK_IMAGE_LAYOUT_UNDEFINED, 0, 0, + image->info().layout, + image->info().stages, + image->info().access); + + m_cmd->trackResource(image); + } + + void DxvkContext::dispatch( uint32_t x, uint32_t y, diff --git a/src/dxvk/dxvk_context.h b/src/dxvk/dxvk_context.h index 37a85c1b..a46f3bb5 100644 --- a/src/dxvk/dxvk_context.h +++ b/src/dxvk/dxvk_context.h @@ -371,6 +371,19 @@ namespace dxvk { void discardBuffer( const Rc& buffer); + /** + * \brief Discards image subresources + * + * Discards the current contents of the image + * and performs a fast layout transition. This + * may improve performance in some cases. + * \param [in] image The image to discard + * \param [in] subresources Image subresources + */ + void discardImage( + const Rc& image, + VkImageSubresourceRange subresources); + /** * \brief Starts compute jobs *