teglImageUtil.hpp revision b035773dba9d9886d5cc0eef92feeba24b279c24
1#ifndef _TEGLIMAGEUTIL_HPP 2#define _TEGLIMAGEUTIL_HPP 3/*------------------------------------------------------------------------- 4 * drawElements Quality Program EGL Module 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 Common utilities for EGL images. 24 *//*--------------------------------------------------------------------*/ 25 26#include "tcuDefs.hpp" 27#include "tcuTexture.hpp" 28 29#include "deUniquePtr.hpp" 30 31#include "teglTestCase.hpp" 32 33#include "egluUtil.hpp" 34#include "egluUnique.hpp" 35#include "egluHeaderWrapper.hpp" 36 37#include "glwDefs.hpp" 38 39namespace deqp 40{ 41namespace egl 42{ 43namespace Image 44{ 45 46class ManagedSurface 47{ 48public: 49 ManagedSurface (de::MovePtr<eglu::UniqueSurface> surface) : m_surface(surface) {} 50 virtual ~ManagedSurface (void) {} 51 EGLSurface get (void) const { return **m_surface; } 52 53private: 54 de::UniquePtr<eglu::UniqueSurface> m_surface; 55}; 56 57de::MovePtr<ManagedSurface> createSurface (EglTestContext& eglTestCtx, EGLConfig config, int width, int height); 58 59class ClientBuffer 60{ 61public: 62 virtual ~ClientBuffer (void) {} 63 virtual EGLClientBuffer get (void) const = 0; 64}; 65 66class ImageSource 67{ 68public: 69 virtual ~ImageSource (void) {} 70 virtual std::string getRequiredExtension(void) const = 0; 71 virtual de::MovePtr<ClientBuffer> createBuffer (const glw::Functions& gl, tcu::Texture2D* reference = DE_NULL) const = 0; 72 virtual EGLImageKHR createImage (const eglu::ImageFunctions& imgExt, EGLDisplay dpy, EGLContext ctx, EGLClientBuffer clientBuffer) const = 0; 73}; 74 75de::MovePtr<ImageSource> createTextureImageSource (EGLenum source, glw::GLenum format, glw::GLenum type, bool useTexLevel0 = false); 76de::MovePtr<ImageSource> createRenderbufferImageSource (glw::GLenum format); 77de::MovePtr<ImageSource> createUnsupportedImageSource (const std::string& message); 78 79} // Image 80} // egl 81} // deqp 82 83 84#endif // _TEGLIMAGEUTIL_HPP 85