Commit 8d287c50 authored by Dylan Baker's avatar Dylan Baker
Browse files

gen_texture_query_lod_tests.py: Use if __name__ == __main__ pattern


Signed-off-by: default avatarDylan Baker <dylanx.c.baker@intel.com>
acked-by: Matt Turner's avatarMatt Turner <mattst88@gmail.com>
parent 9406a6f6
...@@ -105,43 +105,50 @@ TEMPLATE = Template(dedent("""\ ...@@ -105,43 +105,50 @@ TEMPLATE = Template(dedent("""\
void main() void main()
{ {
% if execution_stage == 'fs': % if execution_stage == 'fs':
gl_FragColor.xy = textureQuery${Lod}(s, coord); gl_FragColor.xy = textureQuery${lod}(s, coord);
% else: % else:
gl_Position.xy = textureQuery${Lod}(s, coord); gl_Position.xy = textureQuery${lod}(s, coord);
% endif % endif
} }
""")) """))
for api, requirement in REQUIREMENTS.iteritems():
Lod = 'Lod' if api == 'glsl-4.00' else 'LOD' def main():
"""Main function."""
for sampler_type, coord_type in SAMPLER_TYPE_TO_COORD_TYPE.iteritems(): for api, requirement in REQUIREMENTS.iteritems():
for execution_stage in ("vs", "fs"): lod = 'Lod' if api == 'glsl-4.00' else 'LOD'
file_extension = 'frag' if execution_stage == 'fs' else 'vert'
filename = os.path.join( for sampler_type, coord_type in SAMPLER_TYPE_TO_COORD_TYPE.iteritems():
"spec", api.lower(), "compiler", "built-in-functions", for execution_stage in ("vs", "fs"):
"textureQuery{0}-{1}.{2}".format(Lod, sampler_type, file_extension = 'frag' if execution_stage == 'fs' else 'vert'
file_extension)) filename = os.path.join(
print(filename) "spec", api.lower(), "compiler", "built-in-functions",
"textureQuery{0}-{1}.{2}".format(lod, sampler_type,
dirname = os.path.dirname(filename) file_extension))
if not os.path.exists(dirname): print(filename)
os.makedirs(dirname)
dirname = os.path.dirname(filename)
version = requirement['version'] if not os.path.exists(dirname):
extensions = [requirement['extension']] if requirement['extension'] else [] os.makedirs(dirname)
# samplerCubeArray types are part GLSL 4.00 version = requirement['version']
# or GL_ARB_texture_cube_map_array. extensions = [requirement['extension']] if requirement['extension'] else []
if api == "ARB_texture_query_lod" and sampler_type in [
'samplerCubeArray', 'isamplerCubeArray', # samplerCubeArray types are part GLSL 4.00
'usamplerCubeArray', 'samplerCubeArrayShadow']: # or GL_ARB_texture_cube_map_array.
extensions += ['GL_ARB_texture_cube_map_array'] if api == "ARB_texture_query_lod" and sampler_type in [
'samplerCubeArray', 'isamplerCubeArray',
with open(filename, "w") as f: 'usamplerCubeArray', 'samplerCubeArrayShadow']:
f.write(TEMPLATE.render(version=version, extensions += ['GL_ARB_texture_cube_map_array']
extensions=extensions,
execution_stage=execution_stage, with open(filename, "w") as f:
sampler_type=sampler_type, f.write(TEMPLATE.render(version=version,
coord_type=coord_type, extensions=extensions,
Lod=Lod)) execution_stage=execution_stage,
sampler_type=sampler_type,
coord_type=coord_type,
lod=lod))
if __name__ == '__main__':
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment