DriverRS.java.template 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (C) 2012 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. package %PACKAGE%;
  17. import android.content.res.Resources;
  18. import android.renderscript.*;
  19. // This is the renderer for the driver
  20. public class DriverRS {
  21. private Resources mRes;
  22. private RenderScriptGL mRS;
  23. private ScriptC_%TESTCASE% mScript;
  24. public DriverRS() {
  25. }
  26. // This provides us with the renderscript context and resources that
  27. // allow us to create the script that does rendering
  28. public void init(RenderScriptGL rs, Resources res) {
  29. mRS = rs;
  30. mRes = res;
  31. initRS();
  32. }
  33. private void initRS() {
  34. mScript = new ScriptC_%TESTCASE% (mRS, mRes, R.raw.%TESTCASE%);
  35. mScript.invoke_entry();
  36. }
  37. }