diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-01-19 14:02:16 -0500 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-01-21 14:53:17 -0500 |
commit | 3e3e873b2f38044dad60ba4103e352d8a76f41d1 (patch) | |
tree | c88c7e3e8a77ff92f8e7f67e75e9c4f2f0ab36ed | |
parent | 1e7ca7fc900fbf59a37e84b46c2a2fb69686dc1f (diff) |
shader_runner: add basic depthbuffer testing support
This commit adds an optional 'depthbuffer' line to the [require]
section as well as the possibility of enabling/disabling GL_DEPTH_TEST
and probing depth values.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r-- | tests/shaders/shader_runner.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index 431aa2a3e..6783b6fd4 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -1210,6 +1210,7 @@ struct requirement_parse_results { bool found_gl; bool found_glsl; bool found_size; + bool found_depthbuffer; struct component_version gl_version; struct component_version glsl_version; unsigned size[2]; @@ -1227,6 +1228,7 @@ parse_required_config(struct requirement_parse_results *results, results->found_gl = false; results->found_glsl = false; results->found_size = false; + results->found_depthbuffer = false; if (line == NULL) { printf("could not read file \"%s\"\n", script_name); @@ -1274,6 +1276,8 @@ parse_required_config(struct requirement_parse_results *results, } else if (string_match("SIZE", line)) { results->found_size = true; get_uints(line+4, results->size, 2); + } else if (string_match("depthbuffer", line)) { + results->found_depthbuffer = true; } } @@ -1330,7 +1334,7 @@ choose_required_gl_version(struct requirement_parse_results *parse_results, * * The requirements section can't be fully processed until after the context * is created, but the context can't be created until after the requirements - * section is processed. Do a quick can over the requirements section to find + * section is processed. Do a quick scan over the requirements section to find * the GL and GLSL version requirements. Use these to guide context creation. */ void @@ -1357,6 +1361,10 @@ get_required_config(const char *script_name, } else { config->supports_gl_compat_version = 10; } + + if (parse_results.found_depthbuffer) { + config->window_visual |= PIGLIT_GL_VISUAL_DEPTH; + } } void @@ -2396,6 +2404,7 @@ static const struct string_to_enum enable_table[] = { { "GL_CLIP_PLANE7", GL_CLIP_PLANE0+7 }, { "GL_VERTEX_PROGRAM_TWO_SIDE", GL_VERTEX_PROGRAM_TWO_SIDE }, { "GL_PROGRAM_POINT_SIZE", GL_PROGRAM_POINT_SIZE }, + { "GL_DEPTH_TEST", GL_DEPTH_TEST }, { NULL, 0 } }; @@ -2759,6 +2768,10 @@ piglit_display(void) get_floats(line + 11, c, 4); glClearColor(c[0], c[1], c[2], c[3]); clear_bits |= GL_COLOR_BUFFER_BIT; + } else if (string_match("clear depth", line)) { + get_floats(line + 11, c, 1); + glClearDepth(c[0]); + clear_bits |= GL_DEPTH_BUFFER_BIT; } else if (string_match("clear", line)) { glClear(clear_bits); } else if (sscanf(line, @@ -2933,6 +2946,12 @@ piglit_display(void) & c[2])) { pass = false; } + } else if (string_match("probe depth", line)) { + get_floats(line + 11, c, 3); + if (!piglit_probe_pixel_depth((int) c[0], (int) c[1], + c[2])) { + pass = false; + } } else if (sscanf(line, "probe atomic counter %d %s %d", &x, s, &y) == 3) { |