]> git.tdb.fi Git - libs/gl.git/blob - source/backends/opengl/device_backend.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / backends / opengl / device_backend.h
1 #ifndef MSP_GL_DEVICE_BACKEND_H_
2 #define MSP_GL_DEVICE_BACKEND_H_
3
4 #include <vector>
5 #include <msp/core/noncopyable.h>
6 #include <msp/graphics/glcontext.h>
7
8 namespace Msp {
9 namespace GL {
10
11 class OpenGLBuffer;
12 class OpenGLPipelineState;
13 class OpenGLTexture;
14
15 struct OpenGLDeviceState
16 {
17         const OpenGLPipelineState *last_pipeline = 0;
18         std::vector<int> bound_tex_targets;
19         std::vector<char> bound_storage_textures;
20         std::vector<char> bound_uniform_blocks;
21         unsigned restart_index = 0;
22         unsigned n_clip_distances = 0;
23         const OpenGLBuffer *scratch_buffer = 0;
24         const OpenGLTexture *scratch_texture = 0;
25 };
26
27 class OpenGLDevice: public NonCopyable
28 {
29 protected:
30         Graphics::GLContext context;
31         OpenGLDeviceState state;
32
33         OpenGLDevice(Graphics::Window &, const Graphics::GLOptions &);
34
35         static Graphics::GLOptions create_default_options();
36
37         void fill_info();
38
39         Graphics::GLContext &get_context() { return context; }
40
41 public:
42         OpenGLDeviceState &get_state() { return state; }
43 };
44
45 using DeviceBackend = OpenGLDevice;
46 using DeviceOptions = Graphics::GLOptions;
47
48 } // namespace GL
49 } // namespace Msp
50
51 #endif