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_CREATE_SURFACE_PLATFORM_EXTENSION = (1<<2), //!< EGL surface can be created with eglCreatePlatformPixmapSurfaceEXT()
49 CAPABILITY_READ_PIXELS = (1<<3)
52 virtual ~NativePixmap (void) {}
54 //! Return EGLNativePixmapType that can be used with eglCreatePixmapSurface(). Default implementation throws tcu::NotSupportedError().
55 virtual eglw::EGLNativePixmapType getLegacyNative (void);
57 //! Return native pointer that can be used with eglCreatePlatformPixmapSurface(). Default implementation throws tcu::NotSupportedError().
58 virtual void* getPlatformNative (void);
60 //! Return native pointer that can be used with eglCreatePlatformPixmapSurfaceEXT(). Default implementation throws tcu::NotSupportedError().
61 virtual void* getPlatformExtension (void);
63 // Read pixels from pixmap. Default implementation throws tcu::NotSupportedError()
64 virtual void readPixels (tcu::TextureLevel* dst);
66 // These values are initialized in constructor.
67 Capability getCapabilities (void) const { return m_capabilities; }
70 NativePixmap (Capability capabilities);
73 NativePixmap (const NativePixmap&);
74 NativePixmap& operator= (const NativePixmap&);
76 const Capability m_capabilities;
79 class NativePixmapFactory : public tcu::FactoryBase
82 virtual ~NativePixmapFactory (void);
84 //! Create generic pixmap.
85 virtual NativePixmap* createPixmap (NativeDisplay* nativeDisplay, int width, int height) const = 0;
87 //! Create pixmap that matches given EGL config. Defaults to generic createPixmap().
88 virtual NativePixmap* createPixmap (NativeDisplay* nativeDisplay, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList, int width, int height) const;
90 NativePixmap::Capability getCapabilities (void) const { return m_capabilities; }
93 NativePixmapFactory (const std::string& name, const std::string& description, NativePixmap::Capability capabilities);
96 NativePixmapFactory (const NativePixmapFactory&);
97 NativePixmapFactory& operator= (const NativePixmapFactory&);
99 const NativePixmap::Capability m_capabilities;
102 typedef tcu::FactoryRegistry<NativePixmapFactory> NativePixmapFactoryRegistry;
106 #endif // _EGLUNATIVEPIXMAP_HPP