diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-02-21 00:35:53 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-02-28 21:56:43 +0100 |
commit | 1bd95a314f07732319a71fca2aba81d400ca4c83 (patch) | |
tree | d524ce30dbcf56e26d3b0d93c07aa1715e372779 /src/video_core/renderer_vulkan/vk_state_tracker.h | |
parent | gl_rasterizer: Remove num vertex buffers magic number (diff) | |
download | yuzu-1bd95a314f07732319a71fca2aba81d400ca4c83.tar yuzu-1bd95a314f07732319a71fca2aba81d400ca4c83.tar.gz yuzu-1bd95a314f07732319a71fca2aba81d400ca4c83.tar.bz2 yuzu-1bd95a314f07732319a71fca2aba81d400ca4c83.tar.lz yuzu-1bd95a314f07732319a71fca2aba81d400ca4c83.tar.xz yuzu-1bd95a314f07732319a71fca2aba81d400ca4c83.tar.zst yuzu-1bd95a314f07732319a71fca2aba81d400ca4c83.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_state_tracker.h')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_state_tracker.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.h b/src/video_core/renderer_vulkan/vk_state_tracker.h new file mode 100644 index 000000000..9ec7b5136 --- /dev/null +++ b/src/video_core/renderer_vulkan/vk_state_tracker.h @@ -0,0 +1,53 @@ +// Copyright 2020 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <type_traits> // REMOVE ME +#include <utility> + +#include "common/common_types.h" +#include "core/core.h" +#include "video_core/dirty_flags.h" +#include "video_core/engines/maxwell_3d.h" + +namespace Vulkan { + +namespace Dirty { + +enum : u8 { + First = VideoCommon::Dirty::LastCommonEntry, + + Viewports, +}; + +} // namespace Dirty + +class StateTracker { +public: + explicit StateTracker(Core::System& system); + + void Initialize(); + + void InvalidateCommandBufferState(); + + bool TouchViewports() { + return Exchange(Dirty::Viewports, false); + } + +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]; + flags[id] = new_value; + return is_dirty; + } + + Core::System& system; + Flags invalidation_flags; +}; + +} // namespace Vulkan |