summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-02-21 05:19:07 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:56:43 +0100
commit042256c6bbbe27a71805aa2dabe2cac436134b3d (patch)
treed2e6d12541b9f165e8ee5123205d2b7861b73c96 /src
parentvk_state_tracker: Implement dirty flags for stencil properties (diff)
downloadyuzu-042256c6bbbe27a71805aa2dabe2cac436134b3d.tar
yuzu-042256c6bbbe27a71805aa2dabe2cac436134b3d.tar.gz
yuzu-042256c6bbbe27a71805aa2dabe2cac436134b3d.tar.bz2
yuzu-042256c6bbbe27a71805aa2dabe2cac436134b3d.tar.lz
yuzu-042256c6bbbe27a71805aa2dabe2cac436134b3d.tar.xz
yuzu-042256c6bbbe27a71805aa2dabe2cac436134b3d.tar.zst
yuzu-042256c6bbbe27a71805aa2dabe2cac436134b3d.zip
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:
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:
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 @@
#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) {
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 @@
// 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{};
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 @@
#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