diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-09-25 15:18:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-25 15:18:29 +0200 |
commit | 854457a392b6d38168f7f9d19d1fa8c43fad653c (patch) | |
tree | 3bc1007b5776f1ce82c057875609105de0a1ca44 /src/video_core/query_cache/query_base.h | |
parent | Merge pull request #11569 from german77/lle_applet (diff) | |
parent | Query Cache: Fix Prefix Sums (diff) | |
download | yuzu-854457a392b6d38168f7f9d19d1fa8c43fad653c.tar yuzu-854457a392b6d38168f7f9d19d1fa8c43fad653c.tar.gz yuzu-854457a392b6d38168f7f9d19d1fa8c43fad653c.tar.bz2 yuzu-854457a392b6d38168f7f9d19d1fa8c43fad653c.tar.lz yuzu-854457a392b6d38168f7f9d19d1fa8c43fad653c.tar.xz yuzu-854457a392b6d38168f7f9d19d1fa8c43fad653c.tar.zst yuzu-854457a392b6d38168f7f9d19d1fa8c43fad653c.zip |
Diffstat (limited to 'src/video_core/query_cache/query_base.h')
-rw-r--r-- | src/video_core/query_cache/query_base.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/video_core/query_cache/query_base.h b/src/video_core/query_cache/query_base.h new file mode 100644 index 000000000..1d786b3a7 --- /dev/null +++ b/src/video_core/query_cache/query_base.h @@ -0,0 +1,70 @@ +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "common/common_funcs.h" +#include "common/common_types.h" + +namespace VideoCommon { + +enum class QueryFlagBits : u32 { + HasTimestamp = 1 << 0, ///< Indicates if this query has a timestamp. + IsFinalValueSynced = 1 << 1, ///< Indicates if the query has been synced in the host + IsHostSynced = 1 << 2, ///< Indicates if the query has been synced in the host + IsGuestSynced = 1 << 3, ///< Indicates if the query has been synced with the guest. + IsHostManaged = 1 << 4, ///< Indicates if this query points to a host query + IsRewritten = 1 << 5, ///< Indicates if this query was rewritten by another query + IsInvalidated = 1 << 6, ///< Indicates the value of th query has been nullified. + IsOrphan = 1 << 7, ///< Indicates the query has not been set by a guest query. + IsFence = 1 << 8, ///< Indicates the query is a fence. +}; +DECLARE_ENUM_FLAG_OPERATORS(QueryFlagBits) + +class QueryBase { +public: + VAddr guest_address{}; + QueryFlagBits flags{}; + u64 value{}; + +protected: + // Default constructor + QueryBase() = default; + + // Parameterized constructor + QueryBase(VAddr address, QueryFlagBits flags_, u64 value_) + : guest_address(address), flags(flags_), value{value_} {} +}; + +class GuestQuery : public QueryBase { +public: + // Parameterized constructor + GuestQuery(bool isLong, VAddr address, u64 queryValue) + : QueryBase(address, QueryFlagBits::IsFinalValueSynced, queryValue) { + if (isLong) { + flags |= QueryFlagBits::HasTimestamp; + } + } +}; + +class HostQueryBase : public QueryBase { +public: + // Default constructor + HostQueryBase() : QueryBase(0, QueryFlagBits::IsHostManaged | QueryFlagBits::IsOrphan, 0) {} + + // Parameterized constructor + HostQueryBase(bool has_timestamp, VAddr address) + : QueryBase(address, QueryFlagBits::IsHostManaged, 0), start_bank_id{}, size_banks{}, + start_slot{}, size_slots{} { + if (has_timestamp) { + flags |= QueryFlagBits::HasTimestamp; + } + } + + u32 start_bank_id{}; + u32 size_banks{}; + size_t start_slot{}; + size_t size_slots{}; +}; + +} // namespace VideoCommon
\ No newline at end of file |