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 Color clear tests. 22 *//*--------------------------------------------------------------------*/ 23 24 #include "teglColorClearTests.hpp" 25 #include "teglColorClearCase.hpp" 26 27 #include <EGL/eglext.h> 28 29 #if !defined(EGL_OPENGL_ES3_BIT_KHR) 30 # define EGL_OPENGL_ES3_BIT_KHR 0x0040 31 #endif 32 #if !defined(EGL_CONTEXT_MAJOR_VERSION_KHR) 33 # define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION 34 #endif 35 36 using std::string; 37 using std::vector; 38 39 namespace deqp 40 { 41 namespace egl 42 { 43 44 ColorClearTests::ColorClearTests (EglTestContext& eglTestCtx) 45 : TestCaseGroup(eglTestCtx, "color_clears", "Color clears with different client APIs") 46 { 47 } 48 49 ColorClearTests::~ColorClearTests (void) 50 { 51 } 52 53 struct ColorClearGroupSpec 54 { 55 const char* name; 56 const char* desc; 57 EGLint apiBits; 58 int numContextsPerApi; 59 }; 60 61 template <class ClearClass> 62 static void createColorClearGroups (EglTestContext& eglTestCtx, tcu::TestCaseGroup* group, const ColorClearGroupSpec* first, const ColorClearGroupSpec* last) 63 { 64 for (const ColorClearGroupSpec* groupIter = first; groupIter != last; groupIter++) 65 { 66 tcu::TestCaseGroup* configGroup = new tcu::TestCaseGroup(eglTestCtx.getTestContext(), groupIter->name, groupIter->desc); 67 group->addChild(configGroup); 68 69 vector<RenderConfigIdSet> configSets; 70 eglu::FilterList filters; 71 filters << (eglu::ConfigRenderableType() & groupIter->apiBits); 72 getDefaultRenderConfigIdSets(configSets, eglTestCtx.getConfigs(), filters); 73 74 for (vector<RenderConfigIdSet>::const_iterator setIter = configSets.begin(); setIter != configSets.end(); setIter++) 75 configGroup->addChild(new ClearClass(eglTestCtx, setIter->getName(), "", groupIter->apiBits, setIter->getSurfaceTypeMask(), setIter->getConfigIds(), groupIter->numContextsPerApi)); 76 } 77 } 78 79 void ColorClearTests::init (void) 80 { 81 static const ColorClearGroupSpec singleContextCases[] = 82 { 83 { "gles1", "Color clears using GLES1", EGL_OPENGL_ES_BIT, 1 }, 84 { "gles2", "Color clears using GLES2", EGL_OPENGL_ES2_BIT, 1 }, 85 { "gles3", "Color clears using GLES3", EGL_OPENGL_ES3_BIT_KHR, 1 }, 86 { "vg", "Color clears using OpenVG", EGL_OPENVG_BIT, 1 } 87 }; 88 89 static const ColorClearGroupSpec multiContextCases[] = 90 { 91 { "gles1", "Color clears using multiple GLES1 contexts to shared surface", EGL_OPENGL_ES_BIT, 3 }, 92 { "gles2", "Color clears using multiple GLES2 contexts to shared surface", EGL_OPENGL_ES2_BIT, 3 }, 93 { "gles3", "Color clears using multiple GLES3 contexts to shared surface", EGL_OPENGL_ES3_BIT_KHR, 3 }, 94 { "vg", "Color clears using multiple OpenVG contexts to shared surface", EGL_OPENVG_BIT, 3 }, 95 { "gles1_gles2", "Color clears using multiple APIs to shared surface", EGL_OPENGL_ES_BIT|EGL_OPENGL_ES2_BIT, 1 }, 96 { "gles1_gles2_gles3", "Color clears using multiple APIs to shared surface", EGL_OPENGL_ES_BIT|EGL_OPENGL_ES2_BIT|EGL_OPENGL_ES3_BIT_KHR, 1 }, 97 { "gles1_vg", "Color clears using multiple APIs to shared surface", EGL_OPENGL_ES_BIT|EGL_OPENVG_BIT, 1 }, 98 { "gles2_vg", "Color clears using multiple APIs to shared surface", EGL_OPENGL_ES2_BIT|EGL_OPENVG_BIT, 1 }, 99 { "gles3_vg", "Color clears using multiple APIs to shared surface", EGL_OPENGL_ES3_BIT_KHR|EGL_OPENVG_BIT, 1 }, 100 { "gles1_gles2_vg", "Color clears using multiple APIs to shared surface", EGL_OPENGL_ES_BIT|EGL_OPENGL_ES2_BIT|EGL_OPENVG_BIT, 1 } 101 }; 102 103 tcu::TestCaseGroup* singleContextGroup = new tcu::TestCaseGroup(m_testCtx, "single_context", "Single-context color clears"); 104 addChild(singleContextGroup); 105 createColorClearGroups<SingleThreadColorClearCase>(m_eglTestCtx, singleContextGroup, &singleContextCases[0], &singleContextCases[DE_LENGTH_OF_ARRAY(singleContextCases)]); 106 107 tcu::TestCaseGroup* multiContextGroup = new tcu::TestCaseGroup(m_testCtx, "multi_context", "Multi-context color clears with shared surface"); 108 addChild(multiContextGroup); 109 createColorClearGroups<SingleThreadColorClearCase>(m_eglTestCtx, multiContextGroup, &multiContextCases[0], &multiContextCases[DE_LENGTH_OF_ARRAY(multiContextCases)]); 110 111 tcu::TestCaseGroup* multiThreadGroup = new tcu::TestCaseGroup(m_testCtx, "multi_thread", "Multi-thread color clears with shared surface"); 112 addChild(multiThreadGroup); 113 createColorClearGroups<MultiThreadColorClearCase>(m_eglTestCtx, multiThreadGroup, &multiContextCases[0], &multiContextCases[DE_LENGTH_OF_ARRAY(multiContextCases)]); 114 } 115 116 } // egl 117 } // deqp 118