1 #ifndef EGLCONFIG_INCLUDED
2 #define EGLCONFIG_INCLUDED
6 #include "egltypedefs.h"
9 /* update _eglValidationTable and _eglOffsetOfConfig before updating this
26 EGLint MaxPbufferHeight
;
27 EGLint MaxPbufferPixels
;
28 EGLint MaxPbufferWidth
;
29 EGLint NativeRenderable
;
30 EGLint NativeVisualID
;
31 EGLint NativeVisualType
;
35 EGLint TransparentType
;
36 EGLint TransparentBlueValue
;
37 EGLint TransparentGreenValue
;
38 EGLint TransparentRedValue
;
39 EGLint BindToTextureRGB
;
40 EGLint BindToTextureRGBA
;
41 EGLint MinSwapInterval
;
42 EGLint MaxSwapInterval
;
45 EGLint ColorBufferType
;
46 EGLint RenderableType
;
47 EGLint MatchNativePixmap
;
56 * Map an EGL attribute enum to the offset of the member in _EGLConfig.
59 _eglOffsetOfConfig(EGLint attr
)
62 #define ATTRIB_MAP(attr, memb) case attr: return offsetof(_EGLConfig, memb)
64 ATTRIB_MAP(EGL_BUFFER_SIZE
, BufferSize
);
65 ATTRIB_MAP(EGL_ALPHA_SIZE
, AlphaSize
);
66 ATTRIB_MAP(EGL_BLUE_SIZE
, BlueSize
);
67 ATTRIB_MAP(EGL_GREEN_SIZE
, GreenSize
);
68 ATTRIB_MAP(EGL_RED_SIZE
, RedSize
);
69 ATTRIB_MAP(EGL_DEPTH_SIZE
, DepthSize
);
70 ATTRIB_MAP(EGL_STENCIL_SIZE
, StencilSize
);
71 ATTRIB_MAP(EGL_CONFIG_CAVEAT
, ConfigCaveat
);
72 ATTRIB_MAP(EGL_CONFIG_ID
, ConfigID
);
73 ATTRIB_MAP(EGL_LEVEL
, Level
);
74 ATTRIB_MAP(EGL_MAX_PBUFFER_HEIGHT
, MaxPbufferHeight
);
75 ATTRIB_MAP(EGL_MAX_PBUFFER_PIXELS
, MaxPbufferPixels
);
76 ATTRIB_MAP(EGL_MAX_PBUFFER_WIDTH
, MaxPbufferWidth
);
77 ATTRIB_MAP(EGL_NATIVE_RENDERABLE
, NativeRenderable
);
78 ATTRIB_MAP(EGL_NATIVE_VISUAL_ID
, NativeVisualID
);
79 ATTRIB_MAP(EGL_NATIVE_VISUAL_TYPE
, NativeVisualType
);
80 ATTRIB_MAP(EGL_SAMPLES
, Samples
);
81 ATTRIB_MAP(EGL_SAMPLE_BUFFERS
, SampleBuffers
);
82 ATTRIB_MAP(EGL_SURFACE_TYPE
, SurfaceType
);
83 ATTRIB_MAP(EGL_TRANSPARENT_TYPE
, TransparentType
);
84 ATTRIB_MAP(EGL_TRANSPARENT_BLUE_VALUE
, TransparentBlueValue
);
85 ATTRIB_MAP(EGL_TRANSPARENT_GREEN_VALUE
, TransparentGreenValue
);
86 ATTRIB_MAP(EGL_TRANSPARENT_RED_VALUE
, TransparentRedValue
);
87 ATTRIB_MAP(EGL_BIND_TO_TEXTURE_RGB
, BindToTextureRGB
);
88 ATTRIB_MAP(EGL_BIND_TO_TEXTURE_RGBA
, BindToTextureRGBA
);
89 ATTRIB_MAP(EGL_MIN_SWAP_INTERVAL
, MinSwapInterval
);
90 ATTRIB_MAP(EGL_MAX_SWAP_INTERVAL
, MaxSwapInterval
);
91 ATTRIB_MAP(EGL_LUMINANCE_SIZE
, LuminanceSize
);
92 ATTRIB_MAP(EGL_ALPHA_MASK_SIZE
, AlphaMaskSize
);
93 ATTRIB_MAP(EGL_COLOR_BUFFER_TYPE
, ColorBufferType
);
94 ATTRIB_MAP(EGL_RENDERABLE_TYPE
, RenderableType
);
95 ATTRIB_MAP(EGL_MATCH_NATIVE_PIXMAP
, MatchNativePixmap
);
96 ATTRIB_MAP(EGL_CONFORMANT
, Conformant
);
98 ATTRIB_MAP(EGL_Y_INVERTED_NOK
, YInvertedNOK
);
107 * Update a config for a given key.
109 * Note that a valid key is not necessarily a valid attribute. There are gaps
110 * in the attribute enums. The separation is to catch application errors.
111 * Drivers should never set a key that is an invalid attribute.
114 _eglSetConfigKey(_EGLConfig
*conf
, EGLint key
, EGLint val
)
116 EGLint offset
= _eglOffsetOfConfig(key
);
118 *((EGLint
*) ((char *) conf
+ offset
)) = val
;
123 * Return the value for a given key.
126 _eglGetConfigKey(const _EGLConfig
*conf
, EGLint key
)
128 EGLint offset
= _eglOffsetOfConfig(key
);
130 return *((EGLint
*) ((char *) conf
+ offset
));
135 _eglInitConfig(_EGLConfig
*config
, _EGLDisplay
*dpy
, EGLint id
);
139 _eglLinkConfig(_EGLConfig
*conf
);
143 _eglLookupConfig(EGLConfig config
, _EGLDisplay
*dpy
);
147 * Return the handle of a linked config.
149 static INLINE EGLConfig
150 _eglGetConfigHandle(_EGLConfig
*conf
)
152 return (EGLConfig
) conf
;
157 _eglValidateConfig(const _EGLConfig
*conf
, EGLBoolean for_matching
);
161 _eglMatchConfig(const _EGLConfig
*conf
, const _EGLConfig
*criteria
);
165 _eglParseConfigAttribList(_EGLConfig
*conf
, _EGLDisplay
*dpy
,
166 const EGLint
*attrib_list
);
170 _eglCompareConfigs(const _EGLConfig
*conf1
, const _EGLConfig
*conf2
,
171 const _EGLConfig
*criteria
, EGLBoolean compare_id
);
175 _eglSortConfigs(const _EGLConfig
**configs
, EGLint count
,
176 EGLint (*compare
)(const _EGLConfig
*, const _EGLConfig
*,
182 _eglChooseConfig(_EGLDriver
*drv
, _EGLDisplay
*dpy
, const EGLint
*attrib_list
, EGLConfig
*configs
, EGLint config_size
, EGLint
*num_config
);
186 _eglGetConfigAttrib(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLConfig
*conf
, EGLint attribute
, EGLint
*value
);
190 _eglGetConfigs(_EGLDriver
*drv
, _EGLDisplay
*dpy
, EGLConfig
*configs
, EGLint config_size
, EGLint
*num_config
);
193 #endif /* EGLCONFIG_INCLUDED */