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

[dxvk] Add method to permanently change image layout

This commit is contained in:
Philip Rebohle 2019-06-15 16:45:59 +02:00
parent dc3e5e5949
commit fd1b5c8eb9
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 49 additions and 0 deletions

View File

@ -330,6 +330,35 @@ namespace dxvk {
}
void DxvkContext::changeImageLayout(
const Rc<DxvkImage>& image,
VkImageLayout layout) {
if (image->info().layout != layout) {
this->spillRenderPass();
VkImageSubresourceRange subresources;
subresources.aspectMask = image->formatInfo()->aspectMask;
subresources.baseArrayLayer = 0;
subresources.baseMipLevel = 0;
subresources.layerCount = image->info().numLayers;
subresources.levelCount = image->info().mipLevels;
if (m_barriers.isImageDirty(image, subresources, DxvkAccess::Write))
m_barriers.recordCommands(m_cmd);
m_barriers.accessImage(image, subresources,
image->info().layout,
image->info().stages,
image->info().access,
layout,
image->info().layout,
image->info().stages);
image->setLayout(layout);
}
}
void DxvkContext::clearBuffer(
const Rc<DxvkBuffer>& buffer,
VkDeviceSize offset,

View File

@ -212,6 +212,18 @@ namespace dxvk {
const VkImageBlit& region,
VkFilter filter);
/**
* \brief Changes image layout
*
* Permanently changes the layout for a given
* image. Immediately performs the transition.
* \param [in] image The image to transition
* \param [in] layout New image layout
*/
void changeImageLayout(
const Rc<DxvkImage>& image,
VkImageLayout layout);
/**
* \brief Clears a buffer with a fixed value
*

View File

@ -223,6 +223,14 @@ namespace dxvk {
? VK_IMAGE_LAYOUT_GENERAL : layout;
}
/**
* \brief Changes image layout
* \param [in] layout New layout
*/
void setLayout(VkImageLayout layout) {
m_info.layout = layout;
}
/**
* \brief Checks whether a subresource is entirely covered
*