From 4853c0f67def4f374f7160ec5f8a7173ca60eaba Mon Sep 17 00:00:00 2001 From: Boris Zanin Date: Tue, 16 May 2017 14:32:06 +0200 Subject: Allow pop-free clipping for lines Following test checks has been relaxed: * dEQP-VK.rasterization.primitives.lines_wide * dEQP-VK.rasterization.primitives.line_strip_wide * dEQP-VK.rasterization.primitives_multisample_2_bit.lines_wide * dEQP-VK.rasterization.primitives_multisample_4_bit.lines_wide * dEQP-VK.rasterization.primitives_multisample_8_bit.lines_wide Components: Vulkan VK-GL-CTS issue: 421 Change-Id: I21c04015d36ae55c20ef1c1dda8e2d1fee471221 --- framework/common/tcuRasterizationVerifier.cpp | 107 ++++++++++++++++++++------ framework/common/tcuRasterizationVerifier.hpp | 22 +++++- 2 files changed, 104 insertions(+), 25 deletions(-) (limited to 'framework') diff --git a/framework/common/tcuRasterizationVerifier.cpp b/framework/common/tcuRasterizationVerifier.cpp index 56a9bb77d..4514ef119 100644 --- a/framework/common/tcuRasterizationVerifier.cpp +++ b/framework/common/tcuRasterizationVerifier.cpp @@ -907,7 +907,7 @@ enum ClipMode CLIPMODE_LAST }; -bool verifyMultisampleLineGroupRasterization (const tcu::Surface& surface, const LineSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log, ClipMode clipMode) +bool verifyMultisampleLineGroupRasterization (const tcu::Surface& surface, const LineSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log, ClipMode clipMode, VerifyTriangleGroupRasterizationLogStash* logStash = DE_NULL) { // Multisampled line == 2 triangles @@ -963,7 +963,7 @@ bool verifyMultisampleLineGroupRasterization (const tcu::Surface& surface, const triangleScene.triangles[lineNdx*2 + 1].positions[2] = tcu::Vec4(lineQuadNormalizedDeviceSpace[3].x(), lineQuadNormalizedDeviceSpace[3].y(), 0.0f, 1.0f); triangleScene.triangles[lineNdx*2 + 1].sharedEdge[2] = false; } - return verifyTriangleGroupRasterization(surface, triangleScene, args, log); + return verifyTriangleGroupRasterization(surface, triangleScene, args, log, VERIFICATIONMODE_STRICT, logStash); } bool verifyMultisampleLineGroupInterpolation (const tcu::Surface& surface, const LineSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log) @@ -2234,7 +2234,33 @@ CoverageType calculateTriangleCoverage (const tcu::Vec4& p0, const tcu::Vec4& p1 } } -bool verifyTriangleGroupRasterization (const tcu::Surface& surface, const TriangleSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log, VerificationMode mode) +static void verifyTriangleGroupRasterizationLog (const tcu::Surface& surface, tcu::TestLog& log, VerifyTriangleGroupRasterizationLogStash& logStash) +{ + // Output results + log << tcu::TestLog::Message << "Verifying rasterization result." << tcu::TestLog::EndMessage; + + if (!logStash.result) + { + log << tcu::TestLog::Message << "Invalid pixels found:\n\t" + << logStash.missingPixels << " missing pixels. (Marked with purple)\n\t" + << logStash.unexpectedPixels << " incorrectly filled pixels. (Marked with red)\n\t" + << "Unknown (subpixel on edge) pixels are marked with yellow." + << tcu::TestLog::EndMessage; + log << tcu::TestLog::ImageSet("Verification result", "Result of rendering") + << tcu::TestLog::Image("Result", "Result", surface) + << tcu::TestLog::Image("ErrorMask", "ErrorMask", logStash.errorMask) + << tcu::TestLog::EndImageSet; + } + else + { + log << tcu::TestLog::Message << "No invalid pixels found." << tcu::TestLog::EndMessage; + log << tcu::TestLog::ImageSet("Verification result", "Result of rendering") + << tcu::TestLog::Image("Result", "Result", surface) + << tcu::TestLog::EndImageSet; + } +} + +bool verifyTriangleGroupRasterization (const tcu::Surface& surface, const TriangleSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log, VerificationMode mode, VerifyTriangleGroupRasterizationLogStash* logStash) { DE_ASSERT(mode < VERIFICATIONMODE_LAST); @@ -2252,6 +2278,7 @@ bool verifyTriangleGroupRasterization (const tcu::Surface& surface, const Triang int subPixelBits = args.subpixelBits; tcu::TextureLevel coverageMap (tcu::TextureFormat(tcu::TextureFormat::R, tcu::TextureFormat::UNSIGNED_INT8), surface.getWidth(), surface.getHeight()); tcu::Surface errorMask (surface.getWidth(), surface.getHeight()); + bool result = false; // subpixel bits in in a valid range? @@ -2368,33 +2395,33 @@ bool verifyTriangleGroupRasterization (const tcu::Surface& surface, const Triang }; } - // Output results - log << tcu::TestLog::Message << "Verifying rasterization result." << tcu::TestLog::EndMessage; - if (((mode == VERIFICATIONMODE_STRICT) && (missingPixels + unexpectedPixels > 0)) || ((mode == VERIFICATIONMODE_WEAK) && (missingPixels + unexpectedPixels > weakVerificationThreshold))) { - log << tcu::TestLog::Message << "Invalid pixels found:\n\t" - << missingPixels << " missing pixels. (Marked with purple)\n\t" - << unexpectedPixels << " incorrectly filled pixels. (Marked with red)\n\t" - << "Unknown (subpixel on edge) pixels are marked with yellow." - << tcu::TestLog::EndMessage; - log << tcu::TestLog::ImageSet("Verification result", "Result of rendering") - << tcu::TestLog::Image("Result", "Result", surface) - << tcu::TestLog::Image("ErrorMask", "ErrorMask", errorMask) - << tcu::TestLog::EndImageSet; - - return false; + result = false; } else { - log << tcu::TestLog::Message << "No invalid pixels found." << tcu::TestLog::EndMessage; - log << tcu::TestLog::ImageSet("Verification result", "Result of rendering") - << tcu::TestLog::Image("Result", "Result", surface) - << tcu::TestLog::EndImageSet; + result = true; + } - return true; + // Output or stash results + { + VerifyTriangleGroupRasterizationLogStash* tempLogStash = (logStash == DE_NULL) ? new VerifyTriangleGroupRasterizationLogStash : logStash; + + tempLogStash->result = result; + tempLogStash->missingPixels = missingPixels; + tempLogStash->unexpectedPixels = unexpectedPixels; + tempLogStash->errorMask = errorMask; + + if (logStash == DE_NULL) + { + verifyTriangleGroupRasterizationLog(surface, log, *tempLogStash); + delete tempLogStash; + } } + + return result; } bool verifyLineGroupRasterization (const tcu::Surface& surface, const LineSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log) @@ -2402,14 +2429,46 @@ bool verifyLineGroupRasterization (const tcu::Surface& surface, const LineSceneS const bool multisampled = args.numSamples != 0; if (multisampled) - return verifyMultisampleLineGroupRasterization(surface, scene, args, log, CLIPMODE_NO_CLIPPING); + return verifyMultisampleLineGroupRasterization(surface, scene, args, log, CLIPMODE_NO_CLIPPING, DE_NULL); else return verifySinglesampleLineGroupRasterization(surface, scene, args, log); } bool verifyClippedTriangulatedLineGroupRasterization (const tcu::Surface& surface, const LineSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log) { - return verifyMultisampleLineGroupRasterization(surface, scene, args, log, CLIPMODE_USE_CLIPPING_BOX); + return verifyMultisampleLineGroupRasterization(surface, scene, args, log, CLIPMODE_USE_CLIPPING_BOX, DE_NULL); +} + +bool verifyRelaxedLineGroupRasterization (const tcu::Surface& surface, const LineSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log) +{ + VerifyTriangleGroupRasterizationLogStash noClippingLogStash; + VerifyTriangleGroupRasterizationLogStash useClippingLogStash; + + if (verifyMultisampleLineGroupRasterization(surface, scene, args, log, CLIPMODE_USE_CLIPPING_BOX, &useClippingLogStash)) + { + log << tcu::TestLog::Message << "Relaxed rasterization succeeded with CLIPMODE_USE_CLIPPING_BOX, details follow." << tcu::TestLog::EndMessage; + + verifyTriangleGroupRasterizationLog(surface, log, useClippingLogStash); + + return true; + } + else if (verifyMultisampleLineGroupRasterization(surface, scene, args, log, CLIPMODE_NO_CLIPPING, &noClippingLogStash)) + { + log << tcu::TestLog::Message << "Relaxed rasterization succeeded with CLIPMODE_NO_CLIPPING, details follow." << tcu::TestLog::EndMessage; + + verifyTriangleGroupRasterizationLog(surface, log, noClippingLogStash); + + return true; + } + else + { + log << tcu::TestLog::Message << "Relaxed rasterization failed, details follow." << tcu::TestLog::EndMessage; + + verifyTriangleGroupRasterizationLog(surface, log, useClippingLogStash); + verifyTriangleGroupRasterizationLog(surface, log, noClippingLogStash); + + return false; + } } bool verifyPointGroupRasterization (const tcu::Surface& surface, const PointSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log) diff --git a/framework/common/tcuRasterizationVerifier.hpp b/framework/common/tcuRasterizationVerifier.hpp index 31f88f86c..0815116a6 100644 --- a/framework/common/tcuRasterizationVerifier.hpp +++ b/framework/common/tcuRasterizationVerifier.hpp @@ -25,6 +25,7 @@ #include "tcuDefs.hpp" #include "tcuTestLog.hpp" +#include "tcuSurface.hpp" #include "deMath.h" #include @@ -101,6 +102,14 @@ struct RasterizationArguments int blueBits; }; +struct VerifyTriangleGroupRasterizationLogStash +{ + int missingPixels; + int unexpectedPixels; + tcu::Surface errorMask; + bool result; +}; + /*--------------------------------------------------------------------*//*! * \brief Calculates triangle coverage at given pixel * Calculates the coverage of a triangle given by three vertices. The @@ -116,10 +125,11 @@ CoverageType calculateTriangleCoverage (const tcu::Vec4& p0, const tcu::Vec4& p1 * by RasterizationArguments. Triangles should not be z-clipped. * * Triangle colors are not used. The triangle is expected to be white. + * If logStash is not NULL the results are not logged, but copied to stash. * * Returns false if invalid rasterization is found. *//*--------------------------------------------------------------------*/ -bool verifyTriangleGroupRasterization (const tcu::Surface& surface, const TriangleSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log, VerificationMode mode = VERIFICATIONMODE_STRICT); +bool verifyTriangleGroupRasterization (const tcu::Surface& surface, const TriangleSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log, VerificationMode mode = VERIFICATIONMODE_STRICT, VerifyTriangleGroupRasterizationLogStash* logStash = DE_NULL); /*--------------------------------------------------------------------*//*! * \brief Verify line rasterization result @@ -145,6 +155,16 @@ bool verifyLineGroupRasterization (const tcu::Surface& surface, const LineSceneS *//*--------------------------------------------------------------------*/ bool verifyClippedTriangulatedLineGroupRasterization (const tcu::Surface& surface, const LineSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log); +/*--------------------------------------------------------------------*//*! + * \brief Verify line rasterization result both clipped and non-clipped + * + * For details please see verifyLineGroupRasterization and + * verifyClippedTriangulatedLineGroupRasterization + * + * Returns false if both rasterizations are invalid. + *//*--------------------------------------------------------------------*/ +bool verifyRelaxedLineGroupRasterization (const tcu::Surface& surface, const LineSceneSpec& scene, const RasterizationArguments& args, tcu::TestLog& log); + /*--------------------------------------------------------------------*//*! * \brief Verify point rasterization result * Verifies points in the surface are rasterized within the bounds given -- cgit v1.2.3