summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar liamwhite2023-05-16 10:06:30 -0400
committerGravatar GitHub2023-05-16 10:06:30 -0400
commit47c5c37bed53c4dd67842cd7e87e3d8bf5adb291 (patch)
tree2571ef0f6838c888d16b52d50e9ee04c0f93a985
parentMerge pull request #10107 from grimkor/allow-fully-customised-hotkeys (diff)
parentUse the rendertarget format of the correct RT rather than the first valid (diff)
downloadyuzu-47c5c37bed53c4dd67842cd7e87e3d8bf5adb291.tar.gz
yuzu-47c5c37bed53c4dd67842cd7e87e3d8bf5adb291.tar.xz
yuzu-47c5c37bed53c4dd67842cd7e87e3d8bf5adb291.zip
Merge pull request #10217 from Kelebek1/clear_value
Use the rendertarget format of the correct RT rather than the first valid
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 64bd2f6a5..8d3a9736b 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -348,25 +348,12 @@ void RasterizerVulkan::Clear(u32 layer_count) {
348 348
349 const u32 color_attachment = regs.clear_surface.RT; 349 const u32 color_attachment = regs.clear_surface.RT;
350 if (use_color && framebuffer->HasAspectColorBit(color_attachment)) { 350 if (use_color && framebuffer->HasAspectColorBit(color_attachment)) {
351 VkClearValue clear_value; 351 const auto format =
352 bool is_integer = false; 352 VideoCore::Surface::PixelFormatFromRenderTargetFormat(regs.rt[color_attachment].format);
353 bool is_signed = false; 353 bool is_integer = IsPixelFormatInteger(format);
354 size_t int_size = 8; 354 bool is_signed = IsPixelFormatSignedInteger(format);
355 for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; ++i) { 355 size_t int_size = PixelComponentSizeBitsInteger(format);
356 const auto& this_rt = regs.rt[i]; 356 VkClearValue clear_value{};
357 if (this_rt.Address() == 0) {
358 continue;
359 }
360 if (this_rt.format == Tegra::RenderTargetFormat::NONE) {
361 continue;
362 }
363 const auto format =
364 VideoCore::Surface::PixelFormatFromRenderTargetFormat(this_rt.format);
365 is_integer = IsPixelFormatInteger(format);
366 is_signed = IsPixelFormatSignedInteger(format);
367 int_size = PixelComponentSizeBitsInteger(format);
368 break;
369 }
370 if (!is_integer) { 357 if (!is_integer) {
371 std::memcpy(clear_value.color.float32, regs.clear_color.data(), 358 std::memcpy(clear_value.color.float32, regs.clear_color.data(),
372 regs.clear_color.size() * sizeof(f32)); 359 regs.clear_color.size() * sizeof(f32));