device.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Copyright 2009-2021 Intel Corporation
  2. // SPDX-License-Identifier: Apache-2.0
  3. #pragma once
  4. #include "default.h"
  5. #include "state.h"
  6. #include "accel.h"
  7. namespace embree
  8. {
  9. class BVH4Factory;
  10. class BVH8Factory;
  11. class Device : public State, public MemoryMonitorInterface
  12. {
  13. ALIGNED_CLASS_(16);
  14. public:
  15. /*! Device construction */
  16. Device (const char* cfg);
  17. /*! Device destruction */
  18. virtual ~Device ();
  19. /*! prints info about the device */
  20. void print();
  21. /*! sets the error code */
  22. void setDeviceErrorCode(RTCError error);
  23. /*! returns and clears the error code */
  24. RTCError getDeviceErrorCode();
  25. /*! sets the error code */
  26. static void setThreadErrorCode(RTCError error);
  27. /*! returns and clears the error code */
  28. static RTCError getThreadErrorCode();
  29. /*! processes error codes, do not call directly */
  30. static void process_error(Device* device, RTCError error, const char* str);
  31. /*! invokes the memory monitor callback */
  32. void memoryMonitor(ssize_t bytes, bool post);
  33. /*! sets the size of the software cache. */
  34. void setCacheSize(size_t bytes);
  35. /*! sets a property */
  36. void setProperty(const RTCDeviceProperty prop, ssize_t val);
  37. /*! gets a property */
  38. ssize_t getProperty(const RTCDeviceProperty prop);
  39. private:
  40. /*! initializes the tasking system */
  41. void initTaskingSystem(size_t numThreads);
  42. /*! shuts down the tasking system */
  43. void exitTaskingSystem();
  44. /*! some variables that can be set via rtcSetParameter1i for debugging purposes */
  45. public:
  46. static ssize_t debug_int0;
  47. static ssize_t debug_int1;
  48. static ssize_t debug_int2;
  49. static ssize_t debug_int3;
  50. public:
  51. std::unique_ptr<BVH4Factory> bvh4_factory;
  52. #if defined(EMBREE_TARGET_SIMD8)
  53. std::unique_ptr<BVH8Factory> bvh8_factory;
  54. #endif
  55. #if USE_TASK_ARENA
  56. std::unique_ptr<tbb::task_arena> arena;
  57. #endif
  58. /* ray streams filter */
  59. RayStreamFilterFuncs rayStreamFilters;
  60. };
  61. }