Adjust cull_distance position on pixel center
authorJeannot Breton <jbreton@nvidia.com>
Tue, 2 May 2017 20:44:43 +0000 (15:44 -0500)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 12 May 2017 15:46:19 +0000 (11:46 -0400)
The primitive position is on the pixel edge, it should be on the
pixel center to be rendered at the expected location

Affects:

KHR-GL45.cull_distance.functional

Components: OpenGL

VK-GL-CTS issue: 396

Change-Id: I6f604c559894a4d9b1220a65935eb59b8b8e53e6

external/openglcts/modules/gl/gl3cCullDistanceTests.cpp

index 8c208427130be3ab7f345a0efc5b1dbb2580aacf..84bd8d3a7552f3c944cc39e766f0265d54daa5de 100644 (file)
@@ -1821,7 +1821,7 @@ void CullDistance::FunctionalTest::configureVAO(glw::GLuint clipdistances_array_
                1
        }; /* vertex x offsets to subgrid cell origin for point primitive    */
        const glw::GLuint offsets_point_draw_y[1] = {
-               2
+               1
        }; /* vertex y offsets to subgrid cell origin for point primitive    */
        const glw::GLuint offsets_point_checkpoint_x[1] = {
                1
@@ -1841,7 +1841,8 @@ void CullDistance::FunctionalTest::configureVAO(glw::GLuint clipdistances_array_
        const glw::GLuint offsets_triangle_checkpoint_y[3] = {
                1, sub_grid_cell_size - 2, 1
        }; /* pixel y offsets to subgrid cell origin for triangle primitive  */
-
+       const glw::GLfloat offsets_pixel_center_x = (primitive_mode == PRIMITIVE_MODE_POINTS) ? 0.5f : 0;
+       const glw::GLfloat offsets_pixel_center_y = (primitive_mode == PRIMITIVE_MODE_POINTS) ? 0.5f : 0;
        /* Clear data left from previous tests. */
        m_bo_data.clear();
 
@@ -2032,9 +2033,11 @@ void CullDistance::FunctionalTest::configureVAO(glw::GLuint clipdistances_array_
                                                glw::GLint sub_cell_origin_y = cell_y * grid_cell_size + n_sub_cell_y * sub_grid_cell_size;
                                                /* Normalized texture coordinates of vertex draw position. */
                                                glw::GLfloat x =
-                                                       glw::GLfloat(sub_cell_origin_x + vertex_draw_pixel_offset_x) / glw::GLfloat(m_to_width);
+                                                       (glw::GLfloat(sub_cell_origin_x + vertex_draw_pixel_offset_x) + offsets_pixel_center_x) /
+                                                       glw::GLfloat(m_to_width);
                                                glw::GLfloat y =
-                                                       glw::GLfloat(sub_cell_origin_y + vertex_draw_pixel_offset_y) / glw::GLfloat(m_to_height);
+                                                       (glw::GLfloat(sub_cell_origin_y + vertex_draw_pixel_offset_y) + offsets_pixel_center_y) /
+                                                       glw::GLfloat(m_to_height);
                                                /* Normalized texture coordinates of vertex checkpoint position. */
                                                glw::GLfloat checkpoint_x = glw::GLfloat(sub_cell_origin_x + vertex_checkpoint_pixel_offset_x) /
                                                                                                        glw::GLfloat(m_to_width);