context.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // ======================================================================== //
  2. // Copyright 2009-2017 Intel Corporation //
  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. #pragma once
  17. #include "default.h"
  18. #include "rtcore.h"
  19. namespace embree
  20. {
  21. class Scene;
  22. struct IntersectContext
  23. {
  24. enum {
  25. INPUT_RAY_DATA_AOS = 0,
  26. INPUT_RAY_DATA_SOA4 = 4,
  27. INPUT_RAY_DATA_SOA8 = 8,
  28. INPUT_RAY_DATA_SOA16 = 16
  29. };
  30. public:
  31. __forceinline IntersectContext(Scene* scene, const RTCIntersectContext* user_context)
  32. : scene(scene), user(user_context), flags(INPUT_RAY_DATA_AOS), geomID_to_instID(nullptr) {}
  33. public:
  34. Scene* scene;
  35. const RTCIntersectContext* user;
  36. size_t flags;
  37. const unsigned* geomID_to_instID; // required for xfm node handling
  38. static __forceinline size_t encodeSIMDWidth(const size_t width)
  39. {
  40. assert(width == 4 || width == 8 || width == 16);
  41. return width;
  42. }
  43. __forceinline size_t getInputSIMDWidth()
  44. {
  45. return flags;
  46. }
  47. };
  48. }