diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2023-08-04 03:31:52 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2023-09-23 23:05:29 +0200 |
commit | bdc01254a9b3ce8359f8f007c2102cb2d112418e (patch) | |
tree | b75b974c0751f83089d64957df567e0d138981b1 /src/video_core/query_cache/query_base.h | |
parent | Merge pull request #11567 from liamwhite/fixing-my-error (diff) | |
download | yuzu-bdc01254a9b3ce8359f8f007c2102cb2d112418e.tar yuzu-bdc01254a9b3ce8359f8f007c2102cb2d112418e.tar.gz yuzu-bdc01254a9b3ce8359f8f007c2102cb2d112418e.tar.bz2 yuzu-bdc01254a9b3ce8359f8f007c2102cb2d112418e.tar.lz yuzu-bdc01254a9b3ce8359f8f007c2102cb2d112418e.tar.xz yuzu-bdc01254a9b3ce8359f8f007c2102cb2d112418e.tar.zst yuzu-bdc01254a9b3ce8359f8f007c2102cb2d112418e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/query_cache/query_base.h | 72 |
1 files changed, 72 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..485ed669c --- /dev/null +++ b/src/video_core/query_cache/query_base.h @@ -0,0 +1,72 @@ +// 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 tiemstamp. + 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() : guest_address(0), flags{}, value{} {} + + // 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), start_bank_id{}, + size_banks{}, start_slot{}, size_slots{} {} + + // Parameterized constructor + HostQueryBase(bool isLong, VAddr address) + : QueryBase(address, QueryFlagBits::IsHostManaged, 0), start_bank_id{}, size_banks{}, + start_slot{}, size_slots{} { + if (isLong) { + 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 |