1e5c31af7Sopenharmony_ci#ifndef _TEGLIMAGEUTIL_HPP
2e5c31af7Sopenharmony_ci#define _TEGLIMAGEUTIL_HPP
3e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
4e5c31af7Sopenharmony_ci * drawElements Quality Program EGL Module
5e5c31af7Sopenharmony_ci * ---------------------------------------
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Copyright 2014 The Android Open Source Project
8e5c31af7Sopenharmony_ci *
9e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
10e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
11e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
14e5c31af7Sopenharmony_ci *
15e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
16e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
17e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
19e5c31af7Sopenharmony_ci * limitations under the License.
20e5c31af7Sopenharmony_ci *
21e5c31af7Sopenharmony_ci *//*!
22e5c31af7Sopenharmony_ci * \file
23e5c31af7Sopenharmony_ci * \brief Common utilities for EGL images.
24e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ci#include "tcuDefs.hpp"
27e5c31af7Sopenharmony_ci#include "tcuTexture.hpp"
28e5c31af7Sopenharmony_ci
29e5c31af7Sopenharmony_ci#include "deUniquePtr.hpp"
30e5c31af7Sopenharmony_ci
31e5c31af7Sopenharmony_ci#include "teglTestCase.hpp"
32e5c31af7Sopenharmony_ci
33e5c31af7Sopenharmony_ci#include "egluUtil.hpp"
34e5c31af7Sopenharmony_ci#include "egluUnique.hpp"
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_ci#include "glwDefs.hpp"
37e5c31af7Sopenharmony_ci
38e5c31af7Sopenharmony_cinamespace eglw
39e5c31af7Sopenharmony_ci{
40e5c31af7Sopenharmony_ciclass Library;
41e5c31af7Sopenharmony_ci}
42e5c31af7Sopenharmony_ci
43e5c31af7Sopenharmony_cinamespace deqp
44e5c31af7Sopenharmony_ci{
45e5c31af7Sopenharmony_cinamespace egl
46e5c31af7Sopenharmony_ci{
47e5c31af7Sopenharmony_cinamespace Image
48e5c31af7Sopenharmony_ci{
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_ciclass ManagedSurface
51e5c31af7Sopenharmony_ci{
52e5c31af7Sopenharmony_cipublic:
53e5c31af7Sopenharmony_ci										ManagedSurface	(de::MovePtr<eglu::UniqueSurface> surface) : m_surface(surface) {}
54e5c31af7Sopenharmony_ci	virtual								~ManagedSurface	(void) {}
55e5c31af7Sopenharmony_ci	eglw::EGLSurface					get				(void) const { return **m_surface; }
56e5c31af7Sopenharmony_ci
57e5c31af7Sopenharmony_ciprivate:
58e5c31af7Sopenharmony_ci	de::UniquePtr<eglu::UniqueSurface>	m_surface;
59e5c31af7Sopenharmony_ci};
60e5c31af7Sopenharmony_ci
61e5c31af7Sopenharmony_cide::MovePtr<ManagedSurface> createSurface (EglTestContext& eglTestCtx, eglw::EGLDisplay display, eglw::EGLConfig config, int width, int height);
62e5c31af7Sopenharmony_ci
63e5c31af7Sopenharmony_ciclass ClientBuffer
64e5c31af7Sopenharmony_ci{
65e5c31af7Sopenharmony_cipublic:
66e5c31af7Sopenharmony_ci	virtual							~ClientBuffer	(void) {}
67e5c31af7Sopenharmony_ci	virtual eglw::EGLClientBuffer	get				(void) const = 0;
68e5c31af7Sopenharmony_ci};
69e5c31af7Sopenharmony_ci
70e5c31af7Sopenharmony_ciclass ImageSource
71e5c31af7Sopenharmony_ci{
72e5c31af7Sopenharmony_cipublic:
73e5c31af7Sopenharmony_ci	virtual								~ImageSource		(void) {}
74e5c31af7Sopenharmony_ci	virtual std::string					getRequiredExtension(void) const = 0;
75e5c31af7Sopenharmony_ci	virtual de::MovePtr<ClientBuffer>	createBuffer		(const eglw::Library& egl, const glw::Functions& gl, tcu::Texture2D* reference = DE_NULL) const = 0;
76e5c31af7Sopenharmony_ci	virtual eglw::EGLImageKHR			createImage			(const eglw::Library& egl, eglw::EGLDisplay dpy, eglw::EGLContext ctx, eglw::EGLClientBuffer clientBuffer) const = 0;
77e5c31af7Sopenharmony_ci	virtual glw::GLenum					getEffectiveFormat	(void) const = 0;
78e5c31af7Sopenharmony_ci	virtual bool						isYUVFormatImage	(void) const {return false;};
79e5c31af7Sopenharmony_ci};
80e5c31af7Sopenharmony_ci
81e5c31af7Sopenharmony_cide::MovePtr<ImageSource> createTextureImageSource			(eglw::EGLenum source, glw::GLenum internalFormat, glw::GLenum format, glw::GLenum type, bool useTexLevel0 = false);
82e5c31af7Sopenharmony_cide::MovePtr<ImageSource> createRenderbufferImageSource		(glw::GLenum format);
83e5c31af7Sopenharmony_cide::MovePtr<ImageSource> createUnsupportedImageSource		(const std::string& message, glw::GLenum format, bool isYUV);
84e5c31af7Sopenharmony_ci
85e5c31af7Sopenharmony_ci} // Image
86e5c31af7Sopenharmony_ci} // egl
87e5c31af7Sopenharmony_ci} // deqp
88e5c31af7Sopenharmony_ci
89e5c31af7Sopenharmony_ci
90e5c31af7Sopenharmony_ci#endif // _TEGLIMAGEUTIL_HPP
91