Merge pull request #10217 from Kelebek1/clear_value

Use the rendertarget format of the correct RT rather than the first valid
This commit is contained in:
liamwhite 2023-05-16 10:06:30 -04:00 committed by GitHub
commit 47c5c37bed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 19 deletions

View File

@ -348,25 +348,12 @@ void RasterizerVulkan::Clear(u32 layer_count) {
const u32 color_attachment = regs.clear_surface.RT; const u32 color_attachment = regs.clear_surface.RT;
if (use_color && framebuffer->HasAspectColorBit(color_attachment)) { if (use_color && framebuffer->HasAspectColorBit(color_attachment)) {
VkClearValue clear_value; const auto format =
bool is_integer = false; VideoCore::Surface::PixelFormatFromRenderTargetFormat(regs.rt[color_attachment].format);
bool is_signed = false; bool is_integer = IsPixelFormatInteger(format);
size_t int_size = 8; bool is_signed = IsPixelFormatSignedInteger(format);
for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; ++i) { size_t int_size = PixelComponentSizeBitsInteger(format);
const auto& this_rt = regs.rt[i]; VkClearValue clear_value{};
if (this_rt.Address() == 0) {
continue;
}
if (this_rt.format == Tegra::RenderTargetFormat::NONE) {
continue;
}
const auto format =
VideoCore::Surface::PixelFormatFromRenderTargetFormat(this_rt.format);
is_integer = IsPixelFormatInteger(format);
is_signed = IsPixelFormatSignedInteger(format);
int_size = PixelComponentSizeBitsInteger(format);
break;
}
if (!is_integer) { if (!is_integer) {
std::memcpy(clear_value.color.float32, regs.clear_color.data(), std::memcpy(clear_value.color.float32, regs.clear_color.data(),
regs.clear_color.size() * sizeof(f32)); regs.clear_color.size() * sizeof(f32));