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
31 from templates
import template_dir
32 from modules
import utils
34 TEMPLATES
= template_dir(os
.path
.basename(os
.path
.splitext(__file__
)[0]))
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
47 for inst
in ["TEX", "TXB", "TXD", "TXF", "TXL", "TXP", "TXQ"]:
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
))
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
))
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
))
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
))
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
))
93 if __name__
== '__main__':