summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Bruguier <nicolas.bruguier@supersonicimagine.fr>2008-11-29 14:10:23 +0100
committerNicolas Bruguier <nicolas.bruguier@supersonicimagine.fr>2008-11-29 14:10:23 +0100
commit13f5d77fa51eabf015d92bd9e3003c2a307ba942 (patch)
tree2fb55b717e698979354dbbfa9c1f32b37cabe48d
parent4b8cd59f2757a63bec982a96b7c8112d75b410b8 (diff)
[glitz] Add scanline order in glitz_format_drawable_t.
Add scanline order settings in drawable format to indicate the y coordinate order of drawable framebuffer.
-rw-r--r--examples/glitzinfo/glitzinfo.c12
-rw-r--r--src/glitz.h32
-rw-r--r--src/glitz_format.c7
-rw-r--r--src/glx/glitz_glx_format.c9
4 files changed, 40 insertions, 20 deletions
diff --git a/examples/glitzinfo/glitzinfo.c b/examples/glitzinfo/glitzinfo.c
index 0b7719f..2824738 100644
--- a/examples/glitzinfo/glitzinfo.c
+++ b/examples/glitzinfo/glitzinfo.c
@@ -99,7 +99,7 @@ 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\n",
+ printf ("0x%x\t%d/%d/%d/%d \t%d\t%d\t%c\t%d\t%c\n",
(int) format->id,
format->color.red_size,
format->color.green_size,
@@ -108,7 +108,9 @@ print_format (glitz_drawable_format_t *format)
format->depth_size,
format->stencil_size,
(format->doublebuffer) ? 'y' : '.',
- format->samples);
+ format->samples,
+ (format->scanline_order ==
+ GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN) ? 't' : 'd');
return 1;
}
return 0;
@@ -275,7 +277,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\n");
+ printf ("id\tr/g/b/a \tdepth\tstencil\tdb\tsamples\tscanline\n");
printf ("-------------------------------------"
"-------------------------------------\n");
@@ -304,7 +306,7 @@ main (int argc, char **argv)
#endif
printf ("\nPbuffer formats:\n");
- printf ("id\tr/g/b/a \tdepth\tstencil\tdb\tsamples\n");
+ printf ("id\tr/g/b/a \tdepth\tstencil\tdb\tsamples\tscanline\n");
printf ("-------------------------------------"
"-------------------------------------\n");
@@ -313,7 +315,7 @@ main (int argc, char **argv)
i++;
printf ("\nOffscreen formats:\n");
- printf ("id\tr/g/b/a \tdepth\tstencil\tdb\tsamples\n");
+ printf ("id\tr/g/b/a \tdepth\tstencil\tdb\tsamples\tscanline\n");
printf ("-------------------------------------"
"-------------------------------------\n");
diff --git a/src/glitz.h b/src/glitz.h
index a0d8c6b..8161626 100644
--- a/src/glitz.h
+++ b/src/glitz.h
@@ -112,6 +112,11 @@ typedef enum {
GLITZ_OPERATOR_ADD
} glitz_operator_t;
+typedef enum {
+ GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN,
+ GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
+} glitz_pixel_scanline_order_t;
+
#define GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK (1L << 0)
#define GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK (1L << 1)
#define GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK (1L << 2)
@@ -169,18 +174,20 @@ 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_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)
typedef struct _glitz_drawable_format_t {
- glitz_format_id_t id;
- glitz_color_format_t color;
- unsigned short depth_size;
- unsigned short stencil_size;
- unsigned short samples;
- glitz_bool_t doublebuffer;
+ glitz_format_id_t id;
+ glitz_color_format_t color;
+ unsigned short depth_size;
+ unsigned short stencil_size;
+ unsigned short samples;
+ glitz_bool_t doublebuffer;
+ glitz_pixel_scanline_order_t scanline_order;
} glitz_drawable_format_t;
typedef struct _glitz_format_t {
@@ -586,11 +593,6 @@ glitz_buffer_unmap (glitz_buffer_t *buffer);
/* glitz_pixel.c */
-typedef enum {
- GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN,
- GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
-} glitz_pixel_scanline_order_t;
-
typedef struct _glitz_pixel_masks {
int bpp;
unsigned long alpha_mask;
diff --git a/src/glitz_format.c b/src/glitz_format.c
index 3d44e00..122628a 100644
--- a/src/glitz_format.c
+++ b/src/glitz_format.c
@@ -234,6 +234,9 @@ glitz_drawable_format_copy (const glitz_drawable_format_t *src,
if (mask & GLITZ_FORMAT_SAMPLES_MASK)
dst->samples = src->samples;
+
+ if (mask & GLITZ_FORMAT_SCANLINE_ORDER_MASK)
+ dst->scanline_order = src->scanline_order;
}
glitz_drawable_format_t *
@@ -284,6 +287,10 @@ glitz_drawable_format_find (glitz_int_drawable_format_t *formats,
if (mask & GLITZ_FORMAT_SAMPLES_MASK)
if (templ->d.samples != formats->d.samples)
continue;
+
+ if (mask & GLITZ_FORMAT_SCANLINE_ORDER_MASK)
+ if (templ->d.scanline_order != formats->d.scanline_order)
+ 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 192758e..ee4cdea 100644
--- a/src/glx/glitz_glx_format.c
+++ b/src/glx/glitz_glx_format.c
@@ -157,6 +157,10 @@ _glitz_glx_query_formats (glitz_glx_screen_info_t *screen_info)
format.d.stencil_size = (unsigned short) value;
glXGetConfig (display, &visuals[i], GLX_DOUBLEBUFFER, &value);
format.d.doublebuffer = (value) ? 1: 0;
+ glXGetConfig (display, &visuals[i], GLX_Y_INVERTED_EXT, &value);
+ 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)
@@ -274,6 +278,11 @@ _glitz_glx_query_formats_using_fbconfigs (glitz_glx_screen_info_t *screen_info)
glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_DOUBLEBUFFER,
&value);
format.d.doublebuffer = (value)? 1: 0;
+ glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_Y_INVERTED_EXT,
+ &value);
+ format.d.scanline_order = (value) ?
+ GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP :
+ GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_CONFIG_CAVEAT,
&value);
switch (value) {