diff options
| author | 2020-02-21 01:19:07 -0300 | |
|---|---|---|
| committer | 2020-02-28 17:56:43 -0300 | |
| commit | 042256c6bbbe27a71805aa2dabe2cac436134b3d (patch) | |
| tree | d2e6d12541b9f165e8ee5123205d2b7861b73c96 /src | |
| parent | vk_state_tracker: Implement dirty flags for stencil properties (diff) | |
| download | yuzu-042256c6bbbe27a71805aa2dabe2cac436134b3d.tar.gz yuzu-042256c6bbbe27a71805aa2dabe2cac436134b3d.tar.xz yuzu-042256c6bbbe27a71805aa2dabe2cac436134b3d.zip | |
state_tracker: Remove type traits with named structures
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 12 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_state_tracker.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_state_tracker.cpp | 11 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_state_tracker.h | 11 |
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 | ||
| 1300 | private: | 1304 | private: |
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; | |||
| 24 | using namespace VideoCommon::Dirty; | 23 | using namespace VideoCommon::Dirty; |
| 25 | using Tegra::Engines::Maxwell3D; | 24 | using Tegra::Engines::Maxwell3D; |
| 26 | using Regs = Maxwell3D::Regs; | 25 | using Regs = Maxwell3D::Regs; |
| 27 | using Dirty = std::remove_reference_t<decltype(Maxwell3D::dirty)>; | 26 | using Tables = Maxwell3D::DirtyState::Tables; |
| 28 | using Tables = std::remove_reference_t<decltype(Maxwell3D::dirty.tables)>; | 27 | using Table = Maxwell3D::DirtyState::Table; |
| 29 | using Table = std::remove_reference_t<decltype(Maxwell3D::dirty.tables[0])>; | ||
| 30 | 28 | ||
| 31 | template <typename Integer> | 29 | template <typename Integer> |
| 32 | void FillBlock(Table& table, std::size_t begin, std::size_t num, Integer dirty_index) { | 30 | void 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; | |||
| 21 | using namespace VideoCommon::Dirty; | 23 | using namespace VideoCommon::Dirty; |
| 22 | using Tegra::Engines::Maxwell3D; | 24 | using Tegra::Engines::Maxwell3D; |
| 23 | using Regs = Maxwell3D::Regs; | 25 | using Regs = Maxwell3D::Regs; |
| 24 | using Dirty = std::remove_reference_t<decltype(Maxwell3D::dirty)>; | 26 | using Tables = Maxwell3D::DirtyState::Tables; |
| 25 | using Tables = std::remove_reference_t<decltype(Maxwell3D::dirty.tables)>; | 27 | using Table = Maxwell3D::DirtyState::Table; |
| 26 | using Table = std::remove_reference_t<decltype(Maxwell3D::dirty.tables[0])>; | 28 | using Flags = Maxwell3D::DirtyState::Flags; |
| 27 | using Flags = std::remove_reference_t<decltype(Maxwell3D::dirty.flags)>; | ||
| 28 | 29 | ||
| 29 | Flags MakeInvalidationFlags() { | 30 | Flags 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 | }; |
| 31 | static_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 | ||
| 64 | private: | 67 | private: |
| 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 |