1#ifndef _EGLUUNIQUE_HPP 2#define _EGLUUNIQUE_HPP 3/*------------------------------------------------------------------------- 4 * drawElements Quality Program Tester Core 5 * ---------------------------------------- 6 * 7 * Copyright 2014 The Android Open Source Project 8 * 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 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 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. 20 * 21 *//*! 22 * \file 23 * \brief EGL unique resources 24 *//*--------------------------------------------------------------------*/ 25 26#include "egluDefs.hpp" 27#include "eglwDefs.hpp" 28 29namespace eglw 30{ 31class Library; 32} 33 34namespace eglu 35{ 36 37class UniqueDisplay 38{ 39public: 40 UniqueDisplay (const eglw::Library& egl, eglw::EGLDisplay display); 41 ~UniqueDisplay (void); 42 43 eglw::EGLDisplay operator* (void) const { return m_display; } 44 operator bool (void) const; 45 46private: 47 const eglw::Library& m_egl; 48 eglw::EGLDisplay m_display; 49 50 // Disabled 51 UniqueDisplay& operator= (const UniqueDisplay&); 52 UniqueDisplay (const UniqueDisplay&); 53}; 54 55class UniqueSurface 56{ 57public: 58 UniqueSurface (const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLSurface surface); 59 ~UniqueSurface (void); 60 61 eglw::EGLSurface operator* (void) const { return m_surface; } 62 operator bool (void) const; 63 64private: 65 const eglw::Library& m_egl; 66 eglw::EGLDisplay m_display; 67 eglw::EGLSurface m_surface; 68 69 // Disabled 70 UniqueSurface& operator= (const UniqueSurface&); 71 UniqueSurface (const UniqueSurface&); 72}; 73 74class UniqueContext 75{ 76public: 77 UniqueContext (const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLContext context); 78 ~UniqueContext (void); 79 80 eglw::EGLContext operator* (void) const { return m_context; } 81 operator bool (void) const; 82 83private: 84 const eglw::Library& m_egl; 85 eglw::EGLDisplay m_display; 86 eglw::EGLContext m_context; 87 88 // Disabled 89 UniqueContext operator= (const UniqueContext&); 90 UniqueContext (const UniqueContext&); 91}; 92 93class ScopedCurrentContext 94{ 95public: 96 ScopedCurrentContext (const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLSurface draw, eglw::EGLSurface read, eglw::EGLContext context); 97 ~ScopedCurrentContext (void); 98 99private: 100 const eglw::Library& m_egl; 101 eglw::EGLDisplay m_display; 102}; 103 104class UniqueImage 105{ 106public: 107 UniqueImage (const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLImage image); 108 ~UniqueImage (void); 109 110 eglw::EGLImage operator* (void) const { return m_image; } 111 operator bool (void) const; 112 113private: 114 const eglw::Library& m_egl; 115 eglw::EGLDisplay m_display; 116 eglw::EGLImage m_image; 117 118 // Disabled 119 UniqueImage operator= (const UniqueImage&); 120 UniqueImage (const UniqueImage&); 121}; 122 123} // eglu 124 125#endif // _EGLUUNIQUE_HPP 126