mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-14 10:44:58 +00:00
vk_rasterizer: Only clear valid color attachments
This commit is contained in:
parent
00ce8eff65
commit
e0978931e8
1 changed files with 4 additions and 2 deletions
|
@ -357,11 +357,13 @@ void RasterizerVulkan::Clear() {
|
||||||
.height = std::min(clear_rect.rect.extent.height, render_area.height),
|
.height = std::min(clear_rect.rect.extent.height, render_area.height),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (use_color) {
|
const u32 color_attachment = regs.clear_buffers.RT;
|
||||||
|
const auto attachment_aspect_mask = framebuffer->ImageRanges()[color_attachment].aspectMask;
|
||||||
|
const bool is_color_rt = (attachment_aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT) != 0;
|
||||||
|
if (use_color && is_color_rt) {
|
||||||
VkClearValue clear_value;
|
VkClearValue clear_value;
|
||||||
std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color));
|
std::memcpy(clear_value.color.float32, regs.clear_color, sizeof(regs.clear_color));
|
||||||
|
|
||||||
const u32 color_attachment = regs.clear_buffers.RT;
|
|
||||||
scheduler.Record([color_attachment, clear_value, clear_rect](vk::CommandBuffer cmdbuf) {
|
scheduler.Record([color_attachment, clear_value, clear_rect](vk::CommandBuffer cmdbuf) {
|
||||||
const VkClearAttachment attachment{
|
const VkClearAttachment attachment{
|
||||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
|
|
Loading…
Reference in a new issue