]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/deviceinfo.cpp
Store implementation limits in a central struct
[libs/gl.git] / source / core / deviceinfo.cpp
diff --git a/source/core/deviceinfo.cpp b/source/core/deviceinfo.cpp
new file mode 100644 (file)
index 0000000..54cb88b
--- /dev/null
@@ -0,0 +1,24 @@
+#include "deviceinfo.h"
+#include "gl.h"
+
+namespace Msp {
+namespace GL {
+
+Limits::Limits()
+{
+       glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, reinterpret_cast<int *>(&max_vertex_attributes));
+       glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, reinterpret_cast<int *>(&max_texture_bindings));
+       glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, reinterpret_cast<int *>(&max_uniform_bindings));
+       glGetIntegerv(GL_MAX_CLIP_PLANES, reinterpret_cast<int *>(&max_clip_planes));
+       glGetIntegerv(GL_MAX_SAMPLES, reinterpret_cast<int *>(&max_samples));
+       glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, reinterpret_cast<int *>(&uniform_buffer_alignment));
+}
+
+const Limits &Limits::get_global()
+{
+       static Limits limits;
+       return limits;
+}
+
+} // namespace GL
+} // namespace Msp