summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylanx.c.baker@intel.com>2014-11-11 15:19:04 -0800
committerDylan Baker <dylanx.c.baker@intel.com>2014-11-24 11:53:22 -0800
commit8d287c50089116c201ef082a24d88a696899dea6 (patch)
treed46a584f042c32570d1b1a67f1c1dd8cfaa5dec5
parent9406a6f69d1faffe02d43fd1350cad8f65b77b74 (diff)
gen_texture_query_lod_tests.py: Use if __name__ == __main__ pattern
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> acked-by: Matt Turner <mattst88@gmail.com>
-rw-r--r--generated_tests/gen_texture_query_lod_tests.py77
1 files changed, 42 insertions, 35 deletions
diff --git a/generated_tests/gen_texture_query_lod_tests.py b/generated_tests/gen_texture_query_lod_tests.py
index d5dd3159e..00eb00778 100644
--- a/generated_tests/gen_texture_query_lod_tests.py
+++ b/generated_tests/gen_texture_query_lod_tests.py
@@ -105,43 +105,50 @@ TEMPLATE = Template(dedent("""\
void main()
{
% if execution_stage == 'fs':
- gl_FragColor.xy = textureQuery${Lod}(s, coord);
+ gl_FragColor.xy = textureQuery${lod}(s, coord);
% else:
- gl_Position.xy = textureQuery${Lod}(s, coord);
+ gl_Position.xy = textureQuery${lod}(s, coord);
% endif
}
"""))
-for api, requirement in REQUIREMENTS.iteritems():
- Lod = 'Lod' if api == 'glsl-4.00' else 'LOD'
-
- for sampler_type, coord_type in SAMPLER_TYPE_TO_COORD_TYPE.iteritems():
- for execution_stage in ("vs", "fs"):
- file_extension = 'frag' if execution_stage == 'fs' else 'vert'
- filename = os.path.join(
- "spec", api.lower(), "compiler", "built-in-functions",
- "textureQuery{0}-{1}.{2}".format(Lod, sampler_type,
- file_extension))
- print(filename)
-
- dirname = os.path.dirname(filename)
- if not os.path.exists(dirname):
- os.makedirs(dirname)
-
- version = requirement['version']
- extensions = [requirement['extension']] if requirement['extension'] else []
-
- # samplerCubeArray types are part GLSL 4.00
- # or GL_ARB_texture_cube_map_array.
- if api == "ARB_texture_query_lod" and sampler_type in [
- 'samplerCubeArray', 'isamplerCubeArray',
- 'usamplerCubeArray', 'samplerCubeArrayShadow']:
- extensions += ['GL_ARB_texture_cube_map_array']
-
- with open(filename, "w") as f:
- f.write(TEMPLATE.render(version=version,
- extensions=extensions,
- execution_stage=execution_stage,
- sampler_type=sampler_type,
- coord_type=coord_type,
- Lod=Lod))
+
+def main():
+ """Main function."""
+ for api, requirement in REQUIREMENTS.iteritems():
+ lod = 'Lod' if api == 'glsl-4.00' else 'LOD'
+
+ for sampler_type, coord_type in SAMPLER_TYPE_TO_COORD_TYPE.iteritems():
+ for execution_stage in ("vs", "fs"):
+ file_extension = 'frag' if execution_stage == 'fs' else 'vert'
+ filename = os.path.join(
+ "spec", api.lower(), "compiler", "built-in-functions",
+ "textureQuery{0}-{1}.{2}".format(lod, sampler_type,
+ file_extension))
+ print(filename)
+
+ dirname = os.path.dirname(filename)
+ if not os.path.exists(dirname):
+ os.makedirs(dirname)
+
+ version = requirement['version']
+ extensions = [requirement['extension']] if requirement['extension'] else []
+
+ # samplerCubeArray types are part GLSL 4.00
+ # or GL_ARB_texture_cube_map_array.
+ if api == "ARB_texture_query_lod" and sampler_type in [
+ 'samplerCubeArray', 'isamplerCubeArray',
+ 'usamplerCubeArray', 'samplerCubeArrayShadow']:
+ extensions += ['GL_ARB_texture_cube_map_array']
+
+ with open(filename, "w") as f:
+ f.write(TEMPLATE.render(version=version,
+ extensions=extensions,
+ execution_stage=execution_stage,
+ sampler_type=sampler_type,
+ coord_type=coord_type,
+ lod=lod))
+
+
+if __name__ == '__main__':
+ main()