[2/4] gen_variable_index_read_tests use bools instead of 0 and 1

Submitted by Dylan Baker on April 13, 2015, 11:18 p.m.

Details

Message ID 1428967102-8930-3-git-send-email-baker.dylan.c@gmail.com
State New, archived
Headers show

Not browsing as part of any series.

Commit Message

Dylan Baker April 13, 2015, 11:18 p.m.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
---
 .../gen_variable_index_read_tests/fs.shader_test.mako        |  4 ++--
 .../templates/gen_variable_index_read_tests/helpers.mako     | 12 +++++-------
 .../gen_variable_index_read_tests/vs.shader_test.mako        |  4 ++--
 3 files changed, 9 insertions(+), 11 deletions(-)

Patch hide | download patch | download mbox

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 39b0be5..b7c22c2 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
@@ -24,8 +24,8 @@  ${helpers.license()}
 
 ${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 cb0bff4..dcbcb92 100644
--- a/generated_tests/templates/gen_variable_index_read_tests/helpers.mako
+++ b/generated_tests/templates/gen_variable_index_read_tests/helpers.mako
@@ -119,7 +119,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)}
@@ -128,11 +127,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:
        *
@@ -153,14 +152,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
@@ -168,12 +166,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 b2f8138..c35193e 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
@@ -24,8 +24,8 @@  ${helpers.license()}
 
 ${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)}