1 #ifndef _EGLUUNIQUE_HPP
2 #define _EGLUUNIQUE_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 unique resources
24 *//*--------------------------------------------------------------------*/
26 #include "egluDefs.hpp"
27 #include "eglwDefs.hpp"
28 #include "eglwEnums.hpp"
41 UniqueDisplay (const eglw::Library& egl, eglw::EGLDisplay display);
42 ~UniqueDisplay (void);
44 eglw::EGLDisplay operator* (void) const { return m_display; }
45 operator bool (void) const { return m_display != EGL_NO_DISPLAY; }
48 const eglw::Library& m_egl;
49 eglw::EGLDisplay m_display;
52 UniqueDisplay& operator= (const UniqueDisplay&);
53 UniqueDisplay (const UniqueDisplay&);
59 UniqueSurface (const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLSurface surface);
60 ~UniqueSurface (void);
62 eglw::EGLSurface operator* (void) const { return m_surface; }
63 operator bool (void) const { return m_surface != EGL_NO_SURFACE; }
66 const eglw::Library& m_egl;
67 eglw::EGLDisplay m_display;
68 eglw::EGLSurface m_surface;
71 UniqueSurface& operator= (const UniqueSurface&);
72 UniqueSurface (const UniqueSurface&);
78 UniqueContext (const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLContext context);
79 ~UniqueContext (void);
81 eglw::EGLContext operator* (void) const { return m_context; }
82 operator bool (void) const { return m_context != EGL_NO_CONTEXT; }
85 const eglw::Library& m_egl;
86 eglw::EGLDisplay m_display;
87 eglw::EGLContext m_context;
90 UniqueContext operator= (const UniqueContext&);
91 UniqueContext (const UniqueContext&);
94 class ScopedCurrentContext
97 ScopedCurrentContext (const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLSurface draw, eglw::EGLSurface read, eglw::EGLContext context);
98 ~ScopedCurrentContext (void);
101 const eglw::Library& m_egl;
102 eglw::EGLDisplay m_display;
108 UniqueImage (const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLImage image);
111 eglw::EGLImage operator* (void) const { return m_image; }
112 operator bool (void) const { return m_image != EGL_NO_IMAGE_KHR; }
115 const eglw::Library& m_egl;
116 eglw::EGLDisplay m_display;
117 eglw::EGLImage m_image;
120 UniqueImage operator= (const UniqueImage&);
121 UniqueImage (const UniqueImage&);
126 #endif // _EGLUUNIQUE_HPP