[cairo-commit] glitz/src glitz_agl_format.c, 1.1.1.1,
1.2 glitz_format.c, 1.2, 1.3 glitz_glx_extension.c, 1.3,
1.4 glitz_glx_format.c, 1.1.1.1, 1.2 glitz_glx_info.c, 1.1.1.1, 1.2
David Reveman
commit at pdx.freedesktop.org
Sat May 1 13:36:37 PDT 2004
- Previous message: [cairo-commit] glitz ChangeLog,1.11,1.12
- Next message: [cairo-commit] cairo-artwork AUTHORS, NONE, 1.1 COPYING, NONE,
1.1 ChangeLog, NONE, 1.1 NEWS, NONE, 1.1 README, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: davidr
Update of /cvs/cairo/glitz/src
In directory pdx:/tmp/cvs-serv320/src
Modified Files:
glitz_agl_format.c glitz_format.c glitz_glx_extension.c
glitz_glx_format.c glitz_glx_info.c
Log Message:
Initialization fixes
Index: glitz_agl_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_format.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_agl_format.c 30 Mar 2004 17:07:19 -0000 1.1.1.1
--- b/glitz_agl_format.c 1 May 2004 20:36:34 -0000 1.2
***************
*** 260,264 ****
AGLPixelFormat pixel_format;
int i = 0;
- glitz_bool_t offscreen_argb32_format = 0;
for (i = 0; *(pixel_format_attrib_map[i].attrib); i++) {
--- 260,263 ----
***************
*** 276,280 ****
aglDescribePixelFormat (pixel_format, AGL_DOUBLEBUFFER, &value);
! format.doublebuffer = (value) ? 1: 0;
/* We don't support single buffering in MacOS X */
--- 275,279 ----
aglDescribePixelFormat (pixel_format, AGL_DOUBLEBUFFER, &value);
! format.doublebuffer = (value)? 1: 0;
/* We don't support single buffering in MacOS X */
***************
*** 307,311 ****
if (thread_info->feature_mask & GLITZ_FEATURE_MULTISAMPLE_MASK) {
aglDescribePixelFormat (pixel_format, AGL_SAMPLE_BUFFERS_ARB, &value);
! format.multisample.supported = (value) ? 1: 0;
aglDescribePixelFormat (pixel_format, AGL_SAMPLES_ARB, &value);
format.multisample.samples = (unsigned short) value;
--- 306,310 ----
if (thread_info->feature_mask & GLITZ_FEATURE_MULTISAMPLE_MASK) {
aglDescribePixelFormat (pixel_format, AGL_SAMPLE_BUFFERS_ARB, &value);
! format.multisample.supported = (value)? 1: 0;
aglDescribePixelFormat (pixel_format, AGL_SAMPLES_ARB, &value);
format.multisample.samples = (unsigned short) value;
***************
*** 321,329 ****
}
- if (format.drawable.offscreen &&
- format.alpha_size &&
- format.red_size && format.green_size && format.blue_size)
- offscreen_argb32_format = 1;
-
_glitz_add_format (thread_info, &format);
--- 320,323 ----
***************
*** 343,360 ****
qsort (thread_info->formats, thread_info->n_formats,
sizeof (glitz_format_t), _glitz_agl_format_compare);
!
! /* Adding fake offscreen formats if no real argb32 offscreen formats exist.
! Surfaces created with these formats can only be used with draw/read
! pixel functions and as source in composite functions. */
! if (!offscreen_argb32_format) {
memset (&format, 0, sizeof (glitz_format_t));
format.drawable.offscreen = 1;
format.alpha_size = format.red_size = format.green_size =
format.blue_size = 8;
- format.id = 0;
_glitz_add_format (thread_info, &format);
format.alpha_size = 0;
_glitz_add_format (thread_info, &format);
! format.alpha_size = 8;
format.red_size = format.green_size = format.blue_size = 0;
_glitz_add_format (thread_info, &format);
--- 337,359 ----
qsort (thread_info->formats, thread_info->n_formats,
sizeof (glitz_format_t), _glitz_agl_format_compare);
!
! if (!glitz_format_find_standard (thread_info->formats,
! thread_info->n_formats,
! GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
! GLITZ_STANDARD_ARGB32)) {
!
! thread_info->feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
!
! /* Adding fake offscreen formats. Surfaces created with these format can
! only be used with draw/read pixel functions and as source in composite
! functions. */
memset (&format, 0, sizeof (glitz_format_t));
format.drawable.offscreen = 1;
format.alpha_size = format.red_size = format.green_size =
format.blue_size = 8;
_glitz_add_format (thread_info, &format);
format.alpha_size = 0;
_glitz_add_format (thread_info, &format);
! format.alpha_size = 8;
format.red_size = format.green_size = format.blue_size = 0;
_glitz_add_format (thread_info, &format);
Index: glitz_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_format.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_format.c 28 Apr 2004 08:59:38 -0000 1.2
--- b/glitz_format.c 1 May 2004 20:36:34 -0000 1.3
***************
*** 36,43 ****
glitz_format_t *
glitz_format_find (glitz_format_t *formats,
! int n_formats,
! unsigned long mask,
! const glitz_format_t *templ,
! int count)
{
for (; n_formats; n_formats--, formats++) {
--- 36,43 ----
glitz_format_t *
glitz_format_find (glitz_format_t *formats,
! int n_formats,
! unsigned long mask,
! const glitz_format_t *templ,
! int count)
{
for (; n_formats; n_formats--, formats++) {
***************
*** 120,125 ****
static void
_glitz_format_add_options (unsigned long options,
! glitz_format_t *format,
! unsigned long *mask)
{
if (options & GLITZ_FORMAT_OPTION_DOUBLEBUFFER_MASK) {
--- 120,125 ----
static void
_glitz_format_add_options (unsigned long options,
! glitz_format_t *format,
! unsigned long *mask)
{
if (options & GLITZ_FORMAT_OPTION_DOUBLEBUFFER_MASK) {
***************
*** 156,162 ****
glitz_format_t *
glitz_format_find_standard (glitz_format_t *formats,
! int n_formats,
! unsigned long options,
! glitz_format_name_t format_name)
{
glitz_format_t templ;
--- 156,162 ----
glitz_format_t *
glitz_format_find_standard (glitz_format_t *formats,
! int n_formats,
! unsigned long options,
! glitz_format_name_t format_name)
{
glitz_format_t templ;
Index: glitz_glx_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_extension.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_glx_extension.c 28 Apr 2004 08:59:38 -0000 1.3
--- b/glitz_glx_extension.c 1 May 2004 20:36:34 -0000 1.4
***************
*** 79,84 ****
glitz_glx_query_extensions (glitz_glx_screen_info_t *screen_info)
{
- screen_info->glx_feature_mask = 0;
-
screen_info->glx_feature_mask |=
_glitz_glx_extension_query_client_glx (screen_info->display_info->display);
--- 79,82 ----
***************
*** 86,92 ****
screen_info->glx_feature_mask |= _glitz_glx_extension_query_gl ();
- screen_info->feature_mask = 0;
- screen_info->texture_mask = GLITZ_TEXTURE_TARGET_2D_MASK;
-
if (_glitz_glx_proc_address.get_fbconfigs &&
_glitz_glx_proc_address.get_fbconfig_attrib &&
--- 84,87 ----
***************
*** 102,109 ****
GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK) {
screen_info->feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
! /* All geforce cards seems to support multisample with pbuffers */
! if (!strncmp ("GeForce", (char *) glGetString (GL_RENDERER), 7))
! screen_info->feature_mask |= GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
}
--- 97,110 ----
GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK) {
screen_info->feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
+ char *renderer = (char *) glGetString (GL_RENDERER);
+ if (renderer) {
! /* All geforce and quadro cards seems to support multisample with
! pbuffers */
! if (!strncmp ("GeForce", renderer, 7))
! screen_info->feature_mask |= GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
! else if (!strncmp ("Quadro", renderer, 6))
! screen_info->feature_mask |= GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
! }
}
Index: glitz_glx_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_format.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_glx_format.c 30 Mar 2004 17:07:19 -0000 1.1.1.1
--- b/glitz_glx_format.c 1 May 2004 20:36:34 -0000 1.2
***************
*** 186,204 ****
qsort (screen_info->formats, screen_info->n_formats,
sizeof (glitz_format_t), _glitz_glx_format_compare);
-
- /* Adding fake offscreen formats as no real offscreen formats exists.
- Surfaces created with this format can only be used with draw/read
- pixel functions and as source in composite functions. */
- memset (&format, 0, sizeof (glitz_format_t));
- format.drawable.offscreen = 1;
- format.alpha_size = format.red_size = format.green_size =
- format.blue_size = 8;
- format.id = 0;
- _glitz_add_format (screen_info, &format);
- format.alpha_size = 0;
- _glitz_add_format (screen_info, &format);
- format.alpha_size = 8;
- format.red_size = format.green_size = format.blue_size = 0;
- _glitz_add_format (screen_info, &format);
if (visuals)
--- 186,189 ----
***************
*** 213,217 ****
GLXFBConfig *fbconfigs;
int i, num_configs;
- glitz_bool_t offscreen_argb32_format = 0;
display = screen_info->display_info->display;
--- 198,201 ----
***************
*** 274,278 ****
_glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
GLX_DOUBLEBUFFER, &value);
! format.doublebuffer = (value) ? 1: 0;
if (screen_info->feature_mask & GLITZ_FEATURE_MULTISAMPLE_MASK) {
--- 258,262 ----
_glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
GLX_DOUBLEBUFFER, &value);
! format.doublebuffer = (value)? 1: 0;
if (screen_info->feature_mask & GLITZ_FEATURE_MULTISAMPLE_MASK) {
***************
*** 280,284 ****
GLX_SAMPLE_BUFFERS_ARB,
&value);
! format.multisample.supported = (value) ? 1: 0;
_glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
GLX_SAMPLES_ARB, &value);
--- 264,268 ----
GLX_SAMPLE_BUFFERS_ARB,
&value);
! format.multisample.supported = (value)? 1: 0;
_glitz_glx_proc_address.get_fbconfig_attrib (display, fbconfigs[i],
GLX_SAMPLES_ARB, &value);
***************
*** 289,297 ****
}
- if (format.drawable.offscreen &&
- format.alpha_size &&
- format.red_size && format.green_size && format.blue_size)
- offscreen_argb32_format = 1;
-
_glitz_add_format (screen_info, &format);
--- 273,276 ----
***************
*** 311,332 ****
qsort (screen_info->formats, screen_info->n_formats,
sizeof (glitz_format_t), _glitz_glx_format_compare);
-
- /* Adding fake offscreen formats if no real argb32 offscreen formats exist.
- Surfaces created with these format can only be used with draw/read
- pixel functions and as source in composite functions. */
- if (!offscreen_argb32_format) {
- screen_info->feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
- memset (&format, 0, sizeof (glitz_format_t));
- format.drawable.offscreen = 1;
- format.alpha_size = format.red_size = format.green_size =
- format.blue_size = 8;
- format.id = 0;
- _glitz_add_format (screen_info, &format);
- format.alpha_size = 0;
- _glitz_add_format (screen_info, &format);
- format.alpha_size = 8;
- format.red_size = format.green_size = format.blue_size = 0;
- _glitz_add_format (screen_info, &format);
- }
if (fbconfigs)
--- 290,293 ----
***************
*** 336,339 ****
--- 297,322 ----
}
+ static void
+ glitz_glx_use_fake_offscreen_formats (glitz_glx_screen_info_t *screen_info)
+ {
+ glitz_format_t format;
+
+ screen_info->feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
+
+ /* Adding fake offscreen formats. Surfaces created with these format can
+ only be used with draw/read pixel functions and as source in composite
+ functions. */
+ memset (&format, 0, sizeof (glitz_format_t));
+ format.drawable.offscreen = 1;
+ format.alpha_size = format.red_size = format.green_size =
+ format.blue_size = 8;
+ _glitz_add_format (screen_info, &format);
+ format.alpha_size = 0;
+ _glitz_add_format (screen_info, &format);
+ format.alpha_size = 8;
+ format.red_size = format.green_size = format.blue_size = 0;
+ _glitz_add_format (screen_info, &format);
+ }
+
void
glitz_glx_query_formats (glitz_glx_screen_info_t *screen_info)
***************
*** 347,350 ****
--- 330,339 ----
glitz_glx_query_formats_glx12 (screen_info);
+ if (!glitz_format_find_standard (screen_info->formats,
+ screen_info->n_formats,
+ GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
+ GLITZ_STANDARD_ARGB32))
+ glitz_glx_use_fake_offscreen_formats (screen_info);
+
_glitz_move_out_ids (screen_info);
}
Index: glitz_glx_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_info.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** a/glitz_glx_info.c 30 Mar 2004 17:07:19 -0000 1.1.1.1
--- b/glitz_glx_info.c 1 May 2004 20:36:35 -0000 1.2
***************
*** 173,177 ****
info->displays = NULL;
info->n_displays = 0;
! glitz_glx_proc_address_lookup ();
xthread_key_create (&info_tsd, NULL);
xthread_set_specific (info_tsd, info);
--- 173,178 ----
info->displays = NULL;
info->n_displays = 0;
! if (!_glitz_glx_proc_address.supported)
! glitz_glx_proc_address_lookup ();
xthread_key_create (&info_tsd, NULL);
xthread_set_specific (info_tsd, info);
***************
*** 197,200 ****
--- 198,204 ----
glitz_glx_thread_info_get (void)
{
+ if (!_glitz_glx_proc_address.supported)
+ glitz_glx_proc_address_lookup ();
+
return &thread_info;
}
***************
*** 236,266 ****
XVisualInfo *vinfo;
XSetWindowAttributes win_attrib;
! int attrib[] = {
! GLX_RGBA,
! 0
};
int screen = screen_info->screen;
Display *display = screen_info->display_info->display;
!
! vinfo = glXChooseVisual (display, screen, attrib);
if (!vinfo)
! return;
! win_attrib.colormap =
! XCreateColormap (display,
! RootWindow (display, screen),
! vinfo->visual, AllocNone);
! screen_info->root_drawable =
! XCreateWindow (display,
! RootWindow (display, screen),
! -2, -2, 1, 1, 0, vinfo->depth, CopyFromParent,
! vinfo->visual, CWColormap, &win_attrib);
!
! screen_info->root_context.context =
! glXCreateContext (display, vinfo, NULL, 1);
screen_info->root_context.fbconfig = (XID) 0;
! screen_info->root_context.id = vinfo->visualid;
!
memcpy (&screen_info->root_context.gl,
&_glitz_gl_proc_address,
--- 240,294 ----
XVisualInfo *vinfo;
XSetWindowAttributes win_attrib;
! int attrib_single[] = {
! GLX_RGBA,
! GLX_RED_SIZE, 1,
! GLX_GREEN_SIZE, 1,
! GLX_BLUE_SIZE, 1,
! None
};
+ int attrib_double[] = {
+ GLX_RGBA,
+ GLX_RED_SIZE, 1,
+ GLX_GREEN_SIZE, 1,
+ GLX_BLUE_SIZE, 1,
+ GLX_DOUBLEBUFFER,
+ None
+ };
int screen = screen_info->screen;
Display *display = screen_info->display_info->display;
!
! vinfo = glXChooseVisual (display, screen, attrib_single);
if (!vinfo)
! vinfo = glXChooseVisual (display, screen, attrib_double);
! if (vinfo) {
! win_attrib.background_pixel = 0;
! win_attrib.border_pixel = 0;
! win_attrib.event_mask = StructureNotifyMask | ExposureMask;
! win_attrib.colormap = XCreateColormap (display,
! RootWindow (display, screen),
! vinfo->visual, AllocNone);
!
! screen_info->root_drawable =
! XCreateWindow (display, RootWindow (display, screen),
! 0, 0, 100, 100, 0, vinfo->depth, InputOutput,
! vinfo->visual,
! CWBackPixel | CWBorderPixel | CWColormap | CWEventMask,
! &win_attrib);
!
! screen_info->root_context.context =
! glXCreateContext (display, vinfo, NULL, 1);
!
! screen_info->root_context.id = vinfo->visualid;
!
! XFree (vinfo);
! } else {
! screen_info->root_drawable = None;
! screen_info->root_context.context = NULL;
! screen_info->root_context.id = 0;
! }
screen_info->root_context.fbconfig = (XID) 0;
!
memcpy (&screen_info->root_context.gl,
&_glitz_gl_proc_address,
***************
*** 270,279 ****
sizeof (glitz_glx_proc_address_list_t));
! if (_glitz_glx_proc_address.supported) {
! screen_info->root_context.gl.supported =
! screen_info->root_context.glx.supported = 1;
! }
!
! XFree (vinfo);
}
--- 298,303 ----
sizeof (glitz_glx_proc_address_list_t));
! screen_info->root_context.gl.supported =
! screen_info->root_context.glx.supported = 1;
}
***************
*** 314,328 ****
glitz_glx_create_root_context (screen_info);
! glXMakeCurrent (screen_info->display_info->display,
! screen_info->root_drawable,
! screen_info->root_context.context);
! glPixelStorei (GL_PACK_ALIGNMENT, 4);
! glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
! glitz_glx_query_extensions (screen_info);
! glitz_glx_query_formats (screen_info);
- if (screen_info->root_context.gl.supported)
glitz_glx_context_proc_address_lookup (&screen_info->root_context);
screen_info->context_stack = malloc (sizeof (glitz_glx_context_info_t));
--- 338,358 ----
glitz_glx_create_root_context (screen_info);
! screen_info->glx_feature_mask = 0;
! screen_info->feature_mask = 0;
! screen_info->texture_mask = GLITZ_TEXTURE_TARGET_2D_MASK;
! if (screen_info->root_context.context &&
! glXMakeCurrent (screen_info->display_info->display,
! screen_info->root_drawable,
! screen_info->root_context.context)) {
!
! glPixelStorei (GL_PACK_ALIGNMENT, 4);
! glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
glitz_glx_context_proc_address_lookup (&screen_info->root_context);
+
+ glitz_glx_query_extensions (screen_info);
+ glitz_glx_query_formats (screen_info);
+ }
screen_info->context_stack = malloc (sizeof (glitz_glx_context_info_t));
***************
*** 330,334 ****
screen_info->context_stack->surface = NULL;
screen_info->context_stack->constraint = GLITZ_CN_NONE;
!
return screen_info;
}
--- 360,364 ----
screen_info->context_stack->surface = NULL;
screen_info->context_stack->constraint = GLITZ_CN_NONE;
!
return screen_info;
}
- Previous message: [cairo-commit] glitz ChangeLog,1.11,1.12
- Next message: [cairo-commit] cairo-artwork AUTHORS, NONE, 1.1 COPYING, NONE,
1.1 ChangeLog, NONE, 1.1 NEWS, NONE, 1.1 README, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list