/* Init default values */
_context->feature_flags = 0;
+ _context->feature_flags_private = 0;
_context->features_cached = FALSE;
/* Initialise the driver specific state */
typedef struct
{
/* Features cache */
- CoglFeatureFlags feature_flags;
- gboolean features_cached;
+ CoglFeatureFlags feature_flags;
+ CoglFeatureFlagsPrivate feature_flags_private;
+ gboolean features_cached;
CoglHandle default_material;
const char *extension_names;
/* A set of feature flags to enable if the extension is available */
CoglFeatureFlags feature_flags;
+ /* A set of private feature flags to enable if the extension is available
+ * and for internal use only */
+ CoglFeatureFlagsPrivate feature_flags_private;
/* A list of functions required for this feature. Terminated with a
NULL name */
const CoglFeatureFunction *functions;
#endif /* COGL_HAS_XLIB_SUPPORT */
+typedef enum _CoglFeatureFlagsPrivate
+{
+ COGL_FEATURE_PRIVATE_ARB_FP = (1 << 0)
+} CoglFeatureFlagsPrivate;
+
+gboolean
+_cogl_features_available_private (CoglFeatureFlagsPrivate features);
+
#endif /* __COGL_INTERNAL_H */
return (ctx->feature_flags & features) == features;
}
+gboolean
+_cogl_features_available_private (CoglFeatureFlagsPrivate features)
+{
+ _COGL_GET_CONTEXT (ctx, 0);
+
+ if (!ctx->features_cached)
+ _cogl_features_init ();
+
+ return (ctx->feature_flags_private & features) == features;
+}
+
/* XXX: This function should either be replaced with one returning
* integers, or removed/deprecated and make the
* _cogl_framebuffer_get_viewport* functions public.
#include "cogl-context.h"
-#define COGL_FEATURE_BEGIN(a, b, c, d, e, f)
+#define COGL_FEATURE_BEGIN(a, b, c, d, e, f, g)
#define COGL_FEATURE_FUNCTION(ret, name, args) \
_context->drv.pf_ ## name = NULL;
#define COGL_FEATURE_END()
#define APIENTRY
#endif
-#define COGL_FEATURE_BEGIN(a, b, c, d, e, f)
+#define COGL_FEATURE_BEGIN(a, b, c, d, e, f, g)
#define COGL_FEATURE_FUNCTION(ret, name, args) \
ret (APIENTRY * pf_ ## name) args;
functions */
"ARB:\0EXT\0",
"framebuffer_object\0",
- COGL_FEATURE_OFFSCREEN)
+ COGL_FEATURE_OFFSCREEN,
+ 0)
COGL_FEATURE_FUNCTION (void, glGenRenderbuffers,
(GLsizei n,
GLuint *renderbuffers))
COGL_FEATURE_BEGIN (offscreen_blit, 255, 255,
"EXT\0",
"framebuffer_blit\0",
- COGL_FEATURE_OFFSCREEN_BLIT)
+ COGL_FEATURE_OFFSCREEN_BLIT,
+ 0)
COGL_FEATURE_FUNCTION (void, glBlitFramebuffer,
(GLint srcX0,
GLint srcY0,
COGL_FEATURE_BEGIN (offscreen_multisample, 255, 255,
"EXT\0",
"framebuffer_multisample\0",
- COGL_FEATURE_OFFSCREEN_MULTISAMPLE)
+ COGL_FEATURE_OFFSCREEN_MULTISAMPLE,
+ 0)
COGL_FEATURE_FUNCTION (void, glRenderbufferStorageMultisample,
(GLenum target,
GLsizei samples,
GLsizei width,
GLsizei height))
COGL_FEATURE_END ()
+
COGL_FEATURE_BEGIN (read_pixels_async, 2, 1,
"EXT\0",
"pixel_buffer_object\0",
- COGL_FEATURE_PBOS)
+ COGL_FEATURE_PBOS,
+ 0)
+COGL_FEATURE_END ()
+
+/* ARB_fragment_program */
+COGL_FEATURE_BEGIN (arbfp, 255, 255,
+ "ARB\0",
+ "fragment_program\0",
+ 0,
+ COGL_FEATURE_PRIVATE_ARB_FP)
+COGL_FEATURE_FUNCTION (void, glGenPrograms,
+ (GLsizei n,
+ GLuint *programs))
+COGL_FEATURE_FUNCTION (void, glBindProgram,
+ (GLenum target,
+ GLuint program))
+COGL_FEATURE_FUNCTION (void, glProgramString,
+ (GLenum target,
+ GLenum format,
+ GLsizei len,
+ const void *program))
COGL_FEATURE_END ()
/* The function names in OpenGL 2.0 are different so we can't easily
"shader_objects\0"
"vertex_shader\0"
"fragment_shader\0",
- COGL_FEATURE_SHADERS_GLSL)
+ COGL_FEATURE_SHADERS_GLSL,
+ 0)
COGL_FEATURE_FUNCTION (GLhandleARB, glCreateProgramObject,
(void))
COGL_FEATURE_FUNCTION (GLhandleARB, glCreateShaderObject,
COGL_FEATURE_BEGIN (vbos, 1, 5,
"ARB\0",
"vertex_buffer_object\0",
- COGL_FEATURE_VBOS)
+ COGL_FEATURE_VBOS,
+ 0)
COGL_FEATURE_FUNCTION (void, glGenBuffers,
(GLuint n,
GLuint *buffers))
COGL_FEATURE_BEGIN (in_1_2, 1, 2,
"\0",
"\0",
+ 0,
0)
COGL_FEATURE_FUNCTION (void, glDrawRangeElements,
(GLenum mode,
COGL_FEATURE_BEGIN (multitexture, 1, 3,
"ARB\0",
"multitexture\0",
+ 0,
0)
COGL_FEATURE_FUNCTION (void, glActiveTexture,
(GLenum texture))
COGL_FEATURE_BEGIN (blend_func_separate, 1, 4,
"EXT\0",
"blend_func_separate\0",
+ 0,
0)
COGL_FEATURE_FUNCTION (void, glBlendFuncSeparate,
(GLenum srcRGB,
COGL_FEATURE_BEGIN (blend_equation_separate, 2, 0,
"EXT\0",
"blend_equation_separate\0",
+ 0,
0)
COGL_FEATURE_FUNCTION (void, glBlendEquationSeparate,
(GLenum modeRGB,
/* Define a set of arrays containing the functions required from GL
for each feature */
#define COGL_FEATURE_BEGIN(name, min_gl_major, min_gl_minor, \
- namespaces, extension_names, feature_flags) \
+ namespaces, extension_names, \
+ feature_flags, feature_flags_private) \
static const CoglFeatureFunction cogl_feature_ ## name ## _funcs[] = {
#define COGL_FEATURE_FUNCTION(ret, name, args) \
{ G_STRINGIFY (name), G_STRUCT_OFFSET (CoglContext, drv.pf_ ## name) },
/* Define an array of features */
#undef COGL_FEATURE_BEGIN
#define COGL_FEATURE_BEGIN(name, min_gl_major, min_gl_minor, \
- namespaces, extension_names, feature_flags) \
+ namespaces, extension_names, \
+ feature_flags, feature_flags_private) \
{ min_gl_major, min_gl_minor, namespaces, \
- extension_names, feature_flags, \
+ extension_names, feature_flags, feature_flags_private, \
cogl_feature_ ## name ## _funcs },
#undef COGL_FEATURE_FUNCTION
#define COGL_FEATURE_FUNCTION(ret, name, args)
void
_cogl_features_init (void)
{
- CoglFeatureFlags flags = 0;
- const char *gl_extensions;
- GLint max_clip_planes = 0;
- GLint num_stencil_bits = 0;
- int gl_major = 0, gl_minor = 0;
- int i;
+ CoglFeatureFlags flags = 0;
+ CoglFeatureFlagsPrivate flags_private = 0;
+ const char *gl_extensions;
+ GLint max_clip_planes = 0;
+ GLint num_stencil_bits = 0;
+ int gl_major = 0, gl_minor = 0;
+ int i;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
if (_cogl_feature_check (cogl_feature_data + i,
gl_major, gl_minor,
gl_extensions))
+ {
flags |= cogl_feature_data[i].feature_flags;
+ flags_private |= cogl_feature_data[i].feature_flags_private;
+ }
/* Cache features */
ctx->feature_flags = flags;
+ ctx->feature_flags_private = flags_private;
ctx->features_cached = TRUE;
}
#include "cogl-context.h"
#include "cogl-gles2-wrapper.h"
-#define COGL_FEATURE_BEGIN(a, b, c, d, e, f)
+#define COGL_FEATURE_BEGIN(a, b, c, d, e, f, g)
#define COGL_FEATURE_FUNCTION(ret, name, args) \
_context->drv.pf_ ## name = NULL;
#define COGL_FEATURE_END()
#define APIENTRY
#endif
-#define COGL_FEATURE_BEGIN(a, b, c, d, e, f)
+#define COGL_FEATURE_BEGIN(a, b, c, d, e, f, g)
#define COGL_FEATURE_FUNCTION(ret, name, args) \
ret (APIENTRY * pf_ ## name) args;
COGL_FEATURE_BEGIN (offscreen, 255, 255,
"OES\0",
"framebuffer_object\0",
- COGL_FEATURE_OFFSCREEN)
+ COGL_FEATURE_OFFSCREEN,
+ 0)
COGL_FEATURE_FUNCTION (void, glGenRenderbuffers,
(GLsizei n,
GLuint *renderbuffers))
COGL_FEATURE_BEGIN (element_index_uint, 255, 255,
"OES\0",
"element_index_uint\0",
- COGL_FEATURE_UNSIGNED_INT_INDICES)
+ COGL_FEATURE_UNSIGNED_INT_INDICES,
+ 0)
COGL_FEATURE_END ()
/* Define a set of arrays containing the functions required from GL
for each feature */
#define COGL_FEATURE_BEGIN(name, min_gl_major, min_gl_minor, \
- namespaces, extension_names, feature_flags) \
+ namespaces, extension_names, \
+ feature_flags, feature_flags_private) \
static const CoglFeatureFunction cogl_feature_ ## name ## _funcs[] = {
#define COGL_FEATURE_FUNCTION(ret, name, args) \
{ G_STRINGIFY (name), G_STRUCT_OFFSET (CoglContext, drv.pf_ ## name) },
/* Define an array of features */
#undef COGL_FEATURE_BEGIN
#define COGL_FEATURE_BEGIN(name, min_gl_major, min_gl_minor, \
- namespaces, extension_names, feature_flags) \
+ namespaces, extension_names, \
+ feature_flags, feature_flags_private) \
{ min_gl_major, min_gl_minor, namespaces, \
- extension_names, feature_flags, \
+ extension_names, feature_flags, feature_flags_private, \
cogl_feature_ ## name ## _funcs },
#undef COGL_FEATURE_FUNCTION
#define COGL_FEATURE_FUNCTION(ret, name, args)