13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GLSFBOCOMPLETENESSTESTS_HPP
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GLSFBOCOMPLETENESSTESTS_HPP
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL (ES) Module
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * -----------------------------------------------
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Common parts for ES2/3 framebuffer completeness tests.
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestCase.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsFboUtil.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwDefs.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp"
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestCase.hpp"
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gls
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace fboc
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace details
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing glu::RenderContext;
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestCase;
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestContext;
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytypedef TestCase::IterateResult IterateResult;
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestCaseGroup;
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog;
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string;
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace glw;
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace deqp::gls::FboUtil;
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace deqp::gls::FboUtil::config;
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Context
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							Context					(TestContext& testCtx,
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													 RenderContext& renderCtx,
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													 CheckerFactory& factory);
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	RenderContext&			getRenderContext		(void) const { return m_renderCtx; }
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestContext&			getTestContext			(void) const { return m_testCtx; }
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const FboVerifier&		getVerifier				(void) const { return m_verifier; }
66b5c60b02e542a61a2b658272034c830f92b4c766Jarkko Pöyry	const FormatDB&			getCoreFormats			(void) const { return m_coreFormats; }
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const FormatDB&			getCtxFormats			(void) const { return m_ctxFormats; }
68b5c60b02e542a61a2b658272034c830f92b4c766Jarkko Pöyry	const FormatDB&			getAllFormats			(void) const { return m_allFormats; }
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool					haveMultiColorAtts		(void) const { return m_haveMultiColorAtts; }
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					setHaveMulticolorAtts	(bool have) { m_haveMultiColorAtts = have; }
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					addFormats				(FormatEntries fmtRange);
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					addExtFormats			(FormatExtEntries extRange);
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestCaseGroup*			createRenderableTests	(void);
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestCaseGroup*			createAttachmentTests	(void);
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestCaseGroup*			createSizeTests			(void);
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestContext&			m_testCtx;
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	RenderContext&			m_renderCtx;
79b5c60b02e542a61a2b658272034c830f92b4c766Jarkko Pöyry	FormatDB				m_coreFormats;
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FormatDB				m_ctxFormats;
81b5c60b02e542a61a2b658272034c830f92b4c766Jarkko Pöyry	FormatDB				m_allFormats;
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FboVerifier				m_verifier;
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool					m_haveMultiColorAtts;
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TestBase : public TestCase
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Context&				getContext			(void) const { return m_ctx; }
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							TestBase			(Context& ctx,
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 const string& name, const string& desc)
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								: TestCase		(ctx.getTestContext(),
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 name.c_str(), desc.c_str())
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								, m_ctx			(ctx) {}
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					fail				(const char* msg);
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					qualityWarning		(const char* msg);
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					pass				(void);
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					checkFbo			(FboBuilder& builder);
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ImageFormat				getDefaultFormat	(GLenum attPoint, GLenum bufType) const;
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult			iterate				(void);
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual IterateResult	build				(FboBuilder& builder);
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					attachTargetToNew	(GLenum target, GLenum bufType,
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 ImageFormat format,
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 GLsizei width, GLsizei height,
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 FboBuilder& builder);
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Context&				m_ctx;
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Utilities for building
116a15e7d7f566d93c76ca90171eb728e3d1cd82378Pyry HaulosImage*				makeImage			(GLenum bufType, ImageFormat format,
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										 GLsizei width, GLsizei height, FboBuilder& builder);
1183c827367444ee418f129b2c238299f49d3264554Jarkko PoyryAttachment*			makeAttachment		(GLenum bufType, ImageFormat format,
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										 GLsizei width, GLsizei height, FboBuilder& builder);
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate <typename P>
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ParamTest : public TestBase
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef P	Params;
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				ParamTest		(Context& ctx, const Params& params)
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					: TestBase	(ctx, Params::getName(params), Params::getDescription(params))
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					, m_params	(params) {}
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Params		m_params;
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Shorthand utility
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst glw::Functions& gl (const TestBase& test);
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // details
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing details::Context;
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing details::TestBase;
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing details::ParamTest;
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing details::gl;
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // fboc
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gls
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _GLSFBOCOMPLETENESSTESTS_HPP
149