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{};
} mme_draw;
struct {
std::bitset<std::numeric_limits<u8>::max()> flags;
std::bitset<std::numeric_limits<u8>::max()> on_write_stores;
std::array<std::array<u8, Regs::NUM_REGS>, 2> tables{};
struct DirtyState {
using Flags = std::bitset<std::numeric_limits<u8>::max()>;
using Table = std::array<u8, Regs::NUM_REGS>;
using Tables = std::array<Table, 2>;
Flags flags;
Flags on_write_stores;
Tables tables{};
} dirty;
private:

View File

@ -5,7 +5,6 @@
#include <algorithm>
#include <array>
#include <cstddef>
#include <type_traits>
#include "common/common_types.h"
#include "core/core.h"
@ -24,9 +23,8 @@ using namespace Dirty;
using namespace VideoCommon::Dirty;
using Tegra::Engines::Maxwell3D;
using Regs = Maxwell3D::Regs;
using Dirty = std::remove_reference_t<decltype(Maxwell3D::dirty)>;
using Tables = std::remove_reference_t<decltype(Maxwell3D::dirty.tables)>;
using Table = std::remove_reference_t<decltype(Maxwell3D::dirty.tables[0])>;
using Tables = Maxwell3D::DirtyState::Tables;
using Table = Maxwell3D::DirtyState::Table;
template <typename Integer>
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
// Refer to the license.txt file included.
#include <type_traits>
#include <algorithm>
#include <cstddef>
#include <iterator>
#include "common/common_types.h"
#include "core/core.h"
@ -21,10 +23,9 @@ using namespace Dirty;
using namespace VideoCommon::Dirty;
using Tegra::Engines::Maxwell3D;
using Regs = Maxwell3D::Regs;
using Dirty = std::remove_reference_t<decltype(Maxwell3D::dirty)>;
using Tables = std::remove_reference_t<decltype(Maxwell3D::dirty.tables)>;
using Table = std::remove_reference_t<decltype(Maxwell3D::dirty.tables[0])>;
using Flags = std::remove_reference_t<decltype(Maxwell3D::dirty.flags)>;
using Tables = Maxwell3D::DirtyState::Tables;
using Table = Maxwell3D::DirtyState::Table;
using Flags = Maxwell3D::DirtyState::Flags;
Flags MakeInvalidationFlags() {
Flags flags{};

View File

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