13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 3.1 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 Internal format query tests
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es31fInternalFormatQueryTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluStrUtil.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluContextInfo.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles31
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FormatSamplesCase : public TestCase
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum FormatType
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FORMAT_COLOR,
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FORMAT_INT,
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FORMAT_DEPTH_STENCIL
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						FormatSamplesCase	(Context& ctx, const char* name, const char* desc, glw::GLenum texTarget, glw::GLenum internalFormat, FormatType type);
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				init				(void);
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult		iterate				(void);
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
566548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry	const glw::GLenum	m_target;
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glw::GLenum	m_internalFormat;
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const FormatType	m_type;
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
616548214158a4646849b06b5a3768a6d0a04e7246Jarkko PöyryFormatSamplesCase::FormatSamplesCase (Context& ctx, const char* name, const char* desc, glw::GLenum target, glw::GLenum internalFormat, FormatType type)
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase			(ctx, name, desc)
636548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry	, m_target			(target)
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_internalFormat	(internalFormat)
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type			(type)
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
676548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry	DE_ASSERT(m_target == GL_TEXTURE_2D_MULTISAMPLE 		||
686548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry			  m_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY 	||
696548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry			  m_target == GL_RENDERBUFFER);
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FormatSamplesCase::init (void)
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
746548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry	const bool isTextureTarget = (m_target == GL_TEXTURE_2D_MULTISAMPLE) ||
756548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry								 (m_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY);
766548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry
776548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry	if (m_target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_storage_multisample_2d_array"))
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw tcu::NotSupportedError("Test requires OES_texture_storage_multisample_2d_array extension");
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
804c440d5c2b3bb7ea46ac8599bf80895b918f3fe8Jarkko Pöyry	// stencil8 textures are not supported without GL_OES_texture_stencil8 extension
816548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry	if (isTextureTarget && m_internalFormat == GL_STENCIL_INDEX8 && !m_context.getContextInfo().isExtensionSupported("GL_OES_texture_stencil8"))
824c440d5c2b3bb7ea46ac8599bf80895b918f3fe8Jarkko Pöyry		throw tcu::NotSupportedError("Test requires GL_OES_texture_stencil8 extension");
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
854c440d5c2b3bb7ea46ac8599bf80895b918f3fe8Jarkko PöyryFormatSamplesCase::IterateResult FormatSamplesCase::iterate (void)
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glw::Functions&	gl				= m_context.getRenderContext().getFunctions();
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool					error			= false;
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glw::GLint				maxSamples		= 0;
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glw::GLint				numSampleCounts	= 0;
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Lowest limit
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const glw::GLenum samplesEnum = (m_type == FORMAT_COLOR) ? (GL_MAX_COLOR_TEXTURE_SAMPLES) : (m_type == FORMAT_INT) ? (GL_MAX_INTEGER_SAMPLES) : (GL_MAX_DEPTH_TEXTURE_SAMPLES);
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << tcu::TestLog::Message << "Format must support sample count of " << glu::getGettableStateStr(samplesEnum) << tcu::TestLog::EndMessage;
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.getIntegerv(samplesEnum, &maxSamples);
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "get MAX_*_SAMPLES");
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << tcu::TestLog::Message << glu::getGettableStateStr(samplesEnum) << " = " << maxSamples << tcu::TestLog::EndMessage;
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (maxSamples < 1)
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << tcu::TestLog::Message << "ERROR: minimum value of "  << glu::getGettableStateStr(samplesEnum) << " is 1" << tcu::TestLog::EndMessage;
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			error = true;
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Number of sample counts
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1116548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry		gl.getInternalformativ(m_target, m_internalFormat, GL_NUM_SAMPLE_COUNTS, 1, &numSampleCounts);
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "get GL_NUM_SAMPLE_COUNTS");
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << tcu::TestLog::Message << "GL_NUM_SAMPLE_COUNTS = " << numSampleCounts << tcu::TestLog::EndMessage;
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (numSampleCounts < 1)
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << tcu::TestLog::Message << "ERROR: Format MUST support some multisample configuration, got GL_NUM_SAMPLE_COUNTS = " << numSampleCounts << tcu::TestLog::EndMessage;
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			error = true;
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Sample counts
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::MessageBuilder		samplesMsg(&m_testCtx.getLog());
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		std::vector<glw::GLint>	samples;
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (numSampleCounts > 0)
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			samples.resize(numSampleCounts, -1);
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1326548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry			gl.getInternalformativ(m_target, m_internalFormat, GL_SAMPLES, numSampleCounts, &samples[0]);
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "get GL_SAMPLES");
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			TCU_FAIL("glGetInternalFormativ() reported 0 supported sample counts");
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// make a pretty log
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		samplesMsg << "GL_SAMPLES = [";
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < numSampleCounts; ++ndx)
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (ndx)
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				samplesMsg << ", ";
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			samplesMsg << samples[ndx];
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		samplesMsg << "]" << tcu::TestLog::EndMessage;
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Samples are in order
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 1; ndx < numSampleCounts; ++ndx)
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (samples[ndx-1] <= samples[ndx])
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				m_testCtx.getLog() << tcu::TestLog::Message << "ERROR: Samples must be ordered descending." << tcu::TestLog::EndMessage;
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				error = true;
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break;
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// samples are positive
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 1; ndx < numSampleCounts; ++ndx)
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (samples[ndx-1] <= 0)
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				m_testCtx.getLog() << tcu::TestLog::Message << "ERROR: Only positive SAMPLES allowed." << tcu::TestLog::EndMessage;
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				error = true;
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break;
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// maxSamples must be supported
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (samples[0] < maxSamples)
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << tcu::TestLog::Message << "ERROR: MAX_*_SAMPLES must be supported." << tcu::TestLog::EndMessage;
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			error = true;
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Result
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!error)
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid value");
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1854c440d5c2b3bb7ea46ac8599bf80895b918f3fe8Jarkko Pöyry	return STOP;
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
188700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyryclass NumSampleCountsBufferCase : public TestCase
189700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry{
190700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyrypublic:
191700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry					NumSampleCountsBufferCase 	(Context& ctx, const char* name, const char* desc);
192700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
193700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyryprivate:
194700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	IterateResult	iterate						(void);
195700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry};
196700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
197700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko PöyryNumSampleCountsBufferCase::NumSampleCountsBufferCase (Context& ctx, const char* name, const char* desc)
198700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	: TestCase(ctx, name, desc)
199700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry{
200700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry}
201700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
202700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko PöyryNumSampleCountsBufferCase::IterateResult NumSampleCountsBufferCase::iterate (void)
203700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry{
204700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	const glw::GLint 		defaultValue 	= -123; // queries always return positive values
205700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	const glw::Functions&	gl				= m_context.getRenderContext().getFunctions();
206700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	bool					error			= false;
207700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
208700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	// Query to larger buffer
209700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	{
210700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		glw::GLint buffer[2] = { defaultValue, defaultValue };
211700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
212700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		m_testCtx.getLog() << tcu::TestLog::Message << "Querying GL_NUM_SAMPLE_COUNTS to larger-than-needed buffer." << tcu::TestLog::EndMessage;
213700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		gl.getInternalformativ(GL_TEXTURE_2D_MULTISAMPLE, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 2, buffer);
214700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		GLU_EXPECT_NO_ERROR(gl.getError(), "get GL_NUM_SAMPLE_COUNTS");
215700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
216700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		if (buffer[1] != defaultValue)
217700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		{
218700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			m_testCtx.getLog() << tcu::TestLog::Message << "ERROR: trailing values were modified." << tcu::TestLog::EndMessage;
219700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			error = true;
220700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		}
221700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	}
222700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
223700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	// Query to empty buffer
224700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	{
225700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		glw::GLint buffer[1] = { defaultValue };
226700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
227700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		m_testCtx.getLog() << tcu::TestLog::Message << "Querying GL_NUM_SAMPLE_COUNTS to zero-sized buffer." << tcu::TestLog::EndMessage;
228700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		gl.getInternalformativ(GL_TEXTURE_2D_MULTISAMPLE, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 0, buffer);
229700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		GLU_EXPECT_NO_ERROR(gl.getError(), "get GL_NUM_SAMPLE_COUNTS");
230700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
231700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		if (buffer[0] != defaultValue)
232700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		{
233700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			m_testCtx.getLog() << tcu::TestLog::Message << "ERROR: Query wrote over buffer bounds." << tcu::TestLog::EndMessage;
234700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			error = true;
235700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		}
236700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	}
237700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
238700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	// Result
239700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	if (!error)
240700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
241700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	else
242700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Unexpected buffer modification");
243700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
244700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	return STOP;
245700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry}
246700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
247700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyryclass SamplesBufferCase : public TestCase
248700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry{
249700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyrypublic:
250700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry					SamplesBufferCase 	(Context& ctx, const char* name, const char* desc);
251700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
252700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyryprivate:
253700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	IterateResult	iterate				(void);
254700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry};
255700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
256700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko PöyrySamplesBufferCase::SamplesBufferCase (Context& ctx, const char* name, const char* desc)
257700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	: TestCase(ctx, name, desc)
258700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry{
259700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry}
260700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
261700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko PöyrySamplesBufferCase::IterateResult SamplesBufferCase::iterate (void)
262700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry{
263700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	const glw::GLint 		defaultValue 	= -123; // queries always return positive values
264700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	const glw::Functions&	gl				= m_context.getRenderContext().getFunctions();
265700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	bool					error			= false;
266700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
267700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	glw::GLint				numSampleCounts	= 0;
268700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
269700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	// Number of sample counts
270700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	{
271700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		gl.getInternalformativ(GL_TEXTURE_2D_MULTISAMPLE, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 1, &numSampleCounts);
272700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		GLU_EXPECT_NO_ERROR(gl.getError(), "get GL_NUM_SAMPLE_COUNTS");
273700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
274700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		m_testCtx.getLog() << tcu::TestLog::Message << "GL_NUM_SAMPLE_COUNTS = " << numSampleCounts << tcu::TestLog::EndMessage;
275700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	}
276700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
277700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	if (numSampleCounts < 1)
278700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	{
279700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		m_testCtx.getLog() << tcu::TestLog::Message << "ERROR: Format MUST support some multisample configuration, got GL_NUM_SAMPLE_COUNTS = " << numSampleCounts << tcu::TestLog::EndMessage;
280700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		error = true;
281700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	}
282700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	else
283700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	{
284700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		// Query to larger buffer
285700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		{
286700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			std::vector<glw::GLint> buffer(numSampleCounts + 1, defaultValue);
287700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
288700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			m_testCtx.getLog() << tcu::TestLog::Message << "Querying GL_SAMPLES to larger-than-needed buffer." << tcu::TestLog::EndMessage;
289700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			gl.getInternalformativ(GL_TEXTURE_2D_MULTISAMPLE, GL_RGBA8, GL_SAMPLES, (glw::GLsizei)buffer.size(), &buffer[0]);
290700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			GLU_EXPECT_NO_ERROR(gl.getError(), "get GL_SAMPLES");
291700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
292700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			if (buffer.back() != defaultValue)
293700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			{
294700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry				m_testCtx.getLog() << tcu::TestLog::Message << "ERROR: trailing value was modified." << tcu::TestLog::EndMessage;
295700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry				error = true;
296700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			}
297700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		}
298700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
299700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		// Query to smaller buffer
300700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		if (numSampleCounts > 2)
301700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		{
302700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			glw::GLint buffer[3] = { defaultValue, defaultValue, defaultValue };
303700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
304700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			m_testCtx.getLog() << tcu::TestLog::Message << "Querying GL_SAMPLES to buffer with bufSize=2." << tcu::TestLog::EndMessage;
305700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			gl.getInternalformativ(GL_TEXTURE_2D_MULTISAMPLE, GL_RGBA8, GL_SAMPLES, 2, buffer);
306700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			GLU_EXPECT_NO_ERROR(gl.getError(), "get GL_SAMPLES");
307700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
308700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			if (buffer[2] != defaultValue)
309700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			{
310700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry				m_testCtx.getLog() << tcu::TestLog::Message << "ERROR: Query wrote over buffer bounds." << tcu::TestLog::EndMessage;
311700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry				error = true;
312700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			}
313700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		}
314700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
315700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		// Query to empty buffer
316700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		{
317700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			glw::GLint buffer[1] = { defaultValue };
318700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
319700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			m_testCtx.getLog() << tcu::TestLog::Message << "Querying GL_SAMPLES to zero-sized buffer." << tcu::TestLog::EndMessage;
320700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			gl.getInternalformativ(GL_TEXTURE_2D_MULTISAMPLE, GL_RGBA8, GL_SAMPLES, 0, buffer);
321700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			GLU_EXPECT_NO_ERROR(gl.getError(), "get GL_SAMPLES");
322700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
323700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			if (buffer[0] != defaultValue)
324700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			{
325700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry				m_testCtx.getLog() << tcu::TestLog::Message << "ERROR: Query wrote over buffer bounds." << tcu::TestLog::EndMessage;
326700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry				error = true;
327700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry			}
328700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		}
329700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	}
330700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
331700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	// Result
332700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	if (!error)
333700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
334700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	else
335700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Unexpected buffer modification");
336700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
337700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	return STOP;
338700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry}
339700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3423c827367444ee418f129b2c238299f49d3264554Jarkko PoyryInternalFormatQueryTests::InternalFormatQueryTests (Context& context)
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup(context, "internal_format", "Internal format queries")
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3473c827367444ee418f129b2c238299f49d3264554Jarkko PoyryInternalFormatQueryTests::~InternalFormatQueryTests (void)
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid InternalFormatQueryTests::init (void)
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const struct InternalFormat
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*						name;
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glw::GLenum						format;
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FormatSamplesCase::FormatType	type;
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	} internalFormats[] =
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// color renderable
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "r8",						GL_R8,					FormatSamplesCase::FORMAT_COLOR			},
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rg8",					GL_RG8,					FormatSamplesCase::FORMAT_COLOR			},
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgb8",					GL_RGB8,				FormatSamplesCase::FORMAT_COLOR			},
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgb565",					GL_RGB565,				FormatSamplesCase::FORMAT_COLOR			},
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgba4",					GL_RGBA4,				FormatSamplesCase::FORMAT_COLOR			},
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgb5_a1",				GL_RGB5_A1,				FormatSamplesCase::FORMAT_COLOR			},
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgba8",					GL_RGBA8,				FormatSamplesCase::FORMAT_COLOR			},
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgb10_a2",				GL_RGB10_A2,			FormatSamplesCase::FORMAT_COLOR			},
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgb10_a2ui",				GL_RGB10_A2UI,			FormatSamplesCase::FORMAT_INT			},
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "srgb8_alpha8",			GL_SRGB8_ALPHA8,		FormatSamplesCase::FORMAT_COLOR			},
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "r8i",					GL_R8I,					FormatSamplesCase::FORMAT_INT			},
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "r8ui",					GL_R8UI,				FormatSamplesCase::FORMAT_INT			},
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "r16i",					GL_R16I,				FormatSamplesCase::FORMAT_INT			},
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "r16ui",					GL_R16UI,				FormatSamplesCase::FORMAT_INT			},
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "r32i",					GL_R32I,				FormatSamplesCase::FORMAT_INT			},
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "r32ui",					GL_R32UI,				FormatSamplesCase::FORMAT_INT			},
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rg8i",					GL_RG8I,				FormatSamplesCase::FORMAT_INT			},
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rg8ui",					GL_RG8UI,				FormatSamplesCase::FORMAT_INT			},
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rg16i",					GL_RG16I,				FormatSamplesCase::FORMAT_INT			},
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rg16ui",					GL_RG16UI,				FormatSamplesCase::FORMAT_INT			},
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rg32i",					GL_RG32I,				FormatSamplesCase::FORMAT_INT			},
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rg32ui",					GL_RG32UI,				FormatSamplesCase::FORMAT_INT			},
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgba8i",					GL_RGBA8I,				FormatSamplesCase::FORMAT_INT			},
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgba8ui",				GL_RGBA8UI,				FormatSamplesCase::FORMAT_INT			},
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgba16i",				GL_RGBA16I,				FormatSamplesCase::FORMAT_INT			},
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgba16ui",				GL_RGBA16UI,			FormatSamplesCase::FORMAT_INT			},
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgba32i",				GL_RGBA32I,				FormatSamplesCase::FORMAT_INT			},
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "rgba32ui",				GL_RGBA32UI,			FormatSamplesCase::FORMAT_INT			},
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// depth renderable
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "depth_component16",		GL_DEPTH_COMPONENT16,	FormatSamplesCase::FORMAT_DEPTH_STENCIL	},
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "depth_component24",		GL_DEPTH_COMPONENT24,	FormatSamplesCase::FORMAT_DEPTH_STENCIL	},
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "depth_component32f",		GL_DEPTH_COMPONENT32F,	FormatSamplesCase::FORMAT_DEPTH_STENCIL	},
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "depth24_stencil8",		GL_DEPTH24_STENCIL8,	FormatSamplesCase::FORMAT_DEPTH_STENCIL	},
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "depth32f_stencil8",		GL_DEPTH32F_STENCIL8,	FormatSamplesCase::FORMAT_DEPTH_STENCIL	},
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// stencil renderable
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "stencil_index8",			GL_STENCIL_INDEX8,		FormatSamplesCase::FORMAT_DEPTH_STENCIL	}
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// DEPTH24_STENCIL8,  duplicate
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// DEPTH32F_STENCIL8  duplicate
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const struct
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*	name;
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deUint32	target;
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	} textureTargets[] =
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4096548214158a4646849b06b5a3768a6d0a04e7246Jarkko Pöyry		{ "renderbuffer",					GL_RENDERBUFFER					},
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "texture_2d_multisample",			GL_TEXTURE_2D_MULTISAMPLE		},
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "texture_2d_multisample_array",	GL_TEXTURE_2D_MULTISAMPLE_ARRAY	},
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int groupNdx = 0; groupNdx < DE_LENGTH_OF_ARRAY(textureTargets); ++groupNdx)
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::TestCaseGroup* const	group		= new tcu::TestCaseGroup(m_testCtx, textureTargets[groupNdx].name, glu::getInternalFormatTargetName(textureTargets[groupNdx].target));
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const glw::GLenum			texTarget	= textureTargets[groupNdx].target;
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(group);
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int caseNdx = 0; caseNdx < DE_LENGTH_OF_ARRAY(internalFormats); ++caseNdx)
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const std::string name = std::string(internalFormats[caseNdx].name) + "_samples";
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const std::string desc = std::string("Verify GL_SAMPLES of ") + internalFormats[caseNdx].name;
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			group->addChild(new FormatSamplesCase(m_context, name.c_str(), desc.c_str(), texTarget, internalFormats[caseNdx].format, internalFormats[caseNdx].type));
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
429700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
430700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	// Check buffer sizes are honored
431700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	{
432700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		tcu::TestCaseGroup* const group = new tcu::TestCaseGroup(m_testCtx, "partial_query", "Query data to too short a buffer");
433700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
434700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		addChild(group);
435700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry
436700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		group->addChild(new NumSampleCountsBufferCase	(m_context, "num_sample_counts", 	"Query GL_NUM_SAMPLE_COUNTS to too short a buffer"));
437700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry		group->addChild(new SamplesBufferCase			(m_context, "samples", 				"Query GL_SAMPLES to too short a buffer"));
438700c8fcf7b207b35ba2bdd211f5865bcb1c0961fJarkko Pöyry	}
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles31
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
444