rsdScriptGroup.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (C) 2011-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. #include "rsdCore.h"
  17. #include "../cpu_ref/rsd_cpu.h"
  18. #include "rsScript.h"
  19. #include "rsScriptGroup.h"
  20. #include "rsdScriptGroup.h"
  21. #include "rsdBcc.h"
  22. #include "rsdAllocation.h"
  23. using android::renderscript::Allocation;
  24. using android::renderscript::Context;
  25. using android::renderscript::RsdCpuReference;
  26. using android::renderscript::ScriptGroup;
  27. using android::renderscript::ScriptGroupBase;
  28. using android::renderscript::ScriptKernelID;
  29. using android::renderscript::rs_script_group;
  30. bool rsdScriptGroupInit(const Context *rsc, ScriptGroupBase *sg) {
  31. RsdHal *dc = (RsdHal *)rsc->mHal.drv;
  32. sg->mHal.drv = dc->mCpuRef->createScriptGroup(sg);
  33. return sg->mHal.drv != nullptr;
  34. }
  35. void rsdScriptGroupSetInput(const Context *rsc, const ScriptGroup *sg,
  36. const ScriptKernelID *kid, Allocation *) {
  37. }
  38. void rsdScriptGroupSetOutput(const Context *rsc, const ScriptGroup *sg,
  39. const ScriptKernelID *kid, Allocation *) {
  40. }
  41. void rsdScriptGroupExecute(const Context *rsc, const ScriptGroupBase *sg) {
  42. RsdCpuReference::CpuScriptGroupBase *sgi =
  43. (RsdCpuReference::CpuScriptGroupBase *)sg->mHal.drv;
  44. sgi->execute();
  45. }
  46. void rsdScriptGroupDestroy(const Context *rsc, const ScriptGroupBase *sg) {
  47. RsdCpuReference::CpuScriptGroupBase *sgi =
  48. (RsdCpuReference::CpuScriptGroupBase *)sg->mHal.drv;
  49. delete sgi;
  50. }
  51. void rsdScriptGroupUpdateCachedObject(const Context *rsc,
  52. const ScriptGroup *sg,
  53. rs_script_group *obj)
  54. {
  55. obj->p = sg;
  56. #ifdef __LP64__
  57. obj->unused1 = nullptr;
  58. obj->unused2 = nullptr;
  59. obj->unused3 = nullptr;
  60. #endif
  61. }