blob: 66b8e2af6a78b38cbe505b31dc44037cc59a0657 [file] [log] [blame]
Jamie Madill4f86d052017-06-05 12:59:26 -04001//
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
16namespace gl
17{
18class Context;
19class InfoLog;
20class Program;
21class ProgramState;
22
23class 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_