Verify line-stipple both with and without carry-over
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 11 Aug 2021 14:18:37 +0000 (16:18 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Fri, 15 Oct 2021 21:14:12 +0000 (21:14 +0000)
The Vulkan spec specifies that carrying over the fractional parts of a
line is optional. Let's test both with and without, so we accept either.

Components: Vulkan, Framework

Public Issue: 280

Affected Tests: dEQP-VK.rasterization.primitives.static_stipple.*
dEQP-VK.rasterization.primitives_multisample_4_bit.*

Change-Id: Iaae3397ebfa1db7fbccefd479bd98c1ad8471ff8

framework/common/tcuRasterizationVerifier.cpp

index c775c78..ca65274 100644 (file)
@@ -914,7 +914,8 @@ bool verifyMultisampleLineGroupRasterization (const tcu::Surface&                                           surface,
                                                                                          ClipMode                                                                      clipMode,
                                                                                          VerifyTriangleGroupRasterizationLogStash*     logStash,
                                                                                          const bool                                                            vulkanLinesTest,
-                                                                                         const bool                                                            strictMode)
+                                                                                         const bool                                                            strictMode,
+                                                                                         const bool                                                            carryRemainder)
 {
        // Multisampled line == 2 triangles
 
@@ -969,29 +970,37 @@ bool verifyMultisampleLineGroupRasterization (const tcu::Surface&                                         surface,
                                float d0 = (float)lineOffset;
                                float d1 = d0 + 1.0f;
 
-                               // "leftoverPhase" carries over a fractional stipple phase that was "unused"
-                               // by the last line segment in the strip, if it wasn't an integer length.
-                               if (leftoverPhase > lineLength)
-                               {
-                                       DE_ASSERT(d0 == 0.0f);
-                                       d1 = lineLength;
-                                       leftoverPhase -= lineLength;
-                               }
-                               else if (leftoverPhase != 0.0f)
+                               if (carryRemainder)
                                {
-                                       DE_ASSERT(d0 == 0.0f);
-                                       d1 = leftoverPhase;
-                                       leftoverPhase = 0.0f;
-                               }
-                               else
-                               {
-                                       if (d0 + 1.0f > lineLength)
+                                       // "leftoverPhase" carries over a fractional stipple phase that was "unused"
+                                       // by the last line segment in the strip, if it wasn't an integer length.
+                                       if (leftoverPhase > lineLength)
                                        {
+                                               DE_ASSERT(d0 == 0.0f);
                                                d1 = lineLength;
-                                               leftoverPhase = d0 + 1.0f - lineLength;
+                                               leftoverPhase -= lineLength;
+                                       }
+                                       else if (leftoverPhase != 0.0f)
+                                       {
+                                               DE_ASSERT(d0 == 0.0f);
+                                               d1 = leftoverPhase;
+                                               leftoverPhase = 0.0f;
                                        }
                                        else
-                                               d1 = d0 + 1.0f;
+                                       {
+                                               if (d0 + 1.0f > lineLength)
+                                               {
+                                                       d1 = lineLength;
+                                                       leftoverPhase = d0 + 1.0f - lineLength;
+                                               }
+                                               else
+                                                       d1 = d0 + 1.0f;
+                                       }
+                               }
+                               else
+                               {
+                                       if (d1 > lineLength)
+                                               d1 = lineLength;
                                }
 
                                // set offset for next iteration
@@ -1078,6 +1087,22 @@ bool verifyMultisampleLineGroupRasterization (const tcu::Surface&                                                surface,
        return verifyTriangleGroupRasterization(surface, triangleScene, args, log, scene.verificationMode, logStash, vulkanLinesTest);
 }
 
+bool verifyMultisampleLineGroupRasterization (const tcu::Surface&                                              surface,
+                                                                                         const LineSceneSpec&                                          scene,
+                                                                                         const RasterizationArguments&                         args,
+                                                                                         tcu::TestLog&                                                         log,
+                                                                                         ClipMode                                                                      clipMode,
+                                                                                         VerifyTriangleGroupRasterizationLogStash*     logStash,
+                                                                                         const bool                                                            vulkanLinesTest,
+                                                                                         const bool                                                            strictMode)
+{
+       if (scene.stippleEnable)
+               return verifyMultisampleLineGroupRasterization(surface, scene, args, log, clipMode, logStash, vulkanLinesTest, strictMode, true) ||
+                      verifyMultisampleLineGroupRasterization(surface, scene, args, log, clipMode, logStash, vulkanLinesTest, strictMode, false);
+       else
+               return verifyMultisampleLineGroupRasterization(surface, scene, args, log, clipMode, logStash, vulkanLinesTest, strictMode, true);
+}
+
 static bool verifyMultisampleLineGroupInterpolationInternal (const tcu::Surface&                                               surface,
                                                                                                          const LineSceneSpec&                                          scene,
                                                                                                          const RasterizationArguments&                         args,