1 #pragma once
2 
3 #include <mbgl/gl/features.hpp>
4 #include <mbgl/gl/extension.hpp>
5 #include <mbgl/gl/gl.hpp>
6 
7 #if MBGL_HAS_BINARY_PROGRAMS
8 
9 #define GL_PROGRAM_BINARY_LENGTH                   0x8741
10 #define GL_NUM_PROGRAM_BINARY_FORMATS              0x87FE
11 #define GL_PROGRAM_BINARY_FORMATS                  0x87FF
12 
13 namespace mbgl {
14 namespace gl {
15 namespace extension {
16 
17 class ProgramBinary {
18 public:
19     template <typename Fn>
ProgramBinary(const Fn & loadExtension)20     ProgramBinary(const Fn& loadExtension)
21         : getProgramBinary(loadExtension({
22               { "GL_OES_get_program_binary", "glGetProgramBinaryOES" },
23               { "GL_ARB_get_program_binary", "glGetProgramBinary" },
24           })),
25           programBinary(loadExtension({
26               { "GL_OES_get_program_binary", "glProgramBinaryOES" },
27               { "GL_ARB_get_program_binary", "glProgramBinary" },
28           })) {
29     }
30 
31     const ExtensionFunction<void(
32         GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)>
33         getProgramBinary;
34 
35     const ExtensionFunction<void(
36         GLuint program, GLenum binaryFormat, const GLvoid* binary, GLint length)>
37         programBinary;
38 };
39 
40 } // namespace extension
41 } // namespace gl
42 } // namespace mbgl
43 
44 #endif
45