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:
parent
dc3e5e5949
commit
fd1b5c8eb9
@ -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,
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user