You.i Engine
CYIAssetShaderObject Class Reference

Detailed Description

Shader object asset. Can either be loaded from a precompiled binary, or loaded as source and compiled at run-time.

#include <asset/YiAssetShaderObject.h>

Inheritance diagram for CYIAssetShaderObject:

Public Types

enum  SHADER_TYPE {
  VERTEX_SHADER,
  FRAGMENT_SHADER,
  COMPUTE_SHADER
}
 
enum  CODE_TYPE {
  PRECOMPILED_BINARY,
  UNCOMPILED_SOURCE
}
 
- Public Types inherited from CYIAsset
enum  PATH_TYPE {
  PATH_ABSOLUTE = 0,
  PATH_RELATIVE
}
 

Public Member Functions

 CYIAssetShaderObject ()
 
 CYIAssetShaderObject (const CYIString &path, PATH_TYPE ePathType=PATH_RELATIVE)
 
virtual ~CYIAssetShaderObject ()
 
void GetCode (uint8_t **ppCode, uint32_t *pCodeSize) const
 
CODE_TYPE GetCodeType () const
 
SHADER_TYPE GetType () const
 
bool IsFromDisk () const
 
void SetFromDisk (bool bFromDisk)
 
void SetCode (const uint8_t *pCode, uint32_t uCodeSize, CODE_TYPE eType)
 
void SetType (SHADER_TYPE eType)
 
- Public Member Functions inherited from CYIAsset
virtual ~CYIAsset ()
 
const CYIStringGetPath () const
 
CYIAssetLoadParamsGetLoadParameters () const
 
virtual std::pair< uint32_t, uint32_t > GetApproximateSize () const
 
bool SetName (const CYIString &name)
 
const CYIStringGetName () const
 
bool Load ()
 
void Unload ()
 
bool IsLoaded () const
 
bool Equals (const std::shared_ptr< CYIAsset > &pAsset)
 
virtual bool Prepare ()
 
- Public Member Functions inherited from CYIScriptableRTTIObject
 CYIScriptableRTTIObject ()
 
virtual ~CYIScriptableRTTIObject ()
 
virtual const CYIRuntimeTypeInfoGetRuntimeTypeInfoForScriptObject () const override
 
- Public Member Functions inherited from CYIScriptableObject
 CYIScriptableObject ()
 
 CYIScriptableObject (const CYIScriptableObject &other)
 
CYIScriptableObjectoperator= (const CYIScriptableObject &other)
 
virtual ~CYIScriptableObject ()
 
CYIBindingImplementationGetBindingImplementation () const
 
void SetBindingImplementation (CYIBindingImplementation *pBindingImplementation)
 

Protected Member Functions

virtual void OnUnload () override
 
- Protected Member Functions inherited from CYIAsset
 CYIAsset ()
 
ssize_t GetID () const
 
void SetPath (const CYIString &path, PATH_TYPE ePathType)
 
void SetApproximateSize (uint32_t nSize)
 
void SetLoaded (bool bAssetLoaded)
 
void SetLoadParameters (std::unique_ptr< CYIAssetLoadParams > pParams)
 
virtual void OnLoad ()
 
- Protected Member Functions inherited from CYIScriptableRTTIObject
virtual std::pair< const CYIRuntimeTypeInfo *, const void * > GetRuntimeTypeInfoWithObject () const =0
 

Additional Inherited Members

- Static Protected Attributes inherited from CYIAsset
static ssize_t INVALID_ID
 

Member Enumeration Documentation

Enumerator
PRECOMPILED_BINARY 

Binary data that is compiled off-line prior to program execution. This data can come from disk or from memory. See IsFromDisk.

UNCOMPILED_SOURCE 

String data that is compiled at run-time. This data can come from disk or from memory. See IsFromDisk.

Describes the supported shader types. Together these form a shader program that describes how to render geometry.

Enumerator
VERTEX_SHADER 

Describes code that will be executed per-vertex.

FRAGMENT_SHADER 

Describes code that will be executed per-fragment.

COMPUTE_SHADER 

Describes code that will be executed as groups of threads.

Constructor & Destructor Documentation

CYIAssetShaderObject::CYIAssetShaderObject ( )
CYIAssetShaderObject::CYIAssetShaderObject ( const CYIString path,
PATH_TYPE  ePathType = PATH_RELATIVE 
)
virtual CYIAssetShaderObject::~CYIAssetShaderObject ( )
virtual

Member Function Documentation

void CYIAssetShaderObject::GetCode ( uint8_t **  ppCode,
uint32_t *  pCodeSize 
) const

Returns a pointer to the data defining this asset. The data will be of size pCodeSize in bytes.

If the data type of the shader, specified by GetDataType(), is CYIAssetShaderObject::PRECOMPILED_BINARY, the data will be a binary blob representing a compiled shader object. If the data type is CYIAssetShaderObject::UNCOMPILED_SOURCE, the data will be a string containing the shader source code. This source code will be compiled at run-time prior to usage, but will not be accessible as binary data.

CODE_TYPE CYIAssetShaderObject::GetCodeType ( ) const

Returns the format of the data contained in this asset.

SHADER_TYPE CYIAssetShaderObject::GetType ( ) const

Returns the type of shader object.

bool CYIAssetShaderObject::IsFromDisk ( ) const

Returns true if this asset is loaded from disk and false if it is defined in-memory.

virtual void CYIAssetShaderObject::OnUnload ( )
overrideprotectedvirtual

Reimplemented from CYIAsset.

void CYIAssetShaderObject::SetCode ( const uint8_t *  pCode,
uint32_t  uCodeSize,
CODE_TYPE  eType 
)

Sets the data defining this asset to be pCode with size uCodeSize in bytes. If the code is a null-terminated string, it is up to the user to specify the size (not including the terminating character).

Warning
It is up to the user to delete any memory that has been allocated to store the code, this object maintains its own copy.
void CYIAssetShaderObject::SetFromDisk ( bool  bFromDisk)
See also
IsFromDisk
void CYIAssetShaderObject::SetType ( SHADER_TYPE  eType)

Sets the type of shader object.


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