gl-1.1: Test that unused normal array in ff shader doesn't affect other arrays
[piglit.git] / generated_tests / gen_cl_common_builtins.py
blob0a51c8402b11e060299601f9475b901ab426803f
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, NEGNAN
30 from math import radians, degrees, pi
32 CLC_VERSION_MIN = {
33 'clamp' : 10,
34 'degrees' : 10,
35 'max' : 10,
36 'min' : 10,
37 'mix' : 10,
38 'radians' : 10,
39 'step' : 10,
40 'smoothstep' : 10,
41 'sign' : 10
44 DATA_TYPES = ['float']
46 F = {
47 'float' : 'float'
50 I = {
51 'float' : 'int'
54 tests = {
55 'clamp' : {
56 'arg_types': [F, F, F, F],
57 'function_type': 'tss',
58 'values': [
59 [0.5, 0.0, 0.0, 0.0, float("nan")], #Result
60 [1.0, -0.5, 0.0, 0.0, float("nan")], #Arg0
61 [0.0, 0.0, 0.0, -0.5, float("nan")], #Arg1
62 [0.5, 0.5, 0.0, 0.5, float("nan")], #Arg2
65 'degrees' : {
66 'arg_types': [F, F],
67 'function_type': 'ttt',
68 'values': [
69 [degrees(0.5), degrees(-0.5), 180.0, 0.0, 360, 1800.0, 18000, 90], #Result
70 [0.5, -0.5, pi, 0.0, 2*pi, 10*pi, 100*pi, pi/2] #Arg0
73 'max' : {
74 'arg_types': [F, F, F],
75 'function_type': 'tss',
76 'values': [
77 [1.0, 0.0, 0.0, 0.0 ], #Result
78 [1.0, -0.5, 0.0, 0.0 ], #Arg0
79 [0.0, 0.0, 0.0, -0.5 ] #Arg1
82 'min' : {
83 'arg_types': [F, F, F],
84 'function_type': 'tss',
85 'values': [
86 [0.0, -0.5, 0.0, -0.5 ], #Result
87 [1.0, -0.5, 0.0, 0.0 ], #Arg0
88 [0.0, 0.0, 0.0, -0.5 ] #Arg1
91 'mix' : { #x + (y - x) * a
92 'arg_types': [F, F, F, F],
93 'function_type': 'tts',
94 'values': [
95 [0.5, -0.25, 0.0, -0.5, 1.0, 3.0, 10.0, float("nan"), float("nan"), float("nan")], #Result
96 [1.0, -0.5, 0.0, 0.0, 1.0, 4.0, 15.0, 5.0, 4.0, float("nan")], #Arg0
97 [0.0, 0.0, 0.0, -0.5, 2.0, 2.0, 10.0, -0.2, float("nan"), 1.5], #Arg1
98 [0.5, 0.5, 0.0, 1.0, 0.0, 0.5, 1.0, float("nan"), 1.0, 0.0], #Arg2
101 'radians' : {
102 'arg_types': [F, F],
103 'function_type': 'ttt',
104 'values': [
105 [0.5, -0.5, pi, 0.0, 2*pi, 10*pi, 100*pi, pi/2], #Result
106 [degrees(0.5), degrees(-0.5), 180.0, 0.0, 360, 1800.0, 18000, 90] #Arg0
109 #TODO Add scalar combination (tst?)
110 'step' : {
111 'arg_types': [F, F, F],
112 'function_type': 'ttt',
113 'values': [
114 [0.0, 1.0, 1.0, 0.0, 1.0, 1.0], #Result
115 [1.0, -0.5, 0.0, 0.0, 1.0, float("nan")], #Arg0
116 [0.0, 0.0, 0.0, -0.5, float("nan"), 1.0] #Arg1
119 #TODO Add scalar combination (tst?)
120 'smoothstep' : {
121 'arg_types': [F, F, F, F],
122 'function_type': 'ttt',
123 'values': [
124 [0.0, 0.0, 1.0, 1.0, 0.5, 0.896], #Result
125 [0.0, 0.0, 0.0, -0.5, 0.0, 0.0], #Arg0
126 [1.0, 1.0, 0.5, 0.0, 0.5, 0.5], #Arg1
127 [-0.5, 0.0, 0.5, 1.0, 0.25, 0.4] #Arg2
130 'sign' : {
131 'arg_types': [F, F],
132 'function_type': 'ttt',
133 'values': [
134 [1.0, -1.0, 0.0, -0.0, 0.0], #Result
135 [0.5, -0.5, 0.0, -0.0, float("nan")] #Arg0
141 def main():
142 dirName = os.path.join("cl", "builtin", "common")
144 testDefs = {}
145 functions = sorted(tests.keys())
146 for dataType in DATA_TYPES:
147 for fnName in functions:
148 testDefs[(dataType, fnName)] = tests[fnName]
150 gen(DATA_TYPES, CLC_VERSION_MIN, functions, testDefs, dirName)
153 if __name__ == '__main__':
154 main()