summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2016-04-04 15:42:25 +0100
committerJose Fonseca <jfonseca@vmware.com>2016-04-04 15:42:25 +0100
commit8d6653ac387e5fd1a2eae549239099a05e9cac03 (patch)
treede3bc8105dec54d3428df173827a6afc180e4b9c /helpers
parent9ed6462ab512e967a7f7a1350f9eaaf74105c24d (diff)
helpers: Move GL extension cache object to glfeatures.
So it can be used in the wrappers too.
Diffstat (limited to 'helpers')
-rw-r--r--helpers/glfeatures.cpp38
-rw-r--r--helpers/glfeatures.hpp30
2 files changed, 67 insertions, 1 deletions
diff --git a/helpers/glfeatures.cpp b/helpers/glfeatures.cpp
index 0a815a56..69d93325 100644
--- a/helpers/glfeatures.cpp
+++ b/helpers/glfeatures.cpp
@@ -322,4 +322,42 @@ Extensions::has(const char *string) const
}
+Features::Features(void)
+{
+ memset(this, 0, sizeof *this);
+}
+
+
+void
+Features::load(const Profile & profile, const Extensions & ext)
+{
+ ES = profile.es();
+ core = profile.core;
+
+ ARB_draw_buffers = !ES;
+
+ // Check extensions we use.
+ ARB_sampler_objects = ext.has("GL_ARB_sampler_objects");
+ ARB_get_program_binary = ext.has("GL_ARB_get_program_binary");
+ KHR_debug = !ES && ext.has("GL_KHR_debug");
+ EXT_debug_label = ext.has("GL_EXT_debug_label");
+ ARB_direct_state_access = ext.has("GL_ARB_direct_state_access");
+ ARB_shader_image_load_store = ext.has("GL_ARB_shader_image_load_store");
+ ARB_shader_storage_buffer_object = ext.has("GL_ARB_shader_storage_buffer_object");
+ ARB_program_interface_query = ext.has("GL_ARB_program_interface_query");
+
+ NV_read_depth_stencil = ES && ext.has("GL_NV_read_depth_stencil");
+}
+
+
+void
+Features::load(void)
+{
+ glfeatures::Profile profile = glfeatures::getCurrentContextProfile();
+ glfeatures::Extensions exts;
+ exts.getCurrentContextExtensions(profile);
+ load(profile, exts);
+}
+
+
} /* namespace glfeatures */
diff --git a/helpers/glfeatures.hpp b/helpers/glfeatures.hpp
index 4eabc764..a85a5927 100644
--- a/helpers/glfeatures.hpp
+++ b/helpers/glfeatures.hpp
@@ -125,10 +125,12 @@ Profile
getCurrentContextProfile(void);
-struct Extensions
+class Extensions
{
+private:
std::set<std::string> strings;
+public:
void
getCurrentContextExtensions(const Profile & profile);
@@ -137,5 +139,31 @@ struct Extensions
};
+struct Features
+{
+ unsigned ES:1;
+ unsigned core:1;
+
+ unsigned ARB_draw_buffers:1;
+ unsigned ARB_sampler_objects:1;
+ unsigned ARB_get_program_binary:1;
+ unsigned KHR_debug:1;
+ unsigned EXT_debug_label:1;
+ unsigned NV_read_depth_stencil:1; /* ES only */
+ unsigned ARB_shader_image_load_store:1;
+ unsigned ARB_direct_state_access:1;
+ unsigned ARB_shader_storage_buffer_object:1;
+ unsigned ARB_program_interface_query:1;
+
+ Features(void);
+
+ void
+ load(const Profile & profile, const Extensions & exts);
+
+ // Load from current context
+ void
+ load(void);
+};
+
} /* namespace glfeatures */