summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-12-29 05:05:02 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:56:42 +0100
commit9b08698a0cd1c958a4479ca544dc35333aa0e370 (patch)
treea9f5af078ef84a28c4c053a7cbcd7d9d869c650d
parentgl_state_tracker: Implement dirty flags for vertex formats (diff)
downloadyuzu-9b08698a0cd1c958a4479ca544dc35333aa0e370.tar
yuzu-9b08698a0cd1c958a4479ca544dc35333aa0e370.tar.gz
yuzu-9b08698a0cd1c958a4479ca544dc35333aa0e370.tar.bz2
yuzu-9b08698a0cd1c958a4479ca544dc35333aa0e370.tar.lz
yuzu-9b08698a0cd1c958a4479ca544dc35333aa0e370.tar.xz
yuzu-9b08698a0cd1c958a4479ca544dc35333aa0e370.tar.zst
yuzu-9b08698a0cd1c958a4479ca544dc35333aa0e370.zip
-rw-r--r--src/video_core/engines/maxwell_3d.h6
-rw-r--r--src/video_core/renderer_opengl/gl_state_tracker.cpp22
-rw-r--r--src/video_core/renderer_opengl/gl_state_tracker.h4
3 files changed, 16 insertions, 16 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 8edfa6a34..beaf3ffb6 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -1273,9 +1273,7 @@ public:
/// Notify a memory write has happened.
void OnMemoryWrite() {
- for (const u8 store : dirty.on_write_stores) {
- dirty.flags[store] = true;
- }
+ dirty.flags |= dirty.on_write_stores;
}
enum class MMEDrawMode : u32 {
@@ -1295,8 +1293,8 @@ public:
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>, 3> tables{};
- std::array<u8, 32> on_write_stores{};
} 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 572a43856..319fd825b 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.cpp
+++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp
@@ -110,23 +110,23 @@ StateTracker::StateTracker(Core::System& system) : system{system} {}
void StateTracker::Initialize() {
auto& dirty = system.GPU().Maxwell3D().dirty;
- std::size_t entry_index = 0;
- const auto AddEntry = [&dirty, &entry_index](std::size_t dirty_register) {
- dirty.on_write_stores[entry_index++] = static_cast<u8>(dirty_register);
- };
-
- AddEntry(RenderTargets);
- for (std::size_t i = 0; i < Regs::NumRenderTargets; ++i) {
- AddEntry(ColorBuffer0 + i);
- }
- AddEntry(ZetaBuffer);
-
auto& tables = dirty.tables;
SetupDirtyRenderTargets(tables);
SetupDirtyColorMasks(tables);
SetupDirtyViewports(tables);
SetupDirtyScissors(tables);
SetupDirtyVertexFormat(tables);
+
+ auto& store = dirty.on_write_stores;
+ store[RenderTargets] = true;
+ store[ZetaBuffer] = true;
+ for (std::size_t i = 0; i < Regs::NumRenderTargets; ++i) {
+ store[ColorBuffer0 + i] = true;
+ }
+ store[VertexBuffers] = true;
+ for (std::size_t i = 0; i < Regs::NumVertexArrays; ++i) {
+ store[VertexBuffer0 + i] = true;
+ }
}
} // namespace OpenGL
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.h b/src/video_core/renderer_opengl/gl_state_tracker.h
index 7add22d88..a368aefd7 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.h
+++ b/src/video_core/renderer_opengl/gl_state_tracker.h
@@ -4,6 +4,8 @@
#pragma once
+#include <limits>
+
#include "common/common_types.h"
#include "video_core/dirty_flags.h"
#include "video_core/engines/maxwell_3d.h"
@@ -58,7 +60,7 @@ enum : u8 {
Last
};
-static_assert(Last <= 0xff);
+static_assert(Last <= std::numeric_limits<u8>::max());
} // namespace Dirty