mirror of https://github.com/RPCS3/rpcs3.git
vk: Prefer optimal formats when clearing buffers
This commit is contained in:
parent
84ae1c5214
commit
5f180e0b30
|
@ -257,6 +257,8 @@ namespace vk
|
||||||
|
|
||||||
void change_image_layout(VkCommandBuffer cmd, vk::image *image, VkImageLayout new_layout, VkImageSubresourceRange range)
|
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);
|
change_image_layout(cmd, image->value, image->current_layout, new_layout, range);
|
||||||
image->current_layout = new_layout;
|
image->current_layout = new_layout;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,14 +147,14 @@ namespace rsx
|
||||||
{
|
{
|
||||||
VkImageLayout old_layout = ds->current_layout;
|
VkImageLayout old_layout = ds->current_layout;
|
||||||
VkImageSubresourceRange range = vk::get_image_subresource_range(0, 0, 1, 1, ds->attachment_aspect_flag);
|
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
|
//Clear the surface before drawing on it
|
||||||
VkClearDepthStencilValue clear_depth = {};
|
VkClearDepthStencilValue clear_depth = {};
|
||||||
clear_depth.depth = 1.f;
|
clear_depth.depth = 1.f;
|
||||||
clear_depth.stencil = 255;
|
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);
|
change_image_layout(*pcmd, ds, old_layout, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue