1// This file is automatically generated from 2// frameworks/rs/tests/java_api/RSUnitTests/RSUnitTests.py 3/* 4 * Copyright (C) 2017 The Android Open Source Project 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19package com.android.rs.unittest; 20 21import android.content.Context; 22import android.support.v8.renderscript.Allocation; 23import android.support.v8.renderscript.Element; 24import android.support.v8.renderscript.RenderScript; 25import android.support.v8.renderscript.Type; 26 27public class UT_ctxt_default extends UnitTest { 28 private Type T; 29 private Allocation A; 30 private Allocation B; 31 32 public UT_ctxt_default(Context ctx) { 33 super("Kernel context default", ctx); 34 } 35 36 private void initializeGlobals(RenderScript RS, ScriptC_ctxt_default s) { 37 Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS)); 38 int X = 2; 39 s.set_gDimX(X); 40 typeBuilder.setX(X); 41 42 T = typeBuilder.create(); 43 A = Allocation.createTyped(RS, T); 44 s.set_A(A); 45 B = Allocation.createTyped(RS, T); 46 s.set_B(B); 47 return; 48 } 49 50 public void run() { 51 RenderScript pRS = createRenderScript(true); 52 ScriptC_ctxt_default s = new ScriptC_ctxt_default(pRS); 53 initializeGlobals(pRS, s); 54 s.forEach_init_vars(A); 55 s.forEach_root(A, B); 56 s.invoke_verify_root(); 57 s.invoke_kernel_test(); 58 pRS.finish(); 59 T.destroy(); 60 A.destroy(); 61 B.destroy(); 62 s.destroy(); 63 pRS.destroy(); 64 } 65} 66