You.i Engine
IYIGPUObject Class Referenceabstract

Detailed Description

An interface for managing GPU-bound objects such as shaders and textures.

#include <renderer/YiGPUObject.h>

Inheritance diagram for IYIGPUObject:

Public Types

enum  Status {
  Status::Invalid,
  Status::Unloaded,
  Status::LoadedFresh,
  Status::LoadedStale
}
 

Public Member Functions

 IYIGPUObject ()
 
virtual ~IYIGPUObject ()
 
virtual void Load (const std::shared_ptr< CYIAssetHardware > &pHWAsset)=0
 
virtual void Unload ()=0
 
Status GetStatus () const
 
virtual void Use () const =0
 
virtual void Generate ()=0
 
virtual void Free ()=0
 
virtual void InvalidateHandle ()=0
 

Protected Attributes

Status m_status
 

Member Enumeration Documentation

◆ Status

enum IYIGPUObject::Status
strong
Enumerator
Invalid 

Handle is not valid, Generate() has not been successfully executed.

Unloaded 

Handle is valid, but no data has been loaded.

LoadedFresh 

The data from the associated asset is successfully loaded.

LoadedStale 

The data that is loaded does not match the information in the last Load() call, but data is loaded into this asset.

Constructor & Destructor Documentation

◆ IYIGPUObject()

IYIGPUObject::IYIGPUObject ( )
inline

◆ ~IYIGPUObject()

IYIGPUObject::~IYIGPUObject ( )
inlinevirtual

Member Function Documentation

◆ Free()

virtual void IYIGPUObject::Free ( )
pure virtual

Deallocates the GPU memory associated with this object.

Implemented in CYID3D11FramebufferObject, CYIGLFramebufferObject, CYIGNMTextureObject, CYIGNMFramebufferObject, CYIGLTextureObject, and CYID3D11TextureObject.

◆ Generate()

virtual void IYIGPUObject::Generate ( )
pure virtual

Generates a valid handle. No GPU memory is allocated until Load() is called.

Implemented in CYID3D11FramebufferObject, CYIGLFramebufferObject, CYIGNMTextureObject, CYIGNMFramebufferObject, CYIGLTextureObject, and CYID3D11TextureObject.

◆ GetStatus()

IYIGPUObject::Status IYIGPUObject::GetStatus ( ) const
inline

Returns the status of the object

◆ InvalidateHandle()

virtual void IYIGPUObject::InvalidateHandle ( )
pure virtual

This function can be called to invalidate the buffer handle without freeing the associated memory.

This can be used if the GL context is lost and GPU memory is freed implicitly. Calling Free() on this object will result in a crash if the handle is no longer pointing to valid memory, and a new handle may not be created with Generate() if the current handle is valid. This function allows you to inform the buffer object that the GL data has been freed externally and that the handle should be disconnected.

Warning
Calling this function without being sure that the handle has been freed in GPU memory will result in a memory leak. Use at your own risk.

Implemented in CYID3D11FramebufferObject, CYIGLFramebufferObject, CYIGNMTextureObject, CYIGNMFramebufferObject, CYIGLTextureObject, and CYID3D11TextureObject.

◆ Load()

virtual void IYIGPUObject::Load ( const std::shared_ptr< CYIAssetHardware > &  pHWAsset)
pure virtual

Loads the software data from the associated CYIAsset into graphics memory. If the Status is LOADED_FRESH upon a call to load, meaning that data was previously successfully loaded, the status may become LOADED_STALE in the case where this load failed. See the Status documentation for more details.

Implemented in CYIGNMTextureObject, CYID3D11FramebufferObject, CYIGLFramebufferObject, CYIGLTextureObject, CYID3D11TextureObject, and CYIGNMFramebufferObject.

◆ Unload()

virtual void IYIGPUObject::Unload ( )
pure virtual

Frees any previously loaded data from video memory, but retains the handle.

Implemented in CYIGNMTextureObject, CYID3D11FramebufferObject, CYIGLFramebufferObject, CYIGLTextureObject, CYID3D11TextureObject, and CYIGNMFramebufferObject.

◆ Use()

virtual void IYIGPUObject::Use ( ) const
pure virtual

Member Data Documentation

◆ m_status

Status IYIGPUObject::m_status
protected

The documentation for this class was generated from the following file: