Home | History | Annotate | Download | only in null
      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 
     29 namespace tcu
     30 {
     31 namespace null
     32 {
     33 
     34 class NullGLContextFactory : public glu::ContextFactory
     35 {
     36 public:
     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 
     48 class NullEGLDisplay : public eglu::NativeDisplay
     49 {
     50 public:
     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 
     62 private:
     63 	eglw::FuncPtrLibrary	m_library;
     64 };
     65 
     66 class NullEGLDisplayFactory : public eglu::NativeDisplayFactory
     67 {
     68 public:
     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 
     80 Platform::Platform (void)
     81 {
     82 	m_contextFactoryRegistry.registerFactory(new NullGLContextFactory());
     83 	m_nativeDisplayFactoryRegistry.registerFactory(new NullEGLDisplayFactory());
     84 }
     85 
     86 Platform::~Platform (void)
     87 {
     88 }
     89 
     90 } // null
     91 } // tcu
     92 
     93 tcu::Platform* createPlatform (void)
     94 {
     95 	return new tcu::null::Platform();
     96 }
     97