1 #ifndef MSP_GL_DEVICE_BACKEND_H_
2 #define MSP_GL_DEVICE_BACKEND_H_
5 #include <msp/core/noncopyable.h>
6 #include <msp/graphics/glcontext.h>
12 class OpenGLPipelineState;
15 struct OpenGLDeviceState
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;
27 class OpenGLDevice: public NonCopyable
30 Graphics::GLContext context;
31 OpenGLDeviceState state;
33 OpenGLDevice(Graphics::Window &, const Graphics::GLOptions &);
35 static Graphics::GLOptions create_default_options();
39 Graphics::GLContext &get_context() { return context; }
42 OpenGLDeviceState &get_state() { return state; }
45 using DeviceBackend = OpenGLDevice;
46 using DeviceOptions = Graphics::GLOptions;