mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-23 17:00:57 +01:00
Merge pull request #7838 from lioncash/noncopy
common_types: Remove NonCopyable struct
This commit is contained in:
commit
d68eb751c5
20 changed files with 228 additions and 150 deletions
|
@ -46,13 +46,3 @@ using GPUVAddr = u64; ///< Represents a pointer in the GPU virtual address space
|
||||||
|
|
||||||
using u128 = std::array<std::uint64_t, 2>;
|
using u128 = std::array<std::uint64_t, 2>;
|
||||||
static_assert(sizeof(u128) == 16, "u128 must be 128 bits wide");
|
static_assert(sizeof(u128) == 16, "u128 must be 128 bits wide");
|
||||||
|
|
||||||
// An inheritable class to disallow the copy constructor and operator= functions
|
|
||||||
class NonCopyable {
|
|
||||||
protected:
|
|
||||||
constexpr NonCopyable() = default;
|
|
||||||
~NonCopyable() = default;
|
|
||||||
|
|
||||||
NonCopyable(const NonCopyable&) = delete;
|
|
||||||
NonCopyable& operator=(const NonCopyable&) = delete;
|
|
||||||
};
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
namespace Common::Telemetry {
|
namespace Common::Telemetry {
|
||||||
|
@ -28,7 +29,7 @@ struct VisitorInterface;
|
||||||
/**
|
/**
|
||||||
* Interface class for telemetry data fields.
|
* Interface class for telemetry data fields.
|
||||||
*/
|
*/
|
||||||
class FieldInterface : NonCopyable {
|
class FieldInterface {
|
||||||
public:
|
public:
|
||||||
virtual ~FieldInterface() = default;
|
virtual ~FieldInterface() = default;
|
||||||
|
|
||||||
|
@ -52,14 +53,15 @@ public:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class Field : public FieldInterface {
|
class Field : public FieldInterface {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(Field);
|
||||||
|
|
||||||
Field(FieldType type_, std::string name_, T value_)
|
Field(FieldType type_, std::string name_, T value_)
|
||||||
: name(std::move(name_)), type(type_), value(std::move(value_)) {}
|
: name(std::move(name_)), type(type_), value(std::move(value_)) {}
|
||||||
|
|
||||||
Field(const Field&) = default;
|
~Field() override = default;
|
||||||
Field& operator=(const Field&) = default;
|
|
||||||
|
|
||||||
Field(Field&&) = default;
|
Field(Field&&) noexcept = default;
|
||||||
Field& operator=(Field&& other) = default;
|
Field& operator=(Field&& other) noexcept = default;
|
||||||
|
|
||||||
void Accept(VisitorInterface& visitor) const override;
|
void Accept(VisitorInterface& visitor) const override;
|
||||||
|
|
||||||
|
@ -98,9 +100,15 @@ private:
|
||||||
/**
|
/**
|
||||||
* Collection of data fields that have been logged.
|
* Collection of data fields that have been logged.
|
||||||
*/
|
*/
|
||||||
class FieldCollection final : NonCopyable {
|
class FieldCollection final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(FieldCollection);
|
||||||
|
|
||||||
FieldCollection() = default;
|
FieldCollection() = default;
|
||||||
|
~FieldCollection() = default;
|
||||||
|
|
||||||
|
FieldCollection(FieldCollection&&) noexcept = default;
|
||||||
|
FieldCollection& operator=(FieldCollection&&) noexcept = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accept method for the visitor pattern, visits each field in the collection.
|
* Accept method for the visitor pattern, visits each field in the collection.
|
||||||
|
@ -133,7 +141,7 @@ private:
|
||||||
* Telemetry fields visitor interface class. A backend to log to a web service should implement
|
* Telemetry fields visitor interface class. A backend to log to a web service should implement
|
||||||
* this interface.
|
* this interface.
|
||||||
*/
|
*/
|
||||||
struct VisitorInterface : NonCopyable {
|
struct VisitorInterface {
|
||||||
virtual ~VisitorInterface() = default;
|
virtual ~VisitorInterface() = default;
|
||||||
|
|
||||||
virtual void Visit(const Field<bool>& field) = 0;
|
virtual void Visit(const Field<bool>& field) = 0;
|
||||||
|
@ -160,8 +168,8 @@ struct VisitorInterface : NonCopyable {
|
||||||
* Empty implementation of VisitorInterface that drops all fields. Used when a functional
|
* Empty implementation of VisitorInterface that drops all fields. Used when a functional
|
||||||
* backend implementation is not available.
|
* backend implementation is not available.
|
||||||
*/
|
*/
|
||||||
struct NullVisitor : public VisitorInterface {
|
struct NullVisitor final : public VisitorInterface {
|
||||||
~NullVisitor() = default;
|
YUZU_NON_COPYABLE(NullVisitor);
|
||||||
|
|
||||||
void Visit(const Field<bool>& /*field*/) override {}
|
void Visit(const Field<bool>& /*field*/) override {}
|
||||||
void Visit(const Field<double>& /*field*/) override {}
|
void Visit(const Field<double>& /*field*/) override {}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hardware_properties.h"
|
#include "core/hardware_properties.h"
|
||||||
|
|
||||||
|
@ -24,8 +25,11 @@ class CPUInterruptHandler;
|
||||||
using CPUInterrupts = std::array<CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES>;
|
using CPUInterrupts = std::array<CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES>;
|
||||||
|
|
||||||
/// Generic ARMv8 CPU interface
|
/// Generic ARMv8 CPU interface
|
||||||
class ARM_Interface : NonCopyable {
|
class ARM_Interface {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(ARM_Interface);
|
||||||
|
YUZU_NON_MOVEABLE(ARM_Interface);
|
||||||
|
|
||||||
explicit ARM_Interface(System& system_, CPUInterrupts& interrupt_handlers_,
|
explicit ARM_Interface(System& system_, CPUInterrupts& interrupt_handlers_,
|
||||||
bool uses_wall_clock_)
|
bool uses_wall_clock_)
|
||||||
: system{system_}, interrupt_handlers{interrupt_handlers_}, uses_wall_clock{
|
: system{system_}, interrupt_handlers{interrupt_handlers_}, uses_wall_clock{
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/file_sys/vfs_types.h"
|
#include "core/file_sys/vfs_types.h"
|
||||||
|
|
||||||
|
@ -29,8 +30,11 @@ enum class VfsEntryType {
|
||||||
// A class representing an abstract filesystem. A default implementation given the root VirtualDir
|
// A class representing an abstract filesystem. A default implementation given the root VirtualDir
|
||||||
// is provided for convenience, but if the Vfs implementation has any additional state or
|
// is provided for convenience, but if the Vfs implementation has any additional state or
|
||||||
// functionality, they will need to override.
|
// functionality, they will need to override.
|
||||||
class VfsFilesystem : NonCopyable {
|
class VfsFilesystem {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(VfsFilesystem);
|
||||||
|
YUZU_NON_MOVEABLE(VfsFilesystem);
|
||||||
|
|
||||||
explicit VfsFilesystem(VirtualDir root);
|
explicit VfsFilesystem(VirtualDir root);
|
||||||
virtual ~VfsFilesystem();
|
virtual ~VfsFilesystem();
|
||||||
|
|
||||||
|
@ -77,8 +81,12 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
// A class representing a file in an abstract filesystem.
|
// A class representing a file in an abstract filesystem.
|
||||||
class VfsFile : NonCopyable {
|
class VfsFile {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(VfsFile);
|
||||||
|
YUZU_NON_MOVEABLE(VfsFile);
|
||||||
|
|
||||||
|
VfsFile() = default;
|
||||||
virtual ~VfsFile();
|
virtual ~VfsFile();
|
||||||
|
|
||||||
// Retrieves the file name.
|
// Retrieves the file name.
|
||||||
|
@ -176,8 +184,12 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// A class representing a directory in an abstract filesystem.
|
// A class representing a directory in an abstract filesystem.
|
||||||
class VfsDirectory : NonCopyable {
|
class VfsDirectory {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(VfsDirectory);
|
||||||
|
YUZU_NON_MOVEABLE(VfsDirectory);
|
||||||
|
|
||||||
|
VfsDirectory() = default;
|
||||||
virtual ~VfsDirectory();
|
virtual ~VfsDirectory();
|
||||||
|
|
||||||
// Retrives the file located at path as if the current directory was root. Returns nullptr if
|
// Retrives the file located at path as if the current directory was root. Returns nullptr if
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/input.h"
|
#include "common/input.h"
|
||||||
#include "common/param_package.h"
|
#include "common/param_package.h"
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/input.h"
|
#include "common/input.h"
|
||||||
#include "common/param_package.h"
|
#include "common/param_package.h"
|
||||||
#include "common/point.h"
|
|
||||||
#include "common/quaternion.h"
|
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "common/vector_math.h"
|
#include "common/vector_math.h"
|
||||||
#include "core/hid/hid_types.h"
|
#include "core/hid/hid_types.h"
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "core/hid/hid_types.h"
|
#include "core/hid/hid_types.h"
|
||||||
|
|
||||||
namespace Core::HID {
|
namespace Core::HID {
|
||||||
|
|
|
@ -20,8 +20,6 @@ class KernelCore;
|
||||||
class KProcess;
|
class KProcess;
|
||||||
|
|
||||||
#define KERNEL_AUTOOBJECT_TRAITS(CLASS, BASE_CLASS) \
|
#define KERNEL_AUTOOBJECT_TRAITS(CLASS, BASE_CLASS) \
|
||||||
YUZU_NON_COPYABLE(CLASS); \
|
|
||||||
YUZU_NON_MOVEABLE(CLASS); \
|
|
||||||
\
|
\
|
||||||
private: \
|
private: \
|
||||||
friend class ::Kernel::KClassTokenGenerator; \
|
friend class ::Kernel::KClassTokenGenerator; \
|
||||||
|
@ -32,6 +30,9 @@ private:
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
public: \
|
public: \
|
||||||
|
YUZU_NON_COPYABLE(CLASS); \
|
||||||
|
YUZU_NON_MOVEABLE(CLASS); \
|
||||||
|
\
|
||||||
using BaseClass = BASE_CLASS; \
|
using BaseClass = BASE_CLASS; \
|
||||||
static constexpr TypeObj GetStaticTypeObj() { \
|
static constexpr TypeObj GetStaticTypeObj() { \
|
||||||
constexpr ClassTokenType Token = ClassToken(); \
|
constexpr ClassTokenType Token = ClassToken(); \
|
||||||
|
@ -224,9 +225,9 @@ private:
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class KScopedAutoObject {
|
class KScopedAutoObject {
|
||||||
|
public:
|
||||||
YUZU_NON_COPYABLE(KScopedAutoObject);
|
YUZU_NON_COPYABLE(KScopedAutoObject);
|
||||||
|
|
||||||
public:
|
|
||||||
constexpr KScopedAutoObject() = default;
|
constexpr KScopedAutoObject() = default;
|
||||||
|
|
||||||
constexpr KScopedAutoObject(T* o) : m_obj(o) {
|
constexpr KScopedAutoObject(T* o) : m_obj(o) {
|
||||||
|
|
|
@ -16,13 +16,12 @@ class KernelCore;
|
||||||
class KProcess;
|
class KProcess;
|
||||||
|
|
||||||
class KAutoObjectWithListContainer {
|
class KAutoObjectWithListContainer {
|
||||||
|
public:
|
||||||
YUZU_NON_COPYABLE(KAutoObjectWithListContainer);
|
YUZU_NON_COPYABLE(KAutoObjectWithListContainer);
|
||||||
YUZU_NON_MOVEABLE(KAutoObjectWithListContainer);
|
YUZU_NON_MOVEABLE(KAutoObjectWithListContainer);
|
||||||
|
|
||||||
public:
|
|
||||||
using ListType = boost::intrusive::rbtree<KAutoObjectWithList>;
|
using ListType = boost::intrusive::rbtree<KAutoObjectWithList>;
|
||||||
|
|
||||||
public:
|
|
||||||
class ListAccessor : public KScopedLightLock {
|
class ListAccessor : public KScopedLightLock {
|
||||||
public:
|
public:
|
||||||
explicit ListAccessor(KAutoObjectWithListContainer* container)
|
explicit ListAccessor(KAutoObjectWithListContainer* container)
|
||||||
|
@ -48,7 +47,6 @@ public:
|
||||||
|
|
||||||
friend class ListAccessor;
|
friend class ListAccessor;
|
||||||
|
|
||||||
public:
|
|
||||||
KAutoObjectWithListContainer(KernelCore& kernel) : m_lock(kernel), m_object_list() {}
|
KAutoObjectWithListContainer(KernelCore& kernel) : m_lock(kernel), m_object_list() {}
|
||||||
|
|
||||||
void Initialize() {}
|
void Initialize() {}
|
||||||
|
|
|
@ -22,13 +22,12 @@ namespace Kernel {
|
||||||
class KernelCore;
|
class KernelCore;
|
||||||
|
|
||||||
class KHandleTable {
|
class KHandleTable {
|
||||||
|
public:
|
||||||
YUZU_NON_COPYABLE(KHandleTable);
|
YUZU_NON_COPYABLE(KHandleTable);
|
||||||
YUZU_NON_MOVEABLE(KHandleTable);
|
YUZU_NON_MOVEABLE(KHandleTable);
|
||||||
|
|
||||||
public:
|
|
||||||
static constexpr size_t MaxTableSize = 1024;
|
static constexpr size_t MaxTableSize = 1024;
|
||||||
|
|
||||||
public:
|
|
||||||
explicit KHandleTable(KernelCore& kernel_);
|
explicit KHandleTable(KernelCore& kernel_);
|
||||||
~KHandleTable();
|
~KHandleTable();
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/kernel/k_page_heap.h"
|
#include "core/hle/kernel/k_page_heap.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
@ -20,8 +21,11 @@ namespace Kernel {
|
||||||
|
|
||||||
class KPageLinkedList;
|
class KPageLinkedList;
|
||||||
|
|
||||||
class KMemoryManager final : NonCopyable {
|
class KMemoryManager final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(KMemoryManager);
|
||||||
|
YUZU_NON_MOVEABLE(KMemoryManager);
|
||||||
|
|
||||||
enum class Pool : u32 {
|
enum class Pool : u32 {
|
||||||
Application = 0,
|
Application = 0,
|
||||||
Applet = 1,
|
Applet = 1,
|
||||||
|
@ -88,26 +92,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Impl final : NonCopyable {
|
class Impl final {
|
||||||
private:
|
|
||||||
using RefCount = u16;
|
|
||||||
|
|
||||||
private:
|
|
||||||
KPageHeap heap;
|
|
||||||
Pool pool{};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static std::size_t CalculateManagementOverheadSize(std::size_t region_size);
|
YUZU_NON_COPYABLE(Impl);
|
||||||
|
YUZU_NON_MOVEABLE(Impl);
|
||||||
|
|
||||||
static constexpr std::size_t CalculateOptimizedProcessOverheadSize(
|
|
||||||
std::size_t region_size) {
|
|
||||||
return (Common::AlignUp((region_size / PageSize), Common::BitSize<u64>()) /
|
|
||||||
Common::BitSize<u64>()) *
|
|
||||||
sizeof(u64);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Impl() = default;
|
Impl() = default;
|
||||||
|
~Impl() = default;
|
||||||
|
|
||||||
std::size_t Initialize(Pool new_pool, u64 start_address, u64 end_address);
|
std::size_t Initialize(Pool new_pool, u64 start_address, u64 end_address);
|
||||||
|
|
||||||
|
@ -130,6 +121,21 @@ private:
|
||||||
constexpr VAddr GetEndAddress() const {
|
constexpr VAddr GetEndAddress() const {
|
||||||
return heap.GetEndAddress();
|
return heap.GetEndAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::size_t CalculateManagementOverheadSize(std::size_t region_size);
|
||||||
|
|
||||||
|
static constexpr std::size_t CalculateOptimizedProcessOverheadSize(
|
||||||
|
std::size_t region_size) {
|
||||||
|
return (Common::AlignUp((region_size / PageSize), Common::BitSize<u64>()) /
|
||||||
|
Common::BitSize<u64>()) *
|
||||||
|
sizeof(u64);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
using RefCount = u16;
|
||||||
|
|
||||||
|
KPageHeap heap;
|
||||||
|
Pool pool{};
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/intrusive_red_black_tree.h"
|
#include "common/intrusive_red_black_tree.h"
|
||||||
#include "core/hle/kernel/k_memory_region_type.h"
|
#include "core/hle/kernel/k_memory_region_type.h"
|
||||||
|
@ -13,11 +14,13 @@ namespace Kernel {
|
||||||
|
|
||||||
class KMemoryRegionAllocator;
|
class KMemoryRegionAllocator;
|
||||||
|
|
||||||
class KMemoryRegion final : public Common::IntrusiveRedBlackTreeBaseNode<KMemoryRegion>,
|
class KMemoryRegion final : public Common::IntrusiveRedBlackTreeBaseNode<KMemoryRegion> {
|
||||||
NonCopyable {
|
|
||||||
friend class KMemoryRegionTree;
|
friend class KMemoryRegionTree;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(KMemoryRegion);
|
||||||
|
YUZU_NON_MOVEABLE(KMemoryRegion);
|
||||||
|
|
||||||
constexpr KMemoryRegion() = default;
|
constexpr KMemoryRegion() = default;
|
||||||
constexpr KMemoryRegion(u64 address_, u64 last_address_)
|
constexpr KMemoryRegion(u64 address_, u64 last_address_)
|
||||||
: address{address_}, last_address{last_address_} {}
|
: address{address_}, last_address{last_address_} {}
|
||||||
|
@ -29,6 +32,8 @@ public:
|
||||||
: KMemoryRegion(address_, last_address_, std::numeric_limits<u64>::max(), attributes_,
|
: KMemoryRegion(address_, last_address_, std::numeric_limits<u64>::max(), attributes_,
|
||||||
type_id_) {}
|
type_id_) {}
|
||||||
|
|
||||||
|
~KMemoryRegion() = default;
|
||||||
|
|
||||||
static constexpr int Compare(const KMemoryRegion& lhs, const KMemoryRegion& rhs) {
|
static constexpr int Compare(const KMemoryRegion& lhs, const KMemoryRegion& rhs) {
|
||||||
if (lhs.GetAddress() < rhs.GetAddress()) {
|
if (lhs.GetAddress() < rhs.GetAddress()) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -39,16 +44,6 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
constexpr void Reset(u64 a, u64 la, u64 p, u32 r, u32 t) {
|
|
||||||
address = a;
|
|
||||||
pair_address = p;
|
|
||||||
last_address = la;
|
|
||||||
attributes = r;
|
|
||||||
type_id = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
constexpr u64 GetAddress() const {
|
constexpr u64 GetAddress() const {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
@ -108,6 +103,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
constexpr void Reset(u64 a, u64 la, u64 p, u32 r, u32 t) {
|
||||||
|
address = a;
|
||||||
|
pair_address = p;
|
||||||
|
last_address = la;
|
||||||
|
attributes = r;
|
||||||
|
type_id = t;
|
||||||
|
}
|
||||||
|
|
||||||
u64 address{};
|
u64 address{};
|
||||||
u64 last_address{};
|
u64 last_address{};
|
||||||
u64 pair_address{};
|
u64 pair_address{};
|
||||||
|
@ -115,8 +118,25 @@ private:
|
||||||
u32 type_id{};
|
u32 type_id{};
|
||||||
};
|
};
|
||||||
|
|
||||||
class KMemoryRegionTree final : NonCopyable {
|
class KMemoryRegionTree final {
|
||||||
|
private:
|
||||||
|
using TreeType =
|
||||||
|
Common::IntrusiveRedBlackTreeBaseTraits<KMemoryRegion>::TreeType<KMemoryRegion>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(KMemoryRegionTree);
|
||||||
|
YUZU_NON_MOVEABLE(KMemoryRegionTree);
|
||||||
|
|
||||||
|
using value_type = TreeType::value_type;
|
||||||
|
using size_type = TreeType::size_type;
|
||||||
|
using difference_type = TreeType::difference_type;
|
||||||
|
using pointer = TreeType::pointer;
|
||||||
|
using const_pointer = TreeType::const_pointer;
|
||||||
|
using reference = TreeType::reference;
|
||||||
|
using const_reference = TreeType::const_reference;
|
||||||
|
using iterator = TreeType::iterator;
|
||||||
|
using const_iterator = TreeType::const_iterator;
|
||||||
|
|
||||||
struct DerivedRegionExtents {
|
struct DerivedRegionExtents {
|
||||||
const KMemoryRegion* first_region{};
|
const KMemoryRegion* first_region{};
|
||||||
const KMemoryRegion* last_region{};
|
const KMemoryRegion* last_region{};
|
||||||
|
@ -140,29 +160,9 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
|
||||||
using TreeType =
|
|
||||||
Common::IntrusiveRedBlackTreeBaseTraits<KMemoryRegion>::TreeType<KMemoryRegion>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
using value_type = TreeType::value_type;
|
|
||||||
using size_type = TreeType::size_type;
|
|
||||||
using difference_type = TreeType::difference_type;
|
|
||||||
using pointer = TreeType::pointer;
|
|
||||||
using const_pointer = TreeType::const_pointer;
|
|
||||||
using reference = TreeType::reference;
|
|
||||||
using const_reference = TreeType::const_reference;
|
|
||||||
using iterator = TreeType::iterator;
|
|
||||||
using const_iterator = TreeType::const_iterator;
|
|
||||||
|
|
||||||
private:
|
|
||||||
TreeType m_tree{};
|
|
||||||
KMemoryRegionAllocator& memory_region_allocator;
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit KMemoryRegionTree(KMemoryRegionAllocator& memory_region_allocator_);
|
explicit KMemoryRegionTree(KMemoryRegionAllocator& memory_region_allocator_);
|
||||||
|
~KMemoryRegionTree() = default;
|
||||||
|
|
||||||
public:
|
|
||||||
KMemoryRegion* FindModifiable(u64 address) {
|
KMemoryRegion* FindModifiable(u64 address) {
|
||||||
if (auto it = this->find(KMemoryRegion(address, address, 0, 0)); it != this->end()) {
|
if (auto it = this->find(KMemoryRegion(address, address, 0, 0)); it != this->end()) {
|
||||||
return std::addressof(*it);
|
return std::addressof(*it);
|
||||||
|
@ -241,7 +241,6 @@ public:
|
||||||
return GetDerivedRegionExtents(static_cast<KMemoryRegionType>(type_id));
|
return GetDerivedRegionExtents(static_cast<KMemoryRegionType>(type_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
void InsertDirectly(u64 address, u64 last_address, u32 attr = 0, u32 type_id = 0);
|
void InsertDirectly(u64 address, u64 last_address, u32 attr = 0, u32 type_id = 0);
|
||||||
bool Insert(u64 address, size_t size, u32 type_id, u32 new_attr = 0, u32 old_attr = 0);
|
bool Insert(u64 address, size_t size, u32 type_id, u32 new_attr = 0, u32 old_attr = 0);
|
||||||
|
|
||||||
|
@ -252,7 +251,6 @@ public:
|
||||||
return this->GetRandomAlignedRegion(size + 2 * guard_size, alignment, type_id) + guard_size;
|
return this->GetRandomAlignedRegion(size + 2 * guard_size, alignment, type_id) + guard_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
// Iterator accessors.
|
// Iterator accessors.
|
||||||
iterator begin() {
|
iterator begin() {
|
||||||
return m_tree.begin();
|
return m_tree.begin();
|
||||||
|
@ -322,13 +320,21 @@ public:
|
||||||
iterator nfind(const_reference ref) const {
|
iterator nfind(const_reference ref) const {
|
||||||
return m_tree.nfind(ref);
|
return m_tree.nfind(ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
TreeType m_tree{};
|
||||||
|
KMemoryRegionAllocator& memory_region_allocator;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KMemoryRegionAllocator final : NonCopyable {
|
class KMemoryRegionAllocator final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(KMemoryRegionAllocator);
|
||||||
|
YUZU_NON_MOVEABLE(KMemoryRegionAllocator);
|
||||||
|
|
||||||
static constexpr size_t MaxMemoryRegions = 200;
|
static constexpr size_t MaxMemoryRegions = 200;
|
||||||
|
|
||||||
constexpr KMemoryRegionAllocator() = default;
|
constexpr KMemoryRegionAllocator() = default;
|
||||||
|
constexpr ~KMemoryRegionAllocator() = default;
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
KMemoryRegion* Allocate(Args&&... args) {
|
KMemoryRegion* Allocate(Args&&... args) {
|
||||||
|
|
|
@ -8,14 +8,44 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/kernel/k_page_bitmap.h"
|
#include "core/hle/kernel/k_page_bitmap.h"
|
||||||
#include "core/hle/kernel/memory_types.h"
|
#include "core/hle/kernel/memory_types.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
class KPageHeap final : NonCopyable {
|
class KPageHeap final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(KPageHeap);
|
||||||
|
YUZU_NON_MOVEABLE(KPageHeap);
|
||||||
|
|
||||||
|
KPageHeap() = default;
|
||||||
|
~KPageHeap() = default;
|
||||||
|
|
||||||
|
constexpr VAddr GetAddress() const {
|
||||||
|
return heap_address;
|
||||||
|
}
|
||||||
|
constexpr std::size_t GetSize() const {
|
||||||
|
return heap_size;
|
||||||
|
}
|
||||||
|
constexpr VAddr GetEndAddress() const {
|
||||||
|
return GetAddress() + GetSize();
|
||||||
|
}
|
||||||
|
constexpr std::size_t GetPageOffset(VAddr block) const {
|
||||||
|
return (block - GetAddress()) / PageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Initialize(VAddr heap_address, std::size_t heap_size, std::size_t metadata_size);
|
||||||
|
VAddr AllocateBlock(s32 index, bool random);
|
||||||
|
void Free(VAddr addr, std::size_t num_pages);
|
||||||
|
|
||||||
|
void UpdateUsedSize() {
|
||||||
|
used_size = heap_size - (GetNumFreePages() * PageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::size_t CalculateManagementOverheadSize(std::size_t region_size);
|
||||||
|
|
||||||
static constexpr s32 GetAlignedBlockIndex(std::size_t num_pages, std::size_t align_pages) {
|
static constexpr s32 GetAlignedBlockIndex(std::size_t num_pages, std::size_t align_pages) {
|
||||||
const auto target_pages{std::max(num_pages, align_pages)};
|
const auto target_pages{std::max(num_pages, align_pages)};
|
||||||
for (std::size_t i = 0; i < NumMemoryBlockPageShifts; i++) {
|
for (std::size_t i = 0; i < NumMemoryBlockPageShifts; i++) {
|
||||||
|
@ -45,21 +75,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr std::size_t NumMemoryBlockPageShifts{7};
|
class Block final {
|
||||||
static constexpr std::array<std::size_t, NumMemoryBlockPageShifts> MemoryBlockPageShifts{
|
|
||||||
0xC, 0x10, 0x15, 0x16, 0x19, 0x1D, 0x1E,
|
|
||||||
};
|
|
||||||
|
|
||||||
class Block final : NonCopyable {
|
|
||||||
private:
|
|
||||||
KPageBitmap bitmap;
|
|
||||||
VAddr heap_address{};
|
|
||||||
uintptr_t end_offset{};
|
|
||||||
std::size_t block_shift{};
|
|
||||||
std::size_t next_block_shift{};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(Block);
|
||||||
|
YUZU_NON_MOVEABLE(Block);
|
||||||
|
|
||||||
Block() = default;
|
Block() = default;
|
||||||
|
~Block() = default;
|
||||||
|
|
||||||
constexpr std::size_t GetShift() const {
|
constexpr std::size_t GetShift() const {
|
||||||
return block_shift;
|
return block_shift;
|
||||||
|
@ -129,7 +151,6 @@ private:
|
||||||
return heap_address + (offset << GetShift());
|
return heap_address + (offset << GetShift());
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
static constexpr std::size_t CalculateManagementOverheadSize(std::size_t region_size,
|
static constexpr std::size_t CalculateManagementOverheadSize(std::size_t region_size,
|
||||||
std::size_t cur_block_shift,
|
std::size_t cur_block_shift,
|
||||||
std::size_t next_block_shift) {
|
std::size_t next_block_shift) {
|
||||||
|
@ -139,35 +160,15 @@ private:
|
||||||
return KPageBitmap::CalculateManagementOverheadSize(
|
return KPageBitmap::CalculateManagementOverheadSize(
|
||||||
(align * 2 + Common::AlignUp(region_size, align)) / cur_block_size);
|
(align * 2 + Common::AlignUp(region_size, align)) / cur_block_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
KPageBitmap bitmap;
|
||||||
|
VAddr heap_address{};
|
||||||
|
uintptr_t end_offset{};
|
||||||
|
std::size_t block_shift{};
|
||||||
|
std::size_t next_block_shift{};
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
|
||||||
KPageHeap() = default;
|
|
||||||
|
|
||||||
constexpr VAddr GetAddress() const {
|
|
||||||
return heap_address;
|
|
||||||
}
|
|
||||||
constexpr std::size_t GetSize() const {
|
|
||||||
return heap_size;
|
|
||||||
}
|
|
||||||
constexpr VAddr GetEndAddress() const {
|
|
||||||
return GetAddress() + GetSize();
|
|
||||||
}
|
|
||||||
constexpr std::size_t GetPageOffset(VAddr block) const {
|
|
||||||
return (block - GetAddress()) / PageSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Initialize(VAddr heap_address, std::size_t heap_size, std::size_t metadata_size);
|
|
||||||
VAddr AllocateBlock(s32 index, bool random);
|
|
||||||
void Free(VAddr addr, std::size_t num_pages);
|
|
||||||
|
|
||||||
void UpdateUsedSize() {
|
|
||||||
used_size = heap_size - (GetNumFreePages() * PageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::size_t CalculateManagementOverheadSize(std::size_t region_size);
|
|
||||||
|
|
||||||
private:
|
|
||||||
constexpr std::size_t GetNumFreePages() const {
|
constexpr std::size_t GetNumFreePages() const {
|
||||||
std::size_t num_free{};
|
std::size_t num_free{};
|
||||||
|
|
||||||
|
@ -180,6 +181,11 @@ private:
|
||||||
|
|
||||||
void FreeBlock(VAddr block, s32 index);
|
void FreeBlock(VAddr block, s32 index);
|
||||||
|
|
||||||
|
static constexpr std::size_t NumMemoryBlockPageShifts{7};
|
||||||
|
static constexpr std::array<std::size_t, NumMemoryBlockPageShifts> MemoryBlockPageShifts{
|
||||||
|
0xC, 0x10, 0x15, 0x16, 0x19, 0x1D, 0x1E,
|
||||||
|
};
|
||||||
|
|
||||||
VAddr heap_address{};
|
VAddr heap_address{};
|
||||||
std::size_t heap_size{};
|
std::size_t heap_size{};
|
||||||
std::size_t used_size{};
|
std::size_t used_size{};
|
||||||
|
|
|
@ -63,6 +63,8 @@ constexpr std::size_t GetSizeInRange(const KMemoryInfo& info, VAddr start, VAddr
|
||||||
|
|
||||||
KPageTable::KPageTable(Core::System& system_) : system{system_} {}
|
KPageTable::KPageTable(Core::System& system_) : system{system_} {}
|
||||||
|
|
||||||
|
KPageTable::~KPageTable() = default;
|
||||||
|
|
||||||
ResultCode KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type,
|
ResultCode KPageTable::InitializeForProcess(FileSys::ProgramAddressSpaceType as_type,
|
||||||
bool enable_aslr, VAddr code_addr,
|
bool enable_aslr, VAddr code_addr,
|
||||||
std::size_t code_size, KMemoryManager::Pool pool) {
|
std::size_t code_size, KMemoryManager::Pool pool) {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/page_table.h"
|
#include "common/page_table.h"
|
||||||
#include "core/file_sys/program_metadata.h"
|
#include "core/file_sys/program_metadata.h"
|
||||||
|
@ -22,9 +23,13 @@ namespace Kernel {
|
||||||
|
|
||||||
class KMemoryBlockManager;
|
class KMemoryBlockManager;
|
||||||
|
|
||||||
class KPageTable final : NonCopyable {
|
class KPageTable final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(KPageTable);
|
||||||
|
YUZU_NON_MOVEABLE(KPageTable);
|
||||||
|
|
||||||
explicit KPageTable(Core::System& system_);
|
explicit KPageTable(Core::System& system_);
|
||||||
|
~KPageTable();
|
||||||
|
|
||||||
ResultCode InitializeForProcess(FileSys::ProgramAddressSpaceType as_type, bool enable_aslr,
|
ResultCode InitializeForProcess(FileSys::ProgramAddressSpaceType as_type, bool enable_aslr,
|
||||||
VAddr code_addr, std::size_t code_size,
|
VAddr code_addr, std::size_t code_size,
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
@ -15,13 +16,17 @@ class KernelCore;
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
class KSlabHeapImpl final : NonCopyable {
|
class KSlabHeapImpl final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(KSlabHeapImpl);
|
||||||
|
YUZU_NON_MOVEABLE(KSlabHeapImpl);
|
||||||
|
|
||||||
struct Node {
|
struct Node {
|
||||||
Node* next{};
|
Node* next{};
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr KSlabHeapImpl() = default;
|
constexpr KSlabHeapImpl() = default;
|
||||||
|
constexpr ~KSlabHeapImpl() = default;
|
||||||
|
|
||||||
void Initialize(std::size_t size) {
|
void Initialize(std::size_t size) {
|
||||||
ASSERT(head == nullptr);
|
ASSERT(head == nullptr);
|
||||||
|
@ -64,9 +69,13 @@ private:
|
||||||
|
|
||||||
} // namespace impl
|
} // namespace impl
|
||||||
|
|
||||||
class KSlabHeapBase : NonCopyable {
|
class KSlabHeapBase {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(KSlabHeapBase);
|
||||||
|
YUZU_NON_MOVEABLE(KSlabHeapBase);
|
||||||
|
|
||||||
constexpr KSlabHeapBase() = default;
|
constexpr KSlabHeapBase() = default;
|
||||||
|
constexpr ~KSlabHeapBase() = default;
|
||||||
|
|
||||||
constexpr bool Contains(uintptr_t addr) const {
|
constexpr bool Contains(uintptr_t addr) const {
|
||||||
return start <= addr && addr < end;
|
return start <= addr && addr < end;
|
||||||
|
|
|
@ -28,10 +28,10 @@ class Layer;
|
||||||
|
|
||||||
/// Represents a single display type
|
/// Represents a single display type
|
||||||
class Display {
|
class Display {
|
||||||
|
public:
|
||||||
YUZU_NON_COPYABLE(Display);
|
YUZU_NON_COPYABLE(Display);
|
||||||
YUZU_NON_MOVEABLE(Display);
|
YUZU_NON_MOVEABLE(Display);
|
||||||
|
|
||||||
public:
|
|
||||||
/// Constructs a display with a given unique ID and name.
|
/// Constructs a display with a given unique ID and name.
|
||||||
///
|
///
|
||||||
/// @param id The unique ID for this display.
|
/// @param id The unique ID for this display.
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/file_sys/control_metadata.h"
|
#include "core/file_sys/control_metadata.h"
|
||||||
#include "core/file_sys/vfs.h"
|
#include "core/file_sys/vfs.h"
|
||||||
|
@ -139,8 +140,11 @@ std::string GetResultStatusString(ResultStatus status);
|
||||||
std::ostream& operator<<(std::ostream& os, ResultStatus status);
|
std::ostream& operator<<(std::ostream& os, ResultStatus status);
|
||||||
|
|
||||||
/// Interface for loading an application
|
/// Interface for loading an application
|
||||||
class AppLoader : NonCopyable {
|
class AppLoader {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(AppLoader);
|
||||||
|
YUZU_NON_MOVEABLE(AppLoader);
|
||||||
|
|
||||||
struct LoadParameters {
|
struct LoadParameters {
|
||||||
s32 main_thread_priority;
|
s32 main_thread_priority;
|
||||||
u64 main_thread_stack_size;
|
u64 main_thread_stack_size;
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
|
||||||
|
|
||||||
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/frontend/emu_window.h"
|
#include "core/frontend/emu_window.h"
|
||||||
#include "video_core/gpu.h"
|
#include "video_core/gpu.h"
|
||||||
|
@ -28,8 +29,11 @@ struct RendererSettings {
|
||||||
Layout::FramebufferLayout screenshot_framebuffer_layout;
|
Layout::FramebufferLayout screenshot_framebuffer_layout;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RendererBase : NonCopyable {
|
class RendererBase {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(RendererBase);
|
||||||
|
YUZU_NON_MOVEABLE(RendererBase);
|
||||||
|
|
||||||
explicit RendererBase(Core::Frontend::EmuWindow& window,
|
explicit RendererBase(Core::Frontend::EmuWindow& window,
|
||||||
std::unique_ptr<Core::Frontend::GraphicsContext> context);
|
std::unique_ptr<Core::Frontend::GraphicsContext> context);
|
||||||
virtual ~RendererBase();
|
virtual ~RendererBase();
|
||||||
|
|
|
@ -7,12 +7,14 @@
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
#include "common/common_types.h"
|
#include "common/common_funcs.h"
|
||||||
|
|
||||||
namespace OpenGL {
|
namespace OpenGL {
|
||||||
|
|
||||||
class OGLRenderbuffer : private NonCopyable {
|
class OGLRenderbuffer final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLRenderbuffer);
|
||||||
|
|
||||||
OGLRenderbuffer() = default;
|
OGLRenderbuffer() = default;
|
||||||
|
|
||||||
OGLRenderbuffer(OGLRenderbuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
OGLRenderbuffer(OGLRenderbuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
||||||
|
@ -36,8 +38,10 @@ public:
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLTexture : private NonCopyable {
|
class OGLTexture final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLTexture);
|
||||||
|
|
||||||
OGLTexture() = default;
|
OGLTexture() = default;
|
||||||
|
|
||||||
OGLTexture(OGLTexture&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
OGLTexture(OGLTexture&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
||||||
|
@ -61,8 +65,10 @@ public:
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLTextureView : private NonCopyable {
|
class OGLTextureView final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLTextureView);
|
||||||
|
|
||||||
OGLTextureView() = default;
|
OGLTextureView() = default;
|
||||||
|
|
||||||
OGLTextureView(OGLTextureView&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
OGLTextureView(OGLTextureView&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
||||||
|
@ -86,8 +92,10 @@ public:
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLSampler : private NonCopyable {
|
class OGLSampler final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLSampler);
|
||||||
|
|
||||||
OGLSampler() = default;
|
OGLSampler() = default;
|
||||||
|
|
||||||
OGLSampler(OGLSampler&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
OGLSampler(OGLSampler&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
||||||
|
@ -111,8 +119,10 @@ public:
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLShader : private NonCopyable {
|
class OGLShader final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLShader);
|
||||||
|
|
||||||
OGLShader() = default;
|
OGLShader() = default;
|
||||||
|
|
||||||
OGLShader(OGLShader&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
OGLShader(OGLShader&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
||||||
|
@ -132,8 +142,10 @@ public:
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLProgram : private NonCopyable {
|
class OGLProgram final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLProgram);
|
||||||
|
|
||||||
OGLProgram() = default;
|
OGLProgram() = default;
|
||||||
|
|
||||||
OGLProgram(OGLProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
OGLProgram(OGLProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
||||||
|
@ -154,8 +166,10 @@ public:
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLAssemblyProgram : private NonCopyable {
|
class OGLAssemblyProgram final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLAssemblyProgram);
|
||||||
|
|
||||||
OGLAssemblyProgram() = default;
|
OGLAssemblyProgram() = default;
|
||||||
|
|
||||||
OGLAssemblyProgram(OGLAssemblyProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
OGLAssemblyProgram(OGLAssemblyProgram&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
||||||
|
@ -176,8 +190,10 @@ public:
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLPipeline : private NonCopyable {
|
class OGLPipeline final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLPipeline);
|
||||||
|
|
||||||
OGLPipeline() = default;
|
OGLPipeline() = default;
|
||||||
OGLPipeline(OGLPipeline&& o) noexcept : handle{std::exchange<GLuint>(o.handle, 0)} {}
|
OGLPipeline(OGLPipeline&& o) noexcept : handle{std::exchange<GLuint>(o.handle, 0)} {}
|
||||||
|
|
||||||
|
@ -198,8 +214,10 @@ public:
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLBuffer : private NonCopyable {
|
class OGLBuffer final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLBuffer);
|
||||||
|
|
||||||
OGLBuffer() = default;
|
OGLBuffer() = default;
|
||||||
|
|
||||||
OGLBuffer(OGLBuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
OGLBuffer(OGLBuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
||||||
|
@ -223,8 +241,10 @@ public:
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLSync : private NonCopyable {
|
class OGLSync final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLSync);
|
||||||
|
|
||||||
OGLSync() = default;
|
OGLSync() = default;
|
||||||
|
|
||||||
OGLSync(OGLSync&& o) noexcept : handle(std::exchange(o.handle, nullptr)) {}
|
OGLSync(OGLSync&& o) noexcept : handle(std::exchange(o.handle, nullptr)) {}
|
||||||
|
@ -247,8 +267,10 @@ public:
|
||||||
GLsync handle = 0;
|
GLsync handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLFramebuffer : private NonCopyable {
|
class OGLFramebuffer final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLFramebuffer);
|
||||||
|
|
||||||
OGLFramebuffer() = default;
|
OGLFramebuffer() = default;
|
||||||
|
|
||||||
OGLFramebuffer(OGLFramebuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
OGLFramebuffer(OGLFramebuffer&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
||||||
|
@ -272,8 +294,10 @@ public:
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OGLQuery : private NonCopyable {
|
class OGLQuery final {
|
||||||
public:
|
public:
|
||||||
|
YUZU_NON_COPYABLE(OGLQuery);
|
||||||
|
|
||||||
OGLQuery() = default;
|
OGLQuery() = default;
|
||||||
|
|
||||||
OGLQuery(OGLQuery&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
OGLQuery(OGLQuery&& o) noexcept : handle(std::exchange(o.handle, 0)) {}
|
||||||
|
|
Loading…
Reference in a new issue