13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _EGLUNATIVEPIXMAP_HPP 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _EGLUNATIVEPIXMAP_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 EGL native pixmap abstraction 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuDefs.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuFactoryRegistry.hpp" 283c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "eglwDefs.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuVector.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace tcu 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TextureLevel; 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace eglu 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass NativeDisplay; 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass NativePixmap 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry enum Capability 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry CAPABILITY_CREATE_SURFACE_LEGACY = (1<<0), //!< EGL surface can be created with eglCreatePixmapSurface() 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry CAPABILITY_CREATE_SURFACE_PLATFORM = (1<<1), //!< EGL surface can be created with eglCreatePlatformPixmapSurface() 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry CAPABILITY_READ_PIXELS = (1<<2) 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 513c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos virtual ~NativePixmap (void) {} 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry //! Return EGLNativePixmapType that can be used with eglCreatePixmapSurface(). Default implementation throws tcu::NotSupportedError(). 543c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos virtual eglw::EGLNativePixmapType getLegacyNative (void); 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry //! Return native pointer that can be used with eglCreatePlatformPixmapSurfaceEXT(). Default implementation throws tcu::NotSupportedError(). 573c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos virtual void* getPlatformNative (void); 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Read pixels from pixmap. Default implementation throws tcu::NotSupportedError() 603c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos virtual void readPixels (tcu::TextureLevel* dst); 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // These values are initialized in constructor. 633c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos Capability getCapabilities (void) const { return m_capabilities; } 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected: 663c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos NativePixmap (Capability capabilities); 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 693c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos NativePixmap (const NativePixmap&); 703c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos NativePixmap& operator= (const NativePixmap&); 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 723c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const Capability m_capabilities; 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass NativePixmapFactory : public tcu::FactoryBase 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 783c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos virtual ~NativePixmapFactory (void); 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry //! Create generic pixmap. 813c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos virtual NativePixmap* createPixmap (NativeDisplay* nativeDisplay, int width, int height) const = 0; 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry //! Create pixmap that matches given EGL config. Defaults to generic createPixmap(). 843c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos virtual NativePixmap* createPixmap (NativeDisplay* nativeDisplay, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList, int width, int height) const; 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 863c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos NativePixmap::Capability getCapabilities (void) const { return m_capabilities; } 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected: 893c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos NativePixmapFactory (const std::string& name, const std::string& description, NativePixmap::Capability capabilities); 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate: 923c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos NativePixmapFactory (const NativePixmapFactory&); 933c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos NativePixmapFactory& operator= (const NativePixmapFactory&); 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 953c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos const NativePixmap::Capability m_capabilities; 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytypedef tcu::FactoryRegistry<NativePixmapFactory> NativePixmapFactoryRegistry; 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // eglu 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _EGLUNATIVEPIXMAP_HPP 103