Changed large point clipping test to allow pop-free clipping.
authorAri Suonpaa <ari.suonpaa@siru.fi>
Wed, 23 Aug 2017 10:20:30 +0000 (13:20 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 30 Aug 2017 12:44:07 +0000 (08:44 -0400)
Modified large point clipping test to allow both popful and
pop-free implementations by checking that either no points
or all points are rendered.

Affects:

dEQP-VK.clipping.clip_volume.clipped.large_points

Components: Vulkan

VK-GL-CTS issue: 414

Change-Id: I3a9b25f7562f69e085ef7f5d01cfe808e4990b97

external/vulkancts/modules/vulkan/clipping/vktClippingTests.cpp

index 68b406a..5de9ed1 100644 (file)
@@ -559,14 +559,14 @@ tcu::TestStatus testLargePoints (Context& context)
                vertices.push_back(Vec4(   p,    p, 0.4f, 1.0f));
                vertices.push_back(Vec4(   p,   -p, 0.6f, 1.0f));
                vertices.push_back(Vec4(0.0f,   -p, 0.8f, 1.0f));
-               vertices.push_back(Vec4(   p, 0.0f, 0.9f, 1.0f));
-               vertices.push_back(Vec4(0.0f,    p, 0.1f, 1.0f));
-               vertices.push_back(Vec4(  -p, 0.0f, 0.2f, 1.0f));
+               vertices.push_back(Vec4(   p, 0.0f, 0.7f, 1.0f));
+               vertices.push_back(Vec4(0.0f,    p, 0.5f, 1.0f));
+               vertices.push_back(Vec4(  -p, 0.0f, 0.3f, 1.0f));
        }
 
        tcu::TestLog&   log     = context.getTestContext().getLog();
 
-       log << tcu::TestLog::Message << "Drawing several large points just outside the clip volume. Expecting an empty image." << tcu::TestLog::EndMessage;
+       log << tcu::TestLog::Message << "Drawing several large points just outside the clip volume. Expecting an empty image or all points rendered." << tcu::TestLog::EndMessage;
 
        DrawState                       drawState               (VK_PRIMITIVE_TOPOLOGY_POINT_LIST, RENDER_SIZE, RENDER_SIZE);
        DrawCallData            drawCallData    (vertices);
@@ -575,10 +575,22 @@ tcu::TestStatus testLargePoints (Context& context)
        VulkanDrawContext       drawContext(context, drawState, drawCallData, vulkanProgram);
        drawContext.draw();
 
-       // All pixels must be black -- nothing is drawn.
+       // Popful case: All pixels must be black -- nothing is drawn.
        const int numBlackPixels = countPixels(drawContext.getColorPixels(), Vec4(0.0f, 0.0f, 0.0f, 1.0f), Vec4());
 
-       return (numBlackPixels == NUM_RENDER_PIXELS ? tcu::TestStatus::pass("OK") : tcu::TestStatus::fail("Rendered image(s) are incorrect"));
+       // Pop-free case: All points must be rendered.
+       bool allPointsRendered = true;
+       for (std::vector<Vec4>::iterator i = vertices.begin(); i != vertices.end(); ++i)
+       {
+               if (countPixels(drawContext.getColorPixels(), Vec4(1.0f, i->z(), 0.0f, 1.0f), Vec4(0.01f)) == 0)
+                       allPointsRendered = false;
+       }
+
+       // Test passes if nothing or all points are rendered, allowing implementations to use either popful or pop-free point clipping rules.
+       if (numBlackPixels == NUM_RENDER_PIXELS || allPointsRendered)
+               return tcu::TestStatus::pass("OK");
+       else
+               return tcu::TestStatus::fail("Rendered image(s) are incorrect");
 }
 
 //! Wide line clipping