Fix indirect draw line offset calculation
authorGraeme Leese <gleese@broadcom.com>
Thu, 2 Mar 2017 15:08:20 +0000 (15:08 +0000)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 8 Mar 2017 16:20:58 +0000 (11:20 -0500)
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

external/openglcts/modules/gles31/es31cDrawIndirectTests.cpp

index 76af1b1..72e54eb 100644 (file)
@@ -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<float>(i) + rasterSize / 2 + rasterSize / 16;
+       }
+
        void LinesGen(unsigned int, unsigned int drawSizeY, CColorArray& output)
        {
                output.reserve(drawSizeY * 2);
                float rasterSize = 2.0f / static_cast<float>(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<float>(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<float>(getWindowHeight());
                for (unsigned int i = 0; i < drawSizeY; ++i)
                {
-                       float offsetY = -1.0f + rasterSize * static_cast<float>(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<float>(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));