mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-24 05:45:48 +01:00
maxwell_3d: Change write dirty flags to a bitset
This commit is contained in:
parent
69ad6279e4
commit
9b08698a0c
@ -1273,9 +1273,7 @@ public:
|
|||||||
|
|
||||||
/// Notify a memory write has happened.
|
/// Notify a memory write has happened.
|
||||||
void OnMemoryWrite() {
|
void OnMemoryWrite() {
|
||||||
for (const u8 store : dirty.on_write_stores) {
|
dirty.flags |= dirty.on_write_stores;
|
||||||
dirty.flags[store] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class MMEDrawMode : u32 {
|
enum class MMEDrawMode : u32 {
|
||||||
@ -1295,8 +1293,8 @@ public:
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
std::bitset<std::numeric_limits<u8>::max()> flags;
|
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<std::array<u8, Regs::NUM_REGS>, 3> tables{};
|
||||||
std::array<u8, 32> on_write_stores{};
|
|
||||||
} dirty;
|
} dirty;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -110,23 +110,23 @@ StateTracker::StateTracker(Core::System& system) : system{system} {}
|
|||||||
|
|
||||||
void StateTracker::Initialize() {
|
void StateTracker::Initialize() {
|
||||||
auto& dirty = system.GPU().Maxwell3D().dirty;
|
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;
|
auto& tables = dirty.tables;
|
||||||
SetupDirtyRenderTargets(tables);
|
SetupDirtyRenderTargets(tables);
|
||||||
SetupDirtyColorMasks(tables);
|
SetupDirtyColorMasks(tables);
|
||||||
SetupDirtyViewports(tables);
|
SetupDirtyViewports(tables);
|
||||||
SetupDirtyScissors(tables);
|
SetupDirtyScissors(tables);
|
||||||
SetupDirtyVertexFormat(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
|
} // namespace OpenGL
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "video_core/dirty_flags.h"
|
#include "video_core/dirty_flags.h"
|
||||||
#include "video_core/engines/maxwell_3d.h"
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
@ -58,7 +60,7 @@ enum : u8 {
|
|||||||
|
|
||||||
Last
|
Last
|
||||||
};
|
};
|
||||||
static_assert(Last <= 0xff);
|
static_assert(Last <= std::numeric_limits<u8>::max());
|
||||||
|
|
||||||
} // namespace Dirty
|
} // namespace Dirty
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user