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  YI_GPU_OBJECT_STATUS {
  INVALID,
  UNLOADED,
  LOADED_FRESH,
  LOADED_STALE
}
 

Public Member Functions

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

Protected Attributes

YI_GPU_OBJECT_STATUS m_status
 

Member Enumeration Documentation

Enumerator
INVALID 

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

UNLOADED 

Handle is valid, but no data has been loaded.

LOADED_FRESH 

The data from the associated asset is successfully loaded.

LOADED_STALE 

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 ( )
inline
IYIGPUObject::~IYIGPUObject ( )
inlinevirtual

Member Function Documentation

virtual void IYIGPUObject::Free ( )
pure virtual

Deallocates the GPU memory associated with this object.

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

virtual void IYIGPUObject::Generate ( )
pure virtual

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

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

IYIGPUObject::YI_GPU_OBJECT_STATUS IYIGPUObject::GetStatus ( ) const
inline

Returns the status of the object

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 CYIGLFramebufferObject, CYID3D11FramebufferObject, CYIGNMFramebufferObject, CYIGNMTextureObject, CYID3D11TextureObject, and CYIGLTextureObject.

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 YI_GPU_OBJECT_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 YI_GPU_OBJECT_STATUS documentation for more details.

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

virtual void IYIGPUObject::Unload ( )
pure virtual

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

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

virtual void IYIGPUObject::Use ( ) const
pure virtual

Member Data Documentation

YI_GPU_OBJECT_STATUS IYIGPUObject::m_status
protected

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