Commit 4ff6e9d3 authored by Alejandro Piñeiro's avatar Alejandro Piñeiro Committed by Arcady Goldmints-Orlov

shader_runner: add support for glGetProgram queries

Similar to the already existing verify program_interface_query, but
with the glGetProgramiv queries.

Useful, for example, to verify the current number of active uniforms
(via GL_ACTIVE_UNIFORMS).

Note that now there are two ways to verify link success. With the
already existing "link succes" shader runner query, or using this one:

   vefiry program_query GL_LINK_STATUS GL_TRUE

Although internally they are checked in a different way. It is pending
to check if there are corner cases where they return a different
value.

v2: Add GL_LINE_STRIP and GL_TRIANGLE_STRIP as valid results for the
    query (Antia Puentes).

v3: add special error case for GL_COMPUTE_WORK_GROUP_SIZE, and add
    TODO comment (Caio Marcelo)
Signed-off-by: Alejandro Piñeiro's avatarAlejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Antía Puentes's avatarAntia Puentes <apuentes@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho's avatarCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
parent b788e379
......@@ -2789,6 +2789,95 @@ set_subroutine_uniform(const char *line)
return;
}
/**
* Query values from current program using glGetProgram.
*
* Format of the command:
* verify program_query GL_PNAME_ENUM integer
*
* or
*
* verify program_query GL_PNAME_ENUM <enum>
*
* Note: GL_COMPUTE_WORK_GROUP_SIZE is not supported, as is the only
* query that requires a params with more than one component, and we
* want to keep things simple.
*
*/
static void
verify_program_query(const char *line)
{
static const struct string_to_enum all_pnames[] = {
ENUM_STRING(GL_DELETE_STATUS),
ENUM_STRING(GL_LINK_STATUS),
ENUM_STRING(GL_VALIDATE_STATUS),
ENUM_STRING(GL_INFO_LOG_LENGTH),
ENUM_STRING(GL_ATTACHED_SHADERS),
ENUM_STRING(GL_ACTIVE_ATOMIC_COUNTER_BUFFERS),
ENUM_STRING(GL_ACTIVE_ATTRIBUTES),
ENUM_STRING(GL_ACTIVE_ATTRIBUTE_MAX_LENGTH),
ENUM_STRING(GL_ACTIVE_UNIFORMS),
ENUM_STRING(GL_ACTIVE_UNIFORM_BLOCKS),
ENUM_STRING(GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH),
ENUM_STRING(GL_ACTIVE_UNIFORM_MAX_LENGTH),
ENUM_STRING(GL_COMPUTE_WORK_GROUP_SIZE),
ENUM_STRING(GL_PROGRAM_BINARY_LENGTH),
ENUM_STRING(GL_TRANSFORM_FEEDBACK_BUFFER_MODE),
ENUM_STRING(GL_TRANSFORM_FEEDBACK_VARYINGS),
ENUM_STRING(GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH),
ENUM_STRING(GL_GEOMETRY_VERTICES_OUT),
ENUM_STRING(GL_GEOMETRY_INPUT_TYPE),
ENUM_STRING(GL_GEOMETRY_OUTPUT_TYPE),
{ NULL, 0 }
};
static const struct string_to_enum all_possible_param_enums[] = {
ENUM_STRING(GL_TRUE),
ENUM_STRING(GL_FALSE),
ENUM_STRING(GL_SEPARATE_ATTRIBS),
ENUM_STRING(GL_INTERLEAVED_ATTRIBS),
ENUM_STRING(GL_POINTS),
ENUM_STRING(GL_LINES),
ENUM_STRING(GL_LINES_ADJACENCY),
ENUM_STRING(GL_TRIANGLES),
ENUM_STRING(GL_TRIANGLES_ADJACENCY),
ENUM_STRING(GL_LINE_STRIP),
ENUM_STRING(GL_TRIANGLE_STRIP),
ENUM_STRING(GL_COMPUTE_WORK_GROUP_SIZE),
{ NULL, 0 }
};
unsigned pname;
int expected;
int value;
REQUIRE(parse_enum_tab(all_pnames, line,
&pname, &line),
"Bad glGetProgram pname at: %s\n", line);
REQUIRE(parse_enum_tab(all_possible_param_enums, line, (unsigned *)&expected, &line) ||
parse_int(line, &expected, &line),
"Bad expected value at: %s\n", line);
if (pname == GL_COMPUTE_WORK_GROUP_SIZE) {
/* TODO: eventually it would be good to add support for
* this parameter. What it makes different to the rest is
* that it requires a param with more than one component
*/
fprintf(stderr, "glGetProgram queries with GL_COMPUTE_WORK_GROUP_SIZE "
"not supported yet\n");
piglit_report_result(PIGLIT_FAIL);
}
glGetProgramiv(prog, pname, &value);
if (expected != value) {
fprintf(stderr, "glGetProgram(%s): expected %d, got %d\n",
piglit_get_gl_enum_name(pname), expected, value);
piglit_report_result(PIGLIT_FAIL);
}
}
/**
* Query a uniform using glGetActiveUniformsiv
*
......@@ -4579,6 +4668,8 @@ piglit_display(void)
parse_ints(rest, &ubo_array_index, 1, NULL);
} else if (parse_str(line, "active uniform ", &rest)) {
active_uniform(rest);
} else if (parse_str(line, "verify program_query", &rest)) {
verify_program_query(rest);
} else if (parse_str(line, "verify program_interface_query ", &rest)) {
active_program_interface(rest);
} else if (parse_str(line, "vertex attrib ", &rest)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment