From: Graeme Leese Date: Thu, 2 Mar 2017 15:08:20 +0000 (+0000) Subject: Fix indirect draw line offset calculation X-Git-Tag: upstream/0.1.0~490 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=04a7dd166549758c11022350b602dcd2b643b4d5;p=platform%2Fupstream%2FVK-GL-CTS.git Fix indirect draw line offset calculation The GL_LINES test was correctly avoiding undefined rasterizer tie-break conditions but other tests that draw lines were not. Include the fix in the other tests. Affects: KHR-GLES31.core.draw_indirect.basic-mode-draw*-line*_adjacency Components: OpenGL VK-GL-CTS issue: 193 Change-Id: I58862469b0bae3b5f968bad8586adc7cad6ad7c7 --- diff --git a/external/openglcts/modules/gles31/es31cDrawIndirectTests.cpp b/external/openglcts/modules/gles31/es31cDrawIndirectTests.cpp index 76af1b1..72e54eb 100644 --- a/external/openglcts/modules/gles31/es31cDrawIndirectTests.cpp +++ b/external/openglcts/modules/gles31/es31cDrawIndirectTests.cpp @@ -609,17 +609,22 @@ protected: } } + float LinesOffsetY(unsigned int i, float rasterSize) + { + // Offset lines slightly from the center of pixels so as not to hit rasterizer + // tie-break conditions (the right-edge of the screen at half-integer pixel + // heights is the right corner of a diamond). rasterSize/16 is the smallest + // offset that the spec guarantees the rasterizer can resolve. + return -1.0f + rasterSize * static_cast(i) + rasterSize / 2 + rasterSize / 16; + } + void LinesGen(unsigned int, unsigned int drawSizeY, CColorArray& output) { output.reserve(drawSizeY * 2); float rasterSize = 2.0f / static_cast(getWindowHeight()); for (unsigned int i = 0; i < drawSizeY; ++i) { - // Offset lines slightly from the center of pixels so as not to hit rasterizer - // tie-break conditions (the right-edge of the screen at half-integer pixel - // heights is the right corner of a diamond). rasterSize/16 is the smallest - // offset that the spec guarantees the rasterizer can resolve. - float offsetY = -1.0f + rasterSize * static_cast(i) + rasterSize / 2 + rasterSize / 16; + float offsetY = LinesOffsetY(i, rasterSize); output.push_back(tcu::Vec4(-1.0f, offsetY, 0.0f, 1.0f)); output.push_back(tcu::Vec4(1.0f, offsetY, 0.0f, 1.0f)); } @@ -630,7 +635,7 @@ protected: float rasterSize = 2.0f / static_cast(getWindowHeight()); for (unsigned int i = 0; i < drawSizeY; ++i) { - float offsetY = -1.0f + rasterSize * static_cast(i) + rasterSize / 2; + float offsetY = LinesOffsetY(i, rasterSize); output.push_back(tcu::Vec4(-1.5f, -1.0f + offsetY, 0.0f, 1.0f)); //adj output.push_back(tcu::Vec4(-1.0f, offsetY, 0.0f, 1.0f)); output.push_back(tcu::Vec4(1.0f, offsetY, 0.0f, 1.0f)); @@ -644,7 +649,7 @@ protected: output.push_back(tcu::Vec4(-1.5f, rasterSize / 2, 0.0f, 1.0f)); for (unsigned int i = 0; i < drawSizeY; ++i) { - float offsetY = -1.0f + rasterSize * static_cast(i) + rasterSize / 2; + float offsetY = LinesOffsetY(i, rasterSize); output.push_back(tcu::Vec4(-1.0f, offsetY, 0.0f, 1.0f)); output.push_back(tcu::Vec4(-1.0f, offsetY, 0.0f, 1.0f)); output.push_back(tcu::Vec4(1.0f, offsetY, 0.0f, 1.0f));