[Piglit] [PATCH 16/24] gen_texture_query_lod_tests.py: Split template into templates folder
Dylan Baker
baker.dylan.c at gmail.com
Mon Nov 24 09:58:16 PST 2014
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
generated_tests/CMakeLists.txt | 4 ++-
generated_tests/gen_texture_query_lod_tests.py | 42 +++-------------------
.../template.glsl_parser_test.mako | 33 +++++++++++++++++
3 files changed, 40 insertions(+), 39 deletions(-)
create mode 100644 generated_tests/templates/gen_texture_query_lod_tests/template.glsl_parser_test.mako
diff --git a/generated_tests/CMakeLists.txt b/generated_tests/CMakeLists.txt
index 1ca586e..ff8eb88 100644
--- a/generated_tests/CMakeLists.txt
+++ b/generated_tests/CMakeLists.txt
@@ -41,7 +41,9 @@ piglit_make_generated_tests(
gen_non-lvalue_tests.py)
piglit_make_generated_tests(
texture_query_lod_tests.list
- gen_texture_query_lod_tests.py)
+ gen_texture_query_lod_tests.py
+ templates/gen_texture_query_lod_tests/template.glsl_parser_test.mako
+ )
piglit_make_generated_tests(
shader_bit_encoding_tests.list
gen_shader_bit_encoding_tests.py
diff --git a/generated_tests/gen_texture_query_lod_tests.py b/generated_tests/gen_texture_query_lod_tests.py
index 89f848c..1605204 100644
--- a/generated_tests/gen_texture_query_lod_tests.py
+++ b/generated_tests/gen_texture_query_lod_tests.py
@@ -24,9 +24,11 @@
from __future__ import print_function
import os
import os.path
-from textwrap import dedent
-from mako.template import Template
+from templates import template_file
+
+TEMPLATE = template_file(os.path.basename(os.path.splitext(__file__)[0]),
+ 'template.glsl_parser_test.mako')
SAMPLER_TYPE_TO_COORD_TYPE = {
'sampler1D': 'float',
@@ -76,42 +78,6 @@ REQUIREMENTS = {
}
}
-TEMPLATE = Template(dedent("""\
- /* [config]
- % if execution_stage == 'fs':
- * expect_result: pass
- % else:
- * expect_result: fail
- % endif
- * glsl_version: ${version}
- % if extensions:
- * require_extensions: ${" ".join(extensions)}
- % endif
- * [end config]
- */
-
- #version ${version.translate(None, '.')}
- % for extension in extensions:
- #extension ${extension} : enable
- % endfor
-
- uniform ${sampler_type} s;
- % if execution_stage == 'fs':
- varying ${coord_type} coord;
- % else:
- uniform ${coord_type} coord;
- % endif
-
- void main()
- {
- % if execution_stage == 'fs':
- gl_FragColor.xy = textureQuery${lod}(s, coord);
- % else:
- gl_Position.xy = textureQuery${lod}(s, coord);
- % endif
- }
-"""))
-
def main():
"""Main function."""
diff --git a/generated_tests/templates/gen_texture_query_lod_tests/template.glsl_parser_test.mako b/generated_tests/templates/gen_texture_query_lod_tests/template.glsl_parser_test.mako
new file mode 100644
index 0000000..65155cb
--- /dev/null
+++ b/generated_tests/templates/gen_texture_query_lod_tests/template.glsl_parser_test.mako
@@ -0,0 +1,33 @@
+/* [config]
+% if execution_stage == 'fs':
+ * expect_result: pass
+% else:
+ * expect_result: fail
+% endif
+ * glsl_version: ${version}
+% if extensions:
+ * require_extensions: ${" ".join(extensions)}
+% endif
+ * [end config]
+ */
+
+#version ${version.translate(None, '.')}
+% for extension in extensions:
+#extension ${extension} : enable
+% endfor
+
+uniform ${sampler_type} s;
+% if execution_stage == 'fs':
+varying ${coord_type} coord;
+% else:
+uniform ${coord_type} coord;
+% endif
+
+void main()
+{
+ % if execution_stage == 'fs':
+ gl_FragColor.xy = textureQuery${lod}(s, coord);
+ % else:
+ gl_Position.xy = textureQuery${lod}(s, coord);
+ % endif
+}
--
2.1.3
More information about the Piglit
mailing list