yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

state_tracker: Remove type traits with named structures

This commit is contained in:
ReinUsesLisp 2020-02-21 01:19:07 -03:00
parent 6ac3eb4d87
commit 042256c6bb
4 changed files with 22 additions and 18 deletions

View File

@ -1291,10 +1291,14 @@ public:
u32 gl_end_count{}; u32 gl_end_count{};
} mme_draw; } mme_draw;
struct { struct DirtyState {
std::bitset<std::numeric_limits<u8>::max()> flags; using Flags = std::bitset<std::numeric_limits<u8>::max()>;
std::bitset<std::numeric_limits<u8>::max()> on_write_stores; using Table = std::array<u8, Regs::NUM_REGS>;
std::array<std::array<u8, Regs::NUM_REGS>, 2> tables{}; using Tables = std::array<Table, 2>;
Flags flags;
Flags on_write_stores;
Tables tables{};
} dirty; } dirty;
private: private:

View File

@ -5,7 +5,6 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <cstddef> #include <cstddef>
#include <type_traits>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core.h" #include "core/core.h"
@ -24,9 +23,8 @@ using namespace Dirty;
using namespace VideoCommon::Dirty; using namespace VideoCommon::Dirty;
using Tegra::Engines::Maxwell3D; using Tegra::Engines::Maxwell3D;
using Regs = Maxwell3D::Regs; using Regs = Maxwell3D::Regs;
using Dirty = std::remove_reference_t<decltype(Maxwell3D::dirty)>; using Tables = Maxwell3D::DirtyState::Tables;
using Tables = std::remove_reference_t<decltype(Maxwell3D::dirty.tables)>; using Table = Maxwell3D::DirtyState::Table;
using Table = std::remove_reference_t<decltype(Maxwell3D::dirty.tables[0])>;
template <typename Integer> template <typename Integer>
void FillBlock(Table& table, std::size_t begin, std::size_t num, Integer dirty_index) { void FillBlock(Table& table, std::size_t begin, std::size_t num, Integer dirty_index) {

View File

@ -2,7 +2,9 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <type_traits> #include <algorithm>
#include <cstddef>
#include <iterator>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core.h" #include "core/core.h"
@ -21,10 +23,9 @@ using namespace Dirty;
using namespace VideoCommon::Dirty; using namespace VideoCommon::Dirty;
using Tegra::Engines::Maxwell3D; using Tegra::Engines::Maxwell3D;
using Regs = Maxwell3D::Regs; using Regs = Maxwell3D::Regs;
using Dirty = std::remove_reference_t<decltype(Maxwell3D::dirty)>; using Tables = Maxwell3D::DirtyState::Tables;
using Tables = std::remove_reference_t<decltype(Maxwell3D::dirty.tables)>; using Table = Maxwell3D::DirtyState::Table;
using Table = std::remove_reference_t<decltype(Maxwell3D::dirty.tables[0])>; using Flags = Maxwell3D::DirtyState::Flags;
using Flags = std::remove_reference_t<decltype(Maxwell3D::dirty.flags)>;
Flags MakeInvalidationFlags() { Flags MakeInvalidationFlags() {
Flags flags{}; Flags flags{};

View File

@ -4,8 +4,8 @@
#pragma once #pragma once
#include <type_traits> // REMOVE ME #include <cstddef>
#include <utility> #include <limits>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core.h" #include "core/core.h"
@ -25,7 +25,10 @@ enum : u8 {
BlendConstants, BlendConstants,
DepthBounds, DepthBounds,
StencilProperties, StencilProperties,
Last
}; };
static_assert(Last <= std::numeric_limits<u8>::max());
} // namespace Dirty } // namespace Dirty
@ -62,8 +65,6 @@ public:
} }
private: private:
using Flags = std::remove_reference_t<decltype(Tegra::Engines::Maxwell3D::dirty.flags)>;
bool Exchange(std::size_t id, bool new_value) const noexcept { bool Exchange(std::size_t id, bool new_value) const noexcept {
auto& flags = system.GPU().Maxwell3D().dirty.flags; auto& flags = system.GPU().Maxwell3D().dirty.flags;
const bool is_dirty = flags[id]; const bool is_dirty = flags[id];
@ -72,7 +73,7 @@ private:
} }
Core::System& system; Core::System& system;
Flags invalidation_flags; Tegra::Engines::Maxwell3D::DirtyState::Flags invalidation_flags;
}; };
} // namespace Vulkan } // namespace Vulkan