]> git.tdb.fi Git - libs/gl.git/blob - source/core/deviceinfo.cpp
Make backend idenfication more generic
[libs/gl.git] / source / core / deviceinfo.cpp
1 #include <msp/gl/extensions/arb_enhanced_layouts.h>
2 #include <msp/gl/extensions/arb_explicit_attrib_location.h>
3 #include <msp/gl/extensions/arb_explicit_uniform_location.h>
4 #include <msp/gl/extensions/arb_gpu_shader5.h>
5 #include <msp/gl/extensions/arb_separate_shader_objects.h>
6 #include <msp/gl/extensions/arb_uniform_buffer_object.h>
7 #include <msp/gl/extensions/arb_vertex_shader.h>
8 #include <msp/gl/extensions/ext_framebuffer_multisample.h>
9 #include <msp/gl/extensions/ext_gpu_shader4.h>
10 #include <msp/gl/extensions/ext_texture_array.h>
11 #include <msp/gl/extensions/msp_clipping.h>
12 #include <msp/gl/extensions/nv_fbo_color_attachments.h>
13 #include "deviceinfo.h"
14 #include "gl.h"
15
16 namespace Msp {
17 namespace GL {
18
19 Limits::Limits()
20 {
21         glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, reinterpret_cast<int *>(&max_vertex_attributes));
22         glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, reinterpret_cast<int *>(&max_texture_bindings));
23         glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, reinterpret_cast<int *>(&max_uniform_bindings));
24         glGetIntegerv(GL_MAX_CLIP_PLANES, reinterpret_cast<int *>(&max_clip_planes));
25         glGetIntegerv(GL_MAX_SAMPLES, reinterpret_cast<int *>(&max_samples));
26         glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, reinterpret_cast<int *>(&uniform_buffer_alignment));
27         glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, reinterpret_cast<int *>(&max_color_attachments));
28 }
29
30
31 DeviceInfo::DeviceInfo()
32 {
33         glsl_features.target_api = get_backend_api();
34         glsl_features.glsl_version = get_glsl_version();
35         glsl_features.arb_enhanced_layouts = ARB_enhanced_layouts;
36         glsl_features.arb_explicit_attrib_location = ARB_explicit_attrib_location;
37         glsl_features.arb_explicit_uniform_location = ARB_explicit_uniform_location;
38         glsl_features.arb_gpu_shader5 = ARB_gpu_shader5;
39         glsl_features.arb_separate_shader_objects = ARB_separate_shader_objects;
40         glsl_features.arb_uniform_buffer_object = ARB_uniform_buffer_object;
41         glsl_features.ext_gpu_shader4 = EXT_gpu_shader4;
42         glsl_features.ext_texture_array = EXT_texture_array;
43         glsl_features.uniform_binding_range = limits.max_uniform_bindings;
44         glsl_features.texture_binding_range = limits.max_texture_bindings;
45 }
46
47 const DeviceInfo &DeviceInfo::get_global()
48 {
49         static DeviceInfo info;
50         return info;
51 }
52
53 } // namespace GL
54 } // namespace Msp