Hardware-mirrored asset. These assets contain IYIGPUObject counterparts.
Assets will automatically be marked for loading into video memory when their data setters are called. Users may also manually load and unload them into/from video memory using the CYIAssetHardware::RequestHardwareLoad() and CYIAssetHardware::RequestHardwareUnload() functions.
#include <asset/YiAssetHardware.h>
◆ RetentionPolicy
The CYIAssetHardware::RetentionPolicy enum specifies the retention policy of static hardware assets from the CPU memory once they are loaded onto the GPU. It is globally configurable, where new CYIAssetHardware will be making use of it and the can also change directly per assets. Be aware that on some platform, it is best to leave the assets retained on the CPU side when the platform lifecycle has the ability to destroy the graphic context while the app still runs, giving You.i Engine the ability to re-load every assets back onto GPU memory really fast. A good example of such platform would be Android.
- Note
- Please note that this retension mode only affects static assets since dynamic assets are meant to be update on a regular basis.
- Warning
- The default retention policy varies per platform.
Enumerator |
---|
Retain | Indicates that the asset data should be retained on CPU memory after is is uploaded onto GPU memory.
|
Unload | Indicate that the asset data should not be retained on CPU memory and unloaded/reclaimed after is is uploaded onto GPU memory.
|
◆ CYIAssetHardware()
CYIAssetHardware::CYIAssetHardware |
( |
| ) |
|
◆ ~CYIAssetHardware()
virtual CYIAssetHardware::~CYIAssetHardware |
( |
| ) |
|
|
overridevirtual |
◆ ApplyRetainmentPolicy()
virtual void CYIAssetHardware::ApplyRetainmentPolicy |
( |
| ) |
|
|
inlineprotectedvirtual |
Unloads CPU-side data buffer memory if the retainment policy is configured to unload instead of retaining it.
This function should only be used internally by the GPU object after the data has been uploaded onto the GPU. that some asset may chose to retain/unload cpu assets with additional conditions. For example, CYIAssetTextureBase won't unload the cpu asset if the asset is marked as being dynamic.
- See also
- SetRetentionPolicy
-
GetRetentionPolicy
Reimplemented in CYIAssetTextureBase, and CYIAssetBufferObjectData.
◆ CreateGPUObject()
virtual std::shared_ptr<IYIGPUObject> CYIAssetHardware::CreateGPUObject |
( |
| ) |
const |
|
protectedpure virtual |
◆ GetGPUObject()
const std::shared_ptr<IYIGPUObject>& CYIAssetHardware::GetGPUObject |
( |
| ) |
const |
Returns the hardware version of this object, if available, or a null version if the asset is not being managed or if a hardware version is unavailable.
◆ GetRetentionPolicy()
◆ IsLoadedOnGPU()
bool CYIAssetHardware::IsLoadedOnGPU |
( |
| ) |
const |
Helper function that returns true when the asset data has been successfully loaded into video memory. It will return false if the GPUObject hasn't been instantiated by CreateGPUObject(), or if the GPUObject is not in the correct 'loaded' state.
◆ OnLoad()
virtual void CYIAssetHardware::OnLoad |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ Prepare()
virtual bool CYIAssetHardware::Prepare |
( |
| ) |
|
|
overridevirtual |
Generates the hardware version of this object.
Reimplemented from CYIAsset.
◆ RequestHardwareLoad()
virtual bool CYIAssetHardware::RequestHardwareLoad |
( |
| ) |
|
|
virtual |
Will initiate a load request of the software data into video memory.
Reimplemented in CYIAssetFramebuffer.
◆ RequestHardwareUnload()
virtual bool CYIAssetHardware::RequestHardwareUnload |
( |
| ) |
|
|
virtual |
◆ RequestInvalidate()
virtual bool CYIAssetHardware::RequestInvalidate |
( |
| ) |
|
|
virtual |
In the event that the hardware context is lost, this method can be called to invalidate the resource.
Will be called automatically if this asset is registered with the asset manager.
Reimplemented in CYIAssetFramebuffer.
◆ RequestRestore()
virtual bool CYIAssetHardware::RequestRestore |
( |
| ) |
|
|
virtual |
In the event that the hardware context is restored, this method can be called to restore the resources after it was invalidated using Invalidate.
Will be called automatically if this asset is registered with the asset manager.
Reimplemented in CYIAssetFramebuffer.
◆ SetRetentionPolicy()
◆ CYIGPULoadBufferEvent
friend class CYIGPULoadBufferEvent |
|
friend |
◆ m_hardwareLoadRequested
bool CYIAssetHardware::m_hardwareLoadRequested |
|
protected |
◆ m_pGPUObject
std::shared_ptr<IYIGPUObject> CYIAssetHardware::m_pGPUObject |
|
protected |
◆ m_retentionPolicy
The documentation for this class was generated from the following file: