Allow more conservative coverage for degenerate triangles

Some implementations of conservative rasterization with degenerate
triangles produce more than one pixel worth of coverage, which is
allowed by the Vulkan specification.

This CL modifies the test to allow some extra coverage so it works
on these implementations.

Affects:

dEQP-VK.rasterization.conservative.overestimate.*.triangles.degenerate.*

Components: Vulkan

VK-GL-CTS issue: 2859

Change-Id: I65c6508813c04d5faa2312e26832efe16e44cea2
diff --git a/external/vulkancts/modules/vulkan/rasterization/vktRasterizationTests.cpp b/external/vulkancts/modules/vulkan/rasterization/vktRasterizationTests.cpp
index 7a593cf..6eb39d7 100644
--- a/external/vulkancts/modules/vulkan/rasterization/vktRasterizationTests.cpp
+++ b/external/vulkancts/modules/vulkan/rasterization/vktRasterizationTests.cpp
@@ -2925,11 +2925,22 @@
 	{
 		if (getIteration() != 0)
 		{
-			log << tcu::TestLog::Message << "Triangles expected to be rasterized with one pixel of white color each" << tcu::TestLog::EndMessage;
+			log << tcu::TestLog::Message << "Triangles expected to be rasterized with at least one pixel of white color each" << tcu::TestLog::EndMessage;
 
 			for (int rowNdx = 0; rowNdx < 3; ++rowNdx)
 			for (int colNdx = 0; colNdx < 4; ++colNdx)
+			{
 				referenceImage.setPixel(4 * (colNdx + 1), 4 * (rowNdx + 1), foregroundColor);
+
+				// Allow implementations that need to be extra conservative with degenerate triangles,
+				// which may cause extra coverage.
+				if (resultImage.getPixel(4 * (colNdx + 1) - 1, 4 * (rowNdx + 1) - 1) == foregroundColor)
+					referenceImage.setPixel(4 * (colNdx + 1) - 1, 4 * (rowNdx + 1) - 1, foregroundColor);
+				if (resultImage.getPixel(4 * (colNdx + 1) - 1, 4 * (rowNdx + 1)) == foregroundColor)
+					referenceImage.setPixel(4 * (colNdx + 1) - 1, 4 * (rowNdx + 1), foregroundColor);
+				if (resultImage.getPixel(4 * (colNdx + 1), 4 * (rowNdx + 1) - 1) == foregroundColor)
+					referenceImage.setPixel(4 * (colNdx + 1), 4 * (rowNdx + 1) - 1, foregroundColor);
+			}
 		}
 		else
 			log << tcu::TestLog::Message << "Triangles expected to be culled due to backfacing culling and all degenerate triangles assumed to be backfacing" << tcu::TestLog::EndMessage;