1 #ifndef _EGLUNATIVEPIXMAP_HPP
2 #define _EGLUNATIVEPIXMAP_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Tester Core
5 * ----------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief EGL native pixmap abstraction
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "tcuFactoryRegistry.hpp"
28 #include "eglwDefs.hpp"
29 #include "tcuVector.hpp"
46 CAPABILITY_CREATE_SURFACE_LEGACY = (1<<0), //!< EGL surface can be created with eglCreatePixmapSurface()
47 CAPABILITY_CREATE_SURFACE_PLATFORM = (1<<1), //!< EGL surface can be created with eglCreatePlatformPixmapSurface()
48 CAPABILITY_READ_PIXELS = (1<<2)
51 virtual ~NativePixmap (void) {}
53 //! Return EGLNativePixmapType that can be used with eglCreatePixmapSurface(). Default implementation throws tcu::NotSupportedError().
54 virtual eglw::EGLNativePixmapType getLegacyNative (void);
56 //! Return native pointer that can be used with eglCreatePlatformPixmapSurfaceEXT(). Default implementation throws tcu::NotSupportedError().
57 virtual void* getPlatformNative (void);
59 // Read pixels from pixmap. Default implementation throws tcu::NotSupportedError()
60 virtual void readPixels (tcu::TextureLevel* dst);
62 // These values are initialized in constructor.
63 Capability getCapabilities (void) const { return m_capabilities; }
66 NativePixmap (Capability capabilities);
69 NativePixmap (const NativePixmap&);
70 NativePixmap& operator= (const NativePixmap&);
72 const Capability m_capabilities;
75 class NativePixmapFactory : public tcu::FactoryBase
78 virtual ~NativePixmapFactory (void);
80 //! Create generic pixmap.
81 virtual NativePixmap* createPixmap (NativeDisplay* nativeDisplay, int width, int height) const = 0;
83 //! Create pixmap that matches given EGL config. Defaults to generic createPixmap().
84 virtual NativePixmap* createPixmap (NativeDisplay* nativeDisplay, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList, int width, int height) const;
86 NativePixmap::Capability getCapabilities (void) const { return m_capabilities; }
89 NativePixmapFactory (const std::string& name, const std::string& description, NativePixmap::Capability capabilities);
92 NativePixmapFactory (const NativePixmapFactory&);
93 NativePixmapFactory& operator= (const NativePixmapFactory&);
95 const NativePixmap::Capability m_capabilities;
98 typedef tcu::FactoryRegistry<NativePixmapFactory> NativePixmapFactoryRegistry;
102 #endif // _EGLUNATIVEPIXMAP_HPP