]> git.tdb.fi Git - libs/gl.git/blob - source/core/device.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / core / device.h
1 #ifndef MSP_GL_DEVICE_H_
2 #define MSP_GL_DEVICE_H_
3
4 #include <msp/graphics/window.h>
5 #include "backend.h"
6 #include "device_backend.h"
7 #include "glsl/features.h"
8
9 namespace Msp {
10 namespace GL {
11
12 /**
13 Contains information about various limits imposed by the graphics device.
14 */
15 struct DeviceLimits
16 {
17         unsigned max_clip_planes = 6;
18         unsigned max_vertex_attributes = 16;
19         unsigned max_texture_bindings = 16;
20         unsigned max_color_attachments = 8;
21         unsigned max_samples = 4;
22         unsigned max_uniform_bindings = 24;
23         unsigned uniform_buffer_alignment = 256;
24         float max_anisotropy = 1.0f;
25 };
26
27 /**
28 Contains information about a graphics device.
29 */
30 struct DeviceInfo
31 {
32         GraphicsApi api;
33         Version api_version;
34         DeviceLimits limits;
35         SL::Features glsl_features;
36 };
37
38 /**
39 Represents a graphics device.  An instance must be created to use the library.
40 */
41 class Device: public DeviceBackend
42 {
43         friend DeviceBackend;
44
45 private:
46         DeviceInfo info;
47
48         static Device *current;
49
50 public:
51         Device(Graphics::Window &);
52         Device(Graphics::Window &, const DeviceOptions &);
53         ~Device();
54
55         using DeviceBackend::get_context;
56         const DeviceInfo &get_info() const { return info; }
57
58         static Device &get_current();
59 };
60
61 } // namespace GL
62 } // namespace Msp
63
64 #endif