An interface used to implement a caching mechanism for resources used on the RamsesRenderer. Important: Please note that the resource ids in this context do not match client resource ids.
More...
#include <IRendererResourceCache.h>
|
virtual | ~IRendererResourceCache ()=default |
| Destructor of IRendererResourceCache. More...
|
|
virtual bool | hasResource (rendererResourceId_t resourceId, uint32_t &size) const =0 |
| Called by RamsesRenderer to ask for a resource with the given id. More...
|
|
virtual bool | getResourceData (rendererResourceId_t resourceId, uint8_t *buffer, uint32_t bufferSize) const =0 |
| Called by RamsesRenderer to get the resource data associated with a given resource id. This method will be called immediately after hasResource(...), if the resource exists in the cache. More...
|
|
virtual bool | shouldResourceBeCached (rendererResourceId_t resourceId, uint32_t resourceDataSize, resourceCacheFlag_t cacheFlag, sceneId_t sceneId) const =0 |
| Called by RamsesRenderer when a resource was not in the cache and is now available from other source. The cache is asked if it wants to store a given resource or not. This avoids the overhead of preparing the resource data in case it is not to be cached. More...
|
|
virtual void | storeResource (rendererResourceId_t resourceId, const uint8_t *resourceData, uint32_t resourceDataSize, resourceCacheFlag_t cacheFlag, sceneId_t sceneId)=0 |
| Called by RamsesRenderer with the final resource for storing. This is called immediately after shouldResourceBeCached(...), if it was requested to be cached. More...
|
|
An interface used to implement a caching mechanism for resources used on the RamsesRenderer. Important: Please note that the resource ids in this context do not match client resource ids.
◆ ~IRendererResourceCache()
virtual ramses::IRendererResourceCache::~IRendererResourceCache |
( |
| ) |
|
|
virtualdefault |
◆ getResourceData()
virtual bool ramses::IRendererResourceCache::getResourceData |
( |
rendererResourceId_t |
resourceId, |
|
|
uint8_t * |
buffer, |
|
|
uint32_t |
bufferSize |
|
) |
| const |
|
pure virtual |
Called by RamsesRenderer to get the resource data associated with a given resource id. This method will be called immediately after hasResource(...), if the resource exists in the cache.
- Parameters
-
resourceId | Id for the resource. |
buffer | A pre-allocated buffer which the resource data will be copied into. |
bufferSize | The size of the pre-allocated buffer in bytes. It should be at least the size of the requested resource (returned by hasResource(...)). |
- Returns
- true if the resource was copied successfully into the buffer.
Implemented in ramses::DefaultRendererResourceCache.
◆ hasResource()
virtual bool ramses::IRendererResourceCache::hasResource |
( |
rendererResourceId_t |
resourceId, |
|
|
uint32_t & |
size |
|
) |
| const |
|
pure virtual |
Called by RamsesRenderer to ask for a resource with the given id.
- Parameters
-
| resourceId | Id for the resource. |
[out] | size | The size of the found resource in bytes. This value is only relevant if the resource exists in the cache. |
- Returns
- true if a resource with the given resource id exists in the cache.
Implemented in ramses::DefaultRendererResourceCache.
◆ shouldResourceBeCached()
Called by RamsesRenderer when a resource was not in the cache and is now available from other source. The cache is asked if it wants to store a given resource or not. This avoids the overhead of preparing the resource data in case it is not to be cached.
- Parameters
-
resourceId | Id for the resource. |
resourceDataSize | The size of the resource in bytes. |
cacheFlag | The cache flag associated with the resource (set on client side). |
sceneId | The id of the first scene which requested the resource. In case of multiple scenes using the same resource, only the first scene id is guaranteed to be reported. |
- Returns
- true if the cache wants to store the resource.
Implemented in ramses::DefaultRendererResourceCache.
◆ storeResource()
Called by RamsesRenderer with the final resource for storing. This is called immediately after shouldResourceBeCached(...), if it was requested to be cached.
- Parameters
-
resourceId | Id for the resource. |
resourceData | The resource data which will be copied into the cache. |
resourceDataSize | The size of the resource in bytes. |
cacheFlag | The cache flag associated with the resource (set on client side). |
sceneId | The id of the first scene which requested the resource. In case of multiple scenes using the same resource, only the first scene id is guaranteed to be reported. |
Implemented in ramses::DefaultRendererResourceCache.
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/IRendererResourceCache.h