[Piglit] [PATCH 6/6] gen_variable_index_read_tests: make params.col behave like row

Dylan Baker baker.dylan.c at gmail.com
Fri May 29 12:37:39 PDT 2015


params.row and params.idx automatically add [] around the value for
lookups. col is unique in that it doesn't. This patch changes the
behavior to be more like the other parameters.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 generated_tests/gen_variable_index_read_tests.py                  | 8 ++++++--
 .../templates/gen_variable_index_read_tests/helpers.mako          | 8 ++++----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/generated_tests/gen_variable_index_read_tests.py b/generated_tests/gen_variable_index_read_tests.py
index f28087b..8c050c9 100644
--- a/generated_tests/gen_variable_index_read_tests.py
+++ b/generated_tests/gen_variable_index_read_tests.py
@@ -49,7 +49,7 @@ class TestParams(object):
         self.array_dim = array_dim
         self.mode = mode
         self.index_value = index_value
-        self.col = col
+        self.__col = col
         self.expect_type = expect_type
 
         assert glsl_version in [110, 120]
@@ -97,6 +97,10 @@ class TestParams(object):
             return ''
 
     @lazy_property
+    def col(self):
+        return '[{}]'.format(self.__col)
+
+    @lazy_property
     def test_sizes(self):
         if self.array_dim == 0:
             return [1]
@@ -107,7 +111,7 @@ class TestParams(object):
 
     @lazy_property
     def test_columns(self):
-        if self.col == 'col':
+        if self.col == '[col]':
             return list(range(1, 1 + self.matrix_dim))
         else:
             return [2]
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 d75d936..155eb8c 100644
--- a/generated_tests/templates/gen_variable_index_read_tests/helpers.mako
+++ b/generated_tests/templates/gen_variable_index_read_tests/helpers.mako
@@ -97,7 +97,7 @@ ${base_type}(${matrix_data(c * matrix_dim**2 + 1, matrix_dim)})\
     uniform int index;
   % endif
 
-  % if params.col == 'col':
+  % if params.col == '[col]':
     uniform int col;
   % endif
 
@@ -141,7 +141,7 @@ void main()
        *     written."
        */
     % endif
-    color = (m${params.idx}[${params.col}]${params.row} == expect) ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+    color = (m${params.idx}${params.col}${params.row} == expect) ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
   % endif
 }
 </%def>
@@ -164,7 +164,7 @@ void main()
     % if params.mode == 'temp':
       ${emit_set_matrix(params)}
     % endif
-    gl_FragColor = (m${params.idx}[${params.col}]${params.row} == expect) \
+    gl_FragColor = (m${params.idx}${params.col}${params.row} == expect) \
     % if not do_compare:
       ? color : vec4(1.0, 0.0, 0.0, 1.0);
     % else:
@@ -201,7 +201,7 @@ void main()
     <% x_base = ((size - 1) * (15 * params.matrix_dim + 10)) %>
     % for column in params.test_columns:
       <%block filter="newlines">
-      % if params.col == 'col':
+      % if params.col == '[col]':
         uniform int col ${column - 1}
       % endif
       </%block>
-- 
2.4.2



More information about the Piglit mailing list