upgrade Filament to v1.41
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/Invocable.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
@@ -47,6 +48,8 @@ public:
|
||||
size_t handleArenaSize = 0;
|
||||
};
|
||||
|
||||
Platform() noexcept;
|
||||
|
||||
virtual ~Platform() noexcept;
|
||||
|
||||
/**
|
||||
@@ -79,6 +82,85 @@ public:
|
||||
* thread, or if the platform does not need to perform any special processing.
|
||||
*/
|
||||
virtual bool pumpEvents() noexcept;
|
||||
|
||||
/**
|
||||
* InsertBlobFunc is an Invocable to an application-provided function that a
|
||||
* backend implementation may use to insert a key/value pair into the
|
||||
* cache.
|
||||
*/
|
||||
using InsertBlobFunc = utils::Invocable<
|
||||
void(const void* key, size_t keySize, const void* value, size_t valueSize)>;
|
||||
|
||||
/*
|
||||
* RetrieveBlobFunc is an Invocable to an application-provided function that a
|
||||
* backend implementation may use to retrieve a cached value from the
|
||||
* cache.
|
||||
*/
|
||||
using RetrieveBlobFunc = utils::Invocable<
|
||||
size_t(const void* key, size_t keySize, void* value, size_t valueSize)>;
|
||||
|
||||
/**
|
||||
* Sets the callback functions that the backend can use to interact with caching functionality
|
||||
* provided by the application.
|
||||
*
|
||||
* Cache functions may only be specified once during the lifetime of a
|
||||
* Platform. The <insert> and <retrieve> Invocables may be called at any time and
|
||||
* from any thread from the time at which setBlobFunc is called until the time that Platform
|
||||
* is destroyed. Concurrent calls to these functions from different threads is also allowed.
|
||||
*
|
||||
* @param insertBlob an Invocable that inserts a new value into the cache and associates
|
||||
* it with the given key
|
||||
* @param retrieveBlob an Invocable that retrieves from the cache the value associated with a
|
||||
* given key
|
||||
*/
|
||||
void setBlobFunc(InsertBlobFunc&& insertBlob, RetrieveBlobFunc&& retrieveBlob) noexcept;
|
||||
|
||||
/**
|
||||
* @return true if setBlobFunc was called.
|
||||
*/
|
||||
bool hasBlobFunc() const noexcept;
|
||||
|
||||
/**
|
||||
* To insert a new binary value into the cache and associate it with a given
|
||||
* key, the backend implementation can call the application-provided callback
|
||||
* function insertBlob.
|
||||
*
|
||||
* No guarantees are made as to whether a given key/value pair is present in
|
||||
* the cache after the set call. If a different value has been associated
|
||||
* with the given key in the past then it is undefined which value, if any, is
|
||||
* associated with the key after the set call. Note that while there are no
|
||||
* guarantees, the cache implementation should attempt to cache the most
|
||||
* recently set value for a given key.
|
||||
*
|
||||
* @param key pointer to the beginning of the key data that is to be inserted
|
||||
* @param keySize specifies the size in byte of the data pointed to by <key>
|
||||
* @param value pointer to the beginning of the value data that is to be inserted
|
||||
* @param valueSize specifies the size in byte of the data pointed to by <value>
|
||||
*/
|
||||
void insertBlob(const void* key, size_t keySize, const void* value, size_t valueSize);
|
||||
|
||||
/**
|
||||
* To retrieve the binary value associated with a given key from the cache, a
|
||||
* the backend implementation can call the application-provided callback
|
||||
* function retrieveBlob.
|
||||
*
|
||||
* If the cache contains a value for the given key and its size in bytes is
|
||||
* less than or equal to <valueSize> then the value is written to the memory
|
||||
* pointed to by <value>. Otherwise nothing is written to the memory pointed
|
||||
* to by <value>.
|
||||
*
|
||||
* @param key pointer to the beginning of the key
|
||||
* @param keySize specifies the size in bytes of the binary key pointed to by <key>
|
||||
* @param value pointer to a buffer to receive the cached binary data, if it exists
|
||||
* @param valueSize specifies the size in bytes of the memory pointed to by <value>
|
||||
* @return If the cache contains a value associated with the given key then the
|
||||
* size of that binary value in bytes is returned. Otherwise 0 is returned.
|
||||
*/
|
||||
size_t retrieveBlob(const void* key, size_t keySize, void* value, size_t valueSize);
|
||||
|
||||
private:
|
||||
InsertBlobFunc mInsertBlob;
|
||||
RetrieveBlobFunc mRetrieveBlob;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
Reference in New Issue
Block a user