diff options
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_state_tracker.cpp | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp index 67229ffcc..d74e68b63 100644 --- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp +++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "core/core.h" | 10 | #include "core/core.h" |
| 11 | #include "video_core/dirty_flags.h" | ||
| 11 | #include "video_core/engines/maxwell_3d.h" | 12 | #include "video_core/engines/maxwell_3d.h" |
| 12 | #include "video_core/gpu.h" | 13 | #include "video_core/gpu.h" |
| 13 | #include "video_core/renderer_vulkan/vk_state_tracker.h" | 14 | #include "video_core/renderer_vulkan/vk_state_tracker.h" |
| @@ -38,39 +39,6 @@ Flags MakeInvalidationFlags() { | |||
| 38 | return flags; | 39 | return flags; |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | template <typename Integer> | ||
| 42 | void FillBlock(Table& table, std::size_t begin, std::size_t num, Integer dirty_index) { | ||
| 43 | const auto it = std::begin(table) + begin; | ||
| 44 | std::fill(it, it + num, static_cast<u8>(dirty_index)); | ||
| 45 | } | ||
| 46 | |||
| 47 | template <typename Integer1, typename Integer2> | ||
| 48 | void FillBlock(Tables& tables, std::size_t begin, std::size_t num, Integer1 index_a, | ||
| 49 | Integer2 index_b) { | ||
| 50 | FillBlock(tables[0], begin, num, index_a); | ||
| 51 | FillBlock(tables[1], begin, num, index_b); | ||
| 52 | } | ||
| 53 | |||
| 54 | void SetupDirtyRenderTargets(Tables& tables) { | ||
| 55 | static constexpr std::size_t num_per_rt = NUM(rt[0]); | ||
| 56 | static constexpr std::size_t begin = OFF(rt); | ||
| 57 | static constexpr std::size_t num = num_per_rt * Regs::NumRenderTargets; | ||
| 58 | for (std::size_t rt = 0; rt < Regs::NumRenderTargets; ++rt) { | ||
| 59 | FillBlock(tables[0], begin + rt * num_per_rt, num_per_rt, ColorBuffer0 + rt); | ||
| 60 | } | ||
| 61 | FillBlock(tables[1], begin, num, RenderTargets); | ||
| 62 | |||
| 63 | static constexpr std::array zeta_flags{ZetaBuffer, RenderTargets}; | ||
| 64 | for (std::size_t i = 0; i < std::size(zeta_flags); ++i) { | ||
| 65 | const u8 flag = zeta_flags[i]; | ||
| 66 | auto& table = tables[i]; | ||
| 67 | table[OFF(zeta_enable)] = flag; | ||
| 68 | table[OFF(zeta_width)] = flag; | ||
| 69 | table[OFF(zeta_height)] = flag; | ||
| 70 | FillBlock(table, OFF(zeta), NUM(zeta), flag); | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | void SetupDirtyViewports(Tables& tables) { | 42 | void SetupDirtyViewports(Tables& tables) { |
| 75 | FillBlock(tables[0], OFF(viewport_transform), NUM(viewport_transform), Viewports); | 43 | FillBlock(tables[0], OFF(viewport_transform), NUM(viewport_transform), Viewports); |
| 76 | FillBlock(tables[0], OFF(viewports), NUM(viewports), Viewports); | 44 | FillBlock(tables[0], OFF(viewports), NUM(viewports), Viewports); |
| @@ -123,12 +91,7 @@ void StateTracker::Initialize() { | |||
| 123 | SetupDirtyDepthBounds(tables); | 91 | SetupDirtyDepthBounds(tables); |
| 124 | SetupDirtyStencilProperties(tables); | 92 | SetupDirtyStencilProperties(tables); |
| 125 | 93 | ||
| 126 | auto& store = dirty.on_write_stores; | 94 | SetupCommonOnWriteStores(dirty.on_write_stores); |
| 127 | store[RenderTargets] = true; | ||
| 128 | store[ZetaBuffer] = true; | ||
| 129 | for (std::size_t i = 0; i < Regs::NumRenderTargets; ++i) { | ||
| 130 | store[ColorBuffer0 + i] = true; | ||
| 131 | } | ||
| 132 | } | 95 | } |
| 133 | 96 | ||
| 134 | void StateTracker::InvalidateCommandBufferState() { | 97 | void StateTracker::InvalidateCommandBufferState() { |