[Piglit] [PATCH 2/4] gen_variable_index_read_tests use bools instead of 0 and 1
Dylan Baker
baker.dylan.c at gmail.com
Fri Mar 27 12:01:25 PDT 2015
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
3 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/generated_tests/templates/gen_variable_index_read_tests/fs.shader_test.mako b/generated_tests/templates/gen_variable_index_read_tests/fs.shader_test.mako
index 33f5a78..0009bdc 100644
--- a/generated_tests/templates/gen_variable_index_read_tests/fs.shader_test.mako
+++ b/generated_tests/templates/gen_variable_index_read_tests/fs.shader_test.mako
@@ -41,8 +41,8 @@
${helpers.emit_header(params)}
-${helpers.emit_vs(params, 0)}
+${helpers.emit_vs(params, False)}
-${helpers.emit_fs(params, 1)}
+${helpers.emit_fs(params, True)}
${helpers.emit_test_vectors(params)}
diff --git a/generated_tests/templates/gen_variable_index_read_tests/helpers.mako b/generated_tests/templates/gen_variable_index_read_tests/helpers.mako
index cb3d922..7c9305f 100644
--- a/generated_tests/templates/gen_variable_index_read_tests/helpers.mako
+++ b/generated_tests/templates/gen_variable_index_read_tests/helpers.mako
@@ -99,7 +99,6 @@ ${base_type}(${matrix_data(c * matrix_dim**2 + 1, matrix_dim)})\
varying vec4 color;
</%def>
-## TODO: convert do_compare into a bool
<%def name="emit_vs(params, do_compare)" filter="newlines">
[vertex shader]
${emit_globals(params)}
@@ -108,11 +107,11 @@ void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- % if params.mode == 'varying' or (params.mode == 'temp' and do_compare != 0):
+ % if params.mode == 'varying' or (params.mode == 'temp' and do_compare):
${emit_set_matrix(params)}
% endif
- % if do_compare != 0:
+ % if do_compare:
% if params.mode == 'varying':
/* From page 23 (page 30 of the PDF) of the GLSL 1.10 spec:
*
@@ -133,14 +132,13 @@ void main()
}
</%def>
-## TODO: convert do_compare into a bool
<%def name="emit_fs(params, do_compare)" filter="newlines">
[fragment shader]
${emit_globals(params)}
void main()
{
- % if do_compare == 0 and params.mode == 'varying':
+ % if not do_compare and params.mode == 'varying':
/* There is some trickery here. The fragment shader has to actually use
* the varyings generated by the vertex shader, or the compiler (more
* likely the linker) might demote the varying outputs to just be vertex
@@ -148,12 +146,12 @@ void main()
* shader reading from a varying, that would defeat the test.
*/
% endif
- % if do_compare != 0 or params.mode == 'varying':
+ % if do_compare or params.mode == 'varying':
% if params.mode == 'temp':
${emit_set_matrix(params)}
% endif
gl_FragColor = (m${params.idx}[${params.col}]${params.row} == expect) \
- % if do_compare == 0:
+ % if not do_compare:
? color : vec4(1.0, 0.0, 0.0, 1.0);
% else:
? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
diff --git a/generated_tests/templates/gen_variable_index_read_tests/vs.shader_test.mako b/generated_tests/templates/gen_variable_index_read_tests/vs.shader_test.mako
index 3d20499..507d3d7 100644
--- a/generated_tests/templates/gen_variable_index_read_tests/vs.shader_test.mako
+++ b/generated_tests/templates/gen_variable_index_read_tests/vs.shader_test.mako
@@ -41,8 +41,8 @@
${helpers.emit_header(params)}
-${helpers.emit_vs(params, 1)}
+${helpers.emit_vs(params, True)}
-${helpers.emit_fs(params, 0)}
+${helpers.emit_fs(params, False)}
${helpers.emit_test_vectors(params)}
--
2.3.4
More information about the Piglit
mailing list