Changeset View
Changeset View
Standalone View
Standalone View
egl_context_attribute_builder.cpp
Show All 25 Lines | |||||
26 | { | 26 | { | ||
27 | std::vector<int> attribs; | 27 | std::vector<int> attribs; | ||
28 | if (isVersionRequested()) { | 28 | if (isVersionRequested()) { | ||
29 | attribs.emplace_back(EGL_CONTEXT_MAJOR_VERSION_KHR); | 29 | attribs.emplace_back(EGL_CONTEXT_MAJOR_VERSION_KHR); | ||
30 | attribs.emplace_back(majorVersion()); | 30 | attribs.emplace_back(majorVersion()); | ||
31 | attribs.emplace_back(EGL_CONTEXT_MINOR_VERSION_KHR); | 31 | attribs.emplace_back(EGL_CONTEXT_MINOR_VERSION_KHR); | ||
32 | attribs.emplace_back(minorVersion()); | 32 | attribs.emplace_back(minorVersion()); | ||
33 | } | 33 | } | ||
34 | int contextFlags = 0; | ||||
34 | if (isRobust()) { | 35 | if (isRobust()) { | ||
35 | attribs.emplace_back(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR); | 36 | attribs.emplace_back(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR); | ||
36 | attribs.emplace_back(EGL_LOSE_CONTEXT_ON_RESET_KHR); | 37 | attribs.emplace_back(EGL_LOSE_CONTEXT_ON_RESET_KHR); | ||
38 | contextFlags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; | ||||
39 | } | ||||
40 | if (isForwardCompatible()) { | ||||
41 | contextFlags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR; | ||||
42 | } | ||||
43 | if (contextFlags != 0) { | ||||
37 | attribs.emplace_back(EGL_CONTEXT_FLAGS_KHR); | 44 | attribs.emplace_back(EGL_CONTEXT_FLAGS_KHR); | ||
38 | attribs.emplace_back(EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR); | 45 | attribs.emplace_back(contextFlags); | ||
46 | } | ||||
47 | if (isCoreProfile() || isCompatibilityProfile()) { | ||||
48 | attribs.emplace_back(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR); | ||||
49 | if (isCoreProfile()) { | ||||
50 | attribs.emplace_back(EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR); | ||||
51 | } else if (isCompatibilityProfile()) { | ||||
52 | attribs.emplace_back(EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR); | ||||
53 | } | ||||
39 | } | 54 | } | ||
40 | attribs.emplace_back(EGL_NONE); | 55 | attribs.emplace_back(EGL_NONE); | ||
41 | return attribs; | 56 | return attribs; | ||
42 | } | 57 | } | ||
43 | 58 | | |||
44 | std::vector<int> EglOpenGLESContextAttributeBuilder::build() const | 59 | std::vector<int> EglOpenGLESContextAttributeBuilder::build() const | ||
45 | { | 60 | { | ||
46 | std::vector<int> attribs; | 61 | std::vector<int> attribs; | ||
Show All 13 Lines |