Jamie Madill | 4f86d05 | 2017-06-05 12:59:26 -0400 | [diff] [blame^] | 1 | // |
| 2 | // Copyright 2017 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | // MemoryProgramCache: Stores compiled and linked programs in memory so they don't |
| 7 | // always have to be re-compiled. Can be used in conjunction with the platform |
| 8 | // layer to warm up the cache from disk. |
| 9 | |
| 10 | #ifndef LIBANGLE_MEMORY_PROGRAM_CACHE_H_ |
| 11 | #define LIBANGLE_MEMORY_PROGRAM_CACHE_H_ |
| 12 | |
| 13 | #include "common/MemoryBuffer.h" |
| 14 | #include "libANGLE/Error.h" |
| 15 | |
| 16 | namespace gl |
| 17 | { |
| 18 | class Context; |
| 19 | class InfoLog; |
| 20 | class Program; |
| 21 | class ProgramState; |
| 22 | |
| 23 | class MemoryProgramCache final : angle::NonCopyable |
| 24 | { |
| 25 | public: |
| 26 | // Writes a program's binary to the output memory buffer. |
| 27 | static void Serialize(const Context *context, |
| 28 | const Program *program, |
| 29 | angle::MemoryBuffer *binaryOut); |
| 30 | |
| 31 | // Loads program state according to the specified binary blob. |
| 32 | static LinkResult Deserialize(const Context *context, |
| 33 | const Program *program, |
| 34 | ProgramState *state, |
| 35 | const uint8_t *binary, |
| 36 | size_t length, |
| 37 | InfoLog &infoLog); |
| 38 | }; |
| 39 | |
| 40 | } // namespace gl |
| 41 | |
| 42 | #endif // LIBANGLE_MEMORY_PROGRAM_CACHE_H_ |