13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _TCUPLATFORM_HPP 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _TCUPLATFORM_HPP 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program Tester Core 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ---------------------------------------- 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Platform (OS) specific services. 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuDefs.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace glu 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Platform; 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace eglu 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Platform; 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3823c1f9fbfacc654ff2115e74466bb781a058bb9fPyry Haulosnamespace vk 3923c1f9fbfacc654ff2115e74466bb781a058bb9fPyry Haulos{ 4023c1f9fbfacc654ff2115e74466bb781a058bb9fPyry Haulosclass Platform; 4123c1f9fbfacc654ff2115e74466bb781a058bb9fPyry Haulos} 4223c1f9fbfacc654ff2115e74466bb781a058bb9fPyry Haulos 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace tcu 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass CommandLine; 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FunctionLibrary; 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Base class for platform implementation. 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * This class represents the minimum set of functionality for a platform 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * port. 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * In addition to implementing Platform class, main entry point must be 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * created that takes care of parsing command line, creating log and 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * executing tcu::App. See tcuMain.cpp for reference on implementing 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * application stub. 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * If the platform uses standard posix-style main() for application entry 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * point, tcuMain.cpp can be used as is. In that case you only have to 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * implement createPlatform(). 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * API-specific platform interfaces (glu::Platform and eglu::Platform) 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * can be provided by implementing get<API>Platform() functions. 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Platform 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Platform (void); 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual ~Platform (void); 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry /*--------------------------------------------------------------------*//*! 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Process platform-specific events. 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Test framework will call this function between test cases and test case 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * iterations. Any event handling that must be done periodically should be 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * done here. 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Test framework will decide whether to continue test execution based on 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * return code. For instance if the application receives close event from OS, 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * it should communicate that to framework by returning false. 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \note Do not do rendering buffer swaps here. 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Do it in RenderContext::postIterate() instead. 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \return true if test execution should continue, false otherwise. 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual bool processEvents (void); 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry /*--------------------------------------------------------------------*//*! 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Get GL platform interface 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * GL-specific platform interface is defined by glu::Platform. If your 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * platform port supports OpenGL (ES), you should implement this function. 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Default implementation throws tcu::NotSupportedError exception. 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \return Reference to GL platform interface. 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual const glu::Platform& getGLPlatform (void) const; 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry /*--------------------------------------------------------------------*//*! 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Get EGL platform interface 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * EGL-specific platform interface is defined by eglu::Platform. If your 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * platform port supports EGL, you should implement this function. 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Default implementation throws tcu::NotSupportedError exception. 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \return Reference to EGL platform interface. 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual const eglu::Platform& getEGLPlatform (void) const; 11323c1f9fbfacc654ff2115e74466bb781a058bb9fPyry Haulos 11423c1f9fbfacc654ff2115e74466bb781a058bb9fPyry Haulos virtual const vk::Platform& getVulkanPlatform (void) const; 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // tcu 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _TCUPLATFORM_HPP 120