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
22 """Generate ARBvp tests.
24 Based on a bash generator that performs the same function written by Ian
29 from __future__
import (
30 absolute_import
, division
, print_function
, unicode_literals
34 from templates
import template_dir
35 from modules
import utils
37 TEMPLATES
= template_dir(os
.path
.basename(os
.path
.splitext(__file__
)[0]))
41 """Main function. Generates tests."""
42 dirname
= os
.path
.join('asmparsertest', 'shaders', 'ARBvp1.0')
43 utils
.safe_makedirs(dirname
)
45 targets_1
= ["1D", "2D", "3D", "CUBE", "RECT", "SHADOW1D", "SHADOW2D"]
47 # The ordering in this loop is wierd, it's an artifact of the growth of the
48 # original script and is required to ensure that the names of the tests
50 for inst
in ["TEX", "TXB", "TXD", "TXF", "TXL", "TXP", "TXQ"]:
52 template
= TEMPLATES
.get_template('arbvp.mako')
53 for target
in targets_1
:
54 fname
= os
.path
.join(dirname
,
55 "{}-{:0>2d}.txt".format(inst
.lower(), i
))
56 with
open(fname
, 'w') as f
:
57 f
.write(template
.render_unicode(target
=target
, inst
=inst
))
61 template
= TEMPLATES
.get_template('nvvp3.mako')
62 for target
in targets_1
:
63 fname
= os
.path
.join(dirname
,
64 "{}-{:0>2d}.txt".format(inst
.lower(), i
))
65 with
open(fname
, 'w') as f
:
66 f
.write(template
.render_unicode(target
=target
, inst
=inst
))
70 template
= TEMPLATES
.get_template('nvvp3_2.mako')
71 for target
in ["CUBE", "RECT"]:
72 fname
= os
.path
.join(dirname
,
73 "{}-{:0>2d}.txt".format(inst
.lower(), i
))
74 with
open(fname
, 'w') as f
:
75 f
.write(template
.render_unicode(target
=target
, inst
=inst
))
79 template
= TEMPLATES
.get_template('nvvp3.mako')
80 fname
= os
.path
.join(dirname
, "{}-{:0>2d}.txt".format(inst
.lower(), i
))
81 with
open(fname
, 'w') as f
:
82 f
.write(template
.render_unicode(target
="SHADOWRECT", inst
=inst
))
86 template
= TEMPLATES
.get_template('nvvp3_2.mako')
87 for target
in ["SHADOW1D", "SHADOW2D", "SHADOWRECT"]:
88 fname
= os
.path
.join(dirname
,
89 "{}-{:0>2d}.txt".format(inst
.lower(), i
))
90 with
open(fname
, 'w') as f
:
91 f
.write(template
.render_unicode(target
=target
, inst
=inst
))
96 if __name__
== '__main__':