accelset.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #include "accelset.h"
  17. #include "scene.h"
  18. namespace embree
  19. {
  20. AccelSet::AccelSet (Scene* parent, RTCGeometryFlags gflags, size_t numItems, size_t numTimeSteps)
  21. : Geometry(parent,Geometry::USER_GEOMETRY,numItems,numTimeSteps,gflags), boundsFunc(nullptr), boundsFunc2(nullptr), boundsFunc3(nullptr), boundsFuncUserPtr(nullptr)
  22. {
  23. intersectors.ptr = nullptr;
  24. enabling();
  25. }
  26. void AccelSet::enabling () {
  27. if (numTimeSteps == 1) parent->world.numUserGeometries += numPrimitives;
  28. else parent->worldMB.numUserGeometries += numPrimitives;
  29. }
  30. void AccelSet::disabling() {
  31. if (numTimeSteps == 1) parent->world.numUserGeometries -= numPrimitives;
  32. else parent->worldMB.numUserGeometries -= numPrimitives;
  33. }
  34. /* This is a workaround for some Clang 3.8.0-2ubuntu4 optimization
  35. * that creates issues with the ISA selection. This code essentially
  36. * is compiled with non-SSE2 ISA, but has to run on SSE2
  37. * machines. Clang 3.8.0-2ubuntu4 issues AVX-128 instuctions to
  38. * update intersect and occluded pointers at once. Only providing
  39. * these functions for SSE2 ISA fixes this issue. */
  40. AccelSet::Intersector1::Intersector1 (ErrorFunc error)
  41. : intersect((IntersectFunc)error), occluded((OccludedFunc)error), name(nullptr) {}
  42. AccelSet::Intersector1::Intersector1 (IntersectFunc intersect, OccludedFunc occluded, const char* name)
  43. : intersect(intersect), occluded(occluded), name(name) {}
  44. AccelSet::Intersector4::Intersector4 (ErrorFunc error)
  45. : intersect((void*)error), occluded((void*)error), name(nullptr), ispc(false) {}
  46. AccelSet::Intersector4::Intersector4 (void* intersect, void* occluded, const char* name, bool ispc)
  47. : intersect(intersect), occluded(occluded), name(name), ispc(ispc) {}
  48. AccelSet::Intersector8::Intersector8 (ErrorFunc error)
  49. : intersect((void*)error), occluded((void*)error), name(nullptr), ispc(false) {}
  50. AccelSet::Intersector8::Intersector8 (void* intersect, void* occluded, const char* name, bool ispc)
  51. : intersect(intersect), occluded(occluded), name(name), ispc(ispc) {}
  52. AccelSet::Intersector16::Intersector16 (ErrorFunc error)
  53. : intersect((void*)error), occluded((void*)error), name(nullptr), ispc(false) {}
  54. AccelSet::Intersector16::Intersector16 (void* intersect, void* occluded, const char* name, bool ispc)
  55. : intersect(intersect), occluded(occluded), name(name), ispc(ispc) {}
  56. AccelSet::Intersector1M::Intersector1M (ErrorFunc error)
  57. : intersect((IntersectFunc1M)error), occluded((OccludedFunc1M)error), name(nullptr) {}
  58. AccelSet::Intersector1M::Intersector1M (IntersectFunc1M intersect, OccludedFunc1M occluded, const char* name)
  59. : intersect(intersect), occluded(occluded), name(name) {}
  60. AccelSet::IntersectorN::IntersectorN (ErrorFunc error)
  61. : intersect((IntersectFuncN)error), occluded((OccludedFuncN)error), name(nullptr) {}
  62. AccelSet::IntersectorN::IntersectorN (IntersectFuncN intersect, OccludedFuncN occluded, const char* name)
  63. : intersect(intersect), occluded(occluded), name(name) {}
  64. }