RAMSES Documentation  27.0.130
Information for RAMSES users and developers
BinaryShaderCache.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // Copyright (C) 2016 BMW Car IT GmbH
3 // -------------------------------------------------------------------------
4 // This Source Code Form is subject to the terms of the Mozilla Public
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
6 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 // -------------------------------------------------------------------------
8 
9 #ifndef RAMSES_RENDERERAPI_BINARYSHADERCACHE_H
10 #define RAMSES_RENDERERAPI_BINARYSHADERCACHE_H
11 
13 
14 namespace ramses
15 {
21  {
22  public:
23 
28 
32  virtual ~BinaryShaderCache() override;
33 
43  virtual void deviceSupportsBinaryShaderFormats(const binaryShaderFormatId_t* supportedFormats, uint32_t numSupportedFormats) override;
44 
51  virtual bool hasBinaryShader(effectId_t effectId) const override;
52 
59  virtual uint32_t getBinaryShaderSize(effectId_t effectId) const override;
60 
67  virtual binaryShaderFormatId_t getBinaryShaderFormat(effectId_t effectId) const override;
68 
78  virtual bool shouldBinaryShaderBeCached(effectId_t effectId, sceneId_t sceneId) const override;
79 
86  virtual void getBinaryShaderData(effectId_t effectId, uint8_t* buffer, uint32_t bufferSize) const override;
87 
96  virtual void storeBinaryShader(effectId_t effectId, sceneId_t sceneId, const uint8_t* binaryShaderData, uint32_t binaryShaderDataSize, binaryShaderFormatId_t binaryShaderFormat) override;
97 
102  void saveToFile(const char* filePath) const;
103 
110  bool loadFromFile(const char* filePath);
111 
121  virtual void binaryShaderUploaded(effectId_t effectId, bool success) const override;
122 
127  BinaryShaderCache(const BinaryShaderCache& other) = delete;
128 
135 
139  class BinaryShaderCacheImpl& impl;
140  };
141 }
142 
143 #endif
#define RAMSES_API
Definition: APIExport.h:35
Provide default implementation for IBinaryShaderCache interface, to be used in RamsesRenderer by sett...
Definition: BinaryShaderCache.h:21
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...
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.
virtual binaryShaderFormatId_t getBinaryShaderFormat(effectId_t effectId) const override
Get the binary shader format for the Effect with the given Effect Id.
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.
class BinaryShaderCacheImpl & impl
Definition: BinaryShaderCache.h:139
BinaryShaderCache & operator=(const BinaryShaderCache &other)=delete
Deleted copy assignment.
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 sho...
virtual ~BinaryShaderCache() override
Destructor of IBinaryShaderCache.
virtual bool hasBinaryShader(effectId_t effectId) const override
Check if the cache contains the binary shader for the Effect with the given Effect Id.
virtual bool shouldBinaryShaderBeCached(effectId_t effectId, sceneId_t sceneId) const override
Returns for a specific effect whether it should be cached.
virtual uint32_t getBinaryShaderSize(effectId_t effectId) const override
Get the binary shader size in bytes for the Effect with the given Effect Id.
BinaryShaderCache()
Default Constructor.
BinaryShaderCache(const BinaryShaderCache &other)=delete
Deleted copy constructor.
void saveToFile(const char *filePath) const
Save all binary shaders in the cache to the file with the given path.
bool loadFromFile(const char *filePath)
Load all binary shaders from the file with the given path.
An interface used to exchange Binary Shader Cache with the RamsesRenderer. The RamsesRenderer will no...
Definition: IBinaryShaderCache.h:72
Helper class to create strongly typed values out of various types.
Definition: StronglyTypedValue.h:23
The RAMSES namespace contains all client side objects and functions used to implement RAMSES applicat...
Definition: AnimatedProperty.h:15
Resource identifier used to refer to a resource on the renderer.
Definition: Types.h:33