glsl-1.10: test a complex partial unroll scenario
[piglit.git] / generated_tests / gen_vp_tex.py
blobfa7539ebd8227fd2d4d17e5584d7119f87dc88d8
1 # encoding=utf-8
2 # Copyright © 2016 Intel Corporation
4 # Permission is hereby granted, free of charge, to any person obtaining a copy
5 # of this software and associated documentation files (the "Software"), to deal
6 # in the Software without restriction, including without limitation the rights
7 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 # copies of the Software, and to permit persons to whom the Software is
9 # furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice shall be included in
12 # all copies or substantial portions of the Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 # SOFTWARE.
22 """Generate ARBvp tests.
24 Based on a bash generator that performs the same function written by Ian
25 Romanick.
27 """
29 import os
31 from templates import template_dir
32 from modules import utils
34 TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
37 def main():
38 """Main function. Generates tests."""
39 dirname = os.path.join('asmparsertest', 'shaders', 'ARBvp1.0')
40 utils.safe_makedirs(dirname)
42 targets_1 = ["1D", "2D", "3D", "CUBE", "RECT", "SHADOW1D", "SHADOW2D"]
44 # The ordering in this loop is weird, it's an artifact of the growth of the
45 # original script and is required to ensure that the names of the tests
46 # don't change
47 for inst in ["TEX", "TXB", "TXD", "TXF", "TXL", "TXP", "TXQ"]:
48 i = 1
49 template = TEMPLATES.get_template('arbvp.mako')
50 for target in targets_1:
51 fname = os.path.join(dirname,
52 "{}-{:0>2d}.txt".format(inst.lower(), i))
53 with open(fname, 'w') as f:
54 f.write(template.render_unicode(target=target, inst=inst))
55 print(fname)
56 i += 1
58 template = TEMPLATES.get_template('nvvp3.mako')
59 for target in targets_1:
60 fname = os.path.join(dirname,
61 "{}-{:0>2d}.txt".format(inst.lower(), i))
62 with open(fname, 'w') as f:
63 f.write(template.render_unicode(target=target, inst=inst))
64 print(fname)
65 i += 1
67 template = TEMPLATES.get_template('nvvp3_2.mako')
68 for target in ["CUBE", "RECT"]:
69 fname = os.path.join(dirname,
70 "{}-{:0>2d}.txt".format(inst.lower(), i))
71 with open(fname, 'w') as f:
72 f.write(template.render_unicode(target=target, inst=inst))
73 print(fname)
74 i += 1
76 template = TEMPLATES.get_template('nvvp3.mako')
77 fname = os.path.join(dirname, "{}-{:0>2d}.txt".format(inst.lower(), i))
78 with open(fname, 'w') as f:
79 f.write(template.render_unicode(target="SHADOWRECT", inst=inst))
80 print(fname)
81 i += 1
83 template = TEMPLATES.get_template('nvvp3_2.mako')
84 for target in ["SHADOW1D", "SHADOW2D", "SHADOWRECT"]:
85 fname = os.path.join(dirname,
86 "{}-{:0>2d}.txt".format(inst.lower(), i))
87 with open(fname, 'w') as f:
88 f.write(template.render_unicode(target=target, inst=inst))
89 print(fname)
90 i += 1
93 if __name__ == '__main__':
94 main()