Merge vk-gl-cts/aosp-deqp-dev into vk-gl-cts/master

Change-Id: I2144843957db34a4d7e90f33d08740ecea0ee3ec
diff --git a/framework/common/tcuFuzzyImageCompare.cpp b/framework/common/tcuFuzzyImageCompare.cpp
index 596ab83..4e76476 100644
--- a/framework/common/tcuFuzzyImageCompare.cpp
+++ b/framework/common/tcuFuzzyImageCompare.cpp
@@ -318,7 +318,7 @@
 
 	for (int y = 1; y < height-1; y++)
 	{
-		for (int x = 1; x < width-1; x += params.maxSampleSkip > 0 ? (int)rnd.getInt(0, params.maxSampleSkip) : 1)
+		for (int x = 1; x < width-1; x += 1 + (int)rnd.getInt(0, params.maxSampleSkip))
 		{
 			const deUint32	minDist2RefToCmp	= distSquaredToNeighbor<4>(rnd, readUnorm8<4>(refAccess, x, y), cmpAccess, x, y);
 			const deUint32	minDist2CmpToRef	= distSquaredToNeighbor<4>(rnd, readUnorm8<4>(cmpAccess, x, y), refAccess, x, y);
diff --git a/modules/egl/teglBufferAgeTests.cpp b/modules/egl/teglBufferAgeTests.cpp
index 7aac350..e1a3dc2 100644
--- a/modules/egl/teglBufferAgeTests.cpp
+++ b/modules/egl/teglBufferAgeTests.cpp
@@ -345,6 +345,10 @@
 		const ColoredRect& coloredRect = frame.draws[drawNdx].rect;
 		if (frame.draws[drawNdx].drawType == BufferAgeTest::DRAWTYPE_GLES2_RENDER || frame.draws[drawNdx].drawType == BufferAgeTest::DRAWTYPE_GLES2_CLEAR)
 		{
+			// tcu does not support degenerate subregions. Since they correspond to no-op rendering, just skip them.
+			if (coloredRect.bottomLeft.x() == coloredRect.topRight.x() || coloredRect.bottomLeft.y() == coloredRect.topRight.y())
+				continue;
+
 			const tcu::UVec4 color(coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255);
 			tcu::clear(tcu::getSubregion(target->getAccess(), coloredRect.bottomLeft.x(), coloredRect.bottomLeft.y(),
 										 coloredRect.topRight.x()-coloredRect.bottomLeft.x(), coloredRect.topRight.y()-coloredRect.bottomLeft.y()), color);
diff --git a/modules/egl/teglPartialUpdateTests.cpp b/modules/egl/teglPartialUpdateTests.cpp
index 097701a..a70374a 100644
--- a/modules/egl/teglPartialUpdateTests.cpp
+++ b/modules/egl/teglPartialUpdateTests.cpp
@@ -334,6 +334,10 @@
 		const ColoredRect& coloredRect = frame.draws[drawNdx].rect;
 		if (frame.draws[drawNdx].drawType == PartialUpdateTest::DRAWTYPE_GLES2_RENDER || frame.draws[drawNdx].drawType == PartialUpdateTest::DRAWTYPE_GLES2_CLEAR)
 		{
+			// tcu does not support degenerate subregions. Since they correspond to no-op rendering, just skip them.
+			if (coloredRect.bottomLeft.x() == coloredRect.topRight.x() || coloredRect.bottomLeft.y() == coloredRect.topRight.y())
+				continue;
+
 			const tcu::UVec4 color(coloredRect.color.x(), coloredRect.color.y(), coloredRect.color.z(), 255);
 			tcu::clear(tcu::getSubregion(target->getAccess(), coloredRect.bottomLeft.x(), coloredRect.bottomLeft.y(),
 										 coloredRect.topRight.x()-coloredRect.bottomLeft.x(), coloredRect.topRight.y()-coloredRect.bottomLeft.y()), color);
diff --git a/modules/gles31/functional/es31fDrawElementsBaseVertexTests.cpp b/modules/gles31/functional/es31fDrawElementsBaseVertexTests.cpp
index 11764c1..7b47e13 100644
--- a/modules/gles31/functional/es31fDrawElementsBaseVertexTests.cpp
+++ b/modules/gles31/functional/es31fDrawElementsBaseVertexTests.cpp
@@ -218,6 +218,13 @@
 
 void VertexIDCase::init (void)
 {
+	if (m_method == deqp::gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_BASEVERTEX ||
+		m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED_BASEVERTEX ||
+		m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_INSTANCED_BASEVERTEX)
+	{
+		TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)), "This test requires a 3.2 context or higher context version.");
+	}
+
 	m_testCtx.getLog()	<< TestLog::Message
 						<< "gl_VertexID should be the index of the vertex that is being passed to the shader. i.e. indices[i] + basevertex"
 						<< TestLog::EndMessage;
diff --git a/modules/gles31/functional/es31fShaderFramebufferFetchTests.cpp b/modules/gles31/functional/es31fShaderFramebufferFetchTests.cpp
index 9d77831..c9b0c69 100644
--- a/modules/gles31/functional/es31fShaderFramebufferFetchTests.cpp
+++ b/modules/gles31/functional/es31fShaderFramebufferFetchTests.cpp
@@ -1144,7 +1144,7 @@
 private:
 	void				create2DTextureArrayMipMaps		(const vector<tcu::Vec4>& colors);
 	tcu::TextureLevel	genReferenceTexture				(int level, const vector<tcu::Vec4>& colors, const tcu::Vec4& uniformColor);
-	void				genReferenceMipmap				(int level, const tcu::Vec4& color, tcu::TextureLevel& reference);
+	void				genReferenceMipmap				(const tcu::Vec4& color, tcu::TextureLevel& reference);
 };
 
 TextureLevelTestCase::TextureLevelTestCase (Context& context, const char* name, const char* desc, deUint32 format)
@@ -1180,30 +1180,19 @@
 
 tcu::TextureLevel TextureLevelTestCase::genReferenceTexture (int level, const vector<tcu::Vec4>& colors, const tcu::Vec4& uniformColor)
 {
-	tcu::TextureLevel	reference	(glu::mapGLTransferFormat(m_transferFmt.format, m_transferFmt.dataType), VIEWPORT_WIDTH, VIEWPORT_HEIGHT, 1);
+	tcu::TextureLevel	reference	(glu::mapGLTransferFormat(m_transferFmt.format, m_transferFmt.dataType), VIEWPORT_WIDTH >> level, VIEWPORT_HEIGHT >> level, 1);
 
-	// calculate reference image based on current mipmap level and previously
-	// rendered mipmaps in framebuffer
-	for (int ndx = 0; ndx <= level; ++ndx)
-		genReferenceMipmap(ndx, colors[ndx] + uniformColor, reference);
+	genReferenceMipmap(colors[level] + uniformColor, reference);
 
 	return reference;
 }
 
-void TextureLevelTestCase::genReferenceMipmap (int level, const tcu::Vec4& color, tcu::TextureLevel& reference)
+void TextureLevelTestCase::genReferenceMipmap (const tcu::Vec4& color, tcu::TextureLevel& reference)
 {
-	int	width	= reference.getAccess().getWidth();
-	int	height	= reference.getAccess().getHeight();
-	int	left	= width /2;
-	int	top		= height/2;
-
-	for (int i = 0; i < level; ++i)
-	{
-		width	= de::max(1, width	/ 2);
-		height	= de::max(1, height / 2);
-		left	= width /2;
-		top		= height/2;
-	}
+	const int	width	= reference.getAccess().getWidth();
+	const int	height	= reference.getAccess().getHeight();
+	const int	left	= width  / 2;
+	const int	top		= height / 2;
 
 	clear(getSubregion(reference.getAccess(), left,		0,		0, width-left,	top,		1),	color);
 	clear(getSubregion(reference.getAccess(), 0,		top,	0, left,		height-top,	1), color);
@@ -1214,7 +1203,6 @@
 TextureLevelTestCase::IterateResult TextureLevelTestCase::iterate (void)
 {
 	const tcu::Vec4		uniformColor	= scaleColorValue(m_texFmt, tcu::Vec4(0.1f, 0.0f, 0.0f, 1.0f));
-	tcu::TextureLevel	result			(getReadPixelFormat(m_texFmt), VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
 	vector<tcu::Vec4>	levelColors;
 
 	levelColors.push_back(scaleColorValue(m_texFmt, tcu::Vec4(0.4f, 0.0f, 0.0f, 1.0f)));
@@ -1233,10 +1221,11 @@
 		name << "Level "		<< level;
 		desc << "Mipmap level " << level;
 
-		const tcu::ScopedLogSection section			(m_testCtx.getLog(), name.str(), desc.str());
+		const tcu::ScopedLogSection	section			(m_testCtx.getLog(), name.str(), desc.str());
+		tcu::TextureLevel			result			(getReadPixelFormat(m_texFmt), VIEWPORT_WIDTH >> level, VIEWPORT_HEIGHT >> level);
 		tcu::TextureLevel			reference		= genReferenceTexture(level, levelColors, uniformColor);
 
-		m_gl.framebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_texColorBuffer, level);
+		m_gl.framebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_texColorBuffer, level, 0);
 
 		genUniformColor(uniformColor);
 		render();
diff --git a/modules/glshared/glsDrawTest.cpp b/modules/glshared/glsDrawTest.cpp
index 155bd35..472c5ea 100644
--- a/modules/glshared/glsDrawTest.cpp
+++ b/modules/glshared/glsDrawTest.cpp
@@ -3150,10 +3150,18 @@
 DrawTest::IterateResult DrawTest::iterate (void)
 {
 	const int					specNdx			= (m_iteration / 2);
+	const DrawTestSpec&			spec			= m_specs[specNdx];
+
+	if (spec.drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_BASEVERTEX ||
+		spec.drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_INSTANCED_BASEVERTEX ||
+		spec.drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED_BASEVERTEX)
+	{
+		TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(m_renderCtx.getType(), glu::ApiType::es(3, 2)), "Tests requires a 3.2 context or higher context version.");
+	}
+
 	const bool					drawStep		= (m_iteration % 2) == 0;
 	const bool					compareStep		= (m_iteration % 2) == 1;
 	const IterateResult			iterateResult	= ((size_t)m_iteration + 1 == m_specs.size()*2) ? (STOP) : (CONTINUE);
-	const DrawTestSpec&			spec			= m_specs[specNdx];
 	const bool					updateProgram	= (m_iteration == 0) || (drawStep && !checkSpecsShaderCompatible(m_specs[specNdx], m_specs[specNdx-1])); // try to use the same shader in all iterations
 	IterationLogSectionEmitter	sectionEmitter	(m_testCtx.getLog(), specNdx, m_specs.size(), m_iteration_descriptions[specNdx], drawStep && m_specs.size()!=1);