2 # Copyright © 2016 - 2024 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
32 from mako
import exceptions
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 weird, 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
:
58 f
.write(template
.render_unicode(target
=target
, inst
=inst
))
60 print(exceptions
.text_error_template().render(), file=sys
.stderr
)
65 template
= TEMPLATES
.get_template('nvvp3.mako')
66 for target
in targets_1
:
67 fname
= os
.path
.join(dirname
,
68 "{}-{:0>2d}.txt".format(inst
.lower(), i
))
69 with
open(fname
, 'w') as f
:
71 f
.write(template
.render_unicode(target
=target
, inst
=inst
))
73 print(exceptions
.text_error_template().render(), file=sys
.stderr
)
78 template
= TEMPLATES
.get_template('nvvp3_2.mako')
79 for target
in ["CUBE", "RECT"]:
80 fname
= os
.path
.join(dirname
,
81 "{}-{:0>2d}.txt".format(inst
.lower(), i
))
82 with
open(fname
, 'w') as f
:
84 f
.write(template
.render_unicode(target
=target
, inst
=inst
))
86 print(exceptions
.text_error_template().render(), file=sys
.stderr
)
91 template
= TEMPLATES
.get_template('nvvp3.mako')
92 fname
= os
.path
.join(dirname
, "{}-{:0>2d}.txt".format(inst
.lower(), i
))
93 with
open(fname
, 'w') as f
:
95 f
.write(template
.render_unicode(target
="SHADOWRECT", inst
=inst
))
97 print(exceptions
.text_error_template().render(), file=sys
.stderr
)
102 template
= TEMPLATES
.get_template('nvvp3_2.mako')
103 for target
in ["SHADOW1D", "SHADOW2D", "SHADOWRECT"]:
104 fname
= os
.path
.join(dirname
,
105 "{}-{:0>2d}.txt".format(inst
.lower(), i
))
106 with
open(fname
, 'w') as f
:
108 f
.write(template
.render_unicode(target
=target
, inst
=inst
))
110 print(exceptions
.text_error_template().render(), file=sys
.stderr
)
116 if __name__
== '__main__':