allow non-preferred line interpolation for gles
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 24 Mar 2022 15:23:45 +0000 (16:23 +0100)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Wed, 30 Mar 2022 14:51:02 +0000 (14:51 +0000)
The OpenGL ES 3.2 spec, section 13.6.2.1 ("Wide Lines") says the
following:

Change-Id: I1cff239a9cc712b9e8677966f7b3b1adfe72499a

---8<---
The preferred method of attribute interpolation for a wide line is to
generate the same attribute values for all fragments in the row or
column described above, as if the adjusted line were used for
interpolation and those values replicated to the other fragments,
except for gl_FragCoord which is interpolated as usual. An
implementation may instead interpolate each fragment according to the
formula in "Basic Line Segment Rasterization", using the original
line segment endpoints.
---8<---

However, the code that verified the interpolation only checked against
the preferred interpolation.

Luckily, we have code that does the right checking. By marking the ES2
and ES3 line-rasterization tests with a bit to allow this, we can hook
this up as appropriate.

Components: OpenGL ES, Framework

VK-GL-CTS public Issue: 273

Affected Tests:
dEQP-GLES2.functional.rasterization.interpolation.*_wide
dEQP-GLES3.functional.rasterization.interpolation.line_wide
dEQP-GLES3.functional.rasterization.fbo.rbo_singlesample.interpolation.lines_wide
dEQP-GLES3.functional.rasterization.fbo.texture_2d.interpolation.lines_wide

Change-Id: Iacd493416dc945711410eb08f73f9e234b78ec61

framework/common/tcuRasterizationVerifier.cpp
framework/common/tcuRasterizationVerifier.hpp
modules/gles2/functional/es2fRasterizationTests.cpp
modules/gles3/functional/es3fRasterizationTests.cpp

index 869e262..3ee4414 100644 (file)
@@ -1997,6 +1997,11 @@ bool verifySinglesampleNarrowLineGroupInterpolation (const tcu::Surface& surface
        return verifyLineGroupPixelIndependentInterpolation(surface, scene, args, log, LINEINTERPOLATION_STRICTLY_CORRECT);
 }
 
+bool verifyLineGroupInterpolationWithNonProjectedWeights (const tcu::Surface& surface, const LineSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log)
+{
+       return verifyLineGroupPixelIndependentInterpolation(surface, scene, args, log, LINEINTERPOLATION_STRICTLY_CORRECT);
+}
+
 bool verifyLineGroupInterpolationWithProjectedWeights (const tcu::Surface& surface, const LineSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log)
 {
        return verifyLineGroupPixelIndependentInterpolation(surface, scene, args, log, LINEINTERPOLATION_PROJECTED);
@@ -3004,6 +3009,10 @@ LineInterpolationMethod verifyLineGroupInterpolation (const tcu::Surface& surfac
                {
                        if (verifySinglesampleWideLineGroupInterpolation(surface, scene, args, log))
                                return LINEINTERPOLATION_STRICTLY_CORRECT;
+
+                       if (scene.allowNonProjectedInterpolation &&
+                           verifyLineGroupInterpolationWithNonProjectedWeights(surface, scene, args, log))
+                               return LINEINTERPOLATION_STRICTLY_CORRECT;
                }
 
                // check with projected (inaccurate) interpolation
index f894b7e..fd31974 100644 (file)
@@ -92,6 +92,7 @@ struct LineSceneSpec
        bool                                    isStrip;
        bool                                    isSmooth;
        bool                                    isRectangular;
+       bool                                    allowNonProjectedInterpolation;
        bool                                    stippleEnable;
        deUint32                                stippleFactor;
        deUint16                                stipplePattern;
index 0fc979e..80eab81 100644 (file)
@@ -372,6 +372,7 @@ BaseLineCase::IterateResult BaseLineCase::iterate (void)
                scene.lineWidth = m_lineWidth;
                scene.stippleFactor = 1;
                scene.stipplePattern = 0xFFFF;
+               scene.allowNonProjectedInterpolation = true;
 
                compareOk = verifyLineGroupRasterization(resultImage, scene, args, m_testCtx.getLog());
 
@@ -1799,6 +1800,7 @@ LineInterpolationTest::IterateResult LineInterpolationTest::iterate (void)
                scene.lineWidth = m_lineWidth;
                scene.stippleFactor = 1;
                scene.stipplePattern = 0xFFFF;
+               scene.allowNonProjectedInterpolation = true;
 
 
                iterationResult = verifyLineGroupInterpolation(resultImage, scene, args, m_testCtx.getLog());
index abe3eb7..43d715e 100644 (file)
@@ -603,6 +603,7 @@ BaseLineCase::IterateResult BaseLineCase::iterate (void)
                        scene.lineWidth = lineWidth;
                        scene.stippleFactor = 1;
                        scene.stipplePattern = 0xFFFF;
+                       scene.allowNonProjectedInterpolation = true;
 
                        compareOk = verifyLineGroupRasterization(resultImage, scene, args, m_testCtx.getLog());
 
@@ -2021,6 +2022,7 @@ LineInterpolationTest::IterateResult LineInterpolationTest::iterate (void)
                        scene.lineWidth = getLineWidth();
                        scene.stippleFactor = 1;
                        scene.stipplePattern = 0xFFFF;
+                       scene.allowNonProjectedInterpolation = true;
 
 
                        iterationResult = verifyLineGroupInterpolation(resultImage, scene, args, m_testCtx.getLog());