You.i Engine
YiAssetHardware.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_ASSET_HARDWARE_H_
3 #define _YI_ASSET_HARDWARE_H_
4 
10 #include "asset/YiAsset.h"
11 #include "utility/YiRtti.h"
12 
20 class CYIAssetHardware : public CYIAsset
21 {
22  friend class CYIGPULoadBufferEvent;
23 
24 public:
41  enum class RetentionPolicy
42  {
47  Retain = 0,
48 
53  Unload,
54  };
55 
57  virtual ~CYIAssetHardware() override;
58 
62  virtual bool RequestHardwareLoad();
63 
67  virtual bool RequestHardwareUnload();
68 
74  virtual bool RequestInvalidate();
75 
82  virtual bool RequestRestore();
83 
87  virtual bool Prepare() override;
88 
93  const std::shared_ptr<IYIGPUObject> &GetGPUObject() const;
94 
100  bool IsLoadedOnGPU() const;
101 
108 
114  void SetRetentionPolicy(RetentionPolicy policy);
115 
116 protected:
123  virtual std::shared_ptr<IYIGPUObject> CreateGPUObject() const = 0;
124 
138  virtual void ApplyRetainmentPolicy() {}
139 
140 protected:
141  virtual void OnLoad() override;
142 
144 
145  std::shared_ptr<IYIGPUObject> m_pGPUObject;
146 
148 
149 private:
151 };
152 
155 #endif // _YI_ASSET_HARDWARE_H_
virtual std::shared_ptr< IYIGPUObject > CreateGPUObject() const =0
void SetRetentionPolicy(RetentionPolicy policy)
virtual bool RequestHardwareUnload()
virtual void ApplyRetainmentPolicy()
Definition: YiAssetHardware.h:138
virtual ~CYIAssetHardware() override
std::shared_ptr< IYIGPUObject > m_pGPUObject
Definition: YiAssetHardware.h:145
friend class CYIGPULoadBufferEvent
Definition: YiAssetHardware.h:22
virtual bool Prepare() override
RetentionPolicy
The CYIAssetHardware::RetentionPolicy enum specifies the retention policy of static hardware assets f...
Definition: YiAssetHardware.h:41
RetentionPolicy m_retentionPolicy
Definition: YiAssetHardware.h:147
const std::shared_ptr< IYIGPUObject > & GetGPUObject() const
virtual bool RequestRestore()
virtual void OnLoad() override
Hardware-mirrored asset. These assets contain IYIGPUObject counterparts.
Definition: YiAssetHardware.h:20
virtual bool RequestHardwareLoad()
Base class for any asset. An asset provides functions for dynamically loading and unloading itself an...
Definition: YiAsset.h:32
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
This file contains the classes and macros used to implement RTTI in You.i Engine. ...
RetentionPolicy GetRetentionPolicy() const
bool m_hardwareLoadRequested
Definition: YiAssetHardware.h:143
bool IsLoadedOnGPU() const
virtual bool RequestInvalidate()