]> git.tdb.fi Git - libs/gl.git/blob - source/core/device.h
Set mip levels of multisample textures to 1
[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_storage_texture_bindings = 8;
21         unsigned max_color_attachments = 8;
22         unsigned max_samples = 4;
23         unsigned max_uniform_bindings = 24;
24         unsigned uniform_buffer_alignment = 256;
25         float max_anisotropy = 1.0f;
26 };
27
28 /**
29 Contains information about a graphics device.
30 */
31 struct DeviceInfo
32 {
33         GraphicsApi api;
34         Version api_version;
35         DeviceLimits limits;
36         SL::Features glsl_features;
37 };
38
39 /**
40 Represents a graphics device.  An instance must be created to use the library.
41 */
42 class Device: public DeviceBackend
43 {
44         friend DeviceBackend;
45
46 private:
47         DeviceInfo info;
48
49         static Device *current;
50
51 public:
52         Device(Graphics::Window &);
53         Device(Graphics::Window &, const DeviceOptions &);
54         ~Device();
55
56         using DeviceBackend::get_context;
57         const DeviceInfo &get_info() const { return info; }
58
59         static Device &get_current();
60 };
61
62 } // namespace GL
63 } // namespace Msp
64
65 #endif