1 #ifndef EGLCONFIG_INCLUDED
2 #define EGLCONFIG_INCLUDED
7 #include "egltypedefs.h"
10 /* update _eglValidationTable and _eglOffsetOfConfig before updating this
27 EGLint MaxPbufferHeight
;
28 EGLint MaxPbufferPixels
;
29 EGLint MaxPbufferWidth
;
30 EGLint NativeRenderable
;
31 EGLint NativeVisualID
;
32 EGLint NativeVisualType
;
36 EGLint TransparentType
;
37 EGLint TransparentBlueValue
;
38 EGLint TransparentGreenValue
;
39 EGLint TransparentRedValue
;
40 EGLint BindToTextureRGB
;
41 EGLint BindToTextureRGBA
;
42 EGLint MinSwapInterval
;
43 EGLint MaxSwapInterval
;
46 EGLint ColorBufferType
;
47 EGLint RenderableType
;
48 EGLint MatchNativePixmap
;
57 * Map an EGL attribute enum to the offset of the member in _EGLConfig.
60 _eglOffsetOfConfig(EGLint attr
)
63 #define ATTRIB_MAP(attr, memb) case attr: return offsetof(_EGLConfig, memb)
65 ATTRIB_MAP(EGL_BUFFER_SIZE
, BufferSize
);
66 ATTRIB_MAP(EGL_ALPHA_SIZE
, AlphaSize
);
67 ATTRIB_MAP(EGL_BLUE_SIZE
, BlueSize
);
68 ATTRIB_MAP(EGL_GREEN_SIZE
, GreenSize
);
69 ATTRIB_MAP(EGL_RED_SIZE
, RedSize
);
70 ATTRIB_MAP(EGL_DEPTH_SIZE
, DepthSize
);
71 ATTRIB_MAP(EGL_STENCIL_SIZE
, StencilSize
);
72 ATTRIB_MAP(EGL_CONFIG_CAVEAT
, ConfigCaveat
);
73 ATTRIB_MAP(EGL_CONFIG_ID
, ConfigID
);
74 ATTRIB_MAP(EGL_LEVEL
, Level
);
75 ATTRIB_MAP(EGL_MAX_PBUFFER_HEIGHT
, MaxPbufferHeight
);
76 ATTRIB_MAP(EGL_MAX_PBUFFER_PIXELS
, MaxPbufferPixels
);
77 ATTRIB_MAP(EGL_MAX_PBUFFER_WIDTH
, MaxPbufferWidth
);
78 ATTRIB_MAP(EGL_NATIVE_RENDERABLE
, NativeRenderable
);
79 ATTRIB_MAP(EGL_NATIVE_VISUAL_ID
, NativeVisualID
);
80 ATTRIB_MAP(EGL_NATIVE_VISUAL_TYPE
, NativeVisualType
);
81 ATTRIB_MAP(EGL_SAMPLES
, Samples
);
82 ATTRIB_MAP(EGL_SAMPLE_BUFFERS
, SampleBuffers
);
83 ATTRIB_MAP(EGL_SURFACE_TYPE
, SurfaceType
);
84 ATTRIB_MAP(EGL_TRANSPARENT_TYPE
, TransparentType
);
85 ATTRIB_MAP(EGL_TRANSPARENT_BLUE_VALUE
, TransparentBlueValue
);
86 ATTRIB_MAP(EGL_TRANSPARENT_GREEN_VALUE
, TransparentGreenValue
);
87 ATTRIB_MAP(EGL_TRANSPARENT_RED_VALUE
, TransparentRedValue
);
88 ATTRIB_MAP(EGL_BIND_TO_TEXTURE_RGB
, BindToTextureRGB
);
89 ATTRIB_MAP(EGL_BIND_TO_TEXTURE_RGBA
, BindToTextureRGBA
);
90 ATTRIB_MAP(EGL_MIN_SWAP_INTERVAL
, MinSwapInterval
);
91 ATTRIB_MAP(EGL_MAX_SWAP_INTERVAL
, MaxSwapInterval
);
92 ATTRIB_MAP(EGL_LUMINANCE_SIZE
, LuminanceSize
);
93 ATTRIB_MAP(EGL_ALPHA_MASK_SIZE
, AlphaMaskSize
);
94 ATTRIB_MAP(EGL_COLOR_BUFFER_TYPE
, ColorBufferType
);
95 ATTRIB_MAP(EGL_RENDERABLE_TYPE
, RenderableType
);
96 ATTRIB_MAP(EGL_MATCH_NATIVE_PIXMAP
, MatchNativePixmap
);
97 ATTRIB_MAP(EGL_CONFORMANT
, Conformant
);
99 ATTRIB_MAP(EGL_Y_INVERTED_NOK
, YInvertedNOK
);
108 * Update a config for a given key.
110 * Note that a valid key is not necessarily a valid attribute. There are gaps
111 * in the attribute enums. The separation is to catch application errors.
112 * Drivers should never set a key that is an invalid attribute.
115 _eglSetConfigKey(_EGLConfig
*conf
, EGLint key
, EGLint val
)
117 EGLint offset
= _eglOffsetOfConfig(key
);
119 *((EGLint
*) ((char *) conf
+ offset
)) = val
;
124 * Return the value for a given key.
127 _eglGetConfigKey(const _EGLConfig
*conf
, EGLint key
)
129 EGLint offset
= _eglOffsetOfConfig(key
);
131 return *((EGLint
*) ((char *) conf
+ offset
));
136 _eglInitConfig(_EGLConfig
*config
, _EGLDisplay
*dpy
, EGLint id
);
140 _eglLinkConfig(_EGLConfig
*conf
);
144 _eglLookupConfig(EGLConfig config
, _EGLDisplay
*dpy
);
148 * Return the handle of a linked config.
150 static INLINE EGLConfig
151 _eglGetConfigHandle(_EGLConfig
*conf
)
153 return (EGLConfig
) conf
;
158 _eglValidateConfig(const _EGLConfig
*conf
, EGLBoolean for_matching
);
162 _eglMatchConfig(const _EGLConfig
*conf
, const _EGLConfig
*criteria
);
166 _eglParseConfigAttribList(_EGLConfig
*conf
, _EGLDisplay
*dpy
,
167 const EGLint
*attrib_list
);
171 _eglCompareConfigs(const _EGLConfig
*conf1
, const _EGLConfig
*conf2
,
172 const _EGLConfig
*criteria
, EGLBoolean compare_id
);
176 _eglSortConfigs(const _EGLConfig
**configs
, EGLint count
,
177 EGLint (*compare
)(const _EGLConfig
*, const _EGLConfig
*,
183 _eglChooseConfig(_EGLDriver
*drv
, _EGLDisplay
*dpy
, const EGLint
*attrib_list
, EGLConfig
*configs
, EGLint config_size
, EGLint
*num_config
);
187 _eglGetConfigAttrib(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLConfig
*conf
, EGLint attribute
, EGLint
*value
);
191 _eglGetConfigs(_EGLDriver
*drv
, _EGLDisplay
*dpy
, EGLConfig
*configs
, EGLint config_size
, EGLint
*num_config
);
194 #endif /* EGLCONFIG_INCLUDED */