[Piglit] [PATCH 20/34] gen_builtin_packing_tests.py: python2/3 hybridize
Dylan Baker
baker.dylan.c at gmail.com
Fri Feb 20 18:18:07 PST 2015
---
generated_tests/gen_builtin_packing_tests.py | 2 +-
.../templates/gen_builtin_packing_tests/fs_pack.shader_test.mako | 7 ++++---
.../templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako | 7 ++++---
.../templates/gen_builtin_packing_tests/vs_pack.shader_test.mako | 7 ++++---
.../templates/gen_builtin_packing_tests/vs_unpack.shader_test.mako | 7 ++++---
5 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/generated_tests/gen_builtin_packing_tests.py b/generated_tests/gen_builtin_packing_tests.py
index 2815fc3..99e8318 100644
--- a/generated_tests/gen_builtin_packing_tests.py
+++ b/generated_tests/gen_builtin_packing_tests.py
@@ -1031,7 +1031,7 @@ class ShaderTest(object):
utils.safe_makedirs(dirname)
with open(self.filename, "w") as f:
- f.write(self.__template.render(func=self.__func_info))
+ f.write(self.__template.render_unicode(func=self.__func_info))
def main():
diff --git a/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako b/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako
index c3f0a21..4c053bf 100644
--- a/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako
+++ b/generated_tests/templates/gen_builtin_packing_tests/fs_pack.shader_test.mako
@@ -1,3 +1,4 @@
+<%! from six.moves import range %>
## Test execution of pack2x16 functions in the fragment shader.
[require]
${func.requirements}
@@ -22,7 +23,7 @@ const vec4 green = vec4(0, 1, 0, 1);
uniform ${func.vector_type} func_input;
-% for i in xrange(func.num_valid_outputs):
+% for i in range(func.num_valid_outputs):
uniform ${func.result_precision} uint expect${i};
% endfor
@@ -33,7 +34,7 @@ void main()
${func.result_precision} uint actual = ${func.name}(func_input);
if (false
- % for i in xrange(func.num_valid_outputs):
+ % for i in range(func.num_valid_outputs):
|| actual == expect${i}
% endfor
) {
@@ -53,7 +54,7 @@ vertex/float/2
[test]
% for io in func.inout_seq:
uniform ${func.vector_type} func_input ${" ".join(io.input)}
-% for i in xrange(func.num_valid_outputs):
+% for i in range(func.num_valid_outputs):
uniform uint expect${i} ${io.valid_outputs[i]}
% endfor
draw arrays GL_TRIANGLE_FAN 0 4
diff --git a/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako b/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako
index 02b91f0..ee610bb 100644
--- a/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako
+++ b/generated_tests/templates/gen_builtin_packing_tests/fs_unpack.shader_test.mako
@@ -1,3 +1,4 @@
+<%! from six.moves import range %>
## Test execution of unpack2x16 functions in the fragment shader.
[require]
${func.requirements}
@@ -24,7 +25,7 @@ uniform highp uint func_input;
uniform bool exact;
-% for i in xrange(func.num_valid_outputs):
+% for i in range(func.num_valid_outputs):
uniform ${func.result_precision} ${func.vector_type} expect${i};
% endfor
@@ -35,7 +36,7 @@ void main()
${func.result_precision} ${func.vector_type} actual = ${func.name}(func_input);
if (false
- % for i in xrange(func.num_valid_outputs):
+ % for i in range(func.num_valid_outputs):
|| (exact ? actual == expect${i}
: distance(actual, expect${i}) < 0.00001)
% endfor
@@ -62,7 +63,7 @@ uniform int exact 1
uniform int exact ${int(int(io.input[:-1]) in (0x0, 0xffffffff, 0x80808080,
0x81818181))}
% endif
-% for i in xrange(func.num_valid_outputs):
+% for i in range(func.num_valid_outputs):
uniform ${func.vector_type} expect${i} ${" ".join(io.valid_outputs[i])}
% endfor
draw arrays GL_TRIANGLE_FAN 0 4
diff --git a/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako b/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako
index 5257dcc..5f37d7e 100644
--- a/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako
+++ b/generated_tests/templates/gen_builtin_packing_tests/vs_pack.shader_test.mako
@@ -1,3 +1,4 @@
+<%! from six.moves import range %>
## Test execution of pack2x16 functions in the vertex shader.
[require]
${func.requirements}
@@ -12,7 +13,7 @@ const vec4 green = vec4(0, 1, 0, 1);
uniform ${func.vector_type} func_input;
-% for j in xrange(func.num_valid_outputs):
+% for j in range(func.num_valid_outputs):
uniform ${func.result_precision} uint expect${j};
% endfor
@@ -25,7 +26,7 @@ void main()
${func.result_precision} uint actual = ${func.name}(func_input);
if (false
- % for j in xrange(func.num_valid_outputs):
+ % for j in range(func.num_valid_outputs):
|| actual == expect${j}
% endfor
) {
@@ -58,7 +59,7 @@ vertex/float/2
[test]
% for io in func.inout_seq:
uniform ${func.vector_type} func_input ${" ".join(io.input)}
-% for j in xrange(func.num_valid_outputs):
+% for j in range(func.num_valid_outputs):
uniform uint expect${j} ${io.valid_outputs[j]}
% endfor
draw arrays GL_TRIANGLE_FAN 0 4
diff --git a/generated_tests/templates/gen_builtin_packing_tests/vs_unpack.shader_test.mako b/generated_tests/templates/gen_builtin_packing_tests/vs_unpack.shader_test.mako
index 6318582..5f2a391 100644
--- a/generated_tests/templates/gen_builtin_packing_tests/vs_unpack.shader_test.mako
+++ b/generated_tests/templates/gen_builtin_packing_tests/vs_unpack.shader_test.mako
@@ -1,3 +1,4 @@
+<%! from six.moves import range %>
## Test execution of unpack2x16 functions in the vertex shader.
[require]
${func.requirements}
@@ -14,7 +15,7 @@ uniform highp uint func_input;
uniform bool exact;
-% for j in xrange(func.num_valid_outputs):
+% for j in range(func.num_valid_outputs):
uniform ${func.result_precision} ${func.vector_type} expect${j};
% endfor
@@ -28,7 +29,7 @@ void main()
${func.result_precision} ${func.vector_type} actual = ${func.name}(func_input);
if (false
- % for i in xrange(func.num_valid_outputs):
+ % for i in range(func.num_valid_outputs):
|| (exact ? actual == expect${i} : distance(actual, expect${i}) < 0.00001)
% endfor
) {
@@ -67,7 +68,7 @@ uniform int exact 1
uniform int exact ${int(int(io.input[:-1]) in (0x0, 0xffffffff, 0x80808080,
0x81818181))}
% endif
-% for j in xrange(func.num_valid_outputs):
+% for j in range(func.num_valid_outputs):
uniform ${func.vector_type} expect${j} ${" ".join(io.valid_outputs[j])}
% endfor
draw arrays GL_TRIANGLE_FAN 0 4
--
2.3.0
More information about the Piglit
mailing list