Provide default implementation for IBinaryShaderCache interface, to be used in RamsesRenderer by setting in RendererConfig. Also provides functions to serialize binary shaders to file and deserialize binary shaders from file.
More...
#include <BinaryShaderCache.h>
|
| BinaryShaderCache () |
| Default Constructor. More...
|
|
virtual | ~BinaryShaderCache () override |
| Destructor of IBinaryShaderCache. More...
|
|
virtual void | deviceSupportsBinaryShaderFormats (const binaryShaderFormatId_t *supportedFormats, uint32_t numSupportedFormats) override |
| Provides a list of binary shader formats supported by the device in use. The cache implementation should provide only shaders that were compiled and stored with using of those formats. The format ID is platform/driver specific, on OpenGL it is equivalent to those retrieved from GL_PROGRAM_BINARY_FORMATS parameter. This callback will be called only once, after at least one display is created and at latest before the first IBinaryShaderCache::hasBinaryShader query. More...
|
|
virtual bool | hasBinaryShader (effectId_t effectId) const override |
| Check if the cache contains the binary shader for the Effect with the given Effect Id. More...
|
|
virtual uint32_t | getBinaryShaderSize (effectId_t effectId) const override |
| Get the binary shader size in bytes for the Effect with the given Effect Id. More...
|
|
virtual binaryShaderFormatId_t | getBinaryShaderFormat (effectId_t effectId) const override |
| Get the binary shader format for the Effect with the given Effect Id. More...
|
|
virtual bool | shouldBinaryShaderBeCached (effectId_t effectId, sceneId_t sceneId) const override |
| Returns for a specific effect whether it should be cached. More...
|
|
virtual void | getBinaryShaderData (effectId_t effectId, uint8_t *buffer, uint32_t bufferSize) const override |
| Get the binary shader data for the Effect with the given Effect Id. More...
|
|
virtual void | storeBinaryShader (effectId_t effectId, sceneId_t sceneId, const uint8_t *binaryShaderData, uint32_t binaryShaderDataSize, binaryShaderFormatId_t binaryShaderFormat) override |
| Store the binary shader into the cache. More...
|
|
void | saveToFile (const char *filePath) const |
| Save all binary shaders in the cache to the file with the given path. More...
|
|
bool | loadFromFile (const char *filePath) |
| Load all binary shaders from the file with the given path. More...
|
|
virtual void | binaryShaderUploaded (effectId_t effectId, bool success) const override |
| Used by RamsesRenderer to provide a callback with information on the result of a binary shader upload operation. More...
|
|
| BinaryShaderCache (const BinaryShaderCache &other)=delete |
| Deleted copy constructor. More...
|
|
BinaryShaderCache & | operator= (const BinaryShaderCache &other)=delete |
| Deleted copy assignment. More...
|
|
virtual | ~IBinaryShaderCache ()=default |
| Destructor of IBinaryShaderCache. More...
|
|
|
class BinaryShaderCacheImpl & | impl |
|
Provide default implementation for IBinaryShaderCache interface, to be used in RamsesRenderer by setting in RendererConfig. Also provides functions to serialize binary shaders to file and deserialize binary shaders from file.
◆ BinaryShaderCache() [1/2]
ramses::BinaryShaderCache::BinaryShaderCache |
( |
| ) |
|
◆ ~BinaryShaderCache()
virtual ramses::BinaryShaderCache::~BinaryShaderCache |
( |
| ) |
|
|
overridevirtual |
◆ BinaryShaderCache() [2/2]
Deleted copy constructor.
- Parameters
-
◆ binaryShaderUploaded()
virtual void ramses::BinaryShaderCache::binaryShaderUploaded |
( |
effectId_t |
effectId, |
|
|
bool |
success |
|
) |
| const |
|
overridevirtual |
Used by RamsesRenderer to provide a callback with information on the result of a binary shader upload operation.
This method is called by the renderer after each attempted upload operation from a binary shader cache. It is intended for informational/debugging purposes in detecting an invalid binary shader cache.
- Parameters
-
Implements ramses::IBinaryShaderCache.
◆ deviceSupportsBinaryShaderFormats()
virtual void ramses::BinaryShaderCache::deviceSupportsBinaryShaderFormats |
( |
const binaryShaderFormatId_t * |
supportedFormats, |
|
|
uint32_t |
numSupportedFormats |
|
) |
| |
|
overridevirtual |
Provides a list of binary shader formats supported by the device in use. The cache implementation should provide only shaders that were compiled and stored with using of those formats. The format ID is platform/driver specific, on OpenGL it is equivalent to those retrieved from GL_PROGRAM_BINARY_FORMATS parameter. This callback will be called only once, after at least one display is created and at latest before the first IBinaryShaderCache::hasBinaryShader query.
- Parameters
-
[in] | supportedFormats | Pointer to first element of a list of supported formats, this array is valid only for in the scope of this callback |
[in] | numSupportedFormats | Number of elements in supportedFormats array, if zero there is no support for uploading binary shaders |
Implements ramses::IBinaryShaderCache.
◆ getBinaryShaderData()
virtual void ramses::BinaryShaderCache::getBinaryShaderData |
( |
effectId_t |
effectId, |
|
|
uint8_t * |
buffer, |
|
|
uint32_t |
bufferSize |
|
) |
| const |
|
overridevirtual |
Get the binary shader data for the Effect with the given Effect Id.
- Parameters
-
effectId | Effect Id of the Effect |
buffer | pointer to the buffer to get the binary shader data |
bufferSize | the size of the buffer to get the binary shader data |
Implements ramses::IBinaryShaderCache.
◆ getBinaryShaderFormat()
◆ getBinaryShaderSize()
virtual uint32_t ramses::BinaryShaderCache::getBinaryShaderSize |
( |
effectId_t |
effectId | ) |
const |
|
overridevirtual |
◆ hasBinaryShader()
virtual bool ramses::BinaryShaderCache::hasBinaryShader |
( |
effectId_t |
effectId | ) |
const |
|
overridevirtual |
◆ loadFromFile()
bool ramses::BinaryShaderCache::loadFromFile |
( |
const char * |
filePath | ) |
|
Load all binary shaders from the file with the given path.
- Parameters
-
filePath | the path of the file to load binary shaders |
- Returns
- true when succeed in loading binary shaders from the file false when fail to load binary shaders from the file
◆ operator=()
Deleted copy assignment.
- Parameters
-
- Returns
- unused
◆ saveToFile()
void ramses::BinaryShaderCache::saveToFile |
( |
const char * |
filePath | ) |
const |
Save all binary shaders in the cache to the file with the given path.
- Parameters
-
filePath | the path of the file to save binary shaders |
◆ shouldBinaryShaderBeCached()
virtual bool ramses::BinaryShaderCache::shouldBinaryShaderBeCached |
( |
effectId_t |
effectId, |
|
|
sceneId_t |
sceneId |
|
) |
| const |
|
overridevirtual |
Returns for a specific effect whether it should be cached.
This method is called if the shader is not cached yet but could be provided by the renderer.
The cache can decide whether it the shader should be cached.
- Parameters
-
[in] | effectId | Effect Id of the Effect |
[in] | sceneId | ID of scene that uses the effect |
- Returns
- true if the effect should be cached, false otherwise.
Implements ramses::IBinaryShaderCache.
◆ storeBinaryShader()
virtual void ramses::BinaryShaderCache::storeBinaryShader |
( |
effectId_t |
effectId, |
|
|
sceneId_t |
sceneId, |
|
|
const uint8_t * |
binaryShaderData, |
|
|
uint32_t |
binaryShaderDataSize, |
|
|
binaryShaderFormatId_t |
binaryShaderFormat |
|
) |
| |
|
overridevirtual |
Store the binary shader into the cache.
- Parameters
-
effectId | Effect Id of the Effect |
sceneId | ID of scene that uses the effect |
binaryShaderData | pointer to the binary shader data |
binaryShaderDataSize | size of the binary shader data |
binaryShaderFormat | format of the binary shader |
Implements ramses::IBinaryShaderCache.
◆ impl
class BinaryShaderCacheImpl& ramses::BinaryShaderCache::impl |
Stores internal data for implementation specifics of this class.
The documentation for this class was generated from the following file:
- /home/runner/work/ramses/ramses/renderer/RendererLib/ramses-renderer-api/include/ramses-renderer-api/BinaryShaderCache.h