]> git.tdb.fi Git - libs/gl.git/blob - source/backends/opengl/buffer_backend.h
Use default member initializers for simple types
[libs/gl.git] / source / backends / opengl / buffer_backend.h
1 #ifndef MSP_GL_BUFFER_BACKEND_H_
2 #define MSP_GL_BUFFER_BACKEND_H_
3
4 #include <msp/core/noncopyable.h>
5
6 namespace Msp {
7 namespace GL {
8
9 class OpenGLBuffer: public NonCopyable
10 {
11         friend class OpenGLPipelineState;
12         friend class OpenGLTexture2D;
13         friend class OpenGLVertexSetup;
14
15 protected:
16         unsigned id = 0;
17
18         static OpenGLBuffer *scratch_binding;
19
20         OpenGLBuffer();
21         ~OpenGLBuffer();
22
23         void allocate();
24         void sub_data(unsigned, unsigned, const void *);
25
26         void *map();
27         bool unmap();
28
29         void set_debug_name(const std::string &);
30
31         void bind_scratch();
32         static void unbind_scratch();
33 };
34
35 using BufferBackend = OpenGLBuffer;
36
37 } // namespace GL
38 } // namespace Msp
39
40 #endif