1/*------------------------------------------------------------------------- 2 * drawElements Quality Program Tester Core 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 Null GL platform. 22 *//*--------------------------------------------------------------------*/ 23 24#include "tcuNullPlatform.hpp" 25#include "tcuNullRenderContext.hpp" 26#include "egluNativeDisplay.hpp" 27#include "eglwLibrary.hpp" 28 29namespace tcu 30{ 31namespace null 32{ 33 34class NullGLContextFactory : public glu::ContextFactory 35{ 36public: 37 NullGLContextFactory (void) 38 : glu::ContextFactory("null", "Null Render Context") 39 { 40 } 41 42 glu::RenderContext* createContext (const glu::RenderConfig& config, const tcu::CommandLine&) const 43 { 44 return new RenderContext(config); 45 } 46}; 47 48class NullEGLDisplay : public eglu::NativeDisplay 49{ 50public: 51 NullEGLDisplay (void) 52 : eglu::NativeDisplay(CAPABILITY_GET_DISPLAY_LEGACY) 53 { 54 // \note All functions in library are null 55 } 56 57 const eglw::Library& getLibrary (void) const 58 { 59 return m_library; 60 } 61 62private: 63 eglw::FuncPtrLibrary m_library; 64}; 65 66class NullEGLDisplayFactory : public eglu::NativeDisplayFactory 67{ 68public: 69 NullEGLDisplayFactory (void) 70 : eglu::NativeDisplayFactory("null", "Null EGL Display", eglu::NativeDisplay::CAPABILITY_GET_DISPLAY_LEGACY) 71 { 72 } 73 74 eglu::NativeDisplay* createDisplay (const eglw::EGLAttrib*) const 75 { 76 return new NullEGLDisplay(); 77 } 78}; 79 80Platform::Platform (void) 81{ 82 m_contextFactoryRegistry.registerFactory(new NullGLContextFactory()); 83 m_nativeDisplayFactoryRegistry.registerFactory(new NullEGLDisplayFactory()); 84} 85 86Platform::~Platform (void) 87{ 88} 89 90} // null 91} // tcu 92 93tcu::Platform* createPlatform (void) 94{ 95 return new tcu::null::Platform(); 96} 97