]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/backend.h
Make backend idenfication more generic
[libs/gl.git] / source / core / backend.h
diff --git a/source/core/backend.h b/source/core/backend.h
new file mode 100644 (file)
index 0000000..0dd0172
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef MSP_GL_BACKEND_H_
+#define MSP_GL_BACKEND_H_
+
+#include <string>
+
+namespace Msp {
+namespace GL {
+
+enum GraphicsApi
+{
+       OPENGL,
+       OPENGL_ES
+};
+
+struct Version
+{
+       unsigned short major;
+       unsigned short minor;
+
+       Version();
+       Version(unsigned short, unsigned short);
+       Version(const std::string &);
+
+       bool operator>=(const Version &) const;
+       bool operator<(const Version &o) const { return !(*this>=o); }
+       operator bool() const { return major || minor; }
+};
+
+/** Returns the backend for which the library was compiled. */
+GraphicsApi get_backend_api();
+
+/** Returns the backend version number, as reported by the implementation. */
+const Version &get_backend_version();
+
+} // namespace GL
+} // namespace Msp
+
+#endif