Shader program asset. Contains a vector of CYIAssetShaderObject types.
#include <asset/YiAssetShaderProgram.h>
Public Member Functions | |
CYIAssetShaderProgram () | |
CYIAssetShaderProgram (const CYIString &path, PathType pathType=PathType::Relative) | |
virtual | ~CYIAssetShaderProgram () |
void | AddShaderObject (const std::shared_ptr< CYIAssetShaderObject > &pShaderObjectAsset) |
const std::vector< std::shared_ptr< CYIAssetShaderObject > > & | GetShaderObjects () |
void | RemoveShaderObject (const std::shared_ptr< CYIAssetShaderObject > &pShaderObjectAsset) |
void | SetAttributeLocation (CYIString name, uint32_t location) |
void | UnsetAttributeLocation (CYIString name) |
const std::vector< std::pair< uint32_t, CYIString > > & | GetAttributeLocations () |
bool | Load () |
![]() | |
CYIAssetHardware () | |
virtual | ~CYIAssetHardware () override |
virtual bool | RequestHardwareLoad () |
virtual bool | RequestHardwareUnload () |
virtual bool | RequestInvalidate () |
virtual bool | RequestRestore () |
virtual bool | Prepare () override |
const std::shared_ptr< IYIGPUObject > & | GetGPUObject () const |
bool | IsLoadedOnGPU () const |
RetentionPolicy | GetRetentionPolicy () const |
void | SetRetentionPolicy (RetentionPolicy policy) |
![]() | |
virtual | ~CYIAsset () |
const CYIString & | GetPath () const |
CYIAssetLoadParams * | GetLoadParameters () const |
virtual std::pair< size_t, size_t > | GetApproximateSize () const |
bool | SetName (const CYIString &name) |
const CYIString & | GetName () const |
bool | Load () |
void | Unload () |
bool | IsLoaded () const |
bool | Equals (const std::shared_ptr< CYIAsset > &pAsset) |
Protected Member Functions | |
virtual std::shared_ptr< IYIGPUObject > | CreateGPUObject () const override |
void | UpdateApproximateSize () |
![]() | |
virtual void | ApplyRetainmentPolicy () |
virtual void | OnLoad () override |
![]() | |
CYIAsset () | |
ssize_t | GetID () const |
void | SetPath (const CYIString &path, PathType pathType) |
void | SetApproximateSize (size_t size) |
void | SetLoaded (bool assetLoaded) |
void | SetLoadParameters (std::unique_ptr< CYIAssetLoadParams > pParams) |
virtual void | OnUnload () |
Additional Inherited Members | |
![]() | |
enum | RetentionPolicy { RetentionPolicy::Retain = 0, RetentionPolicy::Unload } |
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. More... | |
![]() | |
enum | PathType { PathType::Absolute = 0, PathType::Relative } |
![]() | |
bool | m_hardwareLoadRequested |
std::shared_ptr< IYIGPUObject > | m_pGPUObject |
RetentionPolicy | m_retentionPolicy |
![]() | |
static ssize_t | INVALID_ID |
CYIAssetShaderProgram::CYIAssetShaderProgram | ( | ) |
CYIAssetShaderProgram::CYIAssetShaderProgram | ( | const CYIString & | path, |
PathType | pathType = PathType::Relative |
||
) |
|
virtual |
void CYIAssetShaderProgram::AddShaderObject | ( | const std::shared_ptr< CYIAssetShaderObject > & | pShaderObjectAsset | ) |
Adds a pShaderObjectAsset to the list of managed shader objects.
|
overrideprotectedvirtual |
Subclasses must implement this function to instance a new IYIGPUObject concrete type corresponding to the asset container. This function will be called by the CreateGPUObject implementation of CYIAssetHardware
Implements CYIAssetHardware.
const std::vector<std::pair<uint32_t, CYIString> >& CYIAssetShaderProgram::GetAttributeLocations | ( | ) |
Get attribute locations as a vector of pairs. The shader will be reloaded, if necessary.
const std::vector<std::shared_ptr<CYIAssetShaderObject> >& CYIAssetShaderProgram::GetShaderObjects | ( | ) |
Returns a vector of shader objects. The shaders will be reloaded, if necessary.
bool CYIAssetShaderProgram::Load | ( | ) |
void CYIAssetShaderProgram::RemoveShaderObject | ( | const std::shared_ptr< CYIAssetShaderObject > & | pShaderObjectAsset | ) |
Removes a pShaderObjectAsset from the list of managed shader objects.
void CYIAssetShaderProgram::SetAttributeLocation | ( | CYIString | name, |
uint32_t | location | ||
) |
Declare a vertex attribute to be at a particular location. See CYIMesh for more information about You.i Engine default attribute locations.
This should ALWAYS be used to declare your attribute locations, for performance we do not provide a means for reading automatically generated attribute locations back from shaders.
void CYIAssetShaderProgram::UnsetAttributeLocation | ( | CYIString | name | ) |
Unset an attribute location setting
|
protected |