[Piglit] [PATCH] primitive-restart: change test for new OpenGL 4.5 behavior

Mathias Fröhlich Mathias.Froehlich at gmx.net
Sat Aug 13 08:35:54 UTC 2016


On Thursday, 11 August 2016 13:11:38 CEST Nicolai Hähnle wrote:
> From: "Yang, Kefeng" <Kefeng.Yang at amd.com>
> 
> With OpenGL 4.5, the spec was changed to remove primitive restart from
> glDrawArrays and friends.

Ok, I have now spotted a difference between the 4.4 and 4.5 specs.
But it appears to me that primitive restart is basically staying, but is 
reduced to these cases that actually make sense somehow.

That is, primitive restart *stays* for all DrawElements calls and vanishes for 
almost all other cases.

So, the test should still test the DrawElement calls as before - also for gl 
>= 4.5.

best
Mathias

> ---
>  tests/general/primitive-restart.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/general/primitive-restart.c b/tests/general/primitive-
restart.c
> index 5cd8be3..48c2a11 100644
> --- a/tests/general/primitive-restart.c
> +++ b/tests/general/primitive-restart.c
> @@ -63,21 +63,21 @@ static char* vbo_cfg_names[] = {
>     "all",
>  };
>  
>  static VBO_CFG vbo_init_cfg = DISABLE_VBO;
>  
>  static const GLfloat red[4] = {1.0, 0.0, 0.0, 1.0};
>  static const GLfloat green[4] = {0.0, 1.0, 0.0, 0.0};
>  static const GLfloat black[4] = {0.0, 0.0, 0.0, 0.0};
>  
>  static bool Have_NV;
> -static bool Have_31;
> +static bool Have_31_to_44;
>  static bool TestGL31;
>  
>  
>  static bool
>  check_rendering(void)
>  {
>     const GLfloat x0 = 0.0, x1 = piglit_width - 10.0, dx = 20.0;
>     const GLint iy = piglit_height / 2;
>     bool draw = true;
>     GLfloat x;
> @@ -638,21 +638,21 @@ primitive_restart_test(VBO_CFG vbo_cfg)
>        pass = pass && test_draw_elements(vbo_cfg, GL_LINE_STRIP, 
GL_UNSIGNED_INT);
>        pass = pass && test_array_element(vbo_cfg, GL_TRIANGLE_STRIP, 
GL_UNSIGNED_BYTE);
>        pass = pass && test_array_element(vbo_cfg, GL_TRIANGLE_STRIP, 
GL_UNSIGNED_SHORT);
>        pass = pass && test_array_element(vbo_cfg, GL_TRIANGLE_STRIP, 
GL_UNSIGNED_INT);
>        pass = pass && test_array_element(vbo_cfg, GL_LINE_STRIP, 
GL_UNSIGNED_BYTE);
>        pass = pass && test_array_element(vbo_cfg, GL_LINE_STRIP, 
GL_UNSIGNED_SHORT);
>        pass = pass && test_array_element(vbo_cfg, GL_LINE_STRIP, 
GL_UNSIGNED_INT);
>        pass = pass && test_draw_arrays(vbo_cfg);
>     }
>  
> -   if (Have_31) {
> +   if (Have_31_to_44) {
>        TestGL31 = true;
>        pass = pass && test_draw_elements(vbo_cfg, GL_TRIANGLE_STRIP, 
GL_UNSIGNED_BYTE);
>        pass = pass && test_draw_elements(vbo_cfg, GL_TRIANGLE_STRIP, 
GL_UNSIGNED_SHORT);
>        pass = pass && test_draw_elements(vbo_cfg, GL_TRIANGLE_STRIP, 
GL_UNSIGNED_INT);
>        pass = pass && test_draw_elements(vbo_cfg, GL_LINE_STRIP, 
GL_UNSIGNED_BYTE);
>        pass = pass && test_draw_elements(vbo_cfg, GL_LINE_STRIP, 
GL_UNSIGNED_SHORT);
>        pass = pass && test_draw_elements(vbo_cfg, GL_LINE_STRIP, 
GL_UNSIGNED_INT);
>        pass = pass && test_array_element(vbo_cfg, GL_TRIANGLE_STRIP, 
GL_UNSIGNED_BYTE);
>        pass = pass && test_array_element(vbo_cfg, GL_TRIANGLE_STRIP, 
GL_UNSIGNED_SHORT);
>        pass = pass && test_array_element(vbo_cfg, GL_TRIANGLE_STRIP, 
GL_UNSIGNED_INT);
> @@ -680,35 +680,37 @@ piglit_display(void)
>     } else {
>        return primitive_restart_test(vbo_init_cfg) ? PIGLIT_PASS : 
PIGLIT_FAIL;
>     }
>  }
>  
>  
>  void
>  piglit_init(int argc, char **argv)
>  {
>     Have_NV = piglit_is_extension_supported("GL_NV_primitive_restart");
> -   Have_31 = piglit_get_gl_version() >= 31;
> +
> +   //In OGL 4.5, the PRIMITIVE_RESTART feature for DA-style draws is 
deprecated
> +   Have_31_to_44 = piglit_get_gl_version() >= 31 && piglit_get_gl_version() 
<= 44;
>  
>     if (argc >= 2) {
>        VBO_CFG vbo_cfg;
>        for (vbo_cfg = 0; vbo_cfg < ARRAY_SIZE(vbo_cfg_names); vbo_cfg++) {
>           if (strcmp(argv[1], vbo_cfg_names[vbo_cfg]) == 0) {
>              vbo_init_cfg = vbo_cfg;
>              break;
>           }
>        }
>     }
>  
>     /* Debug */
>     if (0) {
>        printf("Have NV: %d\n", Have_NV);
> -      printf("Have 31: %d\n", Have_31);
> +      printf("Have 31 to 44: %d\n", Have_31_to_44);
>     }
>  
> -   if (!Have_NV && !Have_31) {
> +   if (!Have_NV && !Have_31_to_44) {
>        piglit_report_result(PIGLIT_SKIP);
>        exit(1);
>     }
>  
>     glClearColor(0, 0, 0, 0);
>  }
> 




More information about the Piglit mailing list