1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 // Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh. 18 19 package android.renderscript.cts; 20 21 import android.renderscript.Allocation; 22 import android.renderscript.RSRuntimeException; 23 import android.renderscript.Element; 24 import android.renderscript.cts.Target; 25 26 import java.util.Arrays; 27 28 public class TestMix extends RSBaseCompute { 29 30 private ScriptC_TestMix script; 31 private ScriptC_TestMixRelaxed scriptRelaxed; 32 33 @Override setUp()34 protected void setUp() throws Exception { 35 super.setUp(); 36 script = new ScriptC_TestMix(mRS); 37 scriptRelaxed = new ScriptC_TestMixRelaxed(mRS); 38 } 39 40 public class ArgumentsFloatFloatFloatFloat { 41 public float inStart; 42 public float inStop; 43 public float inFraction; 44 public Target.Floaty out; 45 } 46 checkMixFloatFloatFloatFloat()47 private void checkMixFloatFloatFloatFloat() { 48 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x471d6db1l, false); 49 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb4422e8fl, false); 50 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xc6a51d9fl, false); 51 try { 52 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE); 53 script.set_gAllocInStop(inStop); 54 script.set_gAllocInFraction(inFraction); 55 script.forEach_testMixFloatFloatFloatFloat(inStart, out); 56 verifyResultsMixFloatFloatFloatFloat(inStart, inStop, inFraction, out, false); 57 } catch (Exception e) { 58 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloatFloatFloatFloat: " + e.toString()); 59 } 60 try { 61 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE); 62 scriptRelaxed.set_gAllocInStop(inStop); 63 scriptRelaxed.set_gAllocInFraction(inFraction); 64 scriptRelaxed.forEach_testMixFloatFloatFloatFloat(inStart, out); 65 verifyResultsMixFloatFloatFloatFloat(inStart, inStop, inFraction, out, true); 66 } catch (Exception e) { 67 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloatFloatFloatFloat: " + e.toString()); 68 } 69 } 70 verifyResultsMixFloatFloatFloatFloat(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)71 private void verifyResultsMixFloatFloatFloatFloat(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 72 float[] arrayInStart = new float[INPUTSIZE * 1]; 73 Arrays.fill(arrayInStart, (float) 42); 74 inStart.copyTo(arrayInStart); 75 float[] arrayInStop = new float[INPUTSIZE * 1]; 76 Arrays.fill(arrayInStop, (float) 42); 77 inStop.copyTo(arrayInStop); 78 float[] arrayInFraction = new float[INPUTSIZE * 1]; 79 Arrays.fill(arrayInFraction, (float) 42); 80 inFraction.copyTo(arrayInFraction); 81 float[] arrayOut = new float[INPUTSIZE * 1]; 82 Arrays.fill(arrayOut, (float) 42); 83 out.copyTo(arrayOut); 84 StringBuilder message = new StringBuilder(); 85 boolean errorFound = false; 86 for (int i = 0; i < INPUTSIZE; i++) { 87 for (int j = 0; j < 1 ; j++) { 88 // Extract the inputs. 89 ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat(); 90 args.inStart = arrayInStart[i]; 91 args.inStop = arrayInStop[i]; 92 args.inFraction = arrayInFraction[i]; 93 // Figure out what the outputs should have been. 94 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed); 95 CoreMathVerifier.computeMix(args, target); 96 // Validate the outputs. 97 boolean valid = true; 98 if (!args.out.couldBe(arrayOut[i * 1 + j])) { 99 valid = false; 100 } 101 if (!valid) { 102 if (!errorFound) { 103 errorFound = true; 104 message.append("Input inStart: "); 105 appendVariableToMessage(message, args.inStart); 106 message.append("\n"); 107 message.append("Input inStop: "); 108 appendVariableToMessage(message, args.inStop); 109 message.append("\n"); 110 message.append("Input inFraction: "); 111 appendVariableToMessage(message, args.inFraction); 112 message.append("\n"); 113 message.append("Expected output out: "); 114 appendVariableToMessage(message, args.out); 115 message.append("\n"); 116 message.append("Actual output out: "); 117 appendVariableToMessage(message, arrayOut[i * 1 + j]); 118 if (!args.out.couldBe(arrayOut[i * 1 + j])) { 119 message.append(" FAIL"); 120 } 121 message.append("\n"); 122 message.append("Errors at"); 123 } 124 message.append(" ["); 125 message.append(Integer.toString(i)); 126 message.append(", "); 127 message.append(Integer.toString(j)); 128 message.append("]"); 129 } 130 } 131 } 132 assertFalse("Incorrect output for checkMixFloatFloatFloatFloat" + 133 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 134 } 135 checkMixFloat2Float2Float2Float2()136 private void checkMixFloat2Float2Float2Float2() { 137 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xa2d9ce9l, false); 138 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x5395e837l, false); 139 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x621e0ac7l, false); 140 try { 141 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE); 142 script.set_gAllocInStop(inStop); 143 script.set_gAllocInFraction(inFraction); 144 script.forEach_testMixFloat2Float2Float2Float2(inStart, out); 145 verifyResultsMixFloat2Float2Float2Float2(inStart, inStop, inFraction, out, false); 146 } catch (Exception e) { 147 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat2Float2Float2Float2: " + e.toString()); 148 } 149 try { 150 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE); 151 scriptRelaxed.set_gAllocInStop(inStop); 152 scriptRelaxed.set_gAllocInFraction(inFraction); 153 scriptRelaxed.forEach_testMixFloat2Float2Float2Float2(inStart, out); 154 verifyResultsMixFloat2Float2Float2Float2(inStart, inStop, inFraction, out, true); 155 } catch (Exception e) { 156 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat2Float2Float2Float2: " + e.toString()); 157 } 158 } 159 verifyResultsMixFloat2Float2Float2Float2(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)160 private void verifyResultsMixFloat2Float2Float2Float2(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 161 float[] arrayInStart = new float[INPUTSIZE * 2]; 162 Arrays.fill(arrayInStart, (float) 42); 163 inStart.copyTo(arrayInStart); 164 float[] arrayInStop = new float[INPUTSIZE * 2]; 165 Arrays.fill(arrayInStop, (float) 42); 166 inStop.copyTo(arrayInStop); 167 float[] arrayInFraction = new float[INPUTSIZE * 2]; 168 Arrays.fill(arrayInFraction, (float) 42); 169 inFraction.copyTo(arrayInFraction); 170 float[] arrayOut = new float[INPUTSIZE * 2]; 171 Arrays.fill(arrayOut, (float) 42); 172 out.copyTo(arrayOut); 173 StringBuilder message = new StringBuilder(); 174 boolean errorFound = false; 175 for (int i = 0; i < INPUTSIZE; i++) { 176 for (int j = 0; j < 2 ; j++) { 177 // Extract the inputs. 178 ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat(); 179 args.inStart = arrayInStart[i * 2 + j]; 180 args.inStop = arrayInStop[i * 2 + j]; 181 args.inFraction = arrayInFraction[i * 2 + j]; 182 // Figure out what the outputs should have been. 183 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed); 184 CoreMathVerifier.computeMix(args, target); 185 // Validate the outputs. 186 boolean valid = true; 187 if (!args.out.couldBe(arrayOut[i * 2 + j])) { 188 valid = false; 189 } 190 if (!valid) { 191 if (!errorFound) { 192 errorFound = true; 193 message.append("Input inStart: "); 194 appendVariableToMessage(message, args.inStart); 195 message.append("\n"); 196 message.append("Input inStop: "); 197 appendVariableToMessage(message, args.inStop); 198 message.append("\n"); 199 message.append("Input inFraction: "); 200 appendVariableToMessage(message, args.inFraction); 201 message.append("\n"); 202 message.append("Expected output out: "); 203 appendVariableToMessage(message, args.out); 204 message.append("\n"); 205 message.append("Actual output out: "); 206 appendVariableToMessage(message, arrayOut[i * 2 + j]); 207 if (!args.out.couldBe(arrayOut[i * 2 + j])) { 208 message.append(" FAIL"); 209 } 210 message.append("\n"); 211 message.append("Errors at"); 212 } 213 message.append(" ["); 214 message.append(Integer.toString(i)); 215 message.append(", "); 216 message.append(Integer.toString(j)); 217 message.append("]"); 218 } 219 } 220 } 221 assertFalse("Incorrect output for checkMixFloat2Float2Float2Float2" + 222 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 223 } 224 checkMixFloat3Float3Float3Float3()225 private void checkMixFloat3Float3Float3Float3() { 226 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x26b009c5l, false); 227 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x249ee4cbl, false); 228 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xb0d4f51bl, false); 229 try { 230 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE); 231 script.set_gAllocInStop(inStop); 232 script.set_gAllocInFraction(inFraction); 233 script.forEach_testMixFloat3Float3Float3Float3(inStart, out); 234 verifyResultsMixFloat3Float3Float3Float3(inStart, inStop, inFraction, out, false); 235 } catch (Exception e) { 236 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat3Float3Float3Float3: " + e.toString()); 237 } 238 try { 239 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE); 240 scriptRelaxed.set_gAllocInStop(inStop); 241 scriptRelaxed.set_gAllocInFraction(inFraction); 242 scriptRelaxed.forEach_testMixFloat3Float3Float3Float3(inStart, out); 243 verifyResultsMixFloat3Float3Float3Float3(inStart, inStop, inFraction, out, true); 244 } catch (Exception e) { 245 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat3Float3Float3Float3: " + e.toString()); 246 } 247 } 248 verifyResultsMixFloat3Float3Float3Float3(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)249 private void verifyResultsMixFloat3Float3Float3Float3(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 250 float[] arrayInStart = new float[INPUTSIZE * 4]; 251 Arrays.fill(arrayInStart, (float) 42); 252 inStart.copyTo(arrayInStart); 253 float[] arrayInStop = new float[INPUTSIZE * 4]; 254 Arrays.fill(arrayInStop, (float) 42); 255 inStop.copyTo(arrayInStop); 256 float[] arrayInFraction = new float[INPUTSIZE * 4]; 257 Arrays.fill(arrayInFraction, (float) 42); 258 inFraction.copyTo(arrayInFraction); 259 float[] arrayOut = new float[INPUTSIZE * 4]; 260 Arrays.fill(arrayOut, (float) 42); 261 out.copyTo(arrayOut); 262 StringBuilder message = new StringBuilder(); 263 boolean errorFound = false; 264 for (int i = 0; i < INPUTSIZE; i++) { 265 for (int j = 0; j < 3 ; j++) { 266 // Extract the inputs. 267 ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat(); 268 args.inStart = arrayInStart[i * 4 + j]; 269 args.inStop = arrayInStop[i * 4 + j]; 270 args.inFraction = arrayInFraction[i * 4 + j]; 271 // Figure out what the outputs should have been. 272 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed); 273 CoreMathVerifier.computeMix(args, target); 274 // Validate the outputs. 275 boolean valid = true; 276 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 277 valid = false; 278 } 279 if (!valid) { 280 if (!errorFound) { 281 errorFound = true; 282 message.append("Input inStart: "); 283 appendVariableToMessage(message, args.inStart); 284 message.append("\n"); 285 message.append("Input inStop: "); 286 appendVariableToMessage(message, args.inStop); 287 message.append("\n"); 288 message.append("Input inFraction: "); 289 appendVariableToMessage(message, args.inFraction); 290 message.append("\n"); 291 message.append("Expected output out: "); 292 appendVariableToMessage(message, args.out); 293 message.append("\n"); 294 message.append("Actual output out: "); 295 appendVariableToMessage(message, arrayOut[i * 4 + j]); 296 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 297 message.append(" FAIL"); 298 } 299 message.append("\n"); 300 message.append("Errors at"); 301 } 302 message.append(" ["); 303 message.append(Integer.toString(i)); 304 message.append(", "); 305 message.append(Integer.toString(j)); 306 message.append("]"); 307 } 308 } 309 } 310 assertFalse("Incorrect output for checkMixFloat3Float3Float3Float3" + 311 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 312 } 313 checkMixFloat4Float4Float4Float4()314 private void checkMixFloat4Float4Float4Float4() { 315 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x433276a1l, false); 316 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf5a7e15fl, false); 317 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xff8bdf6fl, false); 318 try { 319 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE); 320 script.set_gAllocInStop(inStop); 321 script.set_gAllocInFraction(inFraction); 322 script.forEach_testMixFloat4Float4Float4Float4(inStart, out); 323 verifyResultsMixFloat4Float4Float4Float4(inStart, inStop, inFraction, out, false); 324 } catch (Exception e) { 325 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat4Float4Float4Float4: " + e.toString()); 326 } 327 try { 328 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE); 329 scriptRelaxed.set_gAllocInStop(inStop); 330 scriptRelaxed.set_gAllocInFraction(inFraction); 331 scriptRelaxed.forEach_testMixFloat4Float4Float4Float4(inStart, out); 332 verifyResultsMixFloat4Float4Float4Float4(inStart, inStop, inFraction, out, true); 333 } catch (Exception e) { 334 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat4Float4Float4Float4: " + e.toString()); 335 } 336 } 337 verifyResultsMixFloat4Float4Float4Float4(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)338 private void verifyResultsMixFloat4Float4Float4Float4(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 339 float[] arrayInStart = new float[INPUTSIZE * 4]; 340 Arrays.fill(arrayInStart, (float) 42); 341 inStart.copyTo(arrayInStart); 342 float[] arrayInStop = new float[INPUTSIZE * 4]; 343 Arrays.fill(arrayInStop, (float) 42); 344 inStop.copyTo(arrayInStop); 345 float[] arrayInFraction = new float[INPUTSIZE * 4]; 346 Arrays.fill(arrayInFraction, (float) 42); 347 inFraction.copyTo(arrayInFraction); 348 float[] arrayOut = new float[INPUTSIZE * 4]; 349 Arrays.fill(arrayOut, (float) 42); 350 out.copyTo(arrayOut); 351 StringBuilder message = new StringBuilder(); 352 boolean errorFound = false; 353 for (int i = 0; i < INPUTSIZE; i++) { 354 for (int j = 0; j < 4 ; j++) { 355 // Extract the inputs. 356 ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat(); 357 args.inStart = arrayInStart[i * 4 + j]; 358 args.inStop = arrayInStop[i * 4 + j]; 359 args.inFraction = arrayInFraction[i * 4 + j]; 360 // Figure out what the outputs should have been. 361 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed); 362 CoreMathVerifier.computeMix(args, target); 363 // Validate the outputs. 364 boolean valid = true; 365 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 366 valid = false; 367 } 368 if (!valid) { 369 if (!errorFound) { 370 errorFound = true; 371 message.append("Input inStart: "); 372 appendVariableToMessage(message, args.inStart); 373 message.append("\n"); 374 message.append("Input inStop: "); 375 appendVariableToMessage(message, args.inStop); 376 message.append("\n"); 377 message.append("Input inFraction: "); 378 appendVariableToMessage(message, args.inFraction); 379 message.append("\n"); 380 message.append("Expected output out: "); 381 appendVariableToMessage(message, args.out); 382 message.append("\n"); 383 message.append("Actual output out: "); 384 appendVariableToMessage(message, arrayOut[i * 4 + j]); 385 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 386 message.append(" FAIL"); 387 } 388 message.append("\n"); 389 message.append("Errors at"); 390 } 391 message.append(" ["); 392 message.append(Integer.toString(i)); 393 message.append(", "); 394 message.append(Integer.toString(j)); 395 message.append("]"); 396 } 397 } 398 } 399 assertFalse("Incorrect output for checkMixFloat4Float4Float4Float4" + 400 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 401 } 402 403 public class ArgumentsHalfHalfHalfHalf { 404 public short inStart; 405 public double inStartDouble; 406 public short inStop; 407 public double inStopDouble; 408 public short inFraction; 409 public double inFractionDouble; 410 public Target.Floaty out; 411 } 412 checkMixHalfHalfHalfHalf()413 private void checkMixHalfHalfHalfHalf() { 414 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 1, 0xa5c04055l, false); 415 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 1, 0xbc69b07bl, false); 416 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 1, 0x4936a9cbl, false); 417 try { 418 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 1), INPUTSIZE); 419 script.set_gAllocInStop(inStop); 420 script.set_gAllocInFraction(inFraction); 421 script.forEach_testMixHalfHalfHalfHalf(inStart, out); 422 verifyResultsMixHalfHalfHalfHalf(inStart, inStop, inFraction, out, false); 423 } catch (Exception e) { 424 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalfHalfHalfHalf: " + e.toString()); 425 } 426 try { 427 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 1), INPUTSIZE); 428 scriptRelaxed.set_gAllocInStop(inStop); 429 scriptRelaxed.set_gAllocInFraction(inFraction); 430 scriptRelaxed.forEach_testMixHalfHalfHalfHalf(inStart, out); 431 verifyResultsMixHalfHalfHalfHalf(inStart, inStop, inFraction, out, true); 432 } catch (Exception e) { 433 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalfHalfHalfHalf: " + e.toString()); 434 } 435 } 436 verifyResultsMixHalfHalfHalfHalf(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)437 private void verifyResultsMixHalfHalfHalfHalf(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 438 short[] arrayInStart = new short[INPUTSIZE * 1]; 439 Arrays.fill(arrayInStart, (short) 42); 440 inStart.copyTo(arrayInStart); 441 short[] arrayInStop = new short[INPUTSIZE * 1]; 442 Arrays.fill(arrayInStop, (short) 42); 443 inStop.copyTo(arrayInStop); 444 short[] arrayInFraction = new short[INPUTSIZE * 1]; 445 Arrays.fill(arrayInFraction, (short) 42); 446 inFraction.copyTo(arrayInFraction); 447 short[] arrayOut = new short[INPUTSIZE * 1]; 448 Arrays.fill(arrayOut, (short) 42); 449 out.copyTo(arrayOut); 450 StringBuilder message = new StringBuilder(); 451 boolean errorFound = false; 452 for (int i = 0; i < INPUTSIZE; i++) { 453 for (int j = 0; j < 1 ; j++) { 454 // Extract the inputs. 455 ArgumentsHalfHalfHalfHalf args = new ArgumentsHalfHalfHalfHalf(); 456 args.inStart = arrayInStart[i]; 457 args.inStartDouble = Float16Utils.convertFloat16ToDouble(args.inStart); 458 args.inStop = arrayInStop[i]; 459 args.inStopDouble = Float16Utils.convertFloat16ToDouble(args.inStop); 460 args.inFraction = arrayInFraction[i]; 461 args.inFractionDouble = Float16Utils.convertFloat16ToDouble(args.inFraction); 462 // Figure out what the outputs should have been. 463 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed); 464 CoreMathVerifier.computeMix(args, target); 465 // Validate the outputs. 466 boolean valid = true; 467 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 1 + j]))) { 468 valid = false; 469 } 470 if (!valid) { 471 if (!errorFound) { 472 errorFound = true; 473 message.append("Input inStart: "); 474 appendVariableToMessage(message, args.inStart); 475 message.append("\n"); 476 message.append("Input inStop: "); 477 appendVariableToMessage(message, args.inStop); 478 message.append("\n"); 479 message.append("Input inFraction: "); 480 appendVariableToMessage(message, args.inFraction); 481 message.append("\n"); 482 message.append("Expected output out: "); 483 appendVariableToMessage(message, args.out); 484 message.append("\n"); 485 message.append("Actual output out: "); 486 appendVariableToMessage(message, arrayOut[i * 1 + j]); 487 message.append("\n"); 488 message.append("Actual output out (in double): "); 489 appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 1 + j])); 490 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 1 + j]))) { 491 message.append(" FAIL"); 492 } 493 message.append("\n"); 494 message.append("Errors at"); 495 } 496 message.append(" ["); 497 message.append(Integer.toString(i)); 498 message.append(", "); 499 message.append(Integer.toString(j)); 500 message.append("]"); 501 } 502 } 503 } 504 assertFalse("Incorrect output for checkMixHalfHalfHalfHalf" + 505 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 506 } 507 checkMixHalf2Half2Half2Half2()508 private void checkMixHalf2Half2Half2Half2() { 509 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 2, 0x2fe5c049l, false); 510 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 2, 0x7114257l, false); 511 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 2, 0x5b09ae7l, false); 512 try { 513 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 2), INPUTSIZE); 514 script.set_gAllocInStop(inStop); 515 script.set_gAllocInFraction(inFraction); 516 script.forEach_testMixHalf2Half2Half2Half2(inStart, out); 517 verifyResultsMixHalf2Half2Half2Half2(inStart, inStop, inFraction, out, false); 518 } catch (Exception e) { 519 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf2Half2Half2Half2: " + e.toString()); 520 } 521 try { 522 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 2), INPUTSIZE); 523 scriptRelaxed.set_gAllocInStop(inStop); 524 scriptRelaxed.set_gAllocInFraction(inFraction); 525 scriptRelaxed.forEach_testMixHalf2Half2Half2Half2(inStart, out); 526 verifyResultsMixHalf2Half2Half2Half2(inStart, inStop, inFraction, out, true); 527 } catch (Exception e) { 528 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf2Half2Half2Half2: " + e.toString()); 529 } 530 } 531 verifyResultsMixHalf2Half2Half2Half2(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)532 private void verifyResultsMixHalf2Half2Half2Half2(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 533 short[] arrayInStart = new short[INPUTSIZE * 2]; 534 Arrays.fill(arrayInStart, (short) 42); 535 inStart.copyTo(arrayInStart); 536 short[] arrayInStop = new short[INPUTSIZE * 2]; 537 Arrays.fill(arrayInStop, (short) 42); 538 inStop.copyTo(arrayInStop); 539 short[] arrayInFraction = new short[INPUTSIZE * 2]; 540 Arrays.fill(arrayInFraction, (short) 42); 541 inFraction.copyTo(arrayInFraction); 542 short[] arrayOut = new short[INPUTSIZE * 2]; 543 Arrays.fill(arrayOut, (short) 42); 544 out.copyTo(arrayOut); 545 StringBuilder message = new StringBuilder(); 546 boolean errorFound = false; 547 for (int i = 0; i < INPUTSIZE; i++) { 548 for (int j = 0; j < 2 ; j++) { 549 // Extract the inputs. 550 ArgumentsHalfHalfHalfHalf args = new ArgumentsHalfHalfHalfHalf(); 551 args.inStart = arrayInStart[i * 2 + j]; 552 args.inStartDouble = Float16Utils.convertFloat16ToDouble(args.inStart); 553 args.inStop = arrayInStop[i * 2 + j]; 554 args.inStopDouble = Float16Utils.convertFloat16ToDouble(args.inStop); 555 args.inFraction = arrayInFraction[i * 2 + j]; 556 args.inFractionDouble = Float16Utils.convertFloat16ToDouble(args.inFraction); 557 // Figure out what the outputs should have been. 558 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed); 559 CoreMathVerifier.computeMix(args, target); 560 // Validate the outputs. 561 boolean valid = true; 562 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j]))) { 563 valid = false; 564 } 565 if (!valid) { 566 if (!errorFound) { 567 errorFound = true; 568 message.append("Input inStart: "); 569 appendVariableToMessage(message, args.inStart); 570 message.append("\n"); 571 message.append("Input inStop: "); 572 appendVariableToMessage(message, args.inStop); 573 message.append("\n"); 574 message.append("Input inFraction: "); 575 appendVariableToMessage(message, args.inFraction); 576 message.append("\n"); 577 message.append("Expected output out: "); 578 appendVariableToMessage(message, args.out); 579 message.append("\n"); 580 message.append("Actual output out: "); 581 appendVariableToMessage(message, arrayOut[i * 2 + j]); 582 message.append("\n"); 583 message.append("Actual output out (in double): "); 584 appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j])); 585 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j]))) { 586 message.append(" FAIL"); 587 } 588 message.append("\n"); 589 message.append("Errors at"); 590 } 591 message.append(" ["); 592 message.append(Integer.toString(i)); 593 message.append(", "); 594 message.append(Integer.toString(j)); 595 message.append("]"); 596 } 597 } 598 } 599 assertFalse("Incorrect output for checkMixHalf2Half2Half2Half2" + 600 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 601 } 602 checkMixHalf3Half3Half3Half3()603 private void checkMixHalf3Half3Half3Half3() { 604 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 3, 0x25babc91l, false); 605 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 3, 0xcb4bcb2fl, false); 606 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 3, 0x187ca83fl, false); 607 try { 608 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 3), INPUTSIZE); 609 script.set_gAllocInStop(inStop); 610 script.set_gAllocInFraction(inFraction); 611 script.forEach_testMixHalf3Half3Half3Half3(inStart, out); 612 verifyResultsMixHalf3Half3Half3Half3(inStart, inStop, inFraction, out, false); 613 } catch (Exception e) { 614 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf3Half3Half3Half3: " + e.toString()); 615 } 616 try { 617 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 3), INPUTSIZE); 618 scriptRelaxed.set_gAllocInStop(inStop); 619 scriptRelaxed.set_gAllocInFraction(inFraction); 620 scriptRelaxed.forEach_testMixHalf3Half3Half3Half3(inStart, out); 621 verifyResultsMixHalf3Half3Half3Half3(inStart, inStop, inFraction, out, true); 622 } catch (Exception e) { 623 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf3Half3Half3Half3: " + e.toString()); 624 } 625 } 626 verifyResultsMixHalf3Half3Half3Half3(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)627 private void verifyResultsMixHalf3Half3Half3Half3(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 628 short[] arrayInStart = new short[INPUTSIZE * 4]; 629 Arrays.fill(arrayInStart, (short) 42); 630 inStart.copyTo(arrayInStart); 631 short[] arrayInStop = new short[INPUTSIZE * 4]; 632 Arrays.fill(arrayInStop, (short) 42); 633 inStop.copyTo(arrayInStop); 634 short[] arrayInFraction = new short[INPUTSIZE * 4]; 635 Arrays.fill(arrayInFraction, (short) 42); 636 inFraction.copyTo(arrayInFraction); 637 short[] arrayOut = new short[INPUTSIZE * 4]; 638 Arrays.fill(arrayOut, (short) 42); 639 out.copyTo(arrayOut); 640 StringBuilder message = new StringBuilder(); 641 boolean errorFound = false; 642 for (int i = 0; i < INPUTSIZE; i++) { 643 for (int j = 0; j < 3 ; j++) { 644 // Extract the inputs. 645 ArgumentsHalfHalfHalfHalf args = new ArgumentsHalfHalfHalfHalf(); 646 args.inStart = arrayInStart[i * 4 + j]; 647 args.inStartDouble = Float16Utils.convertFloat16ToDouble(args.inStart); 648 args.inStop = arrayInStop[i * 4 + j]; 649 args.inStopDouble = Float16Utils.convertFloat16ToDouble(args.inStop); 650 args.inFraction = arrayInFraction[i * 4 + j]; 651 args.inFractionDouble = Float16Utils.convertFloat16ToDouble(args.inFraction); 652 // Figure out what the outputs should have been. 653 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed); 654 CoreMathVerifier.computeMix(args, target); 655 // Validate the outputs. 656 boolean valid = true; 657 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) { 658 valid = false; 659 } 660 if (!valid) { 661 if (!errorFound) { 662 errorFound = true; 663 message.append("Input inStart: "); 664 appendVariableToMessage(message, args.inStart); 665 message.append("\n"); 666 message.append("Input inStop: "); 667 appendVariableToMessage(message, args.inStop); 668 message.append("\n"); 669 message.append("Input inFraction: "); 670 appendVariableToMessage(message, args.inFraction); 671 message.append("\n"); 672 message.append("Expected output out: "); 673 appendVariableToMessage(message, args.out); 674 message.append("\n"); 675 message.append("Actual output out: "); 676 appendVariableToMessage(message, arrayOut[i * 4 + j]); 677 message.append("\n"); 678 message.append("Actual output out (in double): "); 679 appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j])); 680 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) { 681 message.append(" FAIL"); 682 } 683 message.append("\n"); 684 message.append("Errors at"); 685 } 686 message.append(" ["); 687 message.append(Integer.toString(i)); 688 message.append(", "); 689 message.append(Integer.toString(j)); 690 message.append("]"); 691 } 692 } 693 } 694 assertFalse("Incorrect output for checkMixHalf3Half3Half3Half3" + 695 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 696 } 697 checkMixHalf4Half4Half4Half4()698 private void checkMixHalf4Half4Half4Half4() { 699 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 4, 0x1b8fb8d9l, false); 700 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 4, 0x8f865407l, false); 701 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 4, 0x2b48b597l, false); 702 try { 703 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 4), INPUTSIZE); 704 script.set_gAllocInStop(inStop); 705 script.set_gAllocInFraction(inFraction); 706 script.forEach_testMixHalf4Half4Half4Half4(inStart, out); 707 verifyResultsMixHalf4Half4Half4Half4(inStart, inStop, inFraction, out, false); 708 } catch (Exception e) { 709 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf4Half4Half4Half4: " + e.toString()); 710 } 711 try { 712 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 4), INPUTSIZE); 713 scriptRelaxed.set_gAllocInStop(inStop); 714 scriptRelaxed.set_gAllocInFraction(inFraction); 715 scriptRelaxed.forEach_testMixHalf4Half4Half4Half4(inStart, out); 716 verifyResultsMixHalf4Half4Half4Half4(inStart, inStop, inFraction, out, true); 717 } catch (Exception e) { 718 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf4Half4Half4Half4: " + e.toString()); 719 } 720 } 721 verifyResultsMixHalf4Half4Half4Half4(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)722 private void verifyResultsMixHalf4Half4Half4Half4(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 723 short[] arrayInStart = new short[INPUTSIZE * 4]; 724 Arrays.fill(arrayInStart, (short) 42); 725 inStart.copyTo(arrayInStart); 726 short[] arrayInStop = new short[INPUTSIZE * 4]; 727 Arrays.fill(arrayInStop, (short) 42); 728 inStop.copyTo(arrayInStop); 729 short[] arrayInFraction = new short[INPUTSIZE * 4]; 730 Arrays.fill(arrayInFraction, (short) 42); 731 inFraction.copyTo(arrayInFraction); 732 short[] arrayOut = new short[INPUTSIZE * 4]; 733 Arrays.fill(arrayOut, (short) 42); 734 out.copyTo(arrayOut); 735 StringBuilder message = new StringBuilder(); 736 boolean errorFound = false; 737 for (int i = 0; i < INPUTSIZE; i++) { 738 for (int j = 0; j < 4 ; j++) { 739 // Extract the inputs. 740 ArgumentsHalfHalfHalfHalf args = new ArgumentsHalfHalfHalfHalf(); 741 args.inStart = arrayInStart[i * 4 + j]; 742 args.inStartDouble = Float16Utils.convertFloat16ToDouble(args.inStart); 743 args.inStop = arrayInStop[i * 4 + j]; 744 args.inStopDouble = Float16Utils.convertFloat16ToDouble(args.inStop); 745 args.inFraction = arrayInFraction[i * 4 + j]; 746 args.inFractionDouble = Float16Utils.convertFloat16ToDouble(args.inFraction); 747 // Figure out what the outputs should have been. 748 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed); 749 CoreMathVerifier.computeMix(args, target); 750 // Validate the outputs. 751 boolean valid = true; 752 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) { 753 valid = false; 754 } 755 if (!valid) { 756 if (!errorFound) { 757 errorFound = true; 758 message.append("Input inStart: "); 759 appendVariableToMessage(message, args.inStart); 760 message.append("\n"); 761 message.append("Input inStop: "); 762 appendVariableToMessage(message, args.inStop); 763 message.append("\n"); 764 message.append("Input inFraction: "); 765 appendVariableToMessage(message, args.inFraction); 766 message.append("\n"); 767 message.append("Expected output out: "); 768 appendVariableToMessage(message, args.out); 769 message.append("\n"); 770 message.append("Actual output out: "); 771 appendVariableToMessage(message, arrayOut[i * 4 + j]); 772 message.append("\n"); 773 message.append("Actual output out (in double): "); 774 appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j])); 775 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) { 776 message.append(" FAIL"); 777 } 778 message.append("\n"); 779 message.append("Errors at"); 780 } 781 message.append(" ["); 782 message.append(Integer.toString(i)); 783 message.append(", "); 784 message.append(Integer.toString(j)); 785 message.append("]"); 786 } 787 } 788 } 789 assertFalse("Incorrect output for checkMixHalf4Half4Half4Half4" + 790 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 791 } 792 checkMixFloat2Float2FloatFloat2()793 private void checkMixFloat2Float2FloatFloat2() { 794 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x2bd1d7c3l, false); 795 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x3c8dd1c5l, false); 796 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x92afd1f5l, false); 797 try { 798 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE); 799 script.set_gAllocInStop(inStop); 800 script.set_gAllocInFraction(inFraction); 801 script.forEach_testMixFloat2Float2FloatFloat2(inStart, out); 802 verifyResultsMixFloat2Float2FloatFloat2(inStart, inStop, inFraction, out, false); 803 } catch (Exception e) { 804 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat2Float2FloatFloat2: " + e.toString()); 805 } 806 try { 807 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE); 808 scriptRelaxed.set_gAllocInStop(inStop); 809 scriptRelaxed.set_gAllocInFraction(inFraction); 810 scriptRelaxed.forEach_testMixFloat2Float2FloatFloat2(inStart, out); 811 verifyResultsMixFloat2Float2FloatFloat2(inStart, inStop, inFraction, out, true); 812 } catch (Exception e) { 813 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat2Float2FloatFloat2: " + e.toString()); 814 } 815 } 816 verifyResultsMixFloat2Float2FloatFloat2(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)817 private void verifyResultsMixFloat2Float2FloatFloat2(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 818 float[] arrayInStart = new float[INPUTSIZE * 2]; 819 Arrays.fill(arrayInStart, (float) 42); 820 inStart.copyTo(arrayInStart); 821 float[] arrayInStop = new float[INPUTSIZE * 2]; 822 Arrays.fill(arrayInStop, (float) 42); 823 inStop.copyTo(arrayInStop); 824 float[] arrayInFraction = new float[INPUTSIZE * 1]; 825 Arrays.fill(arrayInFraction, (float) 42); 826 inFraction.copyTo(arrayInFraction); 827 float[] arrayOut = new float[INPUTSIZE * 2]; 828 Arrays.fill(arrayOut, (float) 42); 829 out.copyTo(arrayOut); 830 StringBuilder message = new StringBuilder(); 831 boolean errorFound = false; 832 for (int i = 0; i < INPUTSIZE; i++) { 833 for (int j = 0; j < 2 ; j++) { 834 // Extract the inputs. 835 ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat(); 836 args.inStart = arrayInStart[i * 2 + j]; 837 args.inStop = arrayInStop[i * 2 + j]; 838 args.inFraction = arrayInFraction[i]; 839 // Figure out what the outputs should have been. 840 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed); 841 CoreMathVerifier.computeMix(args, target); 842 // Validate the outputs. 843 boolean valid = true; 844 if (!args.out.couldBe(arrayOut[i * 2 + j])) { 845 valid = false; 846 } 847 if (!valid) { 848 if (!errorFound) { 849 errorFound = true; 850 message.append("Input inStart: "); 851 appendVariableToMessage(message, args.inStart); 852 message.append("\n"); 853 message.append("Input inStop: "); 854 appendVariableToMessage(message, args.inStop); 855 message.append("\n"); 856 message.append("Input inFraction: "); 857 appendVariableToMessage(message, args.inFraction); 858 message.append("\n"); 859 message.append("Expected output out: "); 860 appendVariableToMessage(message, args.out); 861 message.append("\n"); 862 message.append("Actual output out: "); 863 appendVariableToMessage(message, arrayOut[i * 2 + j]); 864 if (!args.out.couldBe(arrayOut[i * 2 + j])) { 865 message.append(" FAIL"); 866 } 867 message.append("\n"); 868 message.append("Errors at"); 869 } 870 message.append(" ["); 871 message.append(Integer.toString(i)); 872 message.append(", "); 873 message.append(Integer.toString(j)); 874 message.append("]"); 875 } 876 } 877 } 878 assertFalse("Incorrect output for checkMixFloat2Float2FloatFloat2" + 879 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 880 } 881 checkMixFloat3Float3FloatFloat3()882 private void checkMixFloat3Float3FloatFloat3() { 883 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1b20fa80l, false); 884 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xd6f4de7cl, false); 885 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xd131a27cl, false); 886 try { 887 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE); 888 script.set_gAllocInStop(inStop); 889 script.set_gAllocInFraction(inFraction); 890 script.forEach_testMixFloat3Float3FloatFloat3(inStart, out); 891 verifyResultsMixFloat3Float3FloatFloat3(inStart, inStop, inFraction, out, false); 892 } catch (Exception e) { 893 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat3Float3FloatFloat3: " + e.toString()); 894 } 895 try { 896 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE); 897 scriptRelaxed.set_gAllocInStop(inStop); 898 scriptRelaxed.set_gAllocInFraction(inFraction); 899 scriptRelaxed.forEach_testMixFloat3Float3FloatFloat3(inStart, out); 900 verifyResultsMixFloat3Float3FloatFloat3(inStart, inStop, inFraction, out, true); 901 } catch (Exception e) { 902 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat3Float3FloatFloat3: " + e.toString()); 903 } 904 } 905 verifyResultsMixFloat3Float3FloatFloat3(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)906 private void verifyResultsMixFloat3Float3FloatFloat3(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 907 float[] arrayInStart = new float[INPUTSIZE * 4]; 908 Arrays.fill(arrayInStart, (float) 42); 909 inStart.copyTo(arrayInStart); 910 float[] arrayInStop = new float[INPUTSIZE * 4]; 911 Arrays.fill(arrayInStop, (float) 42); 912 inStop.copyTo(arrayInStop); 913 float[] arrayInFraction = new float[INPUTSIZE * 1]; 914 Arrays.fill(arrayInFraction, (float) 42); 915 inFraction.copyTo(arrayInFraction); 916 float[] arrayOut = new float[INPUTSIZE * 4]; 917 Arrays.fill(arrayOut, (float) 42); 918 out.copyTo(arrayOut); 919 StringBuilder message = new StringBuilder(); 920 boolean errorFound = false; 921 for (int i = 0; i < INPUTSIZE; i++) { 922 for (int j = 0; j < 3 ; j++) { 923 // Extract the inputs. 924 ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat(); 925 args.inStart = arrayInStart[i * 4 + j]; 926 args.inStop = arrayInStop[i * 4 + j]; 927 args.inFraction = arrayInFraction[i]; 928 // Figure out what the outputs should have been. 929 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed); 930 CoreMathVerifier.computeMix(args, target); 931 // Validate the outputs. 932 boolean valid = true; 933 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 934 valid = false; 935 } 936 if (!valid) { 937 if (!errorFound) { 938 errorFound = true; 939 message.append("Input inStart: "); 940 appendVariableToMessage(message, args.inStart); 941 message.append("\n"); 942 message.append("Input inStop: "); 943 appendVariableToMessage(message, args.inStop); 944 message.append("\n"); 945 message.append("Input inFraction: "); 946 appendVariableToMessage(message, args.inFraction); 947 message.append("\n"); 948 message.append("Expected output out: "); 949 appendVariableToMessage(message, args.out); 950 message.append("\n"); 951 message.append("Actual output out: "); 952 appendVariableToMessage(message, arrayOut[i * 4 + j]); 953 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 954 message.append(" FAIL"); 955 } 956 message.append("\n"); 957 message.append("Errors at"); 958 } 959 message.append(" ["); 960 message.append(Integer.toString(i)); 961 message.append(", "); 962 message.append(Integer.toString(j)); 963 message.append("]"); 964 } 965 } 966 } 967 assertFalse("Incorrect output for checkMixFloat3Float3FloatFloat3" + 968 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 969 } 970 checkMixFloat4Float4FloatFloat4()971 private void checkMixFloat4Float4FloatFloat4() { 972 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xa701d3dl, false); 973 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x715beb33l, false); 974 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xfb37303l, false); 975 try { 976 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE); 977 script.set_gAllocInStop(inStop); 978 script.set_gAllocInFraction(inFraction); 979 script.forEach_testMixFloat4Float4FloatFloat4(inStart, out); 980 verifyResultsMixFloat4Float4FloatFloat4(inStart, inStop, inFraction, out, false); 981 } catch (Exception e) { 982 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat4Float4FloatFloat4: " + e.toString()); 983 } 984 try { 985 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE); 986 scriptRelaxed.set_gAllocInStop(inStop); 987 scriptRelaxed.set_gAllocInFraction(inFraction); 988 scriptRelaxed.forEach_testMixFloat4Float4FloatFloat4(inStart, out); 989 verifyResultsMixFloat4Float4FloatFloat4(inStart, inStop, inFraction, out, true); 990 } catch (Exception e) { 991 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat4Float4FloatFloat4: " + e.toString()); 992 } 993 } 994 verifyResultsMixFloat4Float4FloatFloat4(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)995 private void verifyResultsMixFloat4Float4FloatFloat4(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 996 float[] arrayInStart = new float[INPUTSIZE * 4]; 997 Arrays.fill(arrayInStart, (float) 42); 998 inStart.copyTo(arrayInStart); 999 float[] arrayInStop = new float[INPUTSIZE * 4]; 1000 Arrays.fill(arrayInStop, (float) 42); 1001 inStop.copyTo(arrayInStop); 1002 float[] arrayInFraction = new float[INPUTSIZE * 1]; 1003 Arrays.fill(arrayInFraction, (float) 42); 1004 inFraction.copyTo(arrayInFraction); 1005 float[] arrayOut = new float[INPUTSIZE * 4]; 1006 Arrays.fill(arrayOut, (float) 42); 1007 out.copyTo(arrayOut); 1008 StringBuilder message = new StringBuilder(); 1009 boolean errorFound = false; 1010 for (int i = 0; i < INPUTSIZE; i++) { 1011 for (int j = 0; j < 4 ; j++) { 1012 // Extract the inputs. 1013 ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat(); 1014 args.inStart = arrayInStart[i * 4 + j]; 1015 args.inStop = arrayInStop[i * 4 + j]; 1016 args.inFraction = arrayInFraction[i]; 1017 // Figure out what the outputs should have been. 1018 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.FLOAT, relaxed); 1019 CoreMathVerifier.computeMix(args, target); 1020 // Validate the outputs. 1021 boolean valid = true; 1022 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 1023 valid = false; 1024 } 1025 if (!valid) { 1026 if (!errorFound) { 1027 errorFound = true; 1028 message.append("Input inStart: "); 1029 appendVariableToMessage(message, args.inStart); 1030 message.append("\n"); 1031 message.append("Input inStop: "); 1032 appendVariableToMessage(message, args.inStop); 1033 message.append("\n"); 1034 message.append("Input inFraction: "); 1035 appendVariableToMessage(message, args.inFraction); 1036 message.append("\n"); 1037 message.append("Expected output out: "); 1038 appendVariableToMessage(message, args.out); 1039 message.append("\n"); 1040 message.append("Actual output out: "); 1041 appendVariableToMessage(message, arrayOut[i * 4 + j]); 1042 if (!args.out.couldBe(arrayOut[i * 4 + j])) { 1043 message.append(" FAIL"); 1044 } 1045 message.append("\n"); 1046 message.append("Errors at"); 1047 } 1048 message.append(" ["); 1049 message.append(Integer.toString(i)); 1050 message.append(", "); 1051 message.append(Integer.toString(j)); 1052 message.append("]"); 1053 } 1054 } 1055 } 1056 assertFalse("Incorrect output for checkMixFloat4Float4FloatFloat4" + 1057 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 1058 } 1059 checkMixHalf2Half2HalfHalf2()1060 private void checkMixHalf2Half2HalfHalf2() { 1061 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 2, 0xc5a4349l, false); 1062 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 2, 0x2fea4b57l, false); 1063 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 1, 0xb339d3e7l, false); 1064 try { 1065 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 2), INPUTSIZE); 1066 script.set_gAllocInStop(inStop); 1067 script.set_gAllocInFraction(inFraction); 1068 script.forEach_testMixHalf2Half2HalfHalf2(inStart, out); 1069 verifyResultsMixHalf2Half2HalfHalf2(inStart, inStop, inFraction, out, false); 1070 } catch (Exception e) { 1071 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf2Half2HalfHalf2: " + e.toString()); 1072 } 1073 try { 1074 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 2), INPUTSIZE); 1075 scriptRelaxed.set_gAllocInStop(inStop); 1076 scriptRelaxed.set_gAllocInFraction(inFraction); 1077 scriptRelaxed.forEach_testMixHalf2Half2HalfHalf2(inStart, out); 1078 verifyResultsMixHalf2Half2HalfHalf2(inStart, inStop, inFraction, out, true); 1079 } catch (Exception e) { 1080 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf2Half2HalfHalf2: " + e.toString()); 1081 } 1082 } 1083 verifyResultsMixHalf2Half2HalfHalf2(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)1084 private void verifyResultsMixHalf2Half2HalfHalf2(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 1085 short[] arrayInStart = new short[INPUTSIZE * 2]; 1086 Arrays.fill(arrayInStart, (short) 42); 1087 inStart.copyTo(arrayInStart); 1088 short[] arrayInStop = new short[INPUTSIZE * 2]; 1089 Arrays.fill(arrayInStop, (short) 42); 1090 inStop.copyTo(arrayInStop); 1091 short[] arrayInFraction = new short[INPUTSIZE * 1]; 1092 Arrays.fill(arrayInFraction, (short) 42); 1093 inFraction.copyTo(arrayInFraction); 1094 short[] arrayOut = new short[INPUTSIZE * 2]; 1095 Arrays.fill(arrayOut, (short) 42); 1096 out.copyTo(arrayOut); 1097 StringBuilder message = new StringBuilder(); 1098 boolean errorFound = false; 1099 for (int i = 0; i < INPUTSIZE; i++) { 1100 for (int j = 0; j < 2 ; j++) { 1101 // Extract the inputs. 1102 ArgumentsHalfHalfHalfHalf args = new ArgumentsHalfHalfHalfHalf(); 1103 args.inStart = arrayInStart[i * 2 + j]; 1104 args.inStartDouble = Float16Utils.convertFloat16ToDouble(args.inStart); 1105 args.inStop = arrayInStop[i * 2 + j]; 1106 args.inStopDouble = Float16Utils.convertFloat16ToDouble(args.inStop); 1107 args.inFraction = arrayInFraction[i]; 1108 args.inFractionDouble = Float16Utils.convertFloat16ToDouble(args.inFraction); 1109 // Figure out what the outputs should have been. 1110 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed); 1111 CoreMathVerifier.computeMix(args, target); 1112 // Validate the outputs. 1113 boolean valid = true; 1114 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j]))) { 1115 valid = false; 1116 } 1117 if (!valid) { 1118 if (!errorFound) { 1119 errorFound = true; 1120 message.append("Input inStart: "); 1121 appendVariableToMessage(message, args.inStart); 1122 message.append("\n"); 1123 message.append("Input inStop: "); 1124 appendVariableToMessage(message, args.inStop); 1125 message.append("\n"); 1126 message.append("Input inFraction: "); 1127 appendVariableToMessage(message, args.inFraction); 1128 message.append("\n"); 1129 message.append("Expected output out: "); 1130 appendVariableToMessage(message, args.out); 1131 message.append("\n"); 1132 message.append("Actual output out: "); 1133 appendVariableToMessage(message, arrayOut[i * 2 + j]); 1134 message.append("\n"); 1135 message.append("Actual output out (in double): "); 1136 appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j])); 1137 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 2 + j]))) { 1138 message.append(" FAIL"); 1139 } 1140 message.append("\n"); 1141 message.append("Errors at"); 1142 } 1143 message.append(" ["); 1144 message.append(Integer.toString(i)); 1145 message.append(", "); 1146 message.append(Integer.toString(j)); 1147 message.append("]"); 1148 } 1149 } 1150 } 1151 assertFalse("Incorrect output for checkMixHalf2Half2HalfHalf2" + 1152 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 1153 } 1154 checkMixHalf3Half3HalfHalf3()1155 private void checkMixHalf3Half3HalfHalf3() { 1156 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 3, 0x204615a8l, false); 1157 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 3, 0x541973f4l, false); 1158 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 1, 0xb462aa74l, false); 1159 try { 1160 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 3), INPUTSIZE); 1161 script.set_gAllocInStop(inStop); 1162 script.set_gAllocInFraction(inFraction); 1163 script.forEach_testMixHalf3Half3HalfHalf3(inStart, out); 1164 verifyResultsMixHalf3Half3HalfHalf3(inStart, inStop, inFraction, out, false); 1165 } catch (Exception e) { 1166 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf3Half3HalfHalf3: " + e.toString()); 1167 } 1168 try { 1169 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 3), INPUTSIZE); 1170 scriptRelaxed.set_gAllocInStop(inStop); 1171 scriptRelaxed.set_gAllocInFraction(inFraction); 1172 scriptRelaxed.forEach_testMixHalf3Half3HalfHalf3(inStart, out); 1173 verifyResultsMixHalf3Half3HalfHalf3(inStart, inStop, inFraction, out, true); 1174 } catch (Exception e) { 1175 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf3Half3HalfHalf3: " + e.toString()); 1176 } 1177 } 1178 verifyResultsMixHalf3Half3HalfHalf3(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)1179 private void verifyResultsMixHalf3Half3HalfHalf3(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 1180 short[] arrayInStart = new short[INPUTSIZE * 4]; 1181 Arrays.fill(arrayInStart, (short) 42); 1182 inStart.copyTo(arrayInStart); 1183 short[] arrayInStop = new short[INPUTSIZE * 4]; 1184 Arrays.fill(arrayInStop, (short) 42); 1185 inStop.copyTo(arrayInStop); 1186 short[] arrayInFraction = new short[INPUTSIZE * 1]; 1187 Arrays.fill(arrayInFraction, (short) 42); 1188 inFraction.copyTo(arrayInFraction); 1189 short[] arrayOut = new short[INPUTSIZE * 4]; 1190 Arrays.fill(arrayOut, (short) 42); 1191 out.copyTo(arrayOut); 1192 StringBuilder message = new StringBuilder(); 1193 boolean errorFound = false; 1194 for (int i = 0; i < INPUTSIZE; i++) { 1195 for (int j = 0; j < 3 ; j++) { 1196 // Extract the inputs. 1197 ArgumentsHalfHalfHalfHalf args = new ArgumentsHalfHalfHalfHalf(); 1198 args.inStart = arrayInStart[i * 4 + j]; 1199 args.inStartDouble = Float16Utils.convertFloat16ToDouble(args.inStart); 1200 args.inStop = arrayInStop[i * 4 + j]; 1201 args.inStopDouble = Float16Utils.convertFloat16ToDouble(args.inStop); 1202 args.inFraction = arrayInFraction[i]; 1203 args.inFractionDouble = Float16Utils.convertFloat16ToDouble(args.inFraction); 1204 // Figure out what the outputs should have been. 1205 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed); 1206 CoreMathVerifier.computeMix(args, target); 1207 // Validate the outputs. 1208 boolean valid = true; 1209 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) { 1210 valid = false; 1211 } 1212 if (!valid) { 1213 if (!errorFound) { 1214 errorFound = true; 1215 message.append("Input inStart: "); 1216 appendVariableToMessage(message, args.inStart); 1217 message.append("\n"); 1218 message.append("Input inStop: "); 1219 appendVariableToMessage(message, args.inStop); 1220 message.append("\n"); 1221 message.append("Input inFraction: "); 1222 appendVariableToMessage(message, args.inFraction); 1223 message.append("\n"); 1224 message.append("Expected output out: "); 1225 appendVariableToMessage(message, args.out); 1226 message.append("\n"); 1227 message.append("Actual output out: "); 1228 appendVariableToMessage(message, arrayOut[i * 4 + j]); 1229 message.append("\n"); 1230 message.append("Actual output out (in double): "); 1231 appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j])); 1232 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) { 1233 message.append(" FAIL"); 1234 } 1235 message.append("\n"); 1236 message.append("Errors at"); 1237 } 1238 message.append(" ["); 1239 message.append(Integer.toString(i)); 1240 message.append(", "); 1241 message.append(Integer.toString(j)); 1242 message.append("]"); 1243 } 1244 } 1245 } 1246 assertFalse("Incorrect output for checkMixHalf3Half3HalfHalf3" + 1247 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 1248 } 1249 checkMixHalf4Half4HalfHalf4()1250 private void checkMixHalf4Half4HalfHalf4() { 1251 Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 4, 0x3431e807l, false); 1252 Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 4, 0x78489c91l, false); 1253 Allocation inFraction = createRandomAllocation(mRS, Element.DataType.FLOAT_16, 1, 0xb58b8101l, false); 1254 try { 1255 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 4), INPUTSIZE); 1256 script.set_gAllocInStop(inStop); 1257 script.set_gAllocInFraction(inFraction); 1258 script.forEach_testMixHalf4Half4HalfHalf4(inStart, out); 1259 verifyResultsMixHalf4Half4HalfHalf4(inStart, inStop, inFraction, out, false); 1260 } catch (Exception e) { 1261 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf4Half4HalfHalf4: " + e.toString()); 1262 } 1263 try { 1264 Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_16, 4), INPUTSIZE); 1265 scriptRelaxed.set_gAllocInStop(inStop); 1266 scriptRelaxed.set_gAllocInFraction(inFraction); 1267 scriptRelaxed.forEach_testMixHalf4Half4HalfHalf4(inStart, out); 1268 verifyResultsMixHalf4Half4HalfHalf4(inStart, inStop, inFraction, out, true); 1269 } catch (Exception e) { 1270 throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixHalf4Half4HalfHalf4: " + e.toString()); 1271 } 1272 } 1273 verifyResultsMixHalf4Half4HalfHalf4(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed)1274 private void verifyResultsMixHalf4Half4HalfHalf4(Allocation inStart, Allocation inStop, Allocation inFraction, Allocation out, boolean relaxed) { 1275 short[] arrayInStart = new short[INPUTSIZE * 4]; 1276 Arrays.fill(arrayInStart, (short) 42); 1277 inStart.copyTo(arrayInStart); 1278 short[] arrayInStop = new short[INPUTSIZE * 4]; 1279 Arrays.fill(arrayInStop, (short) 42); 1280 inStop.copyTo(arrayInStop); 1281 short[] arrayInFraction = new short[INPUTSIZE * 1]; 1282 Arrays.fill(arrayInFraction, (short) 42); 1283 inFraction.copyTo(arrayInFraction); 1284 short[] arrayOut = new short[INPUTSIZE * 4]; 1285 Arrays.fill(arrayOut, (short) 42); 1286 out.copyTo(arrayOut); 1287 StringBuilder message = new StringBuilder(); 1288 boolean errorFound = false; 1289 for (int i = 0; i < INPUTSIZE; i++) { 1290 for (int j = 0; j < 4 ; j++) { 1291 // Extract the inputs. 1292 ArgumentsHalfHalfHalfHalf args = new ArgumentsHalfHalfHalfHalf(); 1293 args.inStart = arrayInStart[i * 4 + j]; 1294 args.inStartDouble = Float16Utils.convertFloat16ToDouble(args.inStart); 1295 args.inStop = arrayInStop[i * 4 + j]; 1296 args.inStopDouble = Float16Utils.convertFloat16ToDouble(args.inStop); 1297 args.inFraction = arrayInFraction[i]; 1298 args.inFractionDouble = Float16Utils.convertFloat16ToDouble(args.inFraction); 1299 // Figure out what the outputs should have been. 1300 Target target = new Target(Target.FunctionType.NORMAL, Target.ReturnType.HALF, relaxed); 1301 CoreMathVerifier.computeMix(args, target); 1302 // Validate the outputs. 1303 boolean valid = true; 1304 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) { 1305 valid = false; 1306 } 1307 if (!valid) { 1308 if (!errorFound) { 1309 errorFound = true; 1310 message.append("Input inStart: "); 1311 appendVariableToMessage(message, args.inStart); 1312 message.append("\n"); 1313 message.append("Input inStop: "); 1314 appendVariableToMessage(message, args.inStop); 1315 message.append("\n"); 1316 message.append("Input inFraction: "); 1317 appendVariableToMessage(message, args.inFraction); 1318 message.append("\n"); 1319 message.append("Expected output out: "); 1320 appendVariableToMessage(message, args.out); 1321 message.append("\n"); 1322 message.append("Actual output out: "); 1323 appendVariableToMessage(message, arrayOut[i * 4 + j]); 1324 message.append("\n"); 1325 message.append("Actual output out (in double): "); 1326 appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j])); 1327 if (!args.out.couldBe(Float16Utils.convertFloat16ToDouble(arrayOut[i * 4 + j]))) { 1328 message.append(" FAIL"); 1329 } 1330 message.append("\n"); 1331 message.append("Errors at"); 1332 } 1333 message.append(" ["); 1334 message.append(Integer.toString(i)); 1335 message.append(", "); 1336 message.append(Integer.toString(j)); 1337 message.append("]"); 1338 } 1339 } 1340 } 1341 assertFalse("Incorrect output for checkMixHalf4Half4HalfHalf4" + 1342 (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), errorFound); 1343 } 1344 testMix()1345 public void testMix() { 1346 checkMixFloatFloatFloatFloat(); 1347 checkMixFloat2Float2Float2Float2(); 1348 checkMixFloat3Float3Float3Float3(); 1349 checkMixFloat4Float4Float4Float4(); 1350 checkMixHalfHalfHalfHalf(); 1351 checkMixHalf2Half2Half2Half2(); 1352 checkMixHalf3Half3Half3Half3(); 1353 checkMixHalf4Half4Half4Half4(); 1354 checkMixFloat2Float2FloatFloat2(); 1355 checkMixFloat3Float3FloatFloat3(); 1356 checkMixFloat4Float4FloatFloat4(); 1357 checkMixHalf2Half2HalfHalf2(); 1358 checkMixHalf3Half3HalfHalf3(); 1359 checkMixHalf4Half4HalfHalf4(); 1360 } 1361 } 1362