13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _EGLUCONFIGFILTER_HPP
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _EGLUCONFIGFILTER_HPP
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program Tester Core
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ----------------------------------------
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief EGL Config selection helper.
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuDefs.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRGBA.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
293c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "eglwDefs.hpp"
303c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector>
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
333c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosnamespace eglw
343c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos{
353c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosclass Library;
363c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos}
373c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace eglu
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ConfigInfo;
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
433c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosclass CandidateConfig
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
463c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos					CandidateConfig		(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLConfig config);
473c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos					CandidateConfig		(const ConfigInfo& configInfo);
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
493c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	int				get					(deUint32 attrib) const;
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
517bd8f7c0f982a10c6e7127ce2497ee7e208ea90ePyry Haulos	int				id					(void) const;
527bd8f7c0f982a10c6e7127ce2497ee7e208ea90ePyry Haulos	int				redSize				(void) const;
537bd8f7c0f982a10c6e7127ce2497ee7e208ea90ePyry Haulos	int				greenSize			(void) const;
547bd8f7c0f982a10c6e7127ce2497ee7e208ea90ePyry Haulos	int				blueSize			(void) const;
557bd8f7c0f982a10c6e7127ce2497ee7e208ea90ePyry Haulos	int				alphaSize			(void) const;
567bd8f7c0f982a10c6e7127ce2497ee7e208ea90ePyry Haulos	int				depthSize			(void) const;
577bd8f7c0f982a10c6e7127ce2497ee7e208ea90ePyry Haulos	int				stencilSize			(void) const;
587bd8f7c0f982a10c6e7127ce2497ee7e208ea90ePyry Haulos	int				samples				(void) const;
597bd8f7c0f982a10c6e7127ce2497ee7e208ea90ePyry Haulos
607bd8f7c0f982a10c6e7127ce2497ee7e208ea90ePyry Haulos	deUint32		renderableType		(void) const;
617bd8f7c0f982a10c6e7127ce2497ee7e208ea90ePyry Haulos	deUint32		surfaceType			(void) const;
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
633c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	tcu::RGBA		colorBits			(void) const { return tcu::RGBA(redSize(), greenSize(), blueSize(), alphaSize());	}
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
663c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	enum Type
673c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	{
683c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		TYPE_EGL_OBJECT = 0,
693c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		TYPE_CONFIG_INFO,
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
713c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		TYPE_LAST
723c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	};
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
743c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const Type		m_type;
753c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	union
763c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	{
773c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		struct
783c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		{
793c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			const eglw::Library*	egl;
803c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			eglw::EGLDisplay		display;
813c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			eglw::EGLConfig			config;
823c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		} object;
833c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		const ConfigInfo*			configInfo;
843c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	} m_cfg;
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
873c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulostypedef bool (*ConfigFilter) (const CandidateConfig& candidate);
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FilterList
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								FilterList		(void) {}
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								~FilterList		(void) {}
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
953c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	FilterList&					operator<<		(ConfigFilter filter);
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FilterList&					operator<<		(const FilterList& other);
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
983c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	bool						match			(const eglw::Library& egl, eglw::EGLDisplay display, eglw::EGLConfig config) const;
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool						match			(const ConfigInfo& configInfo) const;
1003c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	bool						match			(const CandidateConfig& candidate) const;
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<ConfigFilter>	m_rules;
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // eglu
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _EGLUCONFIGFILTER_HPP
109