An interface for managing GPU-bound objects such as shaders and textures.
#include <renderer/YiGPUObject.h>
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 |
|
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. |
|
inline |
|
inlinevirtual |
|
pure virtual |
Deallocates the GPU memory associated with this object.
Implemented in CYID3D11FramebufferObject, CYIGLFramebufferObject, CYIGNMTextureObject, CYIGNMFramebufferObject, CYIGLTextureObject, and CYID3D11TextureObject.
|
pure virtual |
Generates a valid handle. No GPU memory is allocated until Load() is called.
Implemented in CYID3D11FramebufferObject, CYIGLFramebufferObject, CYIGNMTextureObject, CYIGNMFramebufferObject, CYIGLTextureObject, and CYID3D11TextureObject.
|
inline |
Returns the status of the object
|
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.
Implemented in CYID3D11FramebufferObject, CYIGLFramebufferObject, CYIGNMTextureObject, CYIGNMFramebufferObject, CYIGLTextureObject, and CYID3D11TextureObject.
|
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.
|
pure virtual |
Frees any previously loaded data from video memory, but retains the handle.
Implemented in CYIGNMTextureObject, CYID3D11FramebufferObject, CYIGLFramebufferObject, CYIGLTextureObject, CYID3D11TextureObject, and CYIGNMFramebufferObject.
|
pure virtual |
Makes the GPU Object active, called by the renderer
Implemented in CYIGNMTextureObject, CYID3D11FramebufferObject, CYIGLFramebufferObject, CYIGLTextureObject, CYID3D11TextureObject, and CYIGNMFramebufferObject.
|
protected |