arb_copy_image: test copying of different mipmap levels of a texture
[piglit.git] / generated_tests / gen_cl_relational_builtins.py
blobece651241c182c68dff204b8c507ec18c95825b1
1 # coding=utf-8
2 # Copyright 2013 Advanced Micro Devices, Inc.
4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the "Software"),
6 # to deal in the Software without restriction, including without limitation
7 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 # and/or sell copies of the Software, and to permit persons to whom the
9 # Software is furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice (including the next
12 # paragraph) shall be included in all copies or substantial portions of the
13 # Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 # SOFTWARE.
23 # Authors: Tom Stellard <thomas.stellard@amd.com>
24 # Aaron Watry <awatry@gmail.com>
27 import os
29 from genclbuiltins import gen, TRUE, NEGNAN
31 CLC_VERSION_MIN = {
32 'isnan' : 10,
33 'isequal' : 10,
34 'isfinite' : 10,
35 'isgreater' : 10,
36 'isgreaterequal' : 10,
37 'isinf' : 10,
38 'isless' : 10,
39 'islessequal' : 10,
40 'islessgreater' : 10,
41 'isnormal' : 10,
42 'isnotequal' : 10,
43 'isordered' : 10,
44 'isunordered' : 10,
45 'signbit' : 10
48 DATA_TYPES = ['float']
50 F = {
51 'float' : 'float'
54 I = {
55 'float' : 'int'
58 tests = {
59 'isnan' : {
60 'arg_types': [I, F],
61 'function_type': 'ttt',
62 'values': [
63 [0, TRUE, 0, 0], # Result
64 [0.0, float("nan"), 1.0, float("inf") ] # Arg0
67 'isequal' : {
68 'arg_types': [I, F, F],
69 'function_type': 'ttt',
70 'values': [
71 [TRUE, 0, TRUE, 0, 0, TRUE, 0, TRUE ], # Result
72 [0.0, float("nan"), 1.0, 1, float("nan"), float("inf"), 1.0, 123.0 ], # Arg0
73 [0.0, float("nan"), 1.0, float("nan"), 1, float("inf"), 0.5, 123.0 ] # Arg1
76 'isfinite' : {
77 'arg_types': [I, F],
78 'function_type': 'ttt',
79 'values': [
80 [TRUE, 0, TRUE, TRUE, 0, 0, TRUE ], # Result
81 [0.0, float("nan"), 1.0, 1.0, float("inf"), float("-inf"), -123.0 ], # Arg0
84 'isgreater' : {
85 'arg_types': [I, F, F],
86 'function_type': 'ttt',
87 'values': [
88 [0, 0, 0, 0, 0, 0, TRUE, 0], # Result
89 [0.0, float("nan"), 1.0, 1, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
90 [0.0, float("nan"), 1.0, float("nan"), 1, float("inf"), 0.5, 1.0 ] # Arg1
93 'isgreaterequal' : {
94 'arg_types': [I, F, F],
95 'function_type': 'ttt',
96 'values': [
97 [TRUE, 0, TRUE, 0, 0, TRUE, TRUE, 0], # Result
98 [0.0, float("nan"), 1.0, 1, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
99 [0.0, float("nan"), 1.0, float("nan"), 1, float("inf"), 0.5, 1.0 ] # Arg1
102 'isinf' : {
103 'arg_types': [I, F],
104 'function_type': 'ttt',
105 'values': [
106 [0, 0, 0, 0, TRUE, TRUE, 0 ], # Result
107 [0.0, float("nan"), 1.0, 1.0, float("inf"), float("-inf"), -123.0 ], # Arg0
110 'isless' : {
111 'arg_types': [I, F, F],
112 'function_type': 'ttt',
113 'values': [
114 [0, 0, 0, 0, 0, 0, 0, TRUE], # Result
115 [0.0, float("nan"), 1.0, 1.0, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
116 [0.0, float("nan"), 1.0, float("nan"), 1.0, 1.0, 0.5, 1.0 ] # Arg1
119 'islessequal' : {
120 'arg_types': [I, F, F],
121 'function_type': 'ttt',
122 'values': [
123 [TRUE, 0, TRUE, 0, 0, 0, 0, TRUE], # Result
124 [0.0, float("nan"), 1.0, 1.0, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
125 [0.0, float("nan"), 1.0, float("nan"), 1.0, 1.0, 0.5, 1.0 ] # Arg1
128 'islessgreater' : {
129 'arg_types': [I, F, F],
130 'function_type': 'ttt',
131 'values': [
132 [0, 0, 0, 0, 0, TRUE, TRUE, TRUE], # Result
133 [0.0, float("nan"), 1.0, 1.0, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
134 [0.0, float("nan"), 1.0, float("nan"), 1.0, 1.0, 0.5, 1.0 ] # Arg1
137 'isnormal' : {
138 'arg_types': [I, F],
139 'function_type': 'ttt',
140 'values': [
141 [0, 0, TRUE, TRUE, 0, 0, TRUE, 0], # Result
142 [0.0, float("nan"), 1.0, 1.0, float("inf"), float("-inf"), -123.0, 1e-126], # Arg0
145 'isnotequal' : {
146 'arg_types': [I, F, F],
147 'function_type': 'ttt',
148 'values': [
149 [0, TRUE, 0, TRUE, TRUE, 0, TRUE, TRUE], # Result
150 [0.0, float("nan"), 1.0, 1, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
151 [0.0, float("nan"), 1.0, float("nan"), 1, float("inf"), 0.5, 1.0 ] # Arg1
154 'isordered' : {
155 'arg_types': [I, F, F],
156 'function_type': 'ttt',
157 'values': [
158 [TRUE, 0, TRUE, 0, 0, TRUE, TRUE, TRUE], # Result
159 [0.0, float("nan"), 1.0, 1.0, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
160 [0.0, float("nan"), 1.0, float("nan"), 1.0, float("inf"), 0.5, 1.0 ] # Arg1
163 'isunordered' : {
164 'arg_types': [I, F, F],
165 'function_type': 'ttt',
166 'values': [
167 [0, TRUE, 0, TRUE, TRUE, 0, 0, 0], # Result
168 [0.0, float("nan"), 1.0, 1.0, float("nan"), float("inf"), 1.0, 0.5 ], # Arg0
169 [0.0, float("nan"), 1.0, float("nan"), 1.0, float("inf"), 0.5, 1.0 ] # Arg1
172 'signbit' : {
173 'arg_types': [I, F],
174 'function_type': 'ttt',
175 'values': [
176 [0, TRUE, 0, 0, TRUE, 0, TRUE, 0 , TRUE ], # Result
177 [0.0, float(0)*-1, 1.0, 1, float("-inf"), float("inf"), -1.0, float("nan"), NEGNAN ] # Arg0
183 def main():
184 dirName = os.path.join("cl", "builtin", "relational")
186 testDefs = {}
187 functions = sorted(tests.keys())
188 for dataType in DATA_TYPES:
189 for fnName in functions:
190 testDefs[(dataType, fnName)] = tests[fnName]
192 gen(DATA_TYPES, CLC_VERSION_MIN, functions, testDefs, dirName)
195 if __name__ == '__main__':
196 main()