[Piglit] [PATCH] generators/gen_vs_in_fp64: Different VBO values per vertex
Juan A. Suarez Romero
jasuarez at igalia.com
Thu Jul 14 14:16:33 UTC 2016
Acked-by: Juan A. Suarez <jasuarez at igalia.com>
On Wed, 2016-07-06 at 14:40 +0300, Andres Gomez wrote:
> Before, in every drawing we were having the same VBO values per
> vertex
> to be compared against the values in the uniforms. Now, we also have
> different values per vertex so we can be sure that it is truly its
> own
> data.
>
> Signed-off-by: Andres Gomez <agomez at igalia.com>
> ---
> .../gen_vs_in_fp64/columns.shader_test.mako | 41
> ++++++++++++---------
> .../gen_vs_in_fp64/regular.shader_test.mako | 43
> +++++++++++++---------
> 2 files changed, 49 insertions(+), 35 deletions(-)
>
> diff --git
> a/generated_tests/templates/gen_vs_in_fp64/columns.shader_test.mako
> b/generated_tests/templates/gen_vs_in_fp64/columns.shader_test.mako
> index 2dfb723..f094a03 100644
> ---
> a/generated_tests/templates/gen_vs_in_fp64/columns.shader_test.mako
> +++
> b/generated_tests/templates/gen_vs_in_fp64/columns.shader_test.mako
> @@ -48,7 +48,9 @@ GLSL >= ${glsl}
> #extension GL_ARB_vertex_attrib_64bit : require
> % endif
>
> -uniform ${mat.name} expected;
> +% for vidx in range(4):
> + uniform ${mat.name} expected${vidx};
> +% endfor
>
> in ${mat.name} value;
> in vec3 piglit_vertex;
> @@ -59,15 +61,18 @@ out vec4 fs_color;
>
> void main()
> {
> - gl_Position = vec4(piglit_vertex, 1.0);
> - % for idx, column in enumerate(columns):
> - % if column == 1:
> - if (value[${idx}] != expected[${idx}]) {
> - fs_color = RED;
> - return;
> - }
> - ## XXX: should we break here?
> - % endif
> + gl_Position = vec4(piglit_vertex.x, piglit_vertex.y, 0.0, 1.0);
> + % for vidx, vertex in enumerate(['-1.0', '0.0', '1.0', '2.0']):
> + if (piglit_vertex.z == ${vertex}) {
> + % for idx, column in enumerate(columns):
> + % if column == 1:
> + if (value[${idx}] != expected${vidx}[${idx}]) {
> + fs_color = RED;
> + return;
> + }
> + % endif
> + % endfor
> + }
> % endfor
> fs_color = GREEN;
> }
> @@ -90,11 +95,11 @@ piglit_vertex/float/vec3\
> % endfor
>
> % for d in range(len(dvalues)):
> - % for vertex in ('-1.0 -1.0 0.0', ' 1.0 -1.0 0.0', '
> 1.0 1.0 0.0', '-1.0 1.0 0.0'):
> + % for vidx, vertex in enumerate(['-1.0 -1.0 -1.0', ' 1.0
> -1.0 0.0', ' 1.0 1.0 1.0', '-1.0 1.0 2.0']):
> ${vertex} \
> % for i in range(mat.columns):
> % for j in range(mat.rows):
> -${dvalues[(d + i * mat.rows + j) % len(dvalues)]} \
> +${dvalues[(d + i * mat.rows + j + vidx) % len(dvalues)]} \
> % endfor
> \
> % endfor
> @@ -105,13 +110,15 @@ ${dvalues[(d + i * mat.rows + j) %
> len(dvalues)]} \
> [test]
> % for d in range(len(dvalues)):
>
> - uniform ${mat.name} expected\
> - % for i in range(mat.columns):
> - % for j in range(mat.rows):
> - ${dvalues[(d + i * mat.rows + j) % len(dvalues)]}\
> + % for vidx in range(4):
> + uniform ${mat.name} expected${vidx}\
> + % for i in range(mat.columns):
> + % for j in range(mat.rows):
> + ${dvalues[(d + i * mat.rows + j + vidx) % len(dvalues)]}\
> + % endfor
> % endfor
> - % endfor
>
> + % endfor
> clear color 0.0 0.0 1.0 0.0
> clear
> draw arrays GL_TRIANGLE_FAN ${d * 4} 4
> diff --git
> a/generated_tests/templates/gen_vs_in_fp64/regular.shader_test.mako
> b/generated_tests/templates/gen_vs_in_fp64/regular.shader_test.mako
> index b6fab62..5620cbe 100644
> ---
> a/generated_tests/templates/gen_vs_in_fp64/regular.shader_test.mako
> +++
> b/generated_tests/templates/gen_vs_in_fp64/regular.shader_test.mako
> @@ -50,7 +50,9 @@ GL_MAX_VERTEX_ATTRIBS >= ${num_vs_in}
> % endif
>
> % for idx, in_type in enumerate(in_types):
> - uniform ${in_type.name} expected${idx}${'[{}]'.format(arrays[idx])
> if arrays[idx] - 1 else ''};
> + % for vidx in range(4):
> + uniform ${in_type.name}
> expected${idx}${vidx}${'[{}]'.format(arrays[idx]) if arrays[idx] - 1
> else ''};
> + % endfor
> % endfor
> % for idx, in_type in enumerate(in_types):
> in ${in_type.name} value${idx}${'[{}]'.format(arrays[idx]) if
> arrays[idx] - 1 else ''};
> @@ -63,13 +65,16 @@ out vec4 fs_color;
>
> void main()
> {
> - gl_Position = vec4(piglit_vertex, 1.0);
> - % for idx, in_type in enumerate(in_types):
> - if (value${idx} != expected${idx}) {
> - fs_color = RED;
> - return;
> - }
> - ## XXX: should this have a break?
> + gl_Position = vec4(piglit_vertex.x, piglit_vertex.y, 0.0, 1.0);
> + % for vidx, vertex in enumerate(['-1.0', '0.0', '1.0', '2.0']):
> + if (piglit_vertex.z == ${vertex}) {
> + % for idx, in_type in enumerate(in_types):
> + if (value${idx} != expected${idx}${vidx}) {
> + fs_color = RED;
> + return;
> + }
> + % endfor
> + }
> % endfor
> fs_color = GREEN;
> }
> @@ -101,7 +106,7 @@ void main()
> % endif
>
> % for d in range(len(gl_types_values['double'])):
> - % for vertex in ('-1.0 -1.0 0.0', ' 1.0 -1.0 0.0', '
> 1.0 1.0 0.0', '-1.0 1.0 0.0'):
> + % for vidx, vertex in enumerate(['-1.0 -1.0 -1.0', ' 1.0
> -1.0 0.0', ' 1.0 1.0 1.0', '-1.0 1.0 2.0']):
> % for idx, in_type in enumerate(in_types):
> % if idx == position_order - 1:
> ${vertex} \
> @@ -109,7 +114,7 @@ void main()
> % for i in range(arrays[idx]):
> % for j in range(in_type.columns):
> % for k in range(in_type.rows):
> - ${gl_types_values[gl_types[idx]][(d + (i *
> in_type.columns + j) * in_type.rows + k) %
> len(gl_types_values[gl_types[idx]])]} \
> + ${gl_types_values[gl_types[idx]][(d + (i *
> in_type.columns + j) * in_type.rows + k + vidx) %
> len(gl_types_values[gl_types[idx]])]} \
> % endfor
> \
> % endfor
> @@ -125,16 +130,18 @@ void main()
> [test]
> % for d in range(len(gl_types_values['double'])):
>
> - % for idx, in_type in enumerate(in_types):
> - % for i in range(arrays[idx]):
> - uniform ${in_type.name} expected${idx}${'[{}]'.format(i) if
> arrays[idx] > 1 else ''}\
> - % for j in range(in_type.columns):
> - % for k in range(in_type.rows):
> - ## Careful: these are the values for the VBO type, not the
> uniform type. If we use the hex format they should match or the run
> will fail.
> - ${gl_types_values[gl_types[idx]][(d + (i * in_type.columns
> + j) * in_type.rows + k) % len(gl_types_values[gl_types[idx]])]}\
> + % for vidx in range(4):
> + % for idx, in_type in enumerate(in_types):
> + % for i in range(arrays[idx]):
> + uniform ${in_type.name}
> expected${idx}${vidx}${'[{}]'.format(i) if arrays[idx] > 1 else ''}\
> + % for j in range(in_type.columns):
> + % for k in range(in_type.rows):
> + ## Careful: these are the values for the VBO type, not
> the uniform type. If we use the hex format they should match or the
> run will fail.
> + ${gl_types_values[gl_types[idx]][(d + (i *
> in_type.columns + j) * in_type.rows + k + vidx) %
> len(gl_types_values[gl_types[idx]])]}\
> + % endfor
> % endfor
> - % endfor
>
> + % endfor
> % endfor
> % endfor
> clear color 0.0 0.0 1.0 0.0
More information about the Piglit
mailing list