summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_3d.h12
-rw-r--r--src/video_core/renderer_opengl/gl_state_tracker.cpp6
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.cpp11
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.h11
4 files changed, 22 insertions, 18 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 3ff6dec75..491cff370 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -1291,10 +1291,14 @@ public:
1291 u32 gl_end_count{}; 1291 u32 gl_end_count{};
1292 } mme_draw; 1292 } mme_draw;
1293 1293
1294 struct { 1294 struct DirtyState {
1295 std::bitset<std::numeric_limits<u8>::max()> flags; 1295 using Flags = std::bitset<std::numeric_limits<u8>::max()>;
1296 std::bitset<std::numeric_limits<u8>::max()> on_write_stores; 1296 using Table = std::array<u8, Regs::NUM_REGS>;
1297 std::array<std::array<u8, Regs::NUM_REGS>, 2> tables{}; 1297 using Tables = std::array<Table, 2>;
1298
1299 Flags flags;
1300 Flags on_write_stores;
1301 Tables tables{};
1298 } dirty; 1302 } dirty;
1299 1303
1300private: 1304private:
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp
index fa8733028..d5088cfa5 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.cpp
+++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp
@@ -5,7 +5,6 @@
5#include <algorithm> 5#include <algorithm>
6#include <array> 6#include <array>
7#include <cstddef> 7#include <cstddef>
8#include <type_traits>
9 8
10#include "common/common_types.h" 9#include "common/common_types.h"
11#include "core/core.h" 10#include "core/core.h"
@@ -24,9 +23,8 @@ using namespace Dirty;
24using namespace VideoCommon::Dirty; 23using namespace VideoCommon::Dirty;
25using Tegra::Engines::Maxwell3D; 24using Tegra::Engines::Maxwell3D;
26using Regs = Maxwell3D::Regs; 25using Regs = Maxwell3D::Regs;
27using Dirty = std::remove_reference_t<decltype(Maxwell3D::dirty)>; 26using Tables = Maxwell3D::DirtyState::Tables;
28using Tables = std::remove_reference_t<decltype(Maxwell3D::dirty.tables)>; 27using Table = Maxwell3D::DirtyState::Table;
29using Table = std::remove_reference_t<decltype(Maxwell3D::dirty.tables[0])>;
30 28
31template <typename Integer> 29template <typename Integer>
32void FillBlock(Table& table, std::size_t begin, std::size_t num, Integer dirty_index) { 30void FillBlock(Table& table, std::size_t begin, std::size_t num, Integer dirty_index) {
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
index 3fd0476b6..67229ffcc 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
@@ -2,7 +2,9 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <type_traits> 5#include <algorithm>
6#include <cstddef>
7#include <iterator>
6 8
7#include "common/common_types.h" 9#include "common/common_types.h"
8#include "core/core.h" 10#include "core/core.h"
@@ -21,10 +23,9 @@ using namespace Dirty;
21using namespace VideoCommon::Dirty; 23using namespace VideoCommon::Dirty;
22using Tegra::Engines::Maxwell3D; 24using Tegra::Engines::Maxwell3D;
23using Regs = Maxwell3D::Regs; 25using Regs = Maxwell3D::Regs;
24using Dirty = std::remove_reference_t<decltype(Maxwell3D::dirty)>; 26using Tables = Maxwell3D::DirtyState::Tables;
25using Tables = std::remove_reference_t<decltype(Maxwell3D::dirty.tables)>; 27using Table = Maxwell3D::DirtyState::Table;
26using Table = std::remove_reference_t<decltype(Maxwell3D::dirty.tables[0])>; 28using Flags = Maxwell3D::DirtyState::Flags;
27using Flags = std::remove_reference_t<decltype(Maxwell3D::dirty.flags)>;
28 29
29Flags MakeInvalidationFlags() { 30Flags MakeInvalidationFlags() {
30 Flags flags{}; 31 Flags flags{};
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.h b/src/video_core/renderer_vulkan/vk_state_tracker.h
index 1d8434dd0..03bc415b2 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.h
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.h
@@ -4,8 +4,8 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <type_traits> // REMOVE ME 7#include <cstddef>
8#include <utility> 8#include <limits>
9 9
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "core/core.h" 11#include "core/core.h"
@@ -25,7 +25,10 @@ enum : u8 {
25 BlendConstants, 25 BlendConstants,
26 DepthBounds, 26 DepthBounds,
27 StencilProperties, 27 StencilProperties,
28
29 Last
28}; 30};
31static_assert(Last <= std::numeric_limits<u8>::max());
29 32
30} // namespace Dirty 33} // namespace Dirty
31 34
@@ -62,8 +65,6 @@ public:
62 } 65 }
63 66
64private: 67private:
65 using Flags = std::remove_reference_t<decltype(Tegra::Engines::Maxwell3D::dirty.flags)>;
66
67 bool Exchange(std::size_t id, bool new_value) const noexcept { 68 bool Exchange(std::size_t id, bool new_value) const noexcept {
68 auto& flags = system.GPU().Maxwell3D().dirty.flags; 69 auto& flags = system.GPU().Maxwell3D().dirty.flags;
69 const bool is_dirty = flags[id]; 70 const bool is_dirty = flags[id];
@@ -72,7 +73,7 @@ private:
72 } 73 }
73 74
74 Core::System& system; 75 Core::System& system;
75 Flags invalidation_flags; 76 Tegra::Engines::Maxwell3D::DirtyState::Flags invalidation_flags;
76}; 77};
77 78
78} // namespace Vulkan 79} // namespace Vulkan