diff options
-rw-r--r-- | examples/glitzinfo/glitzinfo.c | 9 | ||||
-rw-r--r-- | src/glitz.h | 12 | ||||
-rw-r--r-- | src/glitz_format.c | 7 | ||||
-rw-r--r-- | src/glx/glitz_glx_format.c | 15 |
4 files changed, 31 insertions, 12 deletions
diff --git a/examples/glitzinfo/glitzinfo.c b/examples/glitzinfo/glitzinfo.c index 2824738..d4e5e14 100644 --- a/examples/glitzinfo/glitzinfo.c +++ b/examples/glitzinfo/glitzinfo.c @@ -99,8 +99,9 @@ print_format (glitz_drawable_format_t *format) { if (format) { - printf ("0x%x\t%d/%d/%d/%d \t%d\t%d\t%c\t%d\t%c\n", + printf ("0x%x\t%d\t%d/%d/%d/%d \t%d\t%d\t%c\t%d\t%c\n", (int) format->id, + format->depth, format->color.red_size, format->color.green_size, format->color.blue_size, @@ -277,7 +278,7 @@ main (int argc, char **argv) print_features (glitz_drawable_get_features (drawable)); printf ("\nWindow formats:\n"); - printf ("id\tr/g/b/a \tdepth\tstencil\tdb\tsamples\tscanline\n"); + printf ("id\tvdepth\tr/g/b/a \tdepth\tstencil\tdb\tsamples\tscanline\n"); printf ("-------------------------------------" "-------------------------------------\n"); @@ -306,7 +307,7 @@ main (int argc, char **argv) #endif printf ("\nPbuffer formats:\n"); - printf ("id\tr/g/b/a \tdepth\tstencil\tdb\tsamples\tscanline\n"); + printf ("id\tvdepth\tr/g/b/a \tdepth\tstencil\tdb\tsamples\tscanline\n"); printf ("-------------------------------------" "-------------------------------------\n"); @@ -315,7 +316,7 @@ main (int argc, char **argv) i++; printf ("\nOffscreen formats:\n"); - printf ("id\tr/g/b/a \tdepth\tstencil\tdb\tsamples\tscanline\n"); + printf ("id\tvdepth\tr/g/b/a \tdepth\tstencil\tdb\tsamples\tscanline\n"); printf ("-------------------------------------" "-------------------------------------\n"); diff --git a/src/glitz.h b/src/glitz.h index 8161626..9947e5f 100644 --- a/src/glitz.h +++ b/src/glitz.h @@ -174,15 +174,17 @@ typedef struct _glitz_color_format_t { unsigned short alpha_size; } glitz_color_format_t; -#define GLITZ_FORMAT_DEPTH_SIZE_MASK (1L << 6) -#define GLITZ_FORMAT_STENCIL_SIZE_MASK (1L << 7) -#define GLITZ_FORMAT_DOUBLEBUFFER_MASK (1L << 8) -#define GLITZ_FORMAT_SAMPLES_MASK (1L << 9) -#define GLITZ_FORMAT_SCANLINE_ORDER_MASK (1L << 10) +#define GLITZ_FORMAT_DEPTH_SIZE_MASK (1L << 6) +#define GLITZ_FORMAT_STENCIL_SIZE_MASK (1L << 7) +#define GLITZ_FORMAT_DOUBLEBUFFER_MASK (1L << 8) +#define GLITZ_FORMAT_SAMPLES_MASK (1L << 9) +#define GLITZ_FORMAT_SCANLINE_ORDER_MASK (1L << 10) +#define GLITZ_FORMAT_DEPTH_MASK (1L << 11) typedef struct _glitz_drawable_format_t { glitz_format_id_t id; glitz_color_format_t color; + unsigned short depth; unsigned short depth_size; unsigned short stencil_size; unsigned short samples; diff --git a/src/glitz_format.c b/src/glitz_format.c index 122628a..029b553 100644 --- a/src/glitz_format.c +++ b/src/glitz_format.c @@ -237,6 +237,9 @@ glitz_drawable_format_copy (const glitz_drawable_format_t *src, if (mask & GLITZ_FORMAT_SCANLINE_ORDER_MASK) dst->scanline_order = src->scanline_order; + + if (mask & GLITZ_FORMAT_DEPTH_MASK) + dst->depth = src->depth; } glitz_drawable_format_t * @@ -291,6 +294,10 @@ glitz_drawable_format_find (glitz_int_drawable_format_t *formats, if (mask & GLITZ_FORMAT_SCANLINE_ORDER_MASK) if (templ->d.scanline_order != formats->d.scanline_order) continue; + + if (mask & GLITZ_FORMAT_DEPTH_MASK) + if (templ->d.depth != formats->d.depth) + continue; if (mask & GLITZ_INT_FORMAT_WINDOW_MASK) if ((templ->types & GLITZ_DRAWABLE_TYPE_WINDOW_MASK) != diff --git a/src/glx/glitz_glx_format.c b/src/glx/glitz_glx_format.c index ee4cdea..a179ee8 100644 --- a/src/glx/glitz_glx_format.c +++ b/src/glx/glitz_glx_format.c @@ -86,7 +86,7 @@ _glitz_glx_format_compare (const void *elem1, score[i] -= 1000; } - return score[1] - score[0]; + return score[1] - score[0] - (format[1]->d.depth - format[0]->d.depth); } static void @@ -143,6 +143,7 @@ _glitz_glx_query_formats (glitz_glx_screen_info_t *screen_info) if (value != 0) continue; + format.d.depth = visuals[i].depth; glXGetConfig (display, &visuals[i], GLX_RED_SIZE, &value); format.d.color.red_size = (unsigned short) value; glXGetConfig (display, &visuals[i], GLX_GREEN_SIZE, &value); @@ -161,7 +162,7 @@ _glitz_glx_query_formats (glitz_glx_screen_info_t *screen_info) format.d.scanline_order = (value) ? GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP : GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN; - + if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_VISUAL_RATING_MASK) { @@ -228,6 +229,7 @@ _glitz_glx_query_formats_using_fbconfigs (glitz_glx_screen_info_t *screen_info) for (i = 0; i < num_configs; i++) { int value; + XVisualInfo* vinfo; if ((glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_RENDER_TYPE, &value) != 0) || @@ -243,7 +245,14 @@ _glitz_glx_query_formats_using_fbconfigs (glitz_glx_screen_info_t *screen_info) GLX_DRAWABLE_TYPE, &value); if (!((value & GLX_WINDOW_BIT) || (value & GLX_PBUFFER_BIT))) continue; - + + vinfo = glx->get_visual_from_fbconfig (display, fbconfigs[i]); + if (vinfo) + { + format.d.depth = vinfo->depth; + XFree(vinfo); + } + format.types = 0; if (value & GLX_WINDOW_BIT) format.types |= GLITZ_DRAWABLE_TYPE_WINDOW_MASK; |