teglImageUtil.hpp revision 3c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4
16a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson#ifndef _TEGLIMAGEUTIL_HPP
26a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson#define _TEGLIMAGEUTIL_HPP
36a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson/*-------------------------------------------------------------------------
46a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * drawElements Quality Program EGL Module
56a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * ---------------------------------------
66a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson *
76a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * Copyright 2014 The Android Open Source Project
86a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson *
96a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * Licensed under the Apache License, Version 2.0 (the "License");
106a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * you may not use this file except in compliance with the License.
116a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * You may obtain a copy of the License at
126a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson *
136a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson *      http://www.apache.org/licenses/LICENSE-2.0
146a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson *
156a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * Unless required by applicable law or agreed to in writing, software
166a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * distributed under the License is distributed on an "AS IS" BASIS,
176a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
186a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * See the License for the specific language governing permissions and
196a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * limitations under the License.
20967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin *
21dd251ef4952b6c7abbfe8cea49285d8cfe62f96eJeremy Joslin *//*!
2256f9f73a5aad38aa777ec9a42c859e687f2d2af1Jeff Davidson * \file
236a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson * \brief Common utilities for EGL images.
24b096bdceaf2a4becffd2d930a870ccb57bfbe99cJeff Davidson *//*--------------------------------------------------------------------*/
25967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin
26dd251ef4952b6c7abbfe8cea49285d8cfe62f96eJeremy Joslin#include "tcuDefs.hpp"
276a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson#include "tcuTexture.hpp"
2814f1ec05b2add5ee051c0d2e7c7c3b36a6e77b92Jeff Davidson
296a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson#include "deUniquePtr.hpp"
30b096bdceaf2a4becffd2d930a870ccb57bfbe99cJeff Davidson
316a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson#include "teglTestCase.hpp"
32c741553644f8b19c63938ab9e36af1721c2cfa34Jeff Davidson
336a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson#include "egluUtil.hpp"
3426fd143326a11c9dd7942e31acca6df56288d194Jeff Davidson#include "egluUnique.hpp"
35dd251ef4952b6c7abbfe8cea49285d8cfe62f96eJeremy Joslin
3614f1ec05b2add5ee051c0d2e7c7c3b36a6e77b92Jeff Davidson#include "glwDefs.hpp"
37ac7285dc1e13f30d59dad30fe2ad1116e5f676cbJeff Davidson
3856f9f73a5aad38aa777ec9a42c859e687f2d2af1Jeff Davidsonnamespace eglw
396a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson{
4014f1ec05b2add5ee051c0d2e7c7c3b36a6e77b92Jeff Davidsonclass Library;
416a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson}
426a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson
437842f64b75282f1233b30ebdb0d876c485def9a7Jeff Davidsonnamespace deqp
441ec8cd95426a22ded1ab9a13c7608ce9c699010aJeremy Joslin{
456a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidsonnamespace egl
466a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson{
476a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidsonnamespace Image
4814f1ec05b2add5ee051c0d2e7c7c3b36a6e77b92Jeff Davidson{
496a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson
5014f1ec05b2add5ee051c0d2e7c7c3b36a6e77b92Jeff Davidsonclass ManagedSurface
5114f1ec05b2add5ee051c0d2e7c7c3b36a6e77b92Jeff Davidson{
526a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidsonpublic:
5314f1ec05b2add5ee051c0d2e7c7c3b36a6e77b92Jeff Davidson										ManagedSurface	(de::MovePtr<eglu::UniqueSurface> surface) : m_surface(surface) {}
546a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson	virtual								~ManagedSurface	(void) {}
556a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson	eglw::EGLSurface					get				(void) const { return **m_surface; }
566a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson
576a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidsonprivate:
586a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson	de::UniquePtr<eglu::UniqueSurface>	m_surface;
596a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson};
606a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson
61dd251ef4952b6c7abbfe8cea49285d8cfe62f96eJeremy Joslinde::MovePtr<ManagedSurface> createSurface (EglTestContext& eglTestCtx, eglw::EGLDisplay display, eglw::EGLConfig config, int width, int height);
626a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidson
636a4b220f1263d95fdefe6361c2bc87bbb04bbed0Jeff Davidsonclass ClientBuffer
6414f1ec05b2add5ee051c0d2e7c7c3b36a6e77b92Jeff Davidson{
651ec8cd95426a22ded1ab9a13c7608ce9c699010aJeremy Joslinpublic:
661ec8cd95426a22ded1ab9a13c7608ce9c699010aJeremy Joslin	virtual							~ClientBuffer	(void) {}
677842f64b75282f1233b30ebdb0d876c485def9a7Jeff Davidson	virtual eglw::EGLClientBuffer	get				(void) const = 0;
681ec8cd95426a22ded1ab9a13c7608ce9c699010aJeremy Joslin};
691ec8cd95426a22ded1ab9a13c7608ce9c699010aJeremy Joslin
70dd251ef4952b6c7abbfe8cea49285d8cfe62f96eJeremy Joslinclass ImageSource
717842f64b75282f1233b30ebdb0d876c485def9a7Jeff Davidson{
72967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslinpublic:
73967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin	virtual								~ImageSource		(void) {}
74967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin	virtual std::string					getRequiredExtension(void) const = 0;
75967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin	virtual de::MovePtr<ClientBuffer>	createBuffer		(const glw::Functions& gl, tcu::Texture2D* reference = DE_NULL) const = 0;
76967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin	virtual eglw::EGLImageKHR			createImage			(const eglw::Library& egl, eglw::EGLDisplay dpy, eglw::EGLContext ctx, eglw::EGLClientBuffer clientBuffer) const = 0;
77967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin};
78967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin
79967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslinde::MovePtr<ImageSource> createTextureImageSource			(eglw::EGLenum source, glw::GLenum format, glw::GLenum type, bool useTexLevel0 = false);
80967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslinde::MovePtr<ImageSource> createRenderbufferImageSource		(glw::GLenum format);
81967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslinde::MovePtr<ImageSource> createUnsupportedImageSource		(const std::string& message);
82967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin
83967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin} // Image
84967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin} // egl
85967b5815fb55e25419dcfdcf2144cce513123a61Jeremy Joslin} // deqp
861ec8cd95426a22ded1ab9a13c7608ce9c699010aJeremy Joslin
871ec8cd95426a22ded1ab9a13c7608ce9c699010aJeremy Joslin
881ec8cd95426a22ded1ab9a13c7608ce9c699010aJeremy Joslin#endif // _TEGLIMAGEUTIL_HPP
891ec8cd95426a22ded1ab9a13c7608ce9c699010aJeremy Joslin