mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 12:05:23 +00:00
vk: Prefer optimal formats when clearing buffers
This commit is contained in:
parent
84ae1c5214
commit
5f180e0b30
2 changed files with 4 additions and 2 deletions
|
@ -257,6 +257,8 @@ namespace vk
|
|||
|
||||
void change_image_layout(VkCommandBuffer cmd, vk::image *image, VkImageLayout new_layout, VkImageSubresourceRange range)
|
||||
{
|
||||
if (image->current_layout == new_layout) return;
|
||||
|
||||
change_image_layout(cmd, image->value, image->current_layout, new_layout, range);
|
||||
image->current_layout = new_layout;
|
||||
}
|
||||
|
|
|
@ -147,14 +147,14 @@ namespace rsx
|
|||
{
|
||||
VkImageLayout old_layout = ds->current_layout;
|
||||
VkImageSubresourceRange range = vk::get_image_subresource_range(0, 0, 1, 1, ds->attachment_aspect_flag);
|
||||
change_image_layout(*pcmd, ds, VK_IMAGE_LAYOUT_GENERAL, range);
|
||||
change_image_layout(*pcmd, ds, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, range);
|
||||
|
||||
//Clear the surface before drawing on it
|
||||
VkClearDepthStencilValue clear_depth = {};
|
||||
clear_depth.depth = 1.f;
|
||||
clear_depth.stencil = 255;
|
||||
|
||||
vkCmdClearDepthStencilImage(*pcmd, ds->value, VK_IMAGE_LAYOUT_GENERAL, &clear_depth, 1, &range);
|
||||
vkCmdClearDepthStencilImage(*pcmd, ds->value, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clear_depth, 1, &range);
|
||||
change_image_layout(*pcmd, ds, old_layout, range);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue