rsScriptIntrinsic.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #ifndef ANDROID_RS_SCRIPT_INTRINSIC_H
  17. #define ANDROID_RS_SCRIPT_INTRINSIC_H
  18. #include "rsScript.h"
  19. // ---------------------------------------------------------------------------
  20. namespace android {
  21. namespace renderscript {
  22. class ScriptIntrinsic : public Script {
  23. public:
  24. ObjectBaseRef<const Element> mElement;
  25. explicit ScriptIntrinsic(Context *);
  26. ~ScriptIntrinsic() override;
  27. bool init(Context *rsc, RsScriptIntrinsicID iid, Element *e);
  28. void serialize(Context *rsc, OStream *stream) const override;
  29. RsA3DClassID getClassId() const override;
  30. bool freeChildren() override;
  31. void runForEach(Context* rsc,
  32. uint32_t slot,
  33. const Allocation ** ains,
  34. size_t inLen,
  35. Allocation* aout,
  36. const void* usr,
  37. size_t usrBytes,
  38. const RsScriptCall* sc = nullptr) override;
  39. void runReduce(Context *rsc, uint32_t slot,
  40. const Allocation ** ains, size_t inLen,
  41. Allocation *aout, const RsScriptCall *sc) override;
  42. void Invoke(Context *rsc, uint32_t slot, const void *data, size_t len) override;
  43. void setupScript(Context *rsc) override;
  44. uint32_t run(Context *) override;
  45. bool isIntrinsic() const override { return true; }
  46. protected:
  47. uint32_t mIntrinsicID;
  48. };
  49. } // namespace renderscript
  50. } // namespace android
  51. #endif