13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 3.0 Module
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * -------------------------------------------------
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Platform Information and Capability Tests.
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tes3InfoTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluDefs.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluContextInfo.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp"
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp"
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string>
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector>
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string;
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::vector;
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles3
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass QueryStringCase : public TestCase
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	QueryStringCase (Context& context, const char* name, const char* description, deUint32 query)
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: TestCase	(context, name, description)
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_query	(query)
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult iterate (void)
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const glw::Functions&	gl		= m_context.getRenderContext().getFunctions();
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*				result	= (const char*)gl.getString(m_query);
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glGetString() failed");
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << tcu::TestLog::Message << result << tcu::TestLog::EndMessage;
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return STOP;
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32 m_query;
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass QueryExtensionsCase : public TestCase
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	QueryExtensionsCase (Context& context)
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: TestCase	(context, "extensions", "Supported Extensions")
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult iterate (void)
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const vector<string> extensions = m_context.getContextInfo().getExtensions();
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (vector<string>::const_iterator i = extensions.begin(); i != extensions.end(); i++)
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << tcu::TestLog::Message << *i << tcu::TestLog::EndMessage;
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return STOP;
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass RenderTargetInfoCase : public TestCase
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	RenderTargetInfoCase (Context& context)
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: TestCase	(context, "render_target", "Render Target Info")
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult iterate (void)
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const tcu::RenderTarget&	rt		= m_context.getRenderTarget();
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const tcu::PixelFormat&		pf		= rt.getPixelFormat();
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog()
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< tcu::TestLog::Integer("RedBits",		"Red channel bits",		"", QP_KEY_TAG_NONE,	pf.redBits)
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< tcu::TestLog::Integer("GreenBits",	"Green channel bits",	"",	QP_KEY_TAG_NONE,	pf.greenBits)
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< tcu::TestLog::Integer("BlueBits",	"Blue channel bits",	"",	QP_KEY_TAG_NONE,	pf.blueBits)
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< tcu::TestLog::Integer("AlphaBits",	"Alpha channel bits",	"",	QP_KEY_TAG_NONE,	pf.alphaBits)
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< tcu::TestLog::Integer("DepthBits",	"Depth bits",			"",	QP_KEY_TAG_NONE,	rt.getDepthBits())
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< tcu::TestLog::Integer("StencilBits",	"Stencil bits",			"",	QP_KEY_TAG_NONE,	rt.getStencilBits())
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< tcu::TestLog::Integer("NumSamples",	"Number of samples",	"",	QP_KEY_TAG_NONE,	rt.getNumSamples())
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< tcu::TestLog::Integer("Width",		"Width",				"",	QP_KEY_TAG_NONE,	rt.getWidth())
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< tcu::TestLog::Integer("Height",		"Height",				"",	QP_KEY_TAG_NONE,	rt.getHeight());
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return STOP;
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1213c827367444ee418f129b2c238299f49d3264554Jarkko PoyryInfoTests::InfoTests (Context& context)
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup(context, "info", "Platform information queries")
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1263c827367444ee418f129b2c238299f49d3264554Jarkko PoyryInfoTests::~InfoTests (void)
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid InfoTests::init (void)
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new QueryStringCase(m_context, "vendor",					"Vendor String",					GL_VENDOR));
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new QueryStringCase(m_context, "renderer",					"Renderer String",					GL_RENDERER));
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new QueryStringCase(m_context, "version",					"Version String",					GL_VERSION));
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new QueryStringCase(m_context, "shading_language_version",	"Shading Language Version String",	GL_SHADING_LANGUAGE_VERSION));
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new QueryExtensionsCase(m_context));
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new RenderTargetInfoCase(m_context));
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles2
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
142