From 3116016d8e0e4582396d67a1286aa3a6815a3332 Mon Sep 17 00:00:00 2001 From: Petros Bantolas Date: Wed, 18 Jul 2018 11:19:04 +0100 Subject: [PATCH] Fix subpixel precision for line geometry generation Line geometry generation for rasterization tests wasn't taking the HW subPixelPrecisionBits limit into account. Modified the triangle creation routines to round those coordinates down to the driver provided precision. Affects: dEQP-VK.rasterization.*line* dEQP-GLES*.functional.rasterization.*line* Components: Framework VK-GL-CTS issue: 1274 Change-Id: I54af2f9606372bead2a8c7238588374101f80e55 --- framework/common/tcuRasterizationVerifier.cpp | 32 ++++++++++++++++++--------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/framework/common/tcuRasterizationVerifier.cpp b/framework/common/tcuRasterizationVerifier.cpp index dd8ff86..12de7e8 100644 --- a/framework/common/tcuRasterizationVerifier.cpp +++ b/framework/common/tcuRasterizationVerifier.cpp @@ -936,15 +936,21 @@ bool verifyMultisampleLineGroupRasterization (const tcu::Surface& surface, const (lineNormalizedDeviceSpace[1] + tcu::Vec2(1.0f, 1.0f)) * 0.5f * viewportSize, }; - const tcu::Vec2 lineDir = tcu::normalize(lineScreenSpace[1] - lineScreenSpace[0]); + const tcu::Vec2 lineScreenSpaceRounded[2] = + { + tcu::Vec2(deFloatRound(lineScreenSpace[0].x() * (float)(1 << args.subpixelBits)) / (float)(1 << args.subpixelBits), deFloatRound(lineScreenSpace[0].y() * (float)(1 << args.subpixelBits)) / (float)(1 << args.subpixelBits)), + tcu::Vec2(deFloatRound(lineScreenSpace[1].x() * (float)(1 << args.subpixelBits)) / (float)(1 << args.subpixelBits), deFloatRound(lineScreenSpace[1].y() * (float)(1 << args.subpixelBits)) / (float)(1 << args.subpixelBits)) + }; + + const tcu::Vec2 lineDir = tcu::normalize(lineScreenSpaceRounded[1] - lineScreenSpaceRounded[0]); const tcu::Vec2 lineNormalDir = tcu::Vec2(lineDir.y(), -lineDir.x()); const tcu::Vec2 lineQuadScreenSpace[4] = { - lineScreenSpace[0] + lineNormalDir * halfLineWidth, - lineScreenSpace[0] - lineNormalDir * halfLineWidth, - lineScreenSpace[1] - lineNormalDir * halfLineWidth, - lineScreenSpace[1] + lineNormalDir * halfLineWidth, + lineScreenSpaceRounded[0] + lineNormalDir * halfLineWidth, + lineScreenSpaceRounded[0] - lineNormalDir * halfLineWidth, + lineScreenSpaceRounded[1] - lineNormalDir * halfLineWidth, + lineScreenSpaceRounded[1] + lineNormalDir * halfLineWidth, }; const tcu::Vec2 lineQuadNormalizedDeviceSpace[4] = { @@ -989,15 +995,21 @@ bool verifyMultisampleLineGroupInterpolation (const tcu::Surface& surface, const (lineNormalizedDeviceSpace[1] + tcu::Vec2(1.0f, 1.0f)) * 0.5f * viewportSize, }; - const tcu::Vec2 lineDir = tcu::normalize(lineScreenSpace[1] - lineScreenSpace[0]); + const tcu::Vec2 lineScreenSpaceRounded[2] = + { + tcu::Vec2(deFloatRound(lineScreenSpace[0].x() * (float)(1 << args.subpixelBits)) / (float)(1 << args.subpixelBits), deFloatRound(lineScreenSpace[0].y() * (float)(1 << args.subpixelBits)) / (float)(1 << args.subpixelBits)), + tcu::Vec2(deFloatRound(lineScreenSpace[1].x() * (float)(1 << args.subpixelBits)) / (float)(1 << args.subpixelBits), deFloatRound(lineScreenSpace[1].y() * (float)(1 << args.subpixelBits)) / (float)(1 << args.subpixelBits)) + }; + + const tcu::Vec2 lineDir = tcu::normalize(lineScreenSpaceRounded[1] - lineScreenSpaceRounded[0]); const tcu::Vec2 lineNormalDir = tcu::Vec2(lineDir.y(), -lineDir.x()); const tcu::Vec2 lineQuadScreenSpace[4] = { - lineScreenSpace[0] + lineNormalDir * halfLineWidth, - lineScreenSpace[0] - lineNormalDir * halfLineWidth, - lineScreenSpace[1] - lineNormalDir * halfLineWidth, - lineScreenSpace[1] + lineNormalDir * halfLineWidth, + lineScreenSpaceRounded[0] + lineNormalDir * halfLineWidth, + lineScreenSpaceRounded[0] - lineNormalDir * halfLineWidth, + lineScreenSpaceRounded[1] - lineNormalDir * halfLineWidth, + lineScreenSpaceRounded[1] + lineNormalDir * halfLineWidth, }; const tcu::Vec2 lineQuadNormalizedDeviceSpace[4] = { -- 2.7.4