1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief Simple context construction test for EGL_KHR_create_context.
22 *//*--------------------------------------------------------------------*/
23
24 #include "teglCreateContextExtTests.hpp"
25
26 #include "tcuTestLog.hpp"
27
28 #include "egluNativeDisplay.hpp"
29 #include "egluNativeWindow.hpp"
30 #include "egluNativePixmap.hpp"
31 #include "egluConfigFilter.hpp"
32 #include "egluStrUtil.hpp"
33 #include "egluUtil.hpp"
34 #include "egluUnique.hpp"
35
36 #include "eglwLibrary.hpp"
37 #include "eglwEnums.hpp"
38
39 #include "gluDefs.hpp"
40 #include "gluRenderConfig.hpp"
41
42 #include "glwFunctions.hpp"
43 #include "glwEnums.hpp"
44
45 #include "deStringUtil.hpp"
46 #include "deUniquePtr.hpp"
47 #include "deSTLUtil.hpp"
48
49 #include <string>
50 #include <vector>
51 #include <set>
52 #include <sstream>
53
54 #include <cstring>
55
56 using std::set;
57 using std::string;
58 using std::vector;
59 using tcu::TestLog;
60
61 using namespace eglw;
62
63 // Make sure KHR / core values match to those in GL_ARB_robustness and GL_EXT_robustness
64 DE_STATIC_ASSERT(GL_RESET_NOTIFICATION_STRATEGY == 0x8256);
65 DE_STATIC_ASSERT(GL_LOSE_CONTEXT_ON_RESET == 0x8252);
66 DE_STATIC_ASSERT(GL_NO_RESET_NOTIFICATION == 0x8261);
67
68 #if !defined(GL_CONTEXT_ROBUST_ACCESS)
69 # define GL_CONTEXT_ROBUST_ACCESS 0x90F3
70 #endif
71
72 namespace deqp
73 {
74 namespace egl
75 {
76
77 namespace
78 {
79
getAttribListLength(const EGLint * attribList)80 size_t getAttribListLength (const EGLint* attribList)
81 {
82 size_t size = 0;
83
84 while (attribList[size] != EGL_NONE)
85 size++;
86
87 return size + 1;
88 }
89
eglContextFlagsToString(EGLint flags)90 string eglContextFlagsToString (EGLint flags)
91 {
92 std::ostringstream stream;
93
94 if (flags == 0)
95 stream << "<None>";
96 else
97 {
98 bool first = true;
99
100 if ((flags & EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR) != 0)
101 {
102 if (!first)
103 stream << "|";
104
105 first = false;
106
107 stream << "EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR";
108 }
109
110 if ((flags & EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR) != 0)
111 {
112 if (!first)
113 stream << "|";
114
115 first = false;
116
117 stream << "EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR";
118 }
119
120 if ((flags & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) != 0)
121 {
122 if (!first)
123 stream << "|";
124
125 stream << "EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR";
126 }
127 }
128
129 return stream.str();
130 }
131
eglProfileMaskToString(EGLint mask)132 string eglProfileMaskToString (EGLint mask)
133 {
134 std::ostringstream stream;
135
136 if (mask == 0)
137 stream << "<None>";
138 else
139 {
140 bool first = true;
141
142 if ((mask & EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR) != 0)
143 {
144 if (!first)
145 stream << "|";
146
147 first = false;
148
149 stream << "EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR";
150 }
151
152 if ((mask & EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR) != 0)
153 {
154 if (!first)
155 stream << "|";
156
157 stream << "EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR";
158 }
159 }
160
161 return stream.str();
162 }
163
eglResetNotificationStrategyToString(EGLint strategy)164 const char* eglResetNotificationStrategyToString (EGLint strategy)
165 {
166 switch (strategy)
167 {
168 case EGL_NO_RESET_NOTIFICATION_KHR: return "EGL_NO_RESET_NOTIFICATION_KHR";
169 case EGL_LOSE_CONTEXT_ON_RESET_KHR: return "EGL_LOSE_CONTEXT_ON_RESET_KHR";
170 default:
171 return "<Unknown>";
172 }
173 }
174
175 class CreateContextExtCase : public TestCase
176 {
177 public:
178 CreateContextExtCase (EglTestContext& eglTestCtx, EGLenum api, const EGLint* attribList, const eglu::FilterList& filter, const char* name, const char* description);
179 ~CreateContextExtCase (void);
180
181 void executeForSurface (EGLConfig config, EGLSurface surface);
182
183 void init (void);
184 void deinit (void);
185
186 IterateResult iterate (void);
187 void checkRequiredExtensions (void);
188 void logAttribList (void);
189 bool validateCurrentContext (const glw::Functions& gl);
190
191 private:
192 bool m_isOk;
193 int m_iteration;
194
195 const eglu::FilterList m_filter;
196 vector<EGLint> m_attribList;
197 const EGLenum m_api;
198
199 EGLDisplay m_display;
200 vector<EGLConfig> m_configs;
201 glu::ContextType m_glContextType;
202 };
203
attribListToContextType(EGLenum api,const EGLint * attribList)204 glu::ContextType attribListToContextType (EGLenum api, const EGLint* attribList)
205 {
206 EGLint majorVersion = 1;
207 EGLint minorVersion = 0;
208 glu::ContextFlags flags = glu::ContextFlags(0);
209 glu::Profile profile = api == EGL_OPENGL_ES_API ? glu::PROFILE_ES : glu::PROFILE_CORE;
210 const EGLint* iter = attribList;
211
212 while ((*iter) != EGL_NONE)
213 {
214 switch (*iter)
215 {
216 case EGL_CONTEXT_MAJOR_VERSION_KHR:
217 iter++;
218 majorVersion = (*iter);
219 iter++;
220 break;
221
222 case EGL_CONTEXT_MINOR_VERSION_KHR:
223 iter++;
224 minorVersion = (*iter);
225 iter++;
226 break;
227
228 case EGL_CONTEXT_FLAGS_KHR:
229 iter++;
230
231 if ((*iter & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) != 0)
232 flags = flags | glu::CONTEXT_ROBUST;
233
234 if ((*iter & EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR) != 0)
235 flags = flags | glu::CONTEXT_DEBUG;
236
237 if ((*iter & EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR) != 0)
238 flags = flags | glu::CONTEXT_FORWARD_COMPATIBLE;
239
240 iter++;
241 break;
242
243 case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
244 iter++;
245
246 if (*iter == EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR)
247 profile = glu::PROFILE_COMPATIBILITY;
248 else if (*iter != EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR)
249 throw tcu::InternalError("Indeterminate OpenGL profile");
250
251 iter++;
252 break;
253
254 case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
255 iter += 2;
256 break;
257
258 case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
259 iter += 2;
260 break;
261
262 case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
263 iter += 2;
264 break;
265
266 default:
267 DE_ASSERT(DE_FALSE);
268 }
269 }
270
271 return glu::ContextType(majorVersion, minorVersion, profile, flags);
272 }
273
CreateContextExtCase(EglTestContext & eglTestCtx,EGLenum api,const EGLint * attribList,const eglu::FilterList & filter,const char * name,const char * description)274 CreateContextExtCase::CreateContextExtCase (EglTestContext& eglTestCtx, EGLenum api, const EGLint* attribList, const eglu::FilterList& filter, const char* name, const char* description)
275 : TestCase (eglTestCtx, name, description)
276 , m_isOk (true)
277 , m_iteration (0)
278 , m_filter (filter)
279 , m_attribList (attribList, attribList + getAttribListLength(attribList))
280 , m_api (api)
281 , m_display (EGL_NO_DISPLAY)
282 , m_glContextType (attribListToContextType(api, attribList))
283 {
284 }
285
~CreateContextExtCase(void)286 CreateContextExtCase::~CreateContextExtCase (void)
287 {
288 deinit();
289 }
290
init(void)291 void CreateContextExtCase::init (void)
292 {
293 m_display = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
294 m_configs = eglu::chooseConfigs(m_eglTestCtx.getLibrary(), m_display, m_filter);
295 }
296
deinit(void)297 void CreateContextExtCase::deinit (void)
298 {
299 m_attribList.clear();
300 m_configs.clear();
301
302 if (m_display != EGL_NO_DISPLAY)
303 {
304 m_eglTestCtx.getLibrary().terminate(m_display);
305 m_display = EGL_NO_DISPLAY;
306 }
307 }
308
logAttribList(void)309 void CreateContextExtCase::logAttribList (void)
310 {
311 const EGLint* iter = &(m_attribList[0]);
312 std::ostringstream attribListString;
313
314 while ((*iter) != EGL_NONE)
315 {
316 switch (*iter)
317 {
318 case EGL_CONTEXT_MAJOR_VERSION_KHR:
319 iter++;
320 attribListString << "EGL_CONTEXT_MAJOR_VERSION_KHR(EGL_CONTEXT_CLIENT_VERSION), " << (*iter) << ", ";
321 iter++;
322 break;
323
324 case EGL_CONTEXT_MINOR_VERSION_KHR:
325 iter++;
326 attribListString << "EGL_CONTEXT_MINOR_VERSION_KHR, " << (*iter) << ", ";
327 iter++;
328 break;
329
330 case EGL_CONTEXT_FLAGS_KHR:
331 iter++;
332 attribListString << "EGL_CONTEXT_FLAGS_KHR, " << eglContextFlagsToString(*iter) << ", ";
333 iter++;
334 break;
335
336 case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
337 iter++;
338 attribListString << "EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, " << eglProfileMaskToString(*iter) << ", ";
339 iter++;
340 break;
341
342 case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
343 iter++;
344 attribListString << "EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, " << eglResetNotificationStrategyToString(*iter) << ", ";
345 iter++;
346 break;
347
348 case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
349 iter++;
350 attribListString << "EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, ";
351
352 if (*iter == EGL_FALSE || *iter == EGL_TRUE)
353 attribListString << (*iter ? "EGL_TRUE" : "EGL_FALSE");
354 else
355 attribListString << (*iter);
356 iter++;
357 break;
358
359 default:
360 DE_ASSERT(DE_FALSE);
361 }
362 }
363
364 attribListString << "EGL_NONE";
365 m_testCtx.getLog() << TestLog::Message << "EGL attrib list: { " << attribListString.str() << " }" << TestLog::EndMessage;
366 }
367
checkRequiredExtensions(void)368 void CreateContextExtCase::checkRequiredExtensions (void)
369 {
370 bool isOk = true;
371 set<string> requiredExtensions;
372 vector<string> extensions = eglu::getDisplayExtensions(m_eglTestCtx.getLibrary(), m_display);
373
374 {
375 const EGLint* iter = &(m_attribList[0]);
376
377 while ((*iter) != EGL_NONE)
378 {
379 switch (*iter)
380 {
381 case EGL_CONTEXT_MAJOR_VERSION_KHR:
382 iter++;
383 iter++;
384 break;
385
386 case EGL_CONTEXT_MINOR_VERSION_KHR:
387 iter++;
388 requiredExtensions.insert("EGL_KHR_create_context");
389 iter++;
390 break;
391
392 case EGL_CONTEXT_FLAGS_KHR:
393 iter++;
394 requiredExtensions.insert("EGL_KHR_create_context");
395
396 if (*iter & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR)
397 requiredExtensions.insert("EGL_EXT_create_context_robustness");
398
399 iter++;
400 break;
401
402 case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
403 iter++;
404 requiredExtensions.insert("EGL_KHR_create_context");
405 iter++;
406 break;
407
408 case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
409 iter++;
410 requiredExtensions.insert("EGL_KHR_create_context");
411 iter++;
412 break;
413
414 case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
415 iter++;
416 requiredExtensions.insert("EGL_EXT_create_context_robustness");
417 iter++;
418 break;
419
420 case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
421 iter++;
422 requiredExtensions.insert("EGL_EXT_create_context_robustness");
423 iter++;
424 break;
425
426 default:
427 DE_ASSERT(DE_FALSE);
428 }
429 }
430 }
431
432 for (std::set<string>::const_iterator reqExt = requiredExtensions.begin(); reqExt != requiredExtensions.end(); ++reqExt)
433 {
434 if (!de::contains(extensions.begin(), extensions.end(), *reqExt))
435 {
436 m_testCtx.getLog() << TestLog::Message << "Required extension '" << (*reqExt) << "' not supported" << TestLog::EndMessage;
437 isOk = false;
438 }
439 }
440
441 if (!isOk)
442 TCU_THROW(NotSupportedError, "Required extensions not supported");
443 }
444
checkVersionString(TestLog & log,const glw::Functions & gl,bool desktop,int major,int minor)445 bool checkVersionString (TestLog& log, const glw::Functions& gl, bool desktop, int major, int minor)
446 {
447 const char* const versionStr = (const char*)gl.getString(GL_VERSION);
448 const char* iter = versionStr;
449
450 int majorVersion = 0;
451 int minorVersion = 0;
452
453 // Check embedded version prefixes
454 if (!desktop)
455 {
456 const char* prefix = NULL;
457 const char* prefixIter = NULL;
458
459 if (major == 1)
460 prefix = "OpenGL ES-CM ";
461 else
462 prefix = "OpenGL ES ";
463
464 prefixIter = prefix;
465
466 while (*prefixIter)
467 {
468 if ((*prefixIter) != (*iter))
469 {
470 log << TestLog::Message << "Invalid version string prefix. Expected '" << prefix << "'." << TestLog::EndMessage;
471 return false;
472 }
473
474 prefixIter++;
475 iter++;
476 }
477 }
478
479 while ((*iter) && (*iter) != '.')
480 {
481 const int val = (*iter) - '0';
482
483 // Not a number
484 if (val < 0 || val > 9)
485 {
486 log << TestLog::Message << "Failed to parse major version number. Not a number." << TestLog::EndMessage;
487 return false;
488 }
489
490 // Leading zero
491 if (majorVersion == 0 && val == 0)
492 {
493 log << TestLog::Message << "Failed to parse major version number. Begins with zero." << TestLog::EndMessage;
494 return false;
495 }
496
497 majorVersion = majorVersion * 10 + val;
498
499 iter++;
500 }
501
502 // Invalid format
503 if ((*iter) != '.')
504 {
505 log << TestLog::Message << "Failed to parse version. Expected '.' after major version number." << TestLog::EndMessage;
506 return false;
507 }
508
509 iter++;
510
511 while ((*iter) && (*iter) != ' ' && (*iter) != '.')
512 {
513 const int val = (*iter) - '0';
514
515 // Not a number
516 if (val < 0 || val > 9)
517 {
518 log << TestLog::Message << "Failed to parse minor version number. Not a number." << TestLog::EndMessage;
519 return false;
520 }
521
522 // Leading zero
523 if (minorVersion == 0 && val == 0)
524 {
525 // Leading zeros in minor version
526 if ((*(iter + 1)) != ' ' && (*(iter + 1)) != '.' && (*(iter + 1)) != '\0')
527 {
528 log << TestLog::Message << "Failed to parse minor version number. Leading zeros." << TestLog::EndMessage;
529 return false;
530 }
531 }
532
533 minorVersion = minorVersion * 10 + val;
534
535 iter++;
536 }
537
538 // Invalid format
539 if ((*iter) != ' ' && (*iter) != '.' && (*iter) != '\0')
540 return false;
541
542 if (desktop)
543 {
544 if (majorVersion < major)
545 {
546 log << TestLog::Message << "Major version is less than required." << TestLog::EndMessage;
547 return false;
548 }
549 else if (majorVersion == major && minorVersion < minor)
550 {
551 log << TestLog::Message << "Minor version is less than required." << TestLog::EndMessage;
552 return false;
553 }
554 else if (majorVersion == major && minorVersion == minor)
555 return true;
556
557 if (major < 3 || (major == 3 && minor == 0))
558 {
559 if (majorVersion == 3 && minorVersion == 1)
560 {
561 if (glu::hasExtension(gl, glu::ApiType::core(3, 1), "GL_ARB_compatibility"))
562 return true;
563 else
564 {
565 log << TestLog::Message << "Required OpenGL 3.0 or earlier. Got OpenGL 3.1 without GL_ARB_compatibility." << TestLog::EndMessage;
566 return false;
567 }
568 }
569 else if (majorVersion > 3 || (majorVersion == 3 && minorVersion >= minor))
570 {
571 deInt32 profile = 0;
572
573 gl.getIntegerv(GL_CONTEXT_PROFILE_MASK, &profile);
574 GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv()");
575
576 if (profile == GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
577 return true;
578 else
579 {
580 log << TestLog::Message << "Required OpenGL 3.0 or earlier. Got later version without compatibility profile." << TestLog::EndMessage;
581 return false;
582 }
583 }
584 else
585 DE_ASSERT(false);
586
587 return false;
588 }
589 else if (major == 3 && minor == 1)
590 {
591 if (majorVersion > 3 || (majorVersion == 3 && minorVersion >= minor))
592 {
593 deInt32 profile = 0;
594
595 gl.getIntegerv(GL_CONTEXT_PROFILE_MASK, &profile);
596 GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv()");
597
598 if (profile == GL_CONTEXT_CORE_PROFILE_BIT)
599 return true;
600 else
601 {
602 log << TestLog::Message << "Required OpenGL 3.1. Got later version without core profile." << TestLog::EndMessage;
603 return false;
604 }
605 }
606 else
607 DE_ASSERT(false);
608
609 return false;
610 }
611 else
612 {
613 log << TestLog::Message << "Couldn't do any further compatibilyt checks." << TestLog::EndMessage;
614 return true;
615 }
616 }
617 else
618 {
619 if (majorVersion < major)
620 {
621 log << TestLog::Message << "Major version is less than required." << TestLog::EndMessage;
622 return false;
623 }
624 else if (majorVersion == major && minorVersion < minor)
625 {
626 log << TestLog::Message << "Minor version is less than required." << TestLog::EndMessage;
627 return false;
628 }
629 else
630 return true;
631 }
632 }
633
checkVersionQueries(TestLog & log,const glw::Functions & gl,int major,int minor)634 bool checkVersionQueries (TestLog& log, const glw::Functions& gl, int major, int minor)
635 {
636 deInt32 majorVersion = 0;
637 deInt32 minorVersion = 0;
638
639 gl.getIntegerv(GL_MAJOR_VERSION, &majorVersion);
640 GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv()");
641
642 gl.getIntegerv(GL_MINOR_VERSION, &minorVersion);
643 GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv()");
644
645 if (majorVersion < major || (majorVersion == major && minorVersion < minor))
646 {
647 if (majorVersion < major)
648 log << TestLog::Message << "glGetIntegerv(GL_MAJOR_VERSION) returned '" << majorVersion << "' expected at least '" << major << "'" << TestLog::EndMessage;
649 else if (majorVersion == major && minorVersion < minor)
650 log << TestLog::Message << "glGetIntegerv(GL_MINOR_VERSION) returned '" << minorVersion << "' expected '" << minor << "'" << TestLog::EndMessage;
651 else
652 DE_ASSERT(false);
653
654 return false;
655 }
656 else
657 return true;
658 }
659
validateCurrentContext(const glw::Functions & gl)660 bool CreateContextExtCase::validateCurrentContext (const glw::Functions& gl)
661 {
662 bool isOk = true;
663 TestLog& log = m_testCtx.getLog();
664 const EGLint* iter = &(m_attribList[0]);
665
666 EGLint majorVersion = -1;
667 EGLint minorVersion = -1;
668 EGLint contextFlags = -1;
669 EGLint profileMask = -1;
670 EGLint notificationStrategy = -1;
671 EGLint robustAccessExt = -1;
672 EGLint notificationStrategyExt = -1;
673
674 while ((*iter) != EGL_NONE)
675 {
676 switch (*iter)
677 {
678 case EGL_CONTEXT_MAJOR_VERSION_KHR:
679 iter++;
680 majorVersion = (*iter);
681 iter++;
682 break;
683
684 case EGL_CONTEXT_MINOR_VERSION_KHR:
685 iter++;
686 minorVersion = (*iter);
687 iter++;
688 break;
689
690 case EGL_CONTEXT_FLAGS_KHR:
691 iter++;
692 contextFlags = (*iter);
693 iter++;
694 break;
695
696 case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
697 iter++;
698 profileMask = (*iter);
699 iter++;
700 break;
701
702 case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
703 iter++;
704 notificationStrategy = (*iter);
705 iter++;
706 break;
707
708 case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
709 iter++;
710 robustAccessExt = *iter;
711 iter++;
712 break;
713
714 case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
715 iter++;
716 notificationStrategyExt = *iter;
717 iter++;
718 break;
719
720 default:
721 DE_ASSERT(DE_FALSE);
722 }
723 }
724
725 const string version = (const char*)gl.getString(GL_VERSION);
726
727 log << TestLog::Message << "GL_VERSION: '" << version << "'" << TestLog::EndMessage;
728
729 if (majorVersion == -1)
730 majorVersion = 1;
731
732 if (minorVersion == -1)
733 minorVersion = 0;
734
735 if (m_api == EGL_OPENGL_ES_API)
736 {
737 if (!checkVersionString(log, gl, false, majorVersion, minorVersion))
738 isOk = false;
739
740 if (majorVersion == 3)
741 {
742 if (!checkVersionQueries(log, gl, majorVersion, minorVersion))
743 isOk = false;
744 }
745 }
746 else if (m_api == EGL_OPENGL_API)
747 {
748 if (!checkVersionString(log, gl, true, majorVersion, minorVersion))
749 isOk = false;
750
751 if (majorVersion >= 3)
752 {
753 if (!checkVersionQueries(log, gl, majorVersion, minorVersion))
754 isOk = false;
755 }
756 }
757 else
758 DE_ASSERT(false);
759
760
761 if (contextFlags != -1)
762 {
763 if (m_api == EGL_OPENGL_API && (majorVersion > 3 || (majorVersion == 3 && minorVersion >= 1)))
764 {
765 deInt32 contextFlagsGL;
766
767 DE_ASSERT(m_api == EGL_OPENGL_API);
768
769 if (contextFlags == -1)
770 contextFlags = 0;
771
772 gl.getIntegerv(GL_CONTEXT_FLAGS, &contextFlagsGL);
773
774 if (contextFlags != contextFlagsGL)
775 {
776 log << TestLog::Message << "Invalid GL_CONTEXT_FLAGS. Expected '" << eglContextFlagsToString(contextFlags) << "' got '" << eglContextFlagsToString(contextFlagsGL) << "'" << TestLog::EndMessage;
777 isOk = false;
778 }
779 }
780 }
781
782 if (profileMask != -1 || (m_api == EGL_OPENGL_API && (majorVersion >= 3)))
783 {
784 if (profileMask == -1)
785 profileMask = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
786
787 DE_ASSERT(m_api == EGL_OPENGL_API);
788
789 if (majorVersion < 3 || (majorVersion == 3 && minorVersion < 2))
790 {
791 // \note Ignore profile masks. This is not an error
792 }
793 else
794 {
795 deInt32 profileMaskGL = 0;
796
797 gl.getIntegerv(GL_CONTEXT_PROFILE_MASK, &profileMaskGL);
798 GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv()");
799
800 if (profileMask != profileMaskGL)
801 {
802 log << TestLog::Message << "Invalid GL_CONTEXT_PROFILE_MASK. Expected '" << eglProfileMaskToString(profileMask) << "' got '" << eglProfileMaskToString(profileMaskGL) << "'" << TestLog::EndMessage;
803 isOk = false;
804 }
805 }
806 }
807
808 DE_ASSERT(notificationStrategy == -1 || notificationStrategyExt == -1);
809
810 if (notificationStrategy != -1 || notificationStrategyExt != -1)
811 {
812 const deInt32 expected = notificationStrategy != -1 ? notificationStrategy : notificationStrategyExt;
813 deInt32 strategy = 0;
814
815 gl.getIntegerv(GL_RESET_NOTIFICATION_STRATEGY, &strategy);
816 GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv()");
817
818 if (expected == EGL_NO_RESET_NOTIFICATION && strategy != GL_NO_RESET_NOTIFICATION)
819 {
820 log << TestLog::Message << "glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY) returned '" << strategy << "', expected 'GL_NO_RESET_NOTIFICATION'" << TestLog::EndMessage;
821 isOk = false;
822 }
823 else if (expected == EGL_LOSE_CONTEXT_ON_RESET && strategy != GL_LOSE_CONTEXT_ON_RESET)
824 {
825 log << TestLog::Message << "glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY) returned '" << strategy << "', expected 'GL_LOSE_CONTEXT_ON_RESET'" << TestLog::EndMessage;
826 isOk = false;
827 }
828 }
829
830 if (robustAccessExt == EGL_TRUE)
831 {
832 if (m_api == EGL_OPENGL_API)
833 {
834 if (!glu::hasExtension(gl, glu::ApiType::core(majorVersion, minorVersion), "GL_ARB_robustness"))
835 {
836 log << TestLog::Message << "Created robustness context but it doesn't support GL_ARB_robustness." << TestLog::EndMessage;
837 isOk = false;
838 }
839 }
840 else if (m_api == EGL_OPENGL_ES_API)
841 {
842 if (!glu::hasExtension(gl, glu::ApiType::es(majorVersion, minorVersion), "GL_EXT_robustness"))
843 {
844 log << TestLog::Message << "Created robustness context but it doesn't support GL_EXT_robustness." << TestLog::EndMessage;
845 isOk = false;
846 }
847 }
848
849 if (m_api == EGL_OPENGL_API && (majorVersion > 3 || (majorVersion == 3 && minorVersion >= 1)))
850 {
851 deInt32 contextFlagsGL;
852
853 DE_ASSERT(m_api == EGL_OPENGL_API);
854
855 gl.getIntegerv(GL_CONTEXT_FLAGS, &contextFlagsGL);
856
857 if ((contextFlagsGL & GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT) != 0)
858 {
859 log << TestLog::Message << "Invalid GL_CONTEXT_FLAGS. GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT to be set, got '" << eglContextFlagsToString(contextFlagsGL) << "'" << TestLog::EndMessage;
860 isOk = false;
861 }
862 }
863 else if (m_api == EGL_OPENGL_ES_API)
864 {
865 deUint8 robustAccessGL;
866
867 gl.getBooleanv(GL_CONTEXT_ROBUST_ACCESS, &robustAccessGL);
868 GLU_EXPECT_NO_ERROR(gl.getError(), "glGetBooleanv()");
869
870 if (robustAccessGL != GL_TRUE)
871 {
872 log << TestLog::Message << "Invalid GL_CONTEXT_ROBUST_ACCESS returned by glGetBooleanv(). Got '" << robustAccessGL << "' expected GL_TRUE." << TestLog::EndMessage;
873 isOk = false;
874 }
875 }
876
877 }
878
879 return isOk;
880 }
881
iterate(void)882 TestCase::IterateResult CreateContextExtCase::iterate (void)
883 {
884 if (m_iteration == 0)
885 {
886 logAttribList();
887 checkRequiredExtensions();
888 }
889
890 if (m_iteration < (int)m_configs.size())
891 {
892 const Library& egl = m_eglTestCtx.getLibrary();
893 const EGLConfig config = m_configs[m_iteration];
894 const EGLint surfaceTypes = eglu::getConfigAttribInt(egl, m_display, config, EGL_SURFACE_TYPE);
895 const EGLint configId = eglu::getConfigAttribInt(egl, m_display, config, EGL_CONFIG_ID);
896
897 if ((surfaceTypes & EGL_PBUFFER_BIT) != 0)
898 {
899 tcu::ScopedLogSection section (m_testCtx.getLog(), ("EGLConfig ID: " + de::toString(configId) + " with PBuffer").c_str(), ("EGLConfig ID: " + de::toString(configId)).c_str());
900 const EGLint attribList[] =
901 {
902 EGL_WIDTH, 64,
903 EGL_HEIGHT, 64,
904 EGL_NONE
905 };
906 eglu::UniqueSurface surface (egl, m_display, egl.createPbufferSurface(m_display, config, attribList));
907 EGLU_CHECK_MSG(egl, "eglCreatePbufferSurface");
908
909 executeForSurface(config, *surface);
910 }
911 else if ((surfaceTypes & EGL_WINDOW_BIT) != 0)
912 {
913 const eglu::NativeWindowFactory& factory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
914
915 de::UniquePtr<eglu::NativeWindow> window (factory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, config, DE_NULL, eglu::WindowParams(256, 256, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
916 eglu::UniqueSurface surface (egl, m_display, eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, m_display, config, DE_NULL));
917
918 executeForSurface(config, *surface);
919 }
920 else if ((surfaceTypes & EGL_PIXMAP_BIT) != 0)
921 {
922 const eglu::NativePixmapFactory& factory = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
923
924 de::UniquePtr<eglu::NativePixmap> pixmap (factory.createPixmap(&m_eglTestCtx.getNativeDisplay(), m_display, config, DE_NULL, 256, 256));
925 eglu::UniqueSurface surface (egl, m_display, eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, m_display, config, DE_NULL));
926
927 executeForSurface(config, *surface);
928 }
929 else // No supported surface type
930 TCU_FAIL("Invalid or empty surface type bits");
931
932 m_iteration++;
933 return CONTINUE;
934 }
935 else
936 {
937 if (m_configs.size() == 0)
938 {
939 m_testCtx.getLog() << TestLog::Message << "No supported configs found" << TestLog::EndMessage;
940 m_testCtx.setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "No supported configs found");
941 }
942 else if (m_isOk)
943 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
944 else
945 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
946
947 return STOP;
948 }
949 }
950
executeForSurface(EGLConfig config,EGLSurface surface)951 void CreateContextExtCase::executeForSurface (EGLConfig config, EGLSurface surface)
952 {
953 const Library& egl = m_eglTestCtx.getLibrary();
954
955 EGLU_CHECK_CALL(egl, bindAPI(m_api));
956
957 try
958 {
959 glw::Functions gl;
960 eglu::UniqueContext context (egl, m_display, egl.createContext(m_display, config, EGL_NO_CONTEXT, &m_attribList[0]));
961 EGLU_CHECK_MSG(egl, "eglCreateContext");
962
963 EGLU_CHECK_CALL(egl, makeCurrent(m_display, surface, surface, *context));
964
965 m_eglTestCtx.initGLFunctions(&gl, m_glContextType.getAPI());
966
967 if (!validateCurrentContext(gl))
968 m_isOk = false;
969 }
970 catch (const eglu::Error& error)
971 {
972 if (error.getError() == EGL_BAD_MATCH)
973 m_testCtx.getLog() << TestLog::Message << "Context creation failed with error EGL_BAD_CONTEXT. Config doesn't support api version." << TestLog::EndMessage;
974 else if (error.getError() == EGL_BAD_CONFIG)
975 m_testCtx.getLog() << TestLog::Message << "Context creation failed with error EGL_BAD_MATCH. Context attribute compination not supported." << TestLog::EndMessage;
976 else
977 {
978 m_testCtx.getLog() << TestLog::Message << "Context creation failed with error " << eglu::getErrorStr(error.getError()) << ". Error is not result of unsupported api etc." << TestLog::EndMessage;
979 m_isOk = false;
980 }
981 }
982
983 EGLU_CHECK_CALL(egl, makeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
984 }
985
986 class CreateContextExtGroup : public TestCaseGroup
987 {
988 public:
989 CreateContextExtGroup (EglTestContext& eglTestCtx, EGLenum api, EGLint apiBit, const EGLint* attribList, const char* name, const char* description);
990 virtual ~CreateContextExtGroup (void);
991
992 void init (void);
993
994 private:
995 const EGLenum m_api;
996 const EGLint m_apiBit;
997 vector<EGLint> m_attribList;
998 };
999
CreateContextExtGroup(EglTestContext & eglTestCtx,EGLenum api,EGLint apiBit,const EGLint * attribList,const char * name,const char * description)1000 CreateContextExtGroup::CreateContextExtGroup (EglTestContext& eglTestCtx, EGLenum api, EGLint apiBit, const EGLint* attribList, const char* name, const char* description)
1001 : TestCaseGroup (eglTestCtx, name, description)
1002 , m_api (api)
1003 , m_apiBit (apiBit)
1004 , m_attribList (attribList, attribList + getAttribListLength(attribList))
1005 {
1006 }
1007
~CreateContextExtGroup(void)1008 CreateContextExtGroup::~CreateContextExtGroup (void)
1009 {
1010 }
1011
1012
1013 template <int Red, int Green, int Blue, int Alpha>
colorBits(const eglu::CandidateConfig & c)1014 static bool colorBits (const eglu::CandidateConfig& c)
1015 {
1016 return c.redSize() == Red &&
1017 c.greenSize() == Green &&
1018 c.blueSize() == Blue &&
1019 c.alphaSize() == Alpha;
1020 }
1021
hasDepth(const eglu::CandidateConfig & c)1022 static bool hasDepth (const eglu::CandidateConfig& c) { return c.depthSize() > 0; }
noDepth(const eglu::CandidateConfig & c)1023 static bool noDepth (const eglu::CandidateConfig& c) { return c.depthSize() == 0; }
hasStencil(const eglu::CandidateConfig & c)1024 static bool hasStencil (const eglu::CandidateConfig& c) { return c.stencilSize() > 0; }
noStencil(const eglu::CandidateConfig & c)1025 static bool noStencil (const eglu::CandidateConfig& c) { return c.stencilSize() == 0; }
1026
1027 template <deUint32 Type>
renderable(const eglu::CandidateConfig & c)1028 static bool renderable (const eglu::CandidateConfig& c)
1029 {
1030 return (c.renderableType() & Type) == Type;
1031 }
1032
getRenderableFilter(deUint32 bits)1033 static eglu::ConfigFilter getRenderableFilter (deUint32 bits)
1034 {
1035 switch (bits)
1036 {
1037 case EGL_OPENGL_ES2_BIT: return renderable<EGL_OPENGL_ES2_BIT>;
1038 case EGL_OPENGL_ES3_BIT: return renderable<EGL_OPENGL_ES3_BIT>;
1039 case EGL_OPENGL_BIT: return renderable<EGL_OPENGL_BIT>;
1040 default:
1041 DE_ASSERT(false);
1042 return renderable<0>;
1043 }
1044 }
1045
init(void)1046 void CreateContextExtGroup::init (void)
1047 {
1048 const struct
1049 {
1050 const char* name;
1051 const char* description;
1052
1053 eglu::ConfigFilter colorFilter;
1054 eglu::ConfigFilter depthFilter;
1055 eglu::ConfigFilter stencilFilter;
1056 } groups[] =
1057 {
1058 { "rgb565_no_depth_no_stencil", "RGB565 configs without depth or stencil", colorBits<5, 6, 5, 0>, noDepth, noStencil },
1059 { "rgb565_no_depth_stencil", "RGB565 configs with stencil and no depth", colorBits<5, 6, 5, 0>, noDepth, hasStencil },
1060 { "rgb565_depth_no_stencil", "RGB565 configs with depth and no stencil", colorBits<5, 6, 5, 0>, hasDepth, noStencil },
1061 { "rgb565_depth_stencil", "RGB565 configs with depth and stencil", colorBits<5, 6, 5, 0>, hasDepth, hasStencil },
1062
1063 { "rgb888_no_depth_no_stencil", "RGB888 configs without depth or stencil", colorBits<8, 8, 8, 0>, noDepth, noStencil },
1064 { "rgb888_no_depth_stencil", "RGB888 configs with stencil and no depth", colorBits<8, 8, 8, 0>, noDepth, hasStencil },
1065 { "rgb888_depth_no_stencil", "RGB888 configs with depth and no stencil", colorBits<8, 8, 8, 0>, hasDepth, noStencil },
1066 { "rgb888_depth_stencil", "RGB888 configs with depth and stencil", colorBits<8, 8, 8, 0>, hasDepth, hasStencil },
1067
1068 { "rgba4444_no_depth_no_stencil", "RGBA4444 configs without depth or stencil", colorBits<4, 4, 4, 4>, noDepth, noStencil },
1069 { "rgba4444_no_depth_stencil", "RGBA4444 configs with stencil and no depth", colorBits<4, 4, 4, 4>, noDepth, hasStencil },
1070 { "rgba4444_depth_no_stencil", "RGBA4444 configs with depth and no stencil", colorBits<4, 4, 4, 4>, hasDepth, noStencil },
1071 { "rgba4444_depth_stencil", "RGBA4444 configs with depth and stencil", colorBits<4, 4, 4, 4>, hasDepth, hasStencil },
1072
1073 { "rgba5551_no_depth_no_stencil", "RGBA5551 configs without depth or stencil", colorBits<5, 5, 5, 1>, noDepth, noStencil },
1074 { "rgba5551_no_depth_stencil", "RGBA5551 configs with stencil and no depth", colorBits<5, 5, 5, 1>, noDepth, hasStencil },
1075 { "rgba5551_depth_no_stencil", "RGBA5551 configs with depth and no stencil", colorBits<5, 5, 5, 1>, hasDepth, noStencil },
1076 { "rgba5551_depth_stencil", "RGBA5551 configs with depth and stencil", colorBits<5, 5, 5, 1>, hasDepth, hasStencil },
1077
1078 { "rgba8888_no_depth_no_stencil", "RGBA8888 configs without depth or stencil", colorBits<8, 8, 8, 8>, noDepth, noStencil },
1079 { "rgba8888_no_depth_stencil", "RGBA8888 configs with stencil and no depth", colorBits<8, 8, 8, 8>, noDepth, hasStencil },
1080 { "rgba8888_depth_no_stencil", "RGBA8888 configs with depth and no stencil", colorBits<8, 8, 8, 8>, hasDepth, noStencil },
1081 { "rgba8888_depth_stencil", "RGBA8888 configs with depth and stencil", colorBits<8, 8, 8, 8>, hasDepth, hasStencil }
1082 };
1083
1084 for (int groupNdx = 0; groupNdx < DE_LENGTH_OF_ARRAY(groups); groupNdx++)
1085 {
1086 eglu::FilterList filter;
1087
1088 filter << groups[groupNdx].colorFilter
1089 << groups[groupNdx].depthFilter
1090 << groups[groupNdx].stencilFilter
1091 << getRenderableFilter(m_apiBit);
1092
1093 addChild(new CreateContextExtCase(m_eglTestCtx, m_api, &(m_attribList[0]), filter, groups[groupNdx].name, groups[groupNdx].description));
1094 }
1095 // \todo [mika] Add other group
1096 }
1097
1098 } // anonymous
1099
CreateContextExtTests(EglTestContext & eglTestCtx)1100 CreateContextExtTests::CreateContextExtTests (EglTestContext& eglTestCtx)
1101 : TestCaseGroup(eglTestCtx, "create_context_ext", "EGL_KHR_create_context tests.")
1102 {
1103 }
1104
~CreateContextExtTests(void)1105 CreateContextExtTests::~CreateContextExtTests (void)
1106 {
1107 }
1108
init(void)1109 void CreateContextExtTests::init (void)
1110 {
1111 const size_t maxAttributeCount = 10;
1112 const struct
1113 {
1114 const char* name;
1115 const char* description;
1116 EGLenum api;
1117 EGLint apiBit;
1118 EGLint attribList[maxAttributeCount];
1119 } groupList[] =
1120 {
1121 #if 0
1122 // \todo [mika] Not supported by glw
1123 // OpenGL ES 1.x
1124 { "gles_10", "Create OpenGL ES 1.0 context", EGL_OPENGL_ES_API, EGL_OPENGL_ES_BIT,
1125 { EGL_CONTEXT_MAJOR_VERSION_KHR, 1, EGL_CONTEXT_MINOR_VERSION_KHR, 0, EGL_NONE} },
1126 { "gles_11", "Create OpenGL ES 1.1 context", EGL_OPENGL_ES_API, EGL_OPENGL_ES_BIT,
1127 { EGL_CONTEXT_MAJOR_VERSION_KHR, 1, EGL_CONTEXT_MINOR_VERSION_KHR, 1, EGL_NONE } },
1128 #endif
1129 // OpenGL ES 2.x
1130 { "gles_20", "Create OpenGL ES 2.0 context", EGL_OPENGL_ES_API, EGL_OPENGL_ES2_BIT,
1131 { EGL_CONTEXT_MAJOR_VERSION_KHR, 2, EGL_CONTEXT_MINOR_VERSION_KHR, 0, EGL_NONE } },
1132 // OpenGL ES 3.x
1133 { "gles_30", "Create OpenGL ES 3.0 context", EGL_OPENGL_ES_API, EGL_OPENGL_ES3_BIT_KHR,
1134 { EGL_CONTEXT_MAJOR_VERSION_KHR, 3, EGL_CONTEXT_MINOR_VERSION_KHR, 0, EGL_NONE} },
1135 #if 0
1136 // \todo [mika] Not supported by glw
1137 // \note [mika] Should we really test 1.x?
1138 { "gl_10", "Create OpenGL 1.0 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1139 { EGL_CONTEXT_MAJOR_VERSION_KHR, 1, EGL_CONTEXT_MINOR_VERSION_KHR, 0, EGL_NONE} },
1140 { "gl_11", "Create OpenGL 1.1 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1141 { EGL_CONTEXT_MAJOR_VERSION_KHR, 1, EGL_CONTEXT_MINOR_VERSION_KHR, 1, EGL_NONE } },
1142
1143 // OpenGL 2.x
1144 { "gl_20", "Create OpenGL 2.0 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1145 { EGL_CONTEXT_MAJOR_VERSION_KHR, 2, EGL_CONTEXT_MINOR_VERSION_KHR, 0, EGL_NONE } },
1146 { "gl_21", "Create OpenGL 2.1 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1147 { EGL_CONTEXT_MAJOR_VERSION_KHR, 2, EGL_CONTEXT_MINOR_VERSION_KHR, 1, EGL_NONE } },
1148 #endif
1149 // OpenGL 3.x
1150 { "gl_30", "Create OpenGL 3.0 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1151 { EGL_CONTEXT_MAJOR_VERSION_KHR, 3, EGL_CONTEXT_MINOR_VERSION_KHR, 0, EGL_NONE } },
1152 { "robust_gl_30", "Create robust OpenGL 3.0 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1153 { EGL_CONTEXT_MAJOR_VERSION_KHR, 3, EGL_CONTEXT_MINOR_VERSION_KHR, 0, EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR, EGL_NONE } },
1154 { "gl_31", "Create OpenGL 3.1 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1155 { EGL_CONTEXT_MAJOR_VERSION_KHR, 3, EGL_CONTEXT_MINOR_VERSION_KHR, 1, EGL_NONE } },
1156 { "robust_gl_31", "Create robust OpenGL 3.1 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1157 { EGL_CONTEXT_MAJOR_VERSION_KHR, 3, EGL_CONTEXT_MINOR_VERSION_KHR, 1, EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR, EGL_NONE } },
1158 { "gl_32", "Create OpenGL 3.2 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1159 { EGL_CONTEXT_MAJOR_VERSION_KHR, 3, EGL_CONTEXT_MINOR_VERSION_KHR, 2, EGL_NONE } },
1160 { "robust_gl_32", "Create robust OpenGL 3.2 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1161 { EGL_CONTEXT_MAJOR_VERSION_KHR, 3, EGL_CONTEXT_MINOR_VERSION_KHR, 2, EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR, EGL_NONE } },
1162 { "gl_33", "Create OpenGL 3.3 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1163 { EGL_CONTEXT_MAJOR_VERSION_KHR, 3, EGL_CONTEXT_MINOR_VERSION_KHR, 3, EGL_NONE } },
1164 { "robust_gl_33", "Create robust OpenGL 3.3 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1165 { EGL_CONTEXT_MAJOR_VERSION_KHR, 3, EGL_CONTEXT_MINOR_VERSION_KHR, 3, EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR, EGL_NONE } },
1166
1167 // OpenGL 4.x
1168 { "gl_40", "Create OpenGL 4.0 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1169 { EGL_CONTEXT_MAJOR_VERSION_KHR, 4, EGL_CONTEXT_MINOR_VERSION_KHR, 0, EGL_NONE } },
1170 { "robust_gl_40", "Create robust OpenGL 4.0 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1171 { EGL_CONTEXT_MAJOR_VERSION_KHR, 4, EGL_CONTEXT_MINOR_VERSION_KHR, 0, EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR, EGL_NONE } },
1172 { "gl_41", "Create OpenGL 4.1 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1173 { EGL_CONTEXT_MAJOR_VERSION_KHR, 4, EGL_CONTEXT_MINOR_VERSION_KHR, 1, EGL_NONE } },
1174 { "robust_gl_41", "Create robust OpenGL 4.1 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1175 { EGL_CONTEXT_MAJOR_VERSION_KHR, 4, EGL_CONTEXT_MINOR_VERSION_KHR, 1, EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR, EGL_NONE } },
1176 { "gl_42", "Create OpenGL 4.2 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1177 { EGL_CONTEXT_MAJOR_VERSION_KHR, 4, EGL_CONTEXT_MINOR_VERSION_KHR, 2, EGL_NONE } },
1178 { "robust_gl_42", "Create robust OpenGL 4.2 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1179 { EGL_CONTEXT_MAJOR_VERSION_KHR, 4, EGL_CONTEXT_MINOR_VERSION_KHR, 2, EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR, EGL_NONE } },
1180 { "gl_43", "Create OpenGL 4.3 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1181 { EGL_CONTEXT_MAJOR_VERSION_KHR, 4, EGL_CONTEXT_MINOR_VERSION_KHR, 3, EGL_NONE } },
1182 { "robust_gl_43", "Create robust OpenGL 4.3 context", EGL_OPENGL_API, EGL_OPENGL_BIT,
1183 { EGL_CONTEXT_MAJOR_VERSION_KHR, 4, EGL_CONTEXT_MINOR_VERSION_KHR, 3, EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR, EGL_NONE } },
1184
1185 // Robust contexts with EGL_EXT_create_context_robustness
1186 { "robust_gles_2_ext", "Create robust OpenGL ES 2.0 context with EGL_EXT_create_context_robustness.", EGL_OPENGL_ES_API, EGL_OPENGL_ES2_BIT,
1187 { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, EGL_TRUE, EGL_NONE } },
1188 { "robust_gles_3_ext", "Create robust OpenGL ES 3.0 context with EGL_EXT_create_context_robustness.", EGL_OPENGL_ES_API, EGL_OPENGL_ES3_BIT_KHR,
1189 { EGL_CONTEXT_CLIENT_VERSION, 3, EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, EGL_TRUE, EGL_NONE } },
1190 #if 0
1191 // glu/glw doesn't support any version of OpenGL and EGL doesn't allow use of EGL_CONTEXT_CLIENT_VERSION with OpenGL and doesn't define which OpenGL version should be returned.
1192 { "robust_gl_ext", "Create robust OpenGL context with EGL_EXT_create_context_robustness.", EGL_OPENGL_API, EGL_OPENGL_BIT,
1193 { EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, EGL_TRUE, EGL_NONE } }
1194 #endif
1195 };
1196
1197 for (int groupNdx = 0; groupNdx < DE_LENGTH_OF_ARRAY(groupList); groupNdx++)
1198 addChild(new CreateContextExtGroup(m_eglTestCtx, groupList[groupNdx].api, groupList[groupNdx].apiBit, groupList[groupNdx].attribList, groupList[groupNdx].name, groupList[groupNdx].description));
1199 }
1200
1201 } // egl
1202 } // deqp
1203