From 1e774422fcf8e6c9aadcef541d50fc2de893ec23 Mon Sep 17 00:00:00 2001 From: Jeannot Breton Date: Tue, 2 May 2017 15:44:43 -0500 Subject: [PATCH] Adjust cull_distance position on pixel center 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 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/external/openglcts/modules/gl/gl3cCullDistanceTests.cpp b/external/openglcts/modules/gl/gl3cCullDistanceTests.cpp index 8c20842..84bd8d3 100644 --- a/external/openglcts/modules/gl/gl3cCullDistanceTests.cpp +++ b/external/openglcts/modules/gl/gl3cCullDistanceTests.cpp @@ -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); -- 2.7.4