From 042256c6bbbe27a71805aa2dabe2cac436134b3d Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Fri, 21 Feb 2020 01:19:07 -0300 Subject: [PATCH] state_tracker: Remove type traits with named structures --- src/video_core/engines/maxwell_3d.h | 12 ++++++++---- src/video_core/renderer_opengl/gl_state_tracker.cpp | 6 ++---- src/video_core/renderer_vulkan/vk_state_tracker.cpp | 11 ++++++----- src/video_core/renderer_vulkan/vk_state_tracker.h | 11 ++++++----- 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 3ff6dec754..491cff3707 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::max()> flags; - std::bitset::max()> on_write_stores; - std::array, 2> tables{}; + struct DirtyState { + using Flags = std::bitset::max()>; + using Table = std::array; + using Tables = std::array; + + 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 fa87330288..d5088cfa52 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 #include #include -#include #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; -using Tables = std::remove_reference_t; -using Table = std::remove_reference_t; +using Tables = Maxwell3D::DirtyState::Tables; +using Table = Maxwell3D::DirtyState::Table; template 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 3fd0476b6e..67229ffcc3 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 +#include +#include +#include #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; -using Tables = std::remove_reference_t; -using Table = std::remove_reference_t; -using Flags = std::remove_reference_t; +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 1d8434dd08..03bc415b25 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 // REMOVE ME -#include +#include +#include #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::max()); } // namespace Dirty @@ -62,8 +65,6 @@ public: } private: - using Flags = std::remove_reference_t; - 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