rsovScriptGroup.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #include "rsovCore.h"
  17. #include "rsAllocation.h"
  18. #include "rsContext.h"
  19. #include "rsScript.h"
  20. #include "rsScriptGroup.h"
  21. #include "rsd_cpu.h"
  22. using android::renderscript::Allocation;
  23. using android::renderscript::Context;
  24. using android::renderscript::RsdCpuReference;
  25. using android::renderscript::ScriptGroup;
  26. using android::renderscript::ScriptGroupBase;
  27. using android::renderscript::ScriptKernelID;
  28. using android::renderscript::rs_script_group;
  29. bool rsovScriptGroupInit(const Context *rsc, ScriptGroupBase *sg) {
  30. // Always falls back to CPU implmentation of ScriptGroup
  31. RSoVHal *dc = (RSoVHal *)rsc->mHal.drv;
  32. sg->mHal.drv = dc->mCpuRef->createScriptGroup(sg);
  33. return sg->mHal.drv != nullptr;
  34. }
  35. void rsovScriptGroupSetInput(const Context *rsc, const ScriptGroup *sg,
  36. const ScriptKernelID *kid, Allocation *) {}
  37. void rsovScriptGroupSetOutput(const Context *rsc, const ScriptGroup *sg,
  38. const ScriptKernelID *kid, Allocation *) {}
  39. void rsovScriptGroupExecute(const Context *rsc, const ScriptGroupBase *sg) {
  40. RsdCpuReference::CpuScriptGroupBase *sgi =
  41. (RsdCpuReference::CpuScriptGroupBase *)sg->mHal.drv;
  42. sgi->execute();
  43. }
  44. void rsovScriptGroupDestroy(const Context *rsc, const ScriptGroupBase *sg) {
  45. RsdCpuReference::CpuScriptGroupBase *sgi =
  46. (RsdCpuReference::CpuScriptGroupBase *)sg->mHal.drv;
  47. delete sgi;
  48. }