ScriptC_reduce_general_examples_halter.java.expect revision d204e65f7b46a3592a254d581e4b9f2af92b6eac
1/* 2 * Copyright (C) 2011-2014 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/* 18 * This file is auto-generated. DO NOT MODIFY! 19 * The source Renderscript file: reduce_general_examples_halter.rs 20 */ 21 22package examples; 23 24import android.renderscript.*; 25import examples.reduce_general_examples_halterBitCode; 26 27/** 28 * @hide 29 */ 30public class ScriptC_reduce_general_examples_halter extends ScriptC { 31 private static final String __rs_resource_name = "reduce_general_examples_halter"; 32 // Constructor 33 public ScriptC_reduce_general_examples_halter(RenderScript rs) { 34 super(rs, 35 __rs_resource_name, 36 reduce_general_examples_halterBitCode.getBitCode32(), 37 reduce_general_examples_halterBitCode.getBitCode64()); 38 mRSLocal = rs; 39 __I32 = Element.I32(rs); 40 __I32_2 = Element.I32_2(rs); 41 } 42 43 private Element __I32; 44 private Element __I32_2; 45 private RenderScript mRSLocal; 46 // To obtain the result, invoke get(), which blocks 47 // until the asynchronously-launched operation has completed. 48 public static class result_int { 49 public int get() { 50 if (!mGotResult) { 51 int[] outArray = new int[1]; 52 mOut.copyTo(outArray); 53 mResult = outArray[0]; 54 mOut.destroy(); 55 mOut = null; // make Java object eligible for garbage collection 56 if (mTempIns != null) { 57 for (Allocation tempIn : mTempIns) { 58 tempIn.destroy(); 59 } 60 61 mTempIns = null; // make Java objects eligible for garbage collection 62 } 63 64 mGotResult = true; 65 } 66 67 return mResult; 68 } 69 70 private result_int(Allocation out) { 71 mTempIns = null; 72 mOut = out; 73 mGotResult = false; 74 } 75 76 private Allocation[] mTempIns; 77 private Allocation mOut; 78 private boolean mGotResult; 79 private int mResult; 80 } 81 82 // To obtain the result, invoke get(), which blocks 83 // until the asynchronously-launched operation has completed. 84 public static class result_int2 { 85 public Int2 get() { 86 if (!mGotResult) { 87 int[] outArray = new int[2]; 88 mOut.copyTo(outArray); 89 mResult = new Int2(outArray[0], outArray[1]); 90 mOut.destroy(); 91 mOut = null; // make Java object eligible for garbage collection 92 if (mTempIns != null) { 93 for (Allocation tempIn : mTempIns) { 94 tempIn.destroy(); 95 } 96 97 mTempIns = null; // make Java objects eligible for garbage collection 98 } 99 100 mGotResult = true; 101 } 102 103 return mResult; 104 } 105 106 private result_int2(Allocation out) { 107 mTempIns = null; 108 mOut = out; 109 mGotResult = false; 110 } 111 112 private Allocation[] mTempIns; 113 private Allocation mOut; 114 private boolean mGotResult; 115 private Int2 mResult; 116 } 117 118 private final static int mExportReduceNewIdx_fz = 0; 119 // in1 = "inVal" 120 public result_int reduce_fz(int[] in1) { 121 // Verify that "in1" is non-null. 122 if (in1 == null) { 123 throw new RSIllegalArgumentException("Array \"in1\" is null!"); 124 } 125 Allocation ain1 = Allocation.createSized(mRSLocal, __I32, in1.length); 126 ain1.setAutoPadding(true); 127 ain1.copyFrom(in1); 128 129 result_int result = reduce_fz(ain1, null); 130 result.mTempIns = new Allocation[]{ain1}; 131 return result; 132 } 133 134 // ain1 = "int inVal" 135 public result_int reduce_fz(Allocation ain1) { 136 return reduce_fz(ain1, null); 137 } 138 139 // ain1 = "int inVal" 140 public result_int reduce_fz(Allocation ain1, Script.LaunchOptions sc) { 141 // check ain1 142 if (!ain1.getType().getElement().isCompatible(__I32)) { 143 throw new RSRuntimeException("Type mismatch with I32!"); 144 } 145 Allocation aout = Allocation.createSized(mRSLocal, __I32, 1); 146 aout.setAutoPadding(true); 147 reduce(mExportReduceNewIdx_fz, new Allocation[]{ain1}, aout, sc); 148 return new result_int(aout); 149 } 150 151 private final static int mExportReduceNewIdx_fz2 = 1; 152 // in1 = "inVal" 153 public result_int2 reduce_fz2(int[] in1) { 154 // Verify that "in1" is non-null. 155 if (in1 == null) { 156 throw new RSIllegalArgumentException("Array \"in1\" is null!"); 157 } 158 Allocation ain1 = Allocation.createSized(mRSLocal, __I32, in1.length); 159 ain1.setAutoPadding(true); 160 ain1.copyFrom(in1); 161 162 result_int2 result = reduce_fz2(ain1, null); 163 result.mTempIns = new Allocation[]{ain1}; 164 return result; 165 } 166 167 // ain1 = "int inVal" 168 public result_int2 reduce_fz2(Allocation ain1) { 169 return reduce_fz2(ain1, null); 170 } 171 172 // ain1 = "int inVal" 173 public result_int2 reduce_fz2(Allocation ain1, Script.LaunchOptions sc) { 174 // check ain1 175 if (!ain1.getType().getElement().isCompatible(__I32)) { 176 throw new RSRuntimeException("Type mismatch with I32!"); 177 } 178 Allocation aout = Allocation.createSized(mRSLocal, __I32_2, 1); 179 aout.setAutoPadding(true); 180 reduce(mExportReduceNewIdx_fz2, new Allocation[]{ain1}, aout, sc); 181 return new result_int2(aout); 182 } 183 184} 185 186