1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * (C) Copyright IBM Corporation 2003
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * All Rights Reserved.
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the "Software"),
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * to deal in the Software without restriction, including without limitation
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * on the rights to use, copy, modify, merge, publish, distribute, sub
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * license, and/or sell copies of the Software, and to permit persons to whom
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the Software is furnished to do so, subject to the following conditions:
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the next
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * paragraph) shall be included in all copies or substantial portions of the
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Software.
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * USE OR OTHER DEALINGS IN THE SOFTWARE.
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/**
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \file glcontextmodes.h
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \author Ian Romanick <idr@us.ibm.com>
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef GLCONTEXTMODES_H
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GLCONTEXTMODES_H
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct glx_config {
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    struct glx_config * next;
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLboolean rgbMode;
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLboolean floatMode;
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLboolean colorIndexMode;
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLuint doubleBufferMode;
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLuint stereoMode;
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint redBits, greenBits, blueBits, alphaBits;	/* bits per comp */
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLuint redMask, greenMask, blueMask, alphaMask;
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint rgbBits;		/* total bits for rgb */
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint indexBits;		/* total bits for colorindex */
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint depthBits;
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint stencilBits;
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint numAuxBuffers;
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint level;
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint pixmapMode;
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    /* GLX */
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint visualID;
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint visualType;     /**< One of the GLX X visual types. (i.e.,
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org			   * \c GLX_TRUE_COLOR, etc.)
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org			   */
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    /* EXT_visual_rating / GLX 1.2 */
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint visualRating;
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    /* EXT_visual_info / GLX 1.2 */
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint transparentPixel;
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org				/*    colors are floats scaled to ints */
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint transparentIndex;
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    /* ARB_multisample / SGIS_multisample */
73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint sampleBuffers;
74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint samples;
75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    /* SGIX_fbconfig / GLX 1.3 */
77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint drawableType;
78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint renderType;
79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint xRenderable;
80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint fbconfigID;
81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    /* SGIX_pbuffer / GLX 1.3 */
83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint maxPbufferWidth;
84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint maxPbufferHeight;
85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint maxPbufferPixels;
86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint optimalPbufferWidth;   /* Only for SGIX_pbuffer. */
87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint optimalPbufferHeight;  /* Only for SGIX_pbuffer. */
88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    /* SGIX_visual_select_group */
90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint visualSelectGroup;
91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    /* OML_swap_method */
93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint swapMethod;
94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint screen;
96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    /* EXT_texture_from_pixmap */
98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint bindToTextureRgb;
99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint bindToTextureRgba;
100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint bindToMipmapTexture;
101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint bindToTextureTargets;
102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint yInverted;
103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    /* EXT_framebuffer_sRGB */
105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    GLint sRGBCapable;
106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define __GLX_MIN_CONFIG_PROPS	18
109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define __GLX_MAX_CONFIG_PROPS	500
110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define __GLX_EXT_CONFIG_PROPS	10
111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/*
113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org** Since we send all non-core visual properties as token, value pairs,
114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org** we require 2 words across the wire. In order to maintain backwards
115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org** compatibility, we need to send the total number of words that the
116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org** VisualConfigs are sent back in so old libraries can simply "ignore"
117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org** the new properties.
118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org*/
119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define __GLX_TOTAL_CONFIG \
120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   (__GLX_MIN_CONFIG_PROPS + 2 * __GLX_EXT_CONFIG_PROPS)
121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern GLint _gl_convert_from_x_visual_type(int visualType);
123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern int
125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgglx_config_get(struct glx_config * mode, int attribute, int *value_return);
126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern struct glx_config *
127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgglx_config_create_list(unsigned count);
128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern void
129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgglx_config_destroy_list(struct glx_config *configs);
130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern struct glx_config *
131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgglx_config_find_visual(struct glx_config *configs, int vid);
132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgextern struct glx_config *
133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgglx_config_find_fbconfig(struct glx_config *configs, int fbid);
134f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
135f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif /* GLCONTEXTMODES_H */
136f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
137