From ac204754d4fe2aaae214025d8f1f40bcb938d74f Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Fri, 21 Feb 2020 01:56:00 -0300 Subject: dirty_flags: Deduplicate code between OpenGL and Vulkan --- .../renderer_opengl/gl_state_tracker.cpp | 39 +--------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'src/video_core/renderer_opengl') diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp index d5088cfa5..1e43c9ec0 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.cpp +++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp @@ -26,39 +26,6 @@ using Regs = Maxwell3D::Regs; using Tables = Maxwell3D::DirtyState::Tables; using Table = Maxwell3D::DirtyState::Table; -template -void FillBlock(Table& table, std::size_t begin, std::size_t num, Integer dirty_index) { - const auto it = std::begin(table) + begin; - std::fill(it, it + num, static_cast(dirty_index)); -} - -template -void FillBlock(Tables& tables, std::size_t begin, std::size_t num, Integer1 index_a, - Integer2 index_b) { - FillBlock(tables[0], begin, num, index_a); - FillBlock(tables[1], begin, num, index_b); -} - -void SetupDirtyRenderTargets(Tables& tables) { - static constexpr std::size_t num_per_rt = NUM(rt[0]); - static constexpr std::size_t begin = OFF(rt); - static constexpr std::size_t num = num_per_rt * Regs::NumRenderTargets; - for (std::size_t rt = 0; rt < Regs::NumRenderTargets; ++rt) { - FillBlock(tables[0], begin + rt * num_per_rt, num_per_rt, ColorBuffer0 + rt); - } - FillBlock(tables[1], begin, num, RenderTargets); - - static constexpr std::array zeta_flags{ZetaBuffer, RenderTargets}; - for (std::size_t i = 0; i < std::size(zeta_flags); ++i) { - const u8 flag = zeta_flags[i]; - auto& table = tables[i]; - table[OFF(zeta_enable)] = flag; - table[OFF(zeta_width)] = flag; - table[OFF(zeta_height)] = flag; - FillBlock(table, OFF(zeta), NUM(zeta), flag); - } -} - void SetupDirtyColorMasks(Tables& tables) { tables[0][OFF(color_mask_common)] = ColorMaskCommon; for (std::size_t rt = 0; rt < Regs::NumRenderTargets; ++rt) { @@ -261,11 +228,7 @@ void StateTracker::Initialize() { SetupDirtyMisc(tables); auto& store = dirty.on_write_stores; - store[RenderTargets] = true; - store[ZetaBuffer] = true; - for (std::size_t i = 0; i < Regs::NumRenderTargets; ++i) { - store[ColorBuffer0 + i] = true; - } + SetupCommonOnWriteStores(store); store[VertexBuffers] = true; for (std::size_t i = 0; i < Regs::NumVertexArrays; ++i) { store[VertexBuffer0 + i] = true; -- cgit v1.2.3