SPIRV YES/ONLY assumes that the test includes the SPIR-V shader, and that you should use it. This commit checks that this really happens, and prints a proper error message.
Without this commit, a SPIRV YES/ONLY test that by mistake didn't include the [spirv xx] sections would be just skipped with the following non-intuitive message: "Function "glDeleteProgramsARB" not supported on this implementation" --- tests/shaders/shader_runner.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index 1795d66ce..8acb76317 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -1622,6 +1622,7 @@ process_test_script(const char *script_name) enum states state = none; const char *line = text; enum piglit_result result; + bool test_really_contains_spirv = false; if (line == NULL) { printf("could not read file \"%s\"\n", script_name); @@ -1651,6 +1652,7 @@ process_test_script(const char *script_name) shader_string_size = strlen(shader_string); } else if (parse_str(line, "[vertex shader spirv]", NULL)) { state = vertex_shader_spirv; + test_really_contains_spirv = true; shader_string = NULL; } else if (parse_str(line, "[vertex shader specializations]", NULL)) { state = vertex_shader_specializations; @@ -1659,6 +1661,7 @@ process_test_script(const char *script_name) shader_string = NULL; } else if (parse_str(line, "[tessellation control shader spirv]", NULL)) { state = tess_ctrl_shader_spirv; + test_really_contains_spirv = true; shader_string = NULL; } else if (parse_str(line, "[tessellation control shader specializations]", NULL)) { state = tess_ctrl_shader_specializations; @@ -1667,6 +1670,7 @@ process_test_script(const char *script_name) shader_string = NULL; } else if (parse_str(line, "[tessellation evaluation shader spirv]", NULL)) { state = tess_eval_shader_spirv; + test_really_contains_spirv = true; shader_string = NULL; } else if (parse_str(line, "[tessellation evaluation shader specializations]", NULL)) { state = tess_eval_shader_specializations; @@ -1677,6 +1681,7 @@ process_test_script(const char *script_name) state = geometry_shader_specializations; } else if (parse_str(line, "[geometry shader spirv]", NULL)) { state = geometry_shader_spirv; + test_really_contains_spirv = true; shader_string = NULL; } else if (parse_str(line, "[geometry shader specializations]", NULL)) { state = geometry_shader_specializations; @@ -1693,6 +1698,7 @@ process_test_script(const char *script_name) state = fragment_shader_specializations; } else if (parse_str(line, "[fragment shader spirv]", NULL)) { state = fragment_shader_spirv; + test_really_contains_spirv = true; shader_string = NULL; } else if (parse_str(line, "[fragment shader specializations]", NULL)) { state = fragment_shader_specializations; @@ -1701,6 +1707,7 @@ process_test_script(const char *script_name) shader_string = NULL; } else if (parse_str(line, "[compute shader spirv]", NULL)) { state = compute_shader_spirv; + test_really_contains_spirv = true; shader_string = NULL; } else if (parse_str(line, "[compute shader specializations]", NULL)) { state = compute_shader_specializations; @@ -1712,6 +1719,15 @@ process_test_script(const char *script_name) test_start_line_num = line_num + 1; if (test_start[0] != '\0') test_start++; + + if (!test_really_contains_spirv && + spirv_replaces_glsl) { + fprintf(stderr, "SPIRV YES/ONLY test, but" + " spirv section was not found.\n"); + + return PIGLIT_FAIL; + } + return PIGLIT_PASS; } else { fprintf(stderr, @@ -1783,6 +1799,14 @@ process_test_script(const char *script_name) line_num++; } + if (!test_really_contains_spirv && + spirv_replaces_glsl) { + fprintf(stderr, "SPIRV YES/ONLY test, but" + " spirv section was not found.\n"); + + return PIGLIT_FAIL; + } + return leave_state(state, line, script_name); } -- 2.14.1 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit