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; }
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const FormatDB&			getMinFormats			(void) const { return m_minFormats; }
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const FormatDB&			getCtxFormats			(void) const { return m_ctxFormats; }
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool					haveMultiColorAtts		(void) const { return m_haveMultiColorAtts; }
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					setHaveMulticolorAtts	(bool have) { m_haveMultiColorAtts = have; }
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					addFormats				(FormatEntries fmtRange);
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					addExtFormats			(FormatExtEntries extRange);
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestCaseGroup*			createRenderableTests	(void);
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestCaseGroup*			createAttachmentTests	(void);
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestCaseGroup*			createSizeTests			(void);
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestContext&			m_testCtx;
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	RenderContext&			m_renderCtx;
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FormatDB				m_minFormats;
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FormatDB				m_ctxFormats;
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FormatDB				m_maxFormats;
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FboVerifier				m_verifier;
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool					m_haveMultiColorAtts;
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TestBase : public TestCase
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Context&				getContext			(void) const { return m_ctx; }
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							TestBase			(Context& ctx,
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 const string& name, const string& desc)
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								: TestCase		(ctx.getTestContext(),
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 name.c_str(), desc.c_str())
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								, m_ctx			(ctx) {}
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					fail				(const char* msg);
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					qualityWarning		(const char* msg);
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					pass				(void);
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					checkFbo			(FboBuilder& builder);
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ImageFormat				getDefaultFormat	(GLenum attPoint, GLenum bufType) const;
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult			iterate				(void);
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual IterateResult	build				(FboBuilder& builder);
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					attachTargetToNew	(GLenum target, GLenum bufType,
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 ImageFormat format,
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 GLsizei width, GLsizei height,
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 FboBuilder& builder);
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Context&				m_ctx;
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Utilities for building
1153c827367444ee418f129b2c238299f49d3264554Jarkko PoyryImage* 				makeImage			(GLenum bufType, ImageFormat format,
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										 GLsizei width, GLsizei height, FboBuilder& builder);
1173c827367444ee418f129b2c238299f49d3264554Jarkko PoyryAttachment*			makeAttachment		(GLenum bufType, ImageFormat format,
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										 GLsizei width, GLsizei height, FboBuilder& builder);
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate <typename P>
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ParamTest : public TestBase
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef P	Params;
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				ParamTest		(Context& ctx, const Params& params)
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					: TestBase	(ctx, Params::getName(params), Params::getDescription(params))
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					, m_params	(params) {}
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Params		m_params;
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Shorthand utility
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst glw::Functions& gl (const TestBase& test);
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // details
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing details::Context;
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing details::TestBase;
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing details::ParamTest;
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing details::gl;
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // fboc
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gls
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _GLSFBOCOMPLETENESSTESTS_HPP
148