blob: 17c910c53f149600b324088c93dd2142325e2640 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#pragma once
#include <EGL/egl.h>
#include <GLES2/gl2.h>
namespace android
{
class ConfigComparator
{
public:
ConfigComparator(EGLDisplay display)
: m_display(display)
{}
int operator()(EGLConfig const & l, EGLConfig const & r) const
{
return configWeight(l) - configWeight(r);
}
int configWeight(EGLConfig const & config) const
{
int val = -1;
eglGetConfigAttrib(m_display, config, EGL_CONFIG_CAVEAT, &val);
switch (val)
{
case EGL_NONE:
return 0;
case EGL_SLOW_CONFIG:
return 1;
case EGL_NON_CONFORMANT_CONFIG:
return 2;
default:
return 0;
}
}
private:
EGLDisplay m_display;
};
} // namespace android
|