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 29 namespace eglw 30 { 31 class Library; 32 } 33 34 namespace eglu 35 { 36 37 class UniqueDisplay 38 { 39 public: 40 UniqueDisplay(const eglw::Library &egl, eglw::EGLDisplay display); 41 ~UniqueDisplay(void); 42 operator *(void) const43 eglw::EGLDisplay operator*(void) const 44 { 45 return m_display; 46 } 47 operator bool(void) const; 48 49 private: 50 const eglw::Library &m_egl; 51 eglw::EGLDisplay m_display; 52 53 // Disabled 54 UniqueDisplay &operator=(const UniqueDisplay &); 55 UniqueDisplay(const UniqueDisplay &); 56 }; 57 58 class UniqueSurface 59 { 60 public: 61 UniqueSurface(const eglw::Library &egl, eglw::EGLDisplay display, eglw::EGLSurface surface); 62 ~UniqueSurface(void); 63 operator *(void) const64 eglw::EGLSurface operator*(void) const 65 { 66 return m_surface; 67 } 68 operator bool(void) const; 69 70 private: 71 const eglw::Library &m_egl; 72 eglw::EGLDisplay m_display; 73 eglw::EGLSurface m_surface; 74 75 // Disabled 76 UniqueSurface &operator=(const UniqueSurface &); 77 UniqueSurface(const UniqueSurface &); 78 }; 79 80 class UniqueContext 81 { 82 public: 83 UniqueContext(const eglw::Library &egl, eglw::EGLDisplay display, eglw::EGLContext context); 84 ~UniqueContext(void); 85 operator *(void) const86 eglw::EGLContext operator*(void) const 87 { 88 return m_context; 89 } 90 operator bool(void) const; 91 92 private: 93 const eglw::Library &m_egl; 94 eglw::EGLDisplay m_display; 95 eglw::EGLContext m_context; 96 97 // Disabled 98 UniqueContext operator=(const UniqueContext &); 99 UniqueContext(const UniqueContext &); 100 }; 101 102 class ScopedCurrentContext 103 { 104 public: 105 ScopedCurrentContext(const eglw::Library &egl, eglw::EGLDisplay display, eglw::EGLSurface draw, 106 eglw::EGLSurface read, eglw::EGLContext context); 107 ~ScopedCurrentContext(void); 108 109 private: 110 const eglw::Library &m_egl; 111 eglw::EGLDisplay m_display; 112 }; 113 114 class UniqueImage 115 { 116 public: 117 UniqueImage(const eglw::Library &egl, eglw::EGLDisplay display, eglw::EGLImage image); 118 ~UniqueImage(void); 119 operator *(void) const120 eglw::EGLImage operator*(void) const 121 { 122 return m_image; 123 } 124 operator bool(void) const; 125 126 private: 127 const eglw::Library &m_egl; 128 eglw::EGLDisplay m_display; 129 eglw::EGLImage m_image; 130 131 // Disabled 132 UniqueImage operator=(const UniqueImage &); 133 UniqueImage(const UniqueImage &); 134 }; 135 136 } // namespace eglu 137 138 #endif // _EGLUUNIQUE_HPP 139