summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-04-25 03:16:49 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-04-25 03:21:29 +0200
commit527a1574c3f1262a6b6b010fa8234a701b299609 (patch)
treee4a8e9ca4ff1801011dadfaca5293a3fdc65e608 /src/video_core
parentvk_rasterizer: Fix framebuffer creation validation errors (diff)
downloadyuzu-527a1574c3f1262a6b6b010fa8234a701b299609.tar
yuzu-527a1574c3f1262a6b6b010fa8234a701b299609.tar.gz
yuzu-527a1574c3f1262a6b6b010fa8234a701b299609.tar.bz2
yuzu-527a1574c3f1262a6b6b010fa8234a701b299609.tar.lz
yuzu-527a1574c3f1262a6b6b010fa8234a701b299609.tar.xz
yuzu-527a1574c3f1262a6b6b010fa8234a701b299609.tar.zst
yuzu-527a1574c3f1262a6b6b010fa8234a701b299609.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp22
-rw-r--r--src/video_core/renderer_vulkan/vk_renderpass_cache.h2
2 files changed, 19 insertions, 5 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 8f4de5665..4eafdc14d 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -1252,11 +1252,25 @@ std::size_t RasterizerVulkan::CalculateConstBufferSize(
RenderPassParams RasterizerVulkan::GetRenderPassParams(Texceptions texceptions) const {
const auto& regs = system.GPU().Maxwell3D().regs;
+ const std::size_t num_attachments = static_cast<std::size_t>(regs.rt_control.count);
+
RenderPassParams params;
- params.num_color_attachments = static_cast<u8>(regs.rt_control.count);
- std::transform(regs.rt.begin(), regs.rt.end(), params.color_formats.begin(),
- [](const auto& rt) { return static_cast<u8>(rt.format); });
- params.texceptions = static_cast<u8>(texceptions.to_ullong());
+ params.color_formats = {};
+ std::size_t color_texceptions = 0;
+
+ std::size_t index = 0;
+ for (std::size_t rt = 0; rt < num_attachments; ++rt) {
+ const auto& rendertarget = regs.rt[rt];
+ if (rendertarget.Address() == 0 || rendertarget.format == Tegra::RenderTargetFormat::NONE) {
+ continue;
+ }
+ params.color_formats[index] = static_cast<u8>(rendertarget.format);
+ color_texceptions |= (texceptions[rt] ? 1ULL : 0ULL) << index;
+ ++index;
+ }
+ params.num_color_attachments = static_cast<u8>(index);
+ params.texceptions = static_cast<u8>(color_texceptions);
+
params.zeta_format = regs.zeta_enable ? static_cast<u8>(regs.zeta.format) : 0;
params.zeta_texception = texceptions[ZETA_TEXCEPTION_INDEX];
return params;
diff --git a/src/video_core/renderer_vulkan/vk_renderpass_cache.h b/src/video_core/renderer_vulkan/vk_renderpass_cache.h
index 0e988b26b..8b0fec720 100644
--- a/src/video_core/renderer_vulkan/vk_renderpass_cache.h
+++ b/src/video_core/renderer_vulkan/vk_renderpass_cache.h
@@ -19,8 +19,8 @@ namespace Vulkan {
class VKDevice;
struct RenderPassParams {
- u8 num_color_attachments;
std::array<u8, Tegra::Engines::Maxwell3D::Regs::NumRenderTargets> color_formats;
+ u8 num_color_attachments;
u8 texceptions;
u8 zeta_format;