Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1 | /* DO NOT MODIFY - automatically generated by generate_builtins.pl */ |
Eric Anholt | c22c400 | 2010-03-26 18:20:30 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright © 2010 Intel Corporation |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | * copy of this software and associated documentation files (the "Software"), |
| 7 | * to deal in the Software without restriction, including without limitation |
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 | * and/or sell copies of the Software, and to permit persons to whom the |
| 10 | * Software is furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice (including the next |
| 13 | * paragraph) shall be included in all copies or substantial portions of the |
| 14 | * Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
| 23 | */ |
| 24 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 25 | #include <stdio.h> |
Eric Anholt | c22c400 | 2010-03-26 18:20:30 -0700 | [diff] [blame] | 26 | #include "glsl_parser_extras.h" |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 27 | #include "ir_reader.h" |
Eric Anholt | ddd2e83 | 2010-03-27 12:59:42 -0700 | [diff] [blame] | 28 | |
Eric Anholt | c22c400 | 2010-03-26 18:20:30 -0700 | [diff] [blame] | 29 | void |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 30 | read_builtins(_mesa_glsl_parse_state *st, exec_list *instructions, |
| 31 | const char **functions, unsigned count) |
Eric Anholt | c22c400 | 2010-03-26 18:20:30 -0700 | [diff] [blame] | 32 | { |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 33 | if (st->error) |
| 34 | return; |
Eric Anholt | c22c400 | 2010-03-26 18:20:30 -0700 | [diff] [blame] | 35 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 36 | for (unsigned i = 0; i < count; i++) { |
| 37 | _mesa_glsl_read_ir(st, instructions, functions[i]); |
Eric Anholt | c22c400 | 2010-03-26 18:20:30 -0700 | [diff] [blame] | 38 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 39 | if (st->error) { |
| 40 | printf("error reading builtin: %.35s ...\n", functions[i]); |
| 41 | return; |
| 42 | } |
Eric Anholt | cc4ef15 | 2010-04-08 15:35:34 -0700 | [diff] [blame] | 43 | } |
| 44 | } |
| 45 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 46 | /* Version 110 builtins */ |
Eric Anholt | 53afc36 | 2010-03-27 13:55:04 -0700 | [diff] [blame] | 47 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 48 | static const char *builtins_110_abs = { |
| 49 | "((function abs\n" |
| 50 | " (signature float\n" |
| 51 | " (parameters\n" |
| 52 | " (declare (in) float arg0))\n" |
| 53 | " ((return (expression float abs (var_ref arg0)))))\n" |
| 54 | "\n" |
| 55 | " (signature vec2\n" |
| 56 | " (parameters\n" |
| 57 | " (declare (in) vec2 arg0))\n" |
| 58 | " ((return (expression vec2 abs (var_ref arg0)))))\n" |
| 59 | "\n" |
| 60 | " (signature vec3\n" |
| 61 | " (parameters\n" |
| 62 | " (declare (in) vec3 arg0))\n" |
| 63 | " ((return (expression vec3 abs (var_ref arg0)))))\n" |
| 64 | "\n" |
| 65 | " (signature vec4\n" |
| 66 | " (parameters\n" |
| 67 | " (declare (in) vec4 arg0))\n" |
| 68 | " ((return (expression vec4 abs (var_ref arg0)))))\n" |
| 69 | "))\n" |
| 70 | }; |
Eric Anholt | 53afc36 | 2010-03-27 13:55:04 -0700 | [diff] [blame] | 71 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 72 | static const char *builtins_110_all = { |
| 73 | "((function all\n" |
| 74 | " (signature bool\n" |
| 75 | " (parameters\n" |
| 76 | " (declare (in) bvec2 arg0))\n" |
| 77 | " ((return (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\n" |
| 78 | "\n" |
| 79 | " (signature bool\n" |
| 80 | " (parameters\n" |
| 81 | " (declare (in) bvec3 arg0))\n" |
| 82 | " ((return (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))\n" |
| 83 | "\n" |
| 84 | " (signature bool\n" |
| 85 | " (parameters\n" |
| 86 | " (declare (in) bvec4 arg0))\n" |
| 87 | " ((return (expression bool && (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))\n" |
| 88 | "))\n" |
| 89 | }; |
Eric Anholt | 53afc36 | 2010-03-27 13:55:04 -0700 | [diff] [blame] | 90 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 91 | static const char *builtins_110_any = { |
| 92 | "((function any\n" |
| 93 | " (signature bool\n" |
| 94 | " (parameters\n" |
| 95 | " (declare (in) bvec2 arg0))\n" |
| 96 | " ((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\n" |
| 97 | "\n" |
| 98 | " (signature bool\n" |
| 99 | " (parameters\n" |
| 100 | " (declare (in) bvec3 arg0))\n" |
| 101 | " ((return (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))\n" |
| 102 | "\n" |
| 103 | " (signature bool\n" |
| 104 | " (parameters\n" |
| 105 | " (declare (in) bvec4 arg0))\n" |
| 106 | " ((return (expression bool || (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))\n" |
| 107 | "))\n" |
| 108 | }; |
Eric Anholt | 53afc36 | 2010-03-27 13:55:04 -0700 | [diff] [blame] | 109 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 110 | static const char *builtins_110_ceil = { |
| 111 | "((function ceil\n" |
| 112 | " (signature float\n" |
| 113 | " (parameters\n" |
| 114 | " (declare (in) float arg0))\n" |
| 115 | " ((return (expression float ceil (var_ref arg0)))))\n" |
| 116 | "\n" |
| 117 | " (signature vec2\n" |
| 118 | " (parameters\n" |
| 119 | " (declare (in) vec2 arg0))\n" |
| 120 | " ((return (expression vec2 ceil (var_ref arg0)))))\n" |
| 121 | "\n" |
| 122 | " (signature vec3\n" |
| 123 | " (parameters\n" |
| 124 | " (declare (in) vec3 arg0))\n" |
| 125 | " ((return (expression vec3 ceil (var_ref arg0)))))\n" |
| 126 | "\n" |
| 127 | " (signature vec4\n" |
| 128 | " (parameters\n" |
| 129 | " (declare (in) vec4 arg0))\n" |
| 130 | " ((return (expression vec4 ceil (var_ref arg0)))))\n" |
| 131 | "))\n" |
| 132 | }; |
Eric Anholt | 53afc36 | 2010-03-27 13:55:04 -0700 | [diff] [blame] | 133 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 134 | static const char *builtins_110_clamp = { |
| 135 | "((function clamp\n" |
| 136 | " (signature float\n" |
| 137 | " (parameters\n" |
| 138 | " (declare (in) float arg0)\n" |
| 139 | " (declare (in) float arg1)\n" |
| 140 | " (declare (in) float arg2))\n" |
| 141 | " ((return (expression float max (expression float min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" |
| 142 | "\n" |
| 143 | " (signature vec2\n" |
| 144 | " (parameters\n" |
| 145 | " (declare (in) vec2 arg0)\n" |
| 146 | " (declare (in) vec2 arg1)\n" |
| 147 | " (declare (in) vec2 arg2))\n" |
| 148 | " ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" |
| 149 | "\n" |
| 150 | " (signature vec3\n" |
| 151 | " (parameters\n" |
| 152 | " (declare (in) vec3 arg0)\n" |
| 153 | " (declare (in) vec3 arg1)\n" |
| 154 | " (declare (in) vec3 arg2))\n" |
| 155 | " ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" |
| 156 | "\n" |
| 157 | " (signature vec4\n" |
| 158 | " (parameters\n" |
| 159 | " (declare (in) vec4 arg0)\n" |
| 160 | " (declare (in) vec4 arg1)\n" |
| 161 | " (declare (in) vec4 arg2))\n" |
| 162 | " ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" |
| 163 | "))\n" |
| 164 | }; |
Eric Anholt | 53afc36 | 2010-03-27 13:55:04 -0700 | [diff] [blame] | 165 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 166 | static const char *builtins_110_degrees = { |
| 167 | "((function degrees\n" |
| 168 | " (signature float\n" |
| 169 | " (parameters\n" |
| 170 | " (declare (in) float arg0))\n" |
| 171 | " ((return (expression float * (var_ref arg0) (constant float (57.295780))))))\n" |
| 172 | "\n" |
| 173 | " (signature vec2\n" |
| 174 | " (parameters\n" |
| 175 | " (declare (in) vec2 arg0))\n" |
| 176 | " ((return (expression vec2 * (var_ref arg0) (constant float (57.295780))))))\n" |
| 177 | "\n" |
| 178 | " (signature vec3\n" |
| 179 | " (parameters\n" |
| 180 | " (declare (in) vec3 arg0))\n" |
| 181 | " ((return (expression vec3 * (var_ref arg0) (constant float (57.295780))))))\n" |
| 182 | "\n" |
| 183 | " (signature vec4\n" |
| 184 | " (parameters\n" |
| 185 | " (declare (in) vec4 arg0))\n" |
| 186 | " ((return (expression vec4 * (var_ref arg0) (constant float (57.295780))))))\n" |
| 187 | "))\n" |
| 188 | }; |
Eric Anholt | 53afc36 | 2010-03-27 13:55:04 -0700 | [diff] [blame] | 189 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 190 | static const char *builtins_110_dot = { |
| 191 | "((function dot\n" |
| 192 | " (signature float\n" |
| 193 | " (parameters\n" |
| 194 | " (declare (in) float arg0)\n" |
| 195 | " (declare (in) float arg1))\n" |
| 196 | " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" |
| 197 | "\n" |
| 198 | " (signature float\n" |
| 199 | " (parameters\n" |
| 200 | " (declare (in) vec2 arg0)\n" |
| 201 | " (declare (in) vec2 arg1))\n" |
| 202 | " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" |
| 203 | "\n" |
| 204 | " (signature float\n" |
| 205 | " (parameters\n" |
| 206 | " (declare (in) vec3 arg0)\n" |
| 207 | " (declare (in) vec3 arg1))\n" |
| 208 | " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" |
| 209 | "\n" |
| 210 | " (signature float\n" |
| 211 | " (parameters\n" |
| 212 | " (declare (in) vec4 arg0)\n" |
| 213 | " (declare (in) vec4 arg1))\n" |
| 214 | " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" |
| 215 | "))\n" |
| 216 | }; |
Kenneth Graunke | 9fa99f3 | 2010-04-21 12:30:22 -0700 | [diff] [blame] | 217 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 218 | static const char *builtins_110_equal = { |
| 219 | "((function equal\n" |
| 220 | " (signature bvec2\n" |
| 221 | " (parameters\n" |
| 222 | " (declare (in) vec2 arg0)\n" |
| 223 | " (declare (in) vec2 arg1))\n" |
| 224 | " ((declare () bvec2 temp)\n" |
| 225 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 226 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 227 | " (return (var_ref temp))))\n" |
| 228 | "\n" |
| 229 | " (signature bvec3\n" |
| 230 | " (parameters\n" |
| 231 | " (declare (in) vec3 arg0)\n" |
| 232 | " (declare (in) vec3 arg1))\n" |
| 233 | " ((declare () bvec3 temp)\n" |
| 234 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 235 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 236 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 237 | " (return (var_ref temp))))\n" |
| 238 | "\n" |
| 239 | " (signature bvec4\n" |
| 240 | " (parameters\n" |
| 241 | " (declare (in) vec4 arg0)\n" |
| 242 | " (declare (in) vec4 arg1))\n" |
| 243 | " ((declare () bvec4 temp)\n" |
| 244 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 245 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 246 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 247 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 248 | " (return (var_ref temp))))\n" |
| 249 | "\n" |
| 250 | " (signature bvec2\n" |
| 251 | " (parameters\n" |
| 252 | " (declare (in) ivec2 arg0)\n" |
| 253 | " (declare (in) ivec2 arg1))\n" |
| 254 | " ((declare () bvec2 temp)\n" |
| 255 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 256 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 257 | " (return (var_ref temp))))\n" |
| 258 | "\n" |
| 259 | " (signature bvec3\n" |
| 260 | " (parameters\n" |
| 261 | " (declare (in) ivec3 arg0)\n" |
| 262 | " (declare (in) ivec3 arg1))\n" |
| 263 | " ((declare () bvec3 temp)\n" |
| 264 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 265 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 266 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 267 | " (return (var_ref temp))))\n" |
| 268 | "\n" |
| 269 | " (signature bvec4\n" |
| 270 | " (parameters\n" |
| 271 | " (declare (in) ivec4 arg0)\n" |
| 272 | " (declare (in) ivec4 arg1))\n" |
| 273 | " ((declare () bvec4 temp)\n" |
| 274 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 275 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 276 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 277 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 278 | " (return (var_ref temp))))\n" |
| 279 | "))\n" |
| 280 | }; |
Eric Anholt | c22c400 | 2010-03-26 18:20:30 -0700 | [diff] [blame] | 281 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 282 | static const char *builtins_110_exp = { |
| 283 | "((function exp\n" |
| 284 | " (signature float\n" |
| 285 | " (parameters\n" |
| 286 | " (declare (in) float arg0))\n" |
| 287 | " ((return (expression float exp (var_ref arg0)))))\n" |
| 288 | "\n" |
| 289 | " (signature vec2\n" |
| 290 | " (parameters\n" |
| 291 | " (declare (in) vec2 arg0))\n" |
| 292 | " ((return (expression vec2 exp (var_ref arg0)))))\n" |
| 293 | "\n" |
| 294 | " (signature vec3\n" |
| 295 | " (parameters\n" |
| 296 | " (declare (in) vec3 arg0))\n" |
| 297 | " ((return (expression vec3 exp (var_ref arg0)))))\n" |
| 298 | "\n" |
| 299 | " (signature vec4\n" |
| 300 | " (parameters\n" |
| 301 | " (declare (in) vec4 arg0))\n" |
| 302 | " ((return (expression vec4 exp (var_ref arg0)))))\n" |
| 303 | "))\n" |
| 304 | }; |
Eric Anholt | 76a91e1 | 2010-03-27 14:04:43 -0700 | [diff] [blame] | 305 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 306 | static const char *builtins_110_exp2 = { |
| 307 | "((function exp2\n" |
| 308 | " (signature float\n" |
| 309 | " (parameters\n" |
| 310 | " (declare (in) float arg0))\n" |
| 311 | " ((return (expression float exp2 (var_ref arg0)))))\n" |
| 312 | "\n" |
| 313 | " (signature vec2\n" |
| 314 | " (parameters\n" |
| 315 | " (declare (in) vec2 arg0))\n" |
| 316 | " ((return (expression vec2 exp2 (var_ref arg0)))))\n" |
| 317 | "\n" |
| 318 | " (signature vec3\n" |
| 319 | " (parameters\n" |
| 320 | " (declare (in) vec3 arg0))\n" |
| 321 | " ((return (expression vec3 exp2 (var_ref arg0)))))\n" |
| 322 | "\n" |
| 323 | " (signature vec4\n" |
| 324 | " (parameters\n" |
| 325 | " (declare (in) vec4 arg0))\n" |
| 326 | " ((return (expression vec4 exp2 (var_ref arg0)))))\n" |
| 327 | "))\n" |
| 328 | }; |
Eric Anholt | 76a91e1 | 2010-03-27 14:04:43 -0700 | [diff] [blame] | 329 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 330 | static const char *builtins_110_floor = { |
| 331 | "((function floor\n" |
| 332 | " (signature float\n" |
| 333 | " (parameters\n" |
| 334 | " (declare (in) float arg0))\n" |
| 335 | " ((return (expression float floor (var_ref arg0)))))\n" |
| 336 | "\n" |
| 337 | " (signature vec2\n" |
| 338 | " (parameters\n" |
| 339 | " (declare (in) vec2 arg0))\n" |
| 340 | " ((return (expression vec2 floor (var_ref arg0)))))\n" |
| 341 | "\n" |
| 342 | " (signature vec3\n" |
| 343 | " (parameters\n" |
| 344 | " (declare (in) vec3 arg0))\n" |
| 345 | " ((return (expression vec3 floor (var_ref arg0)))))\n" |
| 346 | "\n" |
| 347 | " (signature vec4\n" |
| 348 | " (parameters\n" |
| 349 | " (declare (in) vec4 arg0))\n" |
| 350 | " ((return (expression vec4 floor (var_ref arg0)))))\n" |
| 351 | "))\n" |
| 352 | }; |
Eric Anholt | 76a91e1 | 2010-03-27 14:04:43 -0700 | [diff] [blame] | 353 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 354 | static const char *builtins_110_greaterThan = { |
| 355 | "((function greaterThan\n" |
| 356 | " (signature bvec2\n" |
| 357 | " (parameters\n" |
| 358 | " (declare (in) vec2 arg0)\n" |
| 359 | " (declare (in) vec2 arg1))\n" |
| 360 | " ((declare () bvec2 temp)\n" |
| 361 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 362 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 363 | " (return (var_ref temp))))\n" |
| 364 | "\n" |
| 365 | " (signature bvec3\n" |
| 366 | " (parameters\n" |
| 367 | " (declare (in) vec3 arg0)\n" |
| 368 | " (declare (in) vec3 arg1))\n" |
| 369 | " ((declare () bvec3 temp)\n" |
| 370 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 371 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 372 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 373 | " (return (var_ref temp))))\n" |
| 374 | "\n" |
| 375 | " (signature bvec4\n" |
| 376 | " (parameters\n" |
| 377 | " (declare (in) vec4 arg0)\n" |
| 378 | " (declare (in) vec4 arg1))\n" |
| 379 | " ((declare () bvec4 temp)\n" |
| 380 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 381 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 382 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 383 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 384 | " (return (var_ref temp))))\n" |
| 385 | "\n" |
| 386 | " (signature bvec2\n" |
| 387 | " (parameters\n" |
| 388 | " (declare (in) ivec2 arg0)\n" |
| 389 | " (declare (in) ivec2 arg1))\n" |
| 390 | " ((declare () bvec2 temp)\n" |
| 391 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 392 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 393 | " (return (var_ref temp))))\n" |
| 394 | "\n" |
| 395 | " (signature bvec3\n" |
| 396 | " (parameters\n" |
| 397 | " (declare (in) ivec3 arg0)\n" |
| 398 | " (declare (in) ivec3 arg1))\n" |
| 399 | " ((declare () bvec3 temp)\n" |
| 400 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 401 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 402 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 403 | " (return (var_ref temp))))\n" |
| 404 | "\n" |
| 405 | " (signature bvec4\n" |
| 406 | " (parameters\n" |
| 407 | " (declare (in) ivec4 arg0)\n" |
| 408 | " (declare (in) ivec4 arg1))\n" |
| 409 | " ((declare () bvec4 temp)\n" |
| 410 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 411 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 412 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 413 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 414 | " (return (var_ref temp))))\n" |
| 415 | "))\n" |
| 416 | }; |
Eric Anholt | 76a91e1 | 2010-03-27 14:04:43 -0700 | [diff] [blame] | 417 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 418 | static const char *builtins_110_greaterThanEqual = { |
| 419 | "((function greaterThanEqual\n" |
| 420 | " (signature bvec2\n" |
| 421 | " (parameters\n" |
| 422 | " (declare (in) vec2 arg0)\n" |
| 423 | " (declare (in) vec2 arg1))\n" |
| 424 | " ((declare () bvec2 temp)\n" |
| 425 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 426 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 427 | " (return (var_ref temp))))\n" |
| 428 | "\n" |
| 429 | " (signature bvec3\n" |
| 430 | " (parameters\n" |
| 431 | " (declare (in) vec3 arg0)\n" |
| 432 | " (declare (in) vec3 arg1))\n" |
| 433 | " ((declare () bvec3 temp)\n" |
| 434 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 435 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 436 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 437 | " (return (var_ref temp))))\n" |
| 438 | "\n" |
| 439 | " (signature bvec4\n" |
| 440 | " (parameters\n" |
| 441 | " (declare (in) vec4 arg0)\n" |
| 442 | " (declare (in) vec4 arg1))\n" |
| 443 | " ((declare () bvec4 temp)\n" |
| 444 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 445 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 446 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 447 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 448 | " (return (var_ref temp))))\n" |
| 449 | "\n" |
| 450 | " (signature bvec2\n" |
| 451 | " (parameters\n" |
| 452 | " (declare (in) ivec2 arg0)\n" |
| 453 | " (declare (in) ivec2 arg1))\n" |
| 454 | " ((declare () bvec2 temp)\n" |
| 455 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 456 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 457 | " (return (var_ref temp))))\n" |
| 458 | "\n" |
| 459 | " (signature bvec3\n" |
| 460 | " (parameters\n" |
| 461 | " (declare (in) ivec3 arg0)\n" |
| 462 | " (declare (in) ivec3 arg1))\n" |
| 463 | " ((declare () bvec3 temp)\n" |
| 464 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 465 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 466 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 467 | " (return (var_ref temp))))\n" |
| 468 | "\n" |
| 469 | " (signature bvec4\n" |
| 470 | " (parameters\n" |
| 471 | " (declare (in) ivec4 arg0)\n" |
| 472 | " (declare (in) ivec4 arg1))\n" |
| 473 | " ((declare () bvec4 temp)\n" |
| 474 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 475 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 476 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 477 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 478 | " (return (var_ref temp))))\n" |
| 479 | "))\n" |
| 480 | }; |
Eric Anholt | 76a91e1 | 2010-03-27 14:04:43 -0700 | [diff] [blame] | 481 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 482 | static const char *builtins_110_inversesqrt = { |
| 483 | "((function inversesqrt\n" |
| 484 | " (signature float\n" |
| 485 | " (parameters\n" |
| 486 | " (declare (in) float arg0))\n" |
| 487 | " ((return (expression float rsq (var_ref arg0)))))\n" |
| 488 | "\n" |
| 489 | " (signature vec2\n" |
| 490 | " (parameters\n" |
| 491 | " (declare (in) vec2 arg0))\n" |
| 492 | " ((return (expression vec2 rsq (var_ref arg0)))))\n" |
| 493 | "\n" |
| 494 | " (signature vec3\n" |
| 495 | " (parameters\n" |
| 496 | " (declare (in) vec3 arg0))\n" |
| 497 | " ((return (expression vec3 rsq (var_ref arg0)))))\n" |
| 498 | "\n" |
| 499 | " (signature vec4\n" |
| 500 | " (parameters\n" |
| 501 | " (declare (in) vec4 arg0))\n" |
| 502 | " ((return (expression vec4 rsq (var_ref arg0)))))\n" |
| 503 | "))\n" |
| 504 | }; |
Eric Anholt | 76a91e1 | 2010-03-27 14:04:43 -0700 | [diff] [blame] | 505 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 506 | static const char *builtins_110_length = { |
| 507 | "((function length\n" |
| 508 | " (signature float\n" |
| 509 | " (parameters\n" |
| 510 | " (declare (in) float arg0))\n" |
| 511 | " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" |
| 512 | "\n" |
| 513 | " (signature float\n" |
| 514 | " (parameters\n" |
| 515 | " (declare (in) vec2 arg0))\n" |
| 516 | " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" |
| 517 | "\n" |
| 518 | " (signature float\n" |
| 519 | " (parameters\n" |
| 520 | " (declare (in) vec3 arg0))\n" |
| 521 | " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" |
| 522 | "\n" |
| 523 | " (signature float\n" |
| 524 | " (parameters\n" |
| 525 | " (declare (in) vec4 arg0))\n" |
| 526 | " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" |
| 527 | "))\n" |
| 528 | }; |
Kenneth Graunke | 9fa99f3 | 2010-04-21 12:30:22 -0700 | [diff] [blame] | 529 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 530 | static const char *builtins_110_lessThan = { |
| 531 | "((function lessThan\n" |
| 532 | " (signature bvec2\n" |
| 533 | " (parameters\n" |
| 534 | " (declare (in) vec2 arg0)\n" |
| 535 | " (declare (in) vec2 arg1))\n" |
| 536 | " ((declare () bvec2 temp)\n" |
| 537 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 538 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 539 | " (return (var_ref temp))))\n" |
| 540 | "\n" |
| 541 | " (signature bvec3\n" |
| 542 | " (parameters\n" |
| 543 | " (declare (in) vec3 arg0)\n" |
| 544 | " (declare (in) vec3 arg1))\n" |
| 545 | " ((declare () bvec3 temp)\n" |
| 546 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 547 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 548 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 549 | " (return (var_ref temp))))\n" |
| 550 | "\n" |
| 551 | " (signature bvec4\n" |
| 552 | " (parameters\n" |
| 553 | " (declare (in) vec4 arg0)\n" |
| 554 | " (declare (in) vec4 arg1))\n" |
| 555 | " ((declare () bvec4 temp)\n" |
| 556 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 557 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 558 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 559 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 560 | " (return (var_ref temp))))\n" |
| 561 | "\n" |
| 562 | " (signature bvec2\n" |
| 563 | " (parameters\n" |
| 564 | " (declare (in) ivec2 arg0)\n" |
| 565 | " (declare (in) ivec2 arg1))\n" |
| 566 | " ((declare () bvec2 temp)\n" |
| 567 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 568 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 569 | " (return (var_ref temp))))\n" |
| 570 | "\n" |
| 571 | " (signature bvec3\n" |
| 572 | " (parameters\n" |
| 573 | " (declare (in) ivec3 arg0)\n" |
| 574 | " (declare (in) ivec3 arg1))\n" |
| 575 | " ((declare () bvec3 temp)\n" |
| 576 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 577 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 578 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 579 | " (return (var_ref temp))))\n" |
| 580 | "\n" |
| 581 | " (signature bvec4\n" |
| 582 | " (parameters\n" |
| 583 | " (declare (in) ivec4 arg0)\n" |
| 584 | " (declare (in) ivec4 arg1))\n" |
| 585 | " ((declare () bvec4 temp)\n" |
| 586 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 587 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 588 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 589 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 590 | " (return (var_ref temp))))\n" |
| 591 | "))\n" |
| 592 | }; |
Eric Anholt | 76a91e1 | 2010-03-27 14:04:43 -0700 | [diff] [blame] | 593 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 594 | static const char *builtins_110_lessThanEqual = { |
| 595 | "((function lessThanEqual\n" |
| 596 | " (signature bvec2\n" |
| 597 | " (parameters\n" |
| 598 | " (declare (in) vec2 arg0)\n" |
| 599 | " (declare (in) vec2 arg1))\n" |
| 600 | " ((declare () bvec2 temp)\n" |
| 601 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 602 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 603 | " (return (var_ref temp))))\n" |
| 604 | "\n" |
| 605 | " (signature bvec3\n" |
| 606 | " (parameters\n" |
| 607 | " (declare (in) vec3 arg0)\n" |
| 608 | " (declare (in) vec3 arg1))\n" |
| 609 | " ((declare () bvec3 temp)\n" |
| 610 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 611 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 612 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 613 | " (return (var_ref temp))))\n" |
| 614 | "\n" |
| 615 | " (signature bvec4\n" |
| 616 | " (parameters\n" |
| 617 | " (declare (in) vec4 arg0)\n" |
| 618 | " (declare (in) vec4 arg1))\n" |
| 619 | " ((declare () bvec4 temp)\n" |
| 620 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 621 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 622 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 623 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 624 | " (return (var_ref temp))))\n" |
| 625 | "\n" |
| 626 | " (signature bvec2\n" |
| 627 | " (parameters\n" |
| 628 | " (declare (in) ivec2 arg0)\n" |
| 629 | " (declare (in) ivec2 arg1))\n" |
| 630 | " ((declare () bvec2 temp)\n" |
| 631 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 632 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 633 | " (return (var_ref temp))))\n" |
| 634 | "\n" |
| 635 | " (signature bvec3\n" |
| 636 | " (parameters\n" |
| 637 | " (declare (in) ivec3 arg0)\n" |
| 638 | " (declare (in) ivec3 arg1))\n" |
| 639 | " ((declare () bvec3 temp)\n" |
| 640 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 641 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 642 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 643 | " (return (var_ref temp))))\n" |
| 644 | "\n" |
| 645 | " (signature bvec4\n" |
| 646 | " (parameters\n" |
| 647 | " (declare (in) ivec4 arg0)\n" |
| 648 | " (declare (in) ivec4 arg1))\n" |
| 649 | " ((declare () bvec4 temp)\n" |
| 650 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 651 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 652 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 653 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 654 | " (return (var_ref temp))))\n" |
| 655 | "))\n" |
| 656 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 657 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 658 | static const char *builtins_110_log = { |
| 659 | "((function log\n" |
| 660 | " (signature float\n" |
| 661 | " (parameters\n" |
| 662 | " (declare (in) float arg0))\n" |
| 663 | " ((return (expression float log (var_ref arg0)))))\n" |
| 664 | "\n" |
| 665 | " (signature vec2\n" |
| 666 | " (parameters\n" |
| 667 | " (declare (in) vec2 arg0))\n" |
| 668 | " ((return (expression vec2 log (var_ref arg0)))))\n" |
| 669 | "\n" |
| 670 | " (signature vec3\n" |
| 671 | " (parameters\n" |
| 672 | " (declare (in) vec3 arg0))\n" |
| 673 | " ((return (expression vec3 log (var_ref arg0)))))\n" |
| 674 | "\n" |
| 675 | " (signature vec4\n" |
| 676 | " (parameters\n" |
| 677 | " (declare (in) vec4 arg0))\n" |
| 678 | " ((return (expression vec4 log (var_ref arg0)))))\n" |
| 679 | "))\n" |
| 680 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 681 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 682 | static const char *builtins_110_log2 = { |
| 683 | "((function log2\n" |
| 684 | " (signature float\n" |
| 685 | " (parameters\n" |
| 686 | " (declare (in) float arg0))\n" |
| 687 | " ((return (expression float log2 (var_ref arg0)))))\n" |
| 688 | "\n" |
| 689 | " (signature vec2\n" |
| 690 | " (parameters\n" |
| 691 | " (declare (in) vec2 arg0))\n" |
| 692 | " ((return (expression vec2 log2 (var_ref arg0)))))\n" |
| 693 | "\n" |
| 694 | " (signature vec3\n" |
| 695 | " (parameters\n" |
| 696 | " (declare (in) vec3 arg0))\n" |
| 697 | " ((return (expression vec3 log2 (var_ref arg0)))))\n" |
| 698 | "\n" |
| 699 | " (signature vec4\n" |
| 700 | " (parameters\n" |
| 701 | " (declare (in) vec4 arg0))\n" |
| 702 | " ((return (expression vec4 log2 (var_ref arg0)))))\n" |
| 703 | "))\n" |
| 704 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 705 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 706 | static const char *builtins_110_max = { |
| 707 | "((function max\n" |
| 708 | " (signature float\n" |
| 709 | " (parameters\n" |
| 710 | " (declare (in) float arg0)\n" |
| 711 | " (declare (in) float arg1))\n" |
| 712 | " ((return (expression float max (var_ref arg0) (var_ref arg1)))))\n" |
| 713 | "\n" |
| 714 | " (signature vec2\n" |
| 715 | " (parameters\n" |
| 716 | " (declare (in) vec2 arg0)\n" |
| 717 | " (declare (in) vec2 arg1))\n" |
| 718 | " ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n" |
| 719 | "\n" |
| 720 | " (signature vec3\n" |
| 721 | " (parameters\n" |
| 722 | " (declare (in) vec3 arg0)\n" |
| 723 | " (declare (in) vec3 arg1))\n" |
| 724 | " ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n" |
| 725 | "\n" |
| 726 | " (signature vec4\n" |
| 727 | " (parameters\n" |
| 728 | " (declare (in) vec4 arg0)\n" |
| 729 | " (declare (in) vec4 arg1))\n" |
| 730 | " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n" |
| 731 | "))\n" |
| 732 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 733 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 734 | static const char *builtins_110_min = { |
| 735 | "((function min\n" |
| 736 | " (signature float\n" |
| 737 | " (parameters\n" |
| 738 | " (declare (in) float arg0)\n" |
| 739 | " (declare (in) float arg1))\n" |
| 740 | " ((return (expression float min (var_ref arg0) (var_ref arg1)))))\n" |
| 741 | "\n" |
| 742 | " (signature vec2\n" |
| 743 | " (parameters\n" |
| 744 | " (declare (in) vec2 arg0)\n" |
| 745 | " (declare (in) vec2 arg1))\n" |
| 746 | " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n" |
| 747 | "\n" |
| 748 | " (signature vec3\n" |
| 749 | " (parameters\n" |
| 750 | " (declare (in) vec3 arg0)\n" |
| 751 | " (declare (in) vec3 arg1))\n" |
| 752 | " ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n" |
| 753 | "\n" |
| 754 | " (signature vec4\n" |
| 755 | " (parameters\n" |
| 756 | " (declare (in) vec4 arg0)\n" |
| 757 | " (declare (in) vec4 arg1))\n" |
| 758 | " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" |
| 759 | "))\n" |
| 760 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 761 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 762 | static const char *builtins_110_mix = { |
| 763 | "((function mix\n" |
| 764 | " (signature float\n" |
| 765 | " (parameters\n" |
| 766 | " (declare (in) float arg0)\n" |
| 767 | " (declare (in) float arg1)\n" |
| 768 | " (declare (in) float arg2))\n" |
| 769 | " ((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2))))))\n" |
| 770 | "\n" |
| 771 | " (signature vec2\n" |
| 772 | " (parameters\n" |
| 773 | " (declare (in) vec2 arg0)\n" |
| 774 | " (declare (in) vec2 arg1)\n" |
| 775 | " (declare (in) vec2 arg2))\n" |
| 776 | " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" |
| 777 | "\n" |
| 778 | " (signature vec3\n" |
| 779 | " (parameters\n" |
| 780 | " (declare (in) vec3 arg0)\n" |
| 781 | " (declare (in) vec3 arg1)\n" |
| 782 | " (declare (in) vec3 arg2))\n" |
| 783 | " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" |
| 784 | "\n" |
| 785 | " (signature vec4\n" |
| 786 | " (parameters\n" |
| 787 | " (declare (in) vec4 arg0)\n" |
| 788 | " (declare (in) vec4 arg1)\n" |
| 789 | " (declare (in) vec4 arg2))\n" |
| 790 | " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" |
| 791 | "))\n" |
| 792 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 793 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 794 | static const char *builtins_110_mod = { |
| 795 | "((function mod\n" |
| 796 | " (signature float\n" |
| 797 | " (parameters\n" |
| 798 | " (declare (in) float arg0)\n" |
| 799 | " (declare (in) float arg1))\n" |
| 800 | " ((return (expression float % (var_ref arg0) (var_ref arg1)))))\n" |
| 801 | "\n" |
| 802 | " (signature vec2\n" |
| 803 | " (parameters\n" |
| 804 | " (declare (in) vec2 arg0)\n" |
| 805 | " (declare (in) vec2 arg1))\n" |
| 806 | " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n" |
| 807 | "\n" |
| 808 | " (signature vec3\n" |
| 809 | " (parameters\n" |
| 810 | " (declare (in) vec3 arg0)\n" |
| 811 | " (declare (in) vec3 arg1))\n" |
| 812 | " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n" |
| 813 | "\n" |
| 814 | " (signature vec4\n" |
| 815 | " (parameters\n" |
| 816 | " (declare (in) vec4 arg0)\n" |
| 817 | " (declare (in) vec4 arg1))\n" |
| 818 | " ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n" |
| 819 | "))\n" |
| 820 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 821 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 822 | static const char *builtins_110_normalize = { |
| 823 | "((function normalize\n" |
| 824 | " (signature float\n" |
| 825 | " (parameters\n" |
| 826 | " (declare (in) float arg0))\n" |
| 827 | " ((return (expression float * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" |
| 828 | "\n" |
| 829 | " (signature vec2\n" |
| 830 | " (parameters\n" |
| 831 | " (declare (in) vec2 arg0))\n" |
| 832 | " ((return (expression vec2 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" |
| 833 | "\n" |
| 834 | " (signature vec3\n" |
| 835 | " (parameters\n" |
| 836 | " (declare (in) vec3 arg0))\n" |
| 837 | " ((return (expression vec3 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" |
| 838 | "\n" |
| 839 | " (signature vec4\n" |
| 840 | " (parameters\n" |
| 841 | " (declare (in) vec4 arg0))\n" |
| 842 | " ((return (expression vec4 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" |
| 843 | "))\n" |
| 844 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 845 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 846 | static const char *builtins_110_not = { |
| 847 | "((function not\n" |
| 848 | " (signature bvec2\n" |
| 849 | " (parameters\n" |
| 850 | " (declare (in) bvec2 arg0))\n" |
| 851 | " ((return (expression bvec2 ! (var_ref arg0)))))\n" |
| 852 | "\n" |
| 853 | " (signature bvec3\n" |
| 854 | " (parameters\n" |
| 855 | " (declare (in) bvec3 arg0))\n" |
| 856 | " ((return (expression bvec3 ! (var_ref arg0)))))\n" |
| 857 | "\n" |
| 858 | " (signature bvec4\n" |
| 859 | " (parameters\n" |
| 860 | " (declare (in) bvec4 arg0))\n" |
| 861 | " ((return (expression bvec4 ! (var_ref arg0)))))\n" |
| 862 | "))\n" |
| 863 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 864 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 865 | static const char *builtins_110_notEqual = { |
| 866 | "((function notEqual\n" |
| 867 | " (signature bvec2\n" |
| 868 | " (parameters\n" |
| 869 | " (declare (in) vec2 arg0)\n" |
| 870 | " (declare (in) vec2 arg1))\n" |
| 871 | " ((declare () bvec2 temp)\n" |
| 872 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 873 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 874 | " (return (var_ref temp))))\n" |
| 875 | "\n" |
| 876 | " (signature bvec3\n" |
| 877 | " (parameters\n" |
| 878 | " (declare (in) vec3 arg0)\n" |
| 879 | " (declare (in) vec3 arg1))\n" |
| 880 | " ((declare () bvec3 temp)\n" |
| 881 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 882 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 883 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 884 | " (return (var_ref temp))))\n" |
| 885 | "\n" |
| 886 | " (signature bvec4\n" |
| 887 | " (parameters\n" |
| 888 | " (declare (in) vec4 arg0)\n" |
| 889 | " (declare (in) vec4 arg1))\n" |
| 890 | " ((declare () bvec4 temp)\n" |
| 891 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 892 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 893 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 894 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 895 | " (return (var_ref temp))))\n" |
| 896 | "\n" |
| 897 | " (signature bvec2\n" |
| 898 | " (parameters\n" |
| 899 | " (declare (in) ivec2 arg0)\n" |
| 900 | " (declare (in) ivec2 arg1))\n" |
| 901 | " ((declare () bvec2 temp)\n" |
| 902 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 903 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 904 | " (return (var_ref temp))))\n" |
| 905 | "\n" |
| 906 | " (signature bvec3\n" |
| 907 | " (parameters\n" |
| 908 | " (declare (in) ivec3 arg0)\n" |
| 909 | " (declare (in) ivec3 arg1))\n" |
| 910 | " ((declare () bvec3 temp)\n" |
| 911 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 912 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 913 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 914 | " (return (var_ref temp))))\n" |
| 915 | "\n" |
| 916 | " (signature bvec4\n" |
| 917 | " (parameters\n" |
| 918 | " (declare (in) ivec4 arg0)\n" |
| 919 | " (declare (in) ivec4 arg1))\n" |
| 920 | " ((declare () bvec4 temp)\n" |
| 921 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 922 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 923 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 924 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 925 | " (return (var_ref temp))))\n" |
| 926 | "))\n" |
| 927 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 928 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 929 | static const char *builtins_110_pow = { |
| 930 | "((function pow\n" |
| 931 | " (signature float\n" |
| 932 | " (parameters\n" |
| 933 | " (declare (in) float arg0)\n" |
| 934 | " (declare (in) float arg1))\n" |
| 935 | " ((return (expression float pow (var_ref arg0) (var_ref arg1)))))\n" |
| 936 | "\n" |
| 937 | " (signature vec2\n" |
| 938 | " (parameters\n" |
| 939 | " (declare (in) vec2 arg0)\n" |
| 940 | " (declare (in) vec2 arg1))\n" |
| 941 | " ((return (expression vec2 pow (var_ref arg0) (var_ref arg1)))))\n" |
| 942 | "\n" |
| 943 | " (signature vec3\n" |
| 944 | " (parameters\n" |
| 945 | " (declare (in) vec3 arg0)\n" |
| 946 | " (declare (in) vec3 arg1))\n" |
| 947 | " ((return (expression vec3 pow (var_ref arg0) (var_ref arg1)))))\n" |
| 948 | "\n" |
| 949 | " (signature vec4\n" |
| 950 | " (parameters\n" |
| 951 | " (declare (in) vec4 arg0)\n" |
| 952 | " (declare (in) vec4 arg1))\n" |
| 953 | " ((return (expression vec4 pow (var_ref arg0) (var_ref arg1)))))\n" |
| 954 | "))\n" |
| 955 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 956 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 957 | static const char *builtins_110_radians = { |
| 958 | "((function radians\n" |
| 959 | " (signature float\n" |
| 960 | " (parameters\n" |
| 961 | " (declare (in) float arg0))\n" |
| 962 | " ((return (expression float * (var_ref arg0) (constant float (0.017453))))))\n" |
| 963 | "\n" |
| 964 | " (signature vec2\n" |
| 965 | " (parameters\n" |
| 966 | " (declare (in) vec2 arg0))\n" |
| 967 | " ((return (expression vec2 * (var_ref arg0) (constant float (0.017453))))))\n" |
| 968 | "\n" |
| 969 | " (signature vec3\n" |
| 970 | " (parameters\n" |
| 971 | " (declare (in) vec3 arg0))\n" |
| 972 | " ((return (expression vec3 * (var_ref arg0) (constant float (0.017453))))))\n" |
| 973 | "\n" |
| 974 | " (signature vec4\n" |
| 975 | " (parameters\n" |
| 976 | " (declare (in) vec4 arg0))\n" |
| 977 | " ((return (expression vec4 * (var_ref arg0) (constant float (0.017453))))))\n" |
| 978 | "))\n" |
| 979 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 980 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 981 | static const char *builtins_110_sqrt = { |
| 982 | "((function sqrt\n" |
| 983 | " (signature float\n" |
| 984 | " (parameters\n" |
| 985 | " (declare (in) float arg0))\n" |
| 986 | " ((return (expression float sqrt (var_ref arg0)))))\n" |
| 987 | "\n" |
| 988 | " (signature vec2\n" |
| 989 | " (parameters\n" |
| 990 | " (declare (in) vec2 arg0))\n" |
| 991 | " ((return (expression vec2 sqrt (var_ref arg0)))))\n" |
| 992 | "\n" |
| 993 | " (signature vec3\n" |
| 994 | " (parameters\n" |
| 995 | " (declare (in) vec3 arg0))\n" |
| 996 | " ((return (expression vec3 sqrt (var_ref arg0)))))\n" |
| 997 | "\n" |
| 998 | " (signature vec4\n" |
| 999 | " (parameters\n" |
| 1000 | " (declare (in) vec4 arg0))\n" |
| 1001 | " ((return (expression vec4 sqrt (var_ref arg0)))))\n" |
| 1002 | "))\n" |
| 1003 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 1004 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1005 | static const char *functions_for_110 [] = { |
| 1006 | builtins_110_abs, |
| 1007 | builtins_110_all, |
| 1008 | builtins_110_any, |
| 1009 | builtins_110_ceil, |
| 1010 | builtins_110_clamp, |
| 1011 | builtins_110_degrees, |
| 1012 | builtins_110_dot, |
| 1013 | builtins_110_equal, |
| 1014 | builtins_110_exp, |
| 1015 | builtins_110_exp2, |
| 1016 | builtins_110_floor, |
| 1017 | builtins_110_greaterThan, |
| 1018 | builtins_110_greaterThanEqual, |
| 1019 | builtins_110_inversesqrt, |
| 1020 | builtins_110_length, |
| 1021 | builtins_110_lessThan, |
| 1022 | builtins_110_lessThanEqual, |
| 1023 | builtins_110_log, |
| 1024 | builtins_110_log2, |
| 1025 | builtins_110_max, |
| 1026 | builtins_110_min, |
| 1027 | builtins_110_mix, |
| 1028 | builtins_110_mod, |
| 1029 | builtins_110_normalize, |
| 1030 | builtins_110_not, |
| 1031 | builtins_110_notEqual, |
| 1032 | builtins_110_pow, |
| 1033 | builtins_110_radians, |
| 1034 | builtins_110_sqrt, |
| 1035 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 1036 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1037 | /* Version 130 builtins */ |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 1038 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1039 | static const char *builtins_130_equal = { |
| 1040 | "((function equal\n" |
| 1041 | " (signature bvec2\n" |
| 1042 | " (parameters\n" |
| 1043 | " (declare (in) uvec2 arg0)\n" |
| 1044 | " (declare (in) uvec2 arg1))\n" |
| 1045 | " ((declare () bvec2 temp)\n" |
| 1046 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1047 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1048 | " (return (var_ref temp))))\n" |
| 1049 | "\n" |
| 1050 | " (signature bvec3\n" |
| 1051 | " (parameters\n" |
| 1052 | " (declare (in) uvec3 arg0)\n" |
| 1053 | " (declare (in) uvec3 arg1))\n" |
| 1054 | " ((declare () bvec3 temp)\n" |
| 1055 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1056 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1057 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1058 | " (return (var_ref temp))))\n" |
| 1059 | "\n" |
| 1060 | " (signature bvec4\n" |
| 1061 | " (parameters\n" |
| 1062 | " (declare (in) uvec4 arg0)\n" |
| 1063 | " (declare (in) uvec4 arg1))\n" |
| 1064 | " ((declare () bvec4 temp)\n" |
| 1065 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1066 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1067 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1068 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 1069 | " (return (var_ref temp))))\n" |
| 1070 | "))\n" |
| 1071 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 1072 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1073 | static const char *builtins_130_greaterThan = { |
| 1074 | "((function greaterThan\n" |
| 1075 | " (signature bvec2\n" |
| 1076 | " (parameters\n" |
| 1077 | " (declare (in) uvec2 arg0)\n" |
| 1078 | " (declare (in) uvec2 arg1))\n" |
| 1079 | " ((declare () bvec2 temp)\n" |
| 1080 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1081 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1082 | " (return (var_ref temp))))\n" |
| 1083 | "\n" |
| 1084 | " (signature bvec3\n" |
| 1085 | " (parameters\n" |
| 1086 | " (declare (in) uvec3 arg0)\n" |
| 1087 | " (declare (in) uvec3 arg1))\n" |
| 1088 | " ((declare () bvec3 temp)\n" |
| 1089 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1090 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1091 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1092 | " (return (var_ref temp))))\n" |
| 1093 | "\n" |
| 1094 | " (signature bvec4\n" |
| 1095 | " (parameters\n" |
| 1096 | " (declare (in) uvec4 arg0)\n" |
| 1097 | " (declare (in) uvec4 arg1))\n" |
| 1098 | " ((declare () bvec4 temp)\n" |
| 1099 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1100 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1101 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1102 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 1103 | " (return (var_ref temp))))\n" |
| 1104 | "))\n" |
| 1105 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 1106 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1107 | static const char *builtins_130_greaterThanEqual = { |
| 1108 | "((function greaterThanEqual\n" |
| 1109 | " (signature bvec2\n" |
| 1110 | " (parameters\n" |
| 1111 | " (declare (in) uvec2 arg0)\n" |
| 1112 | " (declare (in) uvec2 arg1))\n" |
| 1113 | " ((declare () bvec2 temp)\n" |
| 1114 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1115 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1116 | " (return (var_ref temp))))\n" |
| 1117 | "\n" |
| 1118 | " (signature bvec3\n" |
| 1119 | " (parameters\n" |
| 1120 | " (declare (in) uvec3 arg0)\n" |
| 1121 | " (declare (in) uvec3 arg1))\n" |
| 1122 | " ((declare () bvec3 temp)\n" |
| 1123 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1124 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1125 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1126 | " (return (var_ref temp))))\n" |
| 1127 | "\n" |
| 1128 | " (signature bvec4\n" |
| 1129 | " (parameters\n" |
| 1130 | " (declare (in) uvec4 arg0)\n" |
| 1131 | " (declare (in) uvec4 arg1))\n" |
| 1132 | " ((declare () bvec4 temp)\n" |
| 1133 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1134 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1135 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1136 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 1137 | " (return (var_ref temp))))\n" |
| 1138 | "))\n" |
| 1139 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 1140 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1141 | static const char *builtins_130_lessThan = { |
| 1142 | "((function lessThan\n" |
| 1143 | " (signature bvec2\n" |
| 1144 | " (parameters\n" |
| 1145 | " (declare (in) uvec2 arg0)\n" |
| 1146 | " (declare (in) uvec2 arg1))\n" |
| 1147 | " ((declare () bvec2 temp)\n" |
| 1148 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1149 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1150 | " (return (var_ref temp))))\n" |
| 1151 | "\n" |
| 1152 | " (signature bvec3\n" |
| 1153 | " (parameters\n" |
| 1154 | " (declare (in) uvec3 arg0)\n" |
| 1155 | " (declare (in) uvec3 arg1))\n" |
| 1156 | " ((declare () bvec3 temp)\n" |
| 1157 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1158 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1159 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1160 | " (return (var_ref temp))))\n" |
| 1161 | "\n" |
| 1162 | " (signature bvec4\n" |
| 1163 | " (parameters\n" |
| 1164 | " (declare (in) uvec4 arg0)\n" |
| 1165 | " (declare (in) uvec4 arg1))\n" |
| 1166 | " ((declare () bvec4 temp)\n" |
| 1167 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1168 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1169 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1170 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 1171 | " (return (var_ref temp))))\n" |
| 1172 | "))\n" |
| 1173 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 1174 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1175 | static const char *builtins_130_lessThanEqual = { |
| 1176 | "((function lessThanEqual\n" |
| 1177 | " (signature bvec2\n" |
| 1178 | " (parameters\n" |
| 1179 | " (declare (in) uvec2 arg0)\n" |
| 1180 | " (declare (in) uvec2 arg1))\n" |
| 1181 | " ((declare () bvec2 temp)\n" |
| 1182 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1183 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1184 | " (return (var_ref temp))))\n" |
| 1185 | "\n" |
| 1186 | " (signature bvec3\n" |
| 1187 | " (parameters\n" |
| 1188 | " (declare (in) uvec3 arg0)\n" |
| 1189 | " (declare (in) uvec3 arg1))\n" |
| 1190 | " ((declare () bvec3 temp)\n" |
| 1191 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1192 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1193 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1194 | " (return (var_ref temp))))\n" |
| 1195 | "\n" |
| 1196 | " (signature bvec4\n" |
| 1197 | " (parameters\n" |
| 1198 | " (declare (in) uvec4 arg0)\n" |
| 1199 | " (declare (in) uvec4 arg1))\n" |
| 1200 | " ((declare () bvec4 temp)\n" |
| 1201 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1202 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1203 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1204 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 1205 | " (return (var_ref temp))))\n" |
| 1206 | "))\n" |
| 1207 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 1208 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1209 | static const char *builtins_130_notEqual = { |
| 1210 | "((function notEqual\n" |
| 1211 | " (signature bvec2\n" |
| 1212 | " (parameters\n" |
| 1213 | " (declare (in) uvec2 arg0)\n" |
| 1214 | " (declare (in) uvec2 arg1))\n" |
| 1215 | " ((declare () bvec2 temp)\n" |
| 1216 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1217 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1218 | " (return (var_ref temp))))\n" |
| 1219 | "\n" |
| 1220 | " (signature bvec3\n" |
| 1221 | " (parameters\n" |
| 1222 | " (declare (in) uvec3 arg0)\n" |
| 1223 | " (declare (in) uvec3 arg1))\n" |
| 1224 | " ((declare () bvec3 temp)\n" |
| 1225 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1226 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1227 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1228 | " (return (var_ref temp))))\n" |
| 1229 | "\n" |
| 1230 | " (signature bvec4\n" |
| 1231 | " (parameters\n" |
| 1232 | " (declare (in) uvec4 arg0)\n" |
| 1233 | " (declare (in) uvec4 arg1))\n" |
| 1234 | " ((declare () bvec4 temp)\n" |
| 1235 | " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" |
| 1236 | " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" |
| 1237 | " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" |
| 1238 | " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" |
| 1239 | " (return (var_ref temp))))\n" |
| 1240 | "))\n" |
| 1241 | }; |
Eric Anholt | feeb43b | 2010-04-08 15:02:59 -0700 | [diff] [blame] | 1242 | |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1243 | static const char *functions_for_130 [] = { |
| 1244 | builtins_130_equal, |
| 1245 | builtins_130_greaterThan, |
| 1246 | builtins_130_greaterThanEqual, |
| 1247 | builtins_130_lessThan, |
| 1248 | builtins_130_lessThanEqual, |
| 1249 | builtins_130_notEqual, |
| 1250 | }; |
Eric Anholt | c22c400 | 2010-03-26 18:20:30 -0700 | [diff] [blame] | 1251 | |
| 1252 | void |
| 1253 | _mesa_glsl_initialize_functions(exec_list *instructions, |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1254 | struct _mesa_glsl_parse_state *state) |
Eric Anholt | c22c400 | 2010-03-26 18:20:30 -0700 | [diff] [blame] | 1255 | { |
Kenneth Graunke | b326212 | 2010-04-28 23:01:33 -0700 | [diff] [blame^] | 1256 | if (state->language_version >= 110) |
| 1257 | read_builtins(state, instructions, functions_for_110, |
| 1258 | sizeof(functions_for_110) / sizeof(const char *)); |
| 1259 | |
| 1260 | if (state->language_version >= 130) |
| 1261 | read_builtins(state, instructions, functions_for_130, |
| 1262 | sizeof(functions_for_130) / sizeof(const char *)); |
| 1263 | |
Eric Anholt | c22c400 | 2010-03-26 18:20:30 -0700 | [diff] [blame] | 1264 | } |