From 2f209ec78e61272ade7f1123af9cfbb458728716 Mon Sep 17 00:00:00 2001 From: David Reveman Date: Wed, 24 May 2006 12:14:20 +0000 Subject: Add glitz_drawable_get_gl_string and direct rendering to the feature mask --- src/glitz.h | 12 ++++++++++++ src/glitz_drawable.c | 33 +++++++++++++++++++++++++++++++++ src/glitz_gl.h | 2 ++ src/glitzint.h | 1 + src/glx/glitz_glx_context.c | 3 +++ 5 files changed, 51 insertions(+) (limited to 'src') diff --git a/src/glitz.h b/src/glitz.h index 6fe2796..a228559 100644 --- a/src/glitz.h +++ b/src/glitz.h @@ -130,6 +130,7 @@ typedef enum { #define GLITZ_FEATURE_MULTI_DRAW_ARRAYS_MASK (1L << 15) #define GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK (1L << 16) #define GLITZ_FEATURE_COPY_SUB_BUFFER_MASK (1L << 17) +#define GLITZ_FEATURE_DIRECT_RENDERING_MASK (1L << 18) /* glitz_format.c */ @@ -282,6 +283,17 @@ glitz_drawable_get_features (glitz_drawable_t *drawable); glitz_drawable_format_t * glitz_drawable_get_format (glitz_drawable_t *drawable); +typedef enum { + GLITZ_GL_STRING_VENDOR, + GLITZ_GL_STRING_RENDERER, + GLITZ_GL_STRING_VERSION, + GLITZ_GL_STRING_EXTENSIONS +} glitz_gl_string_t; + +const char * +glitz_drawable_get_gl_string (glitz_drawable_t *drawable, + glitz_gl_string_t name); + /* glitz_surface.c */ diff --git a/src/glitz_drawable.c b/src/glitz_drawable.c index a434f98..66dce22 100644 --- a/src/glitz_drawable.c +++ b/src/glitz_drawable.c @@ -408,3 +408,36 @@ glitz_drawable_get_format (glitz_drawable_t *drawable) return &drawable->format->d; } slim_hidden_def(glitz_drawable_get_format); + +const char * +glitz_drawable_get_gl_string (glitz_drawable_t *drawable, + glitz_gl_string_t name) +{ + const glitz_gl_ubyte_t *string; + glitz_gl_enum_t gl_name; + + switch (name) { + case GLITZ_GL_STRING_VENDOR: + gl_name = GLITZ_GL_VENDOR; + break; + case GLITZ_GL_STRING_RENDERER: + gl_name = GLITZ_GL_RENDERER; + break; + case GLITZ_GL_STRING_VERSION: + gl_name = GLITZ_GL_VERSION; + break; + case GLITZ_GL_STRING_EXTENSIONS: + gl_name = GLITZ_GL_EXTENSIONS; + break; + default: + return NULL; + } + + drawable->backend->push_current (drawable, NULL, GLITZ_CONTEXT_CURRENT, + NULL); + string = drawable->backend->gl->get_string (gl_name); + drawable->backend->pop_current (drawable); + + return (const char *) string; +} +slim_hidden_def(glitz_drawable_get_gl_string); diff --git a/src/glitz_gl.h b/src/glitz_gl.h index 8020959..3036bc6 100644 --- a/src/glitz_gl.h +++ b/src/glitz_gl.h @@ -60,6 +60,8 @@ typedef ptrdiff_t glitz_gl_sizeiptr_t; #define GLITZ_GL_NO_ERROR 0x0 #define GLITZ_GL_INVALID_OPERATION 0x0502 +#define GLITZ_GL_VENDOR 0x1F00 +#define GLITZ_GL_RENDERER 0x1F01 #define GLITZ_GL_VERSION 0x1F02 #define GLITZ_GL_EXTENSIONS 0x1F03 diff --git a/src/glitzint.h b/src/glitzint.h index 2f0684c..eb9aac6 100644 --- a/src/glitzint.h +++ b/src/glitzint.h @@ -1077,6 +1077,7 @@ slim_hidden_proto(glitz_drawable_flush) slim_hidden_proto(glitz_drawable_finish) slim_hidden_proto(glitz_drawable_get_features) slim_hidden_proto(glitz_drawable_get_format) +slim_hidden_proto(glitz_drawable_get_gl_string) slim_hidden_proto(glitz_surface_set_transform) slim_hidden_proto(glitz_surface_set_fill) slim_hidden_proto(glitz_surface_set_component_alpha) diff --git a/src/glx/glitz_glx_context.c b/src/glx/glitz_glx_context.c index 97a23d6..6510061 100644 --- a/src/glx/glitz_glx_context.c +++ b/src/glx/glitz_glx_context.c @@ -368,6 +368,9 @@ _glitz_glx_context_initialize (glitz_glx_screen_info_t *screen_info, if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_COPY_SUB_BUFFER_MASK) context->backend.feature_mask |= GLITZ_FEATURE_COPY_SUB_BUFFER_MASK; + if (glXIsDirect (screen_info->display_info->display, context->context)) + context->backend.feature_mask |= GLITZ_FEATURE_DIRECT_RENDERING_MASK; + context->initialized = 1; } -- cgit v1.2.3