From ea4cf0a369ace8050860bdc6e7e6005979b87948 Mon Sep 17 00:00:00 2001 From: Stefan Werner Date: Thu, 3 Jul 2025 13:45:05 +0200 Subject: [PATCH 1/6] Added specializtion constants for curves and motion blur --- kernels/sycl/rthwif_embree.cpp | 47 +++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/kernels/sycl/rthwif_embree.cpp b/kernels/sycl/rthwif_embree.cpp index 00a581b60f..08b0721658 100644 --- a/kernels/sycl/rthwif_embree.cpp +++ b/kernels/sycl/rthwif_embree.cpp @@ -269,7 +269,6 @@ __forceinline bool intersect_instance(intel_ray_query_t& query, RayHit& ray, Geo intel_raytracing_acceleration_structure_t hwaccel_ptr = (intel_raytracing_acceleration_structure_t) object->accelBuffer.getHWAccel(bvh_id); intel_ray_query_forward_ray(query, raydesc, hwaccel_ptr); - return false; } @@ -451,20 +450,31 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene if (gtype == Geometry::GTY_FLAT_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_FLAT_LINEAR_CURVE)) { LineSegments* geom = context->scene->get(geomID); - Vec3ff v0, v1; geom->gather_safe(v0,v1,geom->segment(primID),ray.time()); + Vec3ff v0, v1; + if (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR) + geom->gather_safe(v0,v1,geom->segment(primID),ray.time()); + else + geom->gather(v0,v1,geom->segment(primID)); return isa::FlatLinearCurveIntersector1<1>::intersect(true,ray,context,geom,pre,v0,v1,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } else if (gtype == Geometry::GTY_ROUND_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_ROUND_LINEAR_CURVE)) { LineSegments* geom = context->scene->get(geomID); - Vec3ff v0,v1,v2,v3; geom->gather_safe(v0,v1,v2,v3,primID,geom->segment(primID),ray.time()); + Vec3ff v0,v1,v2,v3; + if (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR) + geom->gather_safe(v0,v1,v2,v3,primID,geom->segment(primID),ray.time()); + else + geom->gather(v0,v1,v2,v3,primID,geom->segment(primID)); return isa::RoundLinearCurveIntersector1<1>().intersect(true,ray,context,geom,pre,v0,v1,v2,v3,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } else if (gtype == Geometry::GTY_CONE_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_CONE_LINEAR_CURVE)) { LineSegments* geom = context->scene->get(geomID); Vec3ff v0 = zero, v1 = zero; bool cL = false, cR = false; - geom->gather_safe(v0,v1,cL,cR,primID,geom->segment(primID),ray.time()); + if (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR) + geom->gather_safe(v0,v1,cL,cR,primID,geom->segment(primID),ray.time()); + else + geom->gather(v0,v1,cL,cR,primID,geom->segment(primID)); return isa::ConeCurveIntersector1<1>().intersect(true,ray,context,geom,pre,v0,v1,cL,cR,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } else @@ -474,7 +484,7 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene { using Intersector = isa::OrientedCurve1Intersector1; using Curve = isa::TensorLinearCubicBezierSurface3fa; - if (geom->numTimeSegments() > 0 && (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR)) + if (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR) { Curve curve; if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & RTC_FEATURE_FLAG_NORMAL_ORIENTED_HERMITE_CURVE)) { @@ -496,20 +506,33 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene Vec3ff v0,v1,v2,v3; Vec3fa n0,n1,n2,n3; if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & RTC_FEATURE_FLAG_NORMAL_ORIENTED_HERMITE_CURVE)) - geom->gather_hermite_safe(v0,v1,n0,n1,v2,v3,n2,n3,geom->curve(primID),ray.time()); + geom->gather_hermite(v0,v1,n0,n1,v2,v3,n2,n3,geom->curve(primID)); else - geom->gather_safe(v0,v1,v2,v3,n0,n1,n2,n3,geom->curve(primID),ray.time()); + geom->gather(v0,v1,v2,v3,n0,n1,n2,n3,geom->curve(primID)); isa::convert_to_bezier(gtype, v0,v1,v2,v3, n0,n1,n2,n3); return Intersector().intersect(pre,ray,context,geom,primID,v0,v1,v2,v3,n0,n1,n2,n3,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } } else if (feature_mask & (RTC_FEATURE_FLAG_FLAT_CURVES | RTC_FEATURE_FLAG_ROUND_CURVES)) { Vec3ff v0,v1,v2,v3; - if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & (RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE | RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE))) - geom->gather_hermite_safe(v0,v1,v2,v3,geom->curve(primID),ray.time()); - else - geom->gather_safe(v0,v1,v2,v3,geom->curve(primID),ray.time()); - + if (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR) + { + if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & (RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE | RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE))) { + geom->gather_hermite_safe(v0,v1,v2,v3,geom->curve(primID),ray.time()); + } + else { + geom->gather_safe(v0,v1,v2,v3,geom->curve(primID),ray.time()); + } + } + else { + if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & (RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE | RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE))) { + geom->gather_hermite(v0,v1,v2,v3,geom->curve(primID)); + } + else { + geom->gather(v0,v1,v2,v3,geom->curve(primID)); + } + } + isa::convert_to_bezier(gtype, v0,v1,v2,v3); if (stype == Geometry::GTY_SUBTYPE_FLAT_CURVE && (feature_mask & RTC_FEATURE_FLAG_FLAT_CURVES)) From 779fc723d70af8626b35d213bf7c70bd32ae70e6 Mon Sep 17 00:00:00 2001 From: Stefan Werner Date: Tue, 3 Jun 2025 16:50:41 +0200 Subject: [PATCH 2/6] Fixed gcc warnings when casting to reference types --- kernels/bvh/bvh_builder_morton.cpp | 8 ++++---- kernels/geometry/grid_soa.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernels/bvh/bvh_builder_morton.cpp b/kernels/bvh/bvh_builder_morton.cpp index 0dfdc3e69d..f93fa16340 100644 --- a/kernels/bvh/bvh_builder_morton.cpp +++ b/kernels/bvh/bvh_builder_morton.cpp @@ -52,7 +52,7 @@ namespace embree node->setBounds(i,b); } - BBox3fx result = (BBox3fx&)res; + BBox3fx result = (BBox3fx)res; #if ROTATE_TREE if (N == 4) { @@ -343,7 +343,7 @@ namespace embree new (&accel[i]) Object(geomID_,primID); } - BBox3fx box_o = (BBox3fx&)bounds; + BBox3fx box_o = (BBox3fx)bounds; #if ROTATE_TREE if (N == 4) box_o.lower.a = current.size(); @@ -387,7 +387,7 @@ namespace embree new (&accel[i]) InstancePrimitive(instance, geomID_); } - BBox3fx box_o = (BBox3fx&)bounds; + BBox3fx box_o = (BBox3fx)bounds; #if ROTATE_TREE if (N == 4) box_o.lower.a = current.size(); @@ -431,7 +431,7 @@ namespace embree new (&accel[i]) InstanceArrayPrimitive(geomID_, primID); } - BBox3fx box_o = (BBox3fx&)bounds; + BBox3fx box_o = (BBox3fx)bounds; #if ROTATE_TREE if (N == 4) box_o.lower.a = current.size(); diff --git a/kernels/geometry/grid_soa.h b/kernels/geometry/grid_soa.h index cea90aedf6..64d9813434 100644 --- a/kernels/geometry/grid_soa.h +++ b/kernels/geometry/grid_soa.h @@ -58,8 +58,8 @@ namespace embree } /*! returns reference to root */ - __forceinline BVH4::NodeRef& root(size_t t = 0) { return (BVH4::NodeRef&)data[rootOffset + t*sizeof(BVH4::NodeRef)]; } - __forceinline const BVH4::NodeRef& root(size_t t = 0) const { return (BVH4::NodeRef&)data[rootOffset + t*sizeof(BVH4::NodeRef)]; } + __forceinline BVH4::NodeRef& root(size_t t = 0) { return *(BVH4::NodeRef*)&data[rootOffset + t*sizeof(BVH4::NodeRef)]; } + __forceinline const BVH4::NodeRef& root(size_t t = 0) const { return *(BVH4::NodeRef*)&data[rootOffset + t*sizeof(BVH4::NodeRef)]; } /*! returns pointer to BVH array */ __forceinline char* bvhData() { return &data[0]; } From a7345835087bd99b49460baf90a70bb3cc2c8a3c Mon Sep 17 00:00:00 2001 From: Stefan Werner Date: Mon, 6 Oct 2025 22:53:21 +0200 Subject: [PATCH 3/6] Explicit lambda captures to silence warnings --- tutorials/common/tutorial/tutorial.cpp | 42 +++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tutorials/common/tutorial/tutorial.cpp b/tutorials/common/tutorial/tutorial.cpp index e56954c1ae..01c9f7d095 100644 --- a/tutorials/common/tutorial/tutorial.cpp +++ b/tutorials/common/tutorial/tutorial.cpp @@ -431,20 +431,20 @@ namespace embree registerOption("ambientlight", [this] (Ref cin, const FileName& path) { const Vec3f L = cin->getVec3f(); - futures.push_back([=, this]() { scene->add(new SceneGraph::LightNodeImpl(SceneGraph::AmbientLight(L))); }); + futures.push_back([this, L]() { scene->add(new SceneGraph::LightNodeImpl(SceneGraph::AmbientLight(L))); }); }, "--ambientlight r g b: adds an ambient light with intensity rgb"); registerOptionAlias("ambientlight","ambient"); registerOption("pointlight", [this] (Ref cin, const FileName& path) { const Vec3f P = cin->getVec3f(); const Vec3f I = cin->getVec3f(); - futures.push_back([=, this]() { scene->add(new SceneGraph::LightNodeImpl(SceneGraph::PointLight(P,I))); }); + futures.push_back([this, P, I]() { scene->add(new SceneGraph::LightNodeImpl(SceneGraph::PointLight(P,I))); }); }, "--pointlight x y z r g b: adds a point light at position xyz with intensity rgb"); registerOption("directionallight", [this] (Ref cin, const FileName& path) { const Vec3f D = cin->getVec3f(); const Vec3f E = cin->getVec3f(); - futures.push_back([=, this]() { scene->add(new SceneGraph::LightNodeImpl(SceneGraph::DirectionalLight(D,E))); }); + futures.push_back([this, D, E]() { scene->add(new SceneGraph::LightNodeImpl(SceneGraph::DirectionalLight(D,E))); }); }, "--directionallight x y z r g b: adds a directional light with direction xyz and intensity rgb"); registerOptionAlias("directionallight","dirlight"); @@ -452,7 +452,7 @@ namespace embree const Vec3f D = cin->getVec3f(); const Vec3f L = cin->getVec3f(); const float halfAngle = cin->getFloat(); - futures.push_back([=, this]() { scene->add(new SceneGraph::LightNodeImpl(SceneGraph::DistantLight(D,L,halfAngle))); }); + futures.push_back([this, D, L, halfAngle]() { scene->add(new SceneGraph::LightNodeImpl(SceneGraph::DistantLight(D,L,halfAngle))); }); }, "--distantlight x y z r g b a: adds a distant light with direction xyz, intensity rgb, and opening angle a"); registerOption("triangle-plane", [this] (Ref cin, const FileName& path) { @@ -461,7 +461,7 @@ namespace embree const Vec3f dy = cin->getVec3f(); const size_t width = cin->getInt(); const size_t height = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createTrianglePlane(p0,dx,dy,width,height,new OBJMaterial)); }); + futures.push_back([this, p0, dx, dy, width, height]() { scene->add(SceneGraph::createTrianglePlane(p0,dx,dy,width,height,new OBJMaterial)); }); }, "--triangle-plane p.x p.y p.z dx.x dx.y dx.z dy.x dy.y dy.z width height: adds a plane build of triangles originated at p0 and spanned by the vectors dx and dy with a tessellation width/height."); registerOption("quad-plane", [this] (Ref cin, const FileName& path) { @@ -470,7 +470,7 @@ namespace embree const Vec3f dy = cin->getVec3f(); const size_t width = cin->getInt(); const size_t height = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createQuadPlane(p0,dx,dy,width,height,new OBJMaterial)); }); + futures.push_back([this, p0, dx, dy, width, height]() { scene->add(SceneGraph::createQuadPlane(p0,dx,dy,width,height,new OBJMaterial)); }); }, "--quad-plane p.x p.y p.z dx.x dx.y dx.z dy.x dy.y dy.z width height: adds a plane build of quadrilaterals originated at p0 and spanned by the vectors dx and dy with a tessellation width/height."); registerOption("grid-plane", [this] (Ref cin, const FileName& path) { @@ -479,7 +479,7 @@ namespace embree const Vec3f dy = cin->getVec3f(); const size_t width = cin->getInt(); const size_t height = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createGridPlane(p0,dx,dy,width,height,new OBJMaterial)); }); + futures.push_back([this, p0, dx, dy, width, height]() { scene->add(SceneGraph::createGridPlane(p0,dx,dy,width,height,new OBJMaterial)); }); }, "--grid-plane p.x p.y p.z dx.x dx.y dx.z dy.x dy.y dy.z width height: adds a plane using a grid mesh build. The plane is originated at p0 and spanned by the vectors dx and dy with a tessellation width/height."); registerOption("subdiv-plane", [this] (Ref cin, const FileName& path) { @@ -489,7 +489,7 @@ namespace embree const size_t width = cin->getInt(); const size_t height = cin->getInt(); const float tessellationRate = cin->getFloat(); - futures.push_back([=, this]() { scene->add(SceneGraph::createSubdivPlane(p0,dx,dy,width,height,tessellationRate,new OBJMaterial)); }); + futures.push_back([this, p0, dx, dy, width, height, tessellationRate]() { scene->add(SceneGraph::createSubdivPlane(p0,dx,dy,width,height,tessellationRate,new OBJMaterial)); }); }, "--subdiv-plane p.x p.y p.z dx.x dx.y dx.z dy.x dy.y dy.z width height tessellationRate: adds a plane build as a Catmull Clark subdivision surface originated at p0 and spanned by the vectors dx and dy. The plane consists of widt x height many patches, and each patch has the specified tessellation rate."); registerOption("hair-plane", [this] (Ref cin, const FileName& path) { @@ -499,7 +499,7 @@ namespace embree const float len = cin->getFloat(); const float r = cin->getFloat(); const size_t N = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createHairyPlane(0,p0,dx,dy,len,r,N,SceneGraph::FLAT_CURVE,new OBJMaterial)); }); + futures.push_back([this, p0, dx, dy, len, r, N]() { scene->add(SceneGraph::createHairyPlane(0,p0,dx,dy,len,r,N,SceneGraph::FLAT_CURVE,new OBJMaterial)); }); }, "--hair-plane p.x p.y p.z dx.x dx.y dx.z dy.x dy.y dy.z length radius num: adds a hair plane originated at p0 and spanned by the vectors dx and dy. num hairs are generated with specified length and radius."); registerOption("curve-plane", [this] (Ref cin, const FileName& path) { @@ -509,34 +509,34 @@ namespace embree const float len = cin->getFloat(); const float r = cin->getFloat(); const size_t N = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createHairyPlane(0,p0,dx,dy,len,r,N,SceneGraph::ROUND_CURVE,new OBJMaterial)); }); + futures.push_back([this, p0, dx, dy, len, r, N]() { scene->add(SceneGraph::createHairyPlane(0,p0,dx,dy,len,r,N,SceneGraph::ROUND_CURVE,new OBJMaterial)); }); }, "--curve-plane p.x p.y p.z dx.x dx.y dx.z dy.x dy.y dy.z length radius: adds a plane build of bezier curves originated at p0 and spanned by the vectors dx and dy. num curves are generated with specified length and radius."); registerOption("sphere", [this] (Ref cin, const FileName& path) { const Vec3f p = cin->getVec3f(); const float r = cin->getFloat(); - futures.push_back([=, this]() { scene->add(SceneGraph::createSphere(p, r, new OBJMaterial)); }); + futures.push_back([this, p, r]() { scene->add(SceneGraph::createSphere(p, r, new OBJMaterial)); }); }, "--sphere p.x p.y p.z r: adds a sphere at position p with radius r"); registerOption("triangle-sphere", [this] (Ref cin, const FileName& path) { const Vec3f p = cin->getVec3f(); const float r = cin->getFloat(); const size_t numPhi = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createTriangleSphere(p,r,numPhi,new OBJMaterial)); }); + futures.push_back([this, p, r, numPhi]() { scene->add(SceneGraph::createTriangleSphere(p,r,numPhi,new OBJMaterial)); }); }, "--triangle-sphere p.x p.y p.z r numPhi: adds a sphere at position p with radius r and tessellation numPhi build of triangles."); registerOption("quad-sphere", [this] (Ref cin, const FileName& path) { const Vec3f p = cin->getVec3f(); const float r = cin->getFloat(); const size_t numPhi = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createQuadSphere(p,r,numPhi,new OBJMaterial)); }); + futures.push_back([this, p, r, numPhi]() { scene->add(SceneGraph::createQuadSphere(p,r,numPhi,new OBJMaterial)); }); }, "--quad-sphere p.x p.y p.z r numPhi: adds a sphere at position p with radius r and tessellation numPhi build of quadrilaterals."); registerOption("grid-sphere", [this] (Ref cin, const FileName& path) { const Vec3f p = cin->getVec3f(); const float r = cin->getFloat(); const size_t N = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createGridSphere(p,r,N,new OBJMaterial)); }); + futures.push_back([this, p, r, N]() { scene->add(SceneGraph::createGridSphere(p,r,N,new OBJMaterial)); }); }, "--grid-sphere p.x p.y p.z r N: adds a grid sphere at position p with radius r using a cube topology and N*N quads at each face."); registerOption("triangle-sphere-mblur", [this] (Ref cin, const FileName& path) { @@ -544,7 +544,7 @@ namespace embree const Vec3f dp = cin->getVec3f(); const float r = cin->getFloat(); const size_t numPhi = cin->getInt(); - futures.push_back([=, this]() { + futures.push_back([this, p, dp, r, numPhi]() { Ref mesh = SceneGraph::createTriangleSphere(p,r,numPhi,new OBJMaterial); mesh->set_motion_vector(dp); scene->add(mesh); @@ -556,7 +556,7 @@ namespace embree const Vec3f dp = cin->getVec3f(); const float r = cin->getFloat(); const size_t numPhi = cin->getInt(); - futures.push_back([=, this]() { + futures.push_back([this, p, dp, r, numPhi]() { Ref mesh = SceneGraph::createQuadSphere(p,r,numPhi,new OBJMaterial); mesh->set_motion_vector(dp); scene->add(mesh); @@ -568,7 +568,7 @@ namespace embree const float r = cin->getFloat(); const size_t numPhi = cin->getInt(); const float tessellationRate = cin->getFloat(); - futures.push_back([=, this]() { scene->add(SceneGraph::createSubdivSphere(p,r,numPhi,tessellationRate,new OBJMaterial)); }); + futures.push_back([this, p, r, numPhi, tessellationRate]() { scene->add(SceneGraph::createSubdivSphere(p,r,numPhi,tessellationRate,new OBJMaterial)); }); }, "--subdiv-sphere p.x p.y p.z r numPhi: adds a sphere at position p with radius r build of Catmull Clark subdivision surfaces. The sphere consists of numPhi x numPhi many patches and each path has the specified tessellation rate."); registerOption("point-sphere", [this] (Ref cin, const FileName& path) { @@ -576,7 +576,7 @@ namespace embree const float r = cin->getFloat(); const float pointR = cin->getFloat(); const size_t numPhi = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createPointSphere(p, r, pointR, numPhi, SceneGraph::SPHERE, new OBJMaterial)); }); + futures.push_back([this, p, r, pointR, numPhi]() { scene->add(SceneGraph::createPointSphere(p, r, pointR, numPhi, SceneGraph::SPHERE, new OBJMaterial)); }); }, "--point-sphere p.x p.y p.z r pointR numPhi: adds a sphere at position p with radius r and tessellation numPhi build of spheres."); registerOption("point-sphere-mblur", [this] (Ref cin, const FileName& path) { @@ -585,7 +585,7 @@ namespace embree const float r = cin->getFloat(); const float pointR = cin->getFloat(); const size_t numPhi = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createPointSphere(p, r, pointR, numPhi, SceneGraph::SPHERE, new OBJMaterial)->set_motion_vector(dp)); }); + futures.push_back([this, p, dp, r, pointR, numPhi]() { scene->add(SceneGraph::createPointSphere(p, r, pointR, numPhi, SceneGraph::SPHERE, new OBJMaterial)->set_motion_vector(dp)); }); }, "--point-sphere p.x p.y p.z d.x d.y d.z r pointR numPhi: adds a sphere at position p, motion vector d, with radius r and tessellation numPhi build of spheres."); registerOption("disc-sphere", [this] (Ref cin, const FileName& path) { @@ -593,7 +593,7 @@ namespace embree const float r = cin->getFloat(); const float pointR = cin->getFloat(); const size_t numPhi = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createPointSphere(p, r, pointR, numPhi, SceneGraph::DISC, new OBJMaterial)); }); + futures.push_back([this, p, r, pointR, numPhi]() { scene->add(SceneGraph::createPointSphere(p, r, pointR, numPhi, SceneGraph::DISC, new OBJMaterial)); }); }, "--disc-sphere p.x p.y p.z r pointR numPhi: adds a sphere at position p with radius r and tessellation numPhi build of discs."); registerOption("oriented-disc-sphere", [this] (Ref cin, const FileName& path) { @@ -601,7 +601,7 @@ namespace embree const float r = cin->getFloat(); const float pointR = cin->getFloat(); const size_t numPhi = cin->getInt(); - futures.push_back([=, this]() { scene->add(SceneGraph::createPointSphere(p, r, pointR, numPhi, SceneGraph::ORIENTED_DISC, new OBJMaterial)); }); + futures.push_back([this, p, r, pointR, numPhi]() { scene->add(SceneGraph::createPointSphere(p, r, pointR, numPhi, SceneGraph::ORIENTED_DISC, new OBJMaterial)); }); }, "--oriented-disc-sphere p.x p.y p.z r pointR numPhi: adds a sphere at position p with radius r and tessellation numPhi build of oriented discs."); registerOption("print-cameras", [this] (Ref cin, const FileName& path) { From 7c7149dd6333065969cdcbb124be83d4c6eee7d3 Mon Sep 17 00:00:00 2001 From: Stefan Werner Date: Tue, 7 Oct 2025 16:03:05 +0200 Subject: [PATCH 4/6] Fixed compilation with internal task scheduler Internal task scheduler is now outside of RTC namespace matching the other schedulers. --- common/tasking/taskschedulerinternal.cpp | 4 ---- common/tasking/taskschedulerinternal.h | 11 ----------- 2 files changed, 15 deletions(-) diff --git a/common/tasking/taskschedulerinternal.cpp b/common/tasking/taskschedulerinternal.cpp index 83ead95122..c515a6b29f 100644 --- a/common/tasking/taskschedulerinternal.cpp +++ b/common/tasking/taskschedulerinternal.cpp @@ -8,8 +8,6 @@ namespace embree { - RTC_NAMESPACE_BEGIN - static MutexSys g_mutex; size_t TaskScheduler::g_numThreads = 0; __thread TaskScheduler* TaskScheduler::g_instance = nullptr; @@ -399,6 +397,4 @@ namespace embree dll_export void TaskScheduler::removeScheduler(const Ref& scheduler) { threadPool->remove(scheduler); } - - RTC_NAMESPACE_END } diff --git a/common/tasking/taskschedulerinternal.h b/common/tasking/taskschedulerinternal.h index b01bebf7c3..e0a910dbe9 100644 --- a/common/tasking/taskschedulerinternal.h +++ b/common/tasking/taskschedulerinternal.h @@ -18,11 +18,6 @@ namespace embree { - - /* The tasking system exports some symbols to be used by the tutorials. Thus we - hide is also in the API namespace when requested. */ - RTC_NAMESPACE_BEGIN - struct TaskScheduler : public RefCount { ALIGNED_STRUCT_(64); @@ -375,10 +370,4 @@ namespace embree static __thread Thread* thread_local_thread; static ThreadPool* threadPool; }; - - RTC_NAMESPACE_END - -#if defined(RTC_NAMESPACE) - using RTC_NAMESPACE::TaskScheduler; -#endif } From d366de1638d1b078ee979d6ad5bc2941bb899b05 Mon Sep 17 00:00:00 2001 From: Stefan Werner Date: Thu, 9 Oct 2025 14:12:42 +0200 Subject: [PATCH 5/6] Revert "Added specializtion constants for curves and motion blur" This reverts commit 3c00c3462038a472725fd66e0ade9fd0e520942b. --- kernels/sycl/rthwif_embree.cpp | 47 +++++++++------------------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/kernels/sycl/rthwif_embree.cpp b/kernels/sycl/rthwif_embree.cpp index 2cd8faebd1..e81e859d5b 100644 --- a/kernels/sycl/rthwif_embree.cpp +++ b/kernels/sycl/rthwif_embree.cpp @@ -278,6 +278,7 @@ __forceinline bool intersect_instance(intel_ray_query_t& query, RayHit& ray, Geo intel_raytracing_acceleration_structure_t hwaccel_ptr = (intel_raytracing_acceleration_structure_t) object->accelBuffer.getHWAccel(bvh_id); intel_ray_query_forward_ray(query, raydesc, hwaccel_ptr); + return false; } @@ -468,31 +469,20 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene if (gtype == Geometry::GTY_FLAT_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_FLAT_LINEAR_CURVE)) { LineSegments* geom = context->scene->get(geomID); - Vec3ff v0, v1; - if (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR) - geom->gather_safe(v0,v1,geom->segment(primID),ray.time()); - else - geom->gather(v0,v1,geom->segment(primID)); + Vec3ff v0, v1; geom->gather_safe(v0,v1,geom->segment(primID),ray.time()); return isa::FlatLinearCurveIntersector1<1>::intersect(true,ray,context,geom,pre,v0,v1,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } else if (gtype == Geometry::GTY_ROUND_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_ROUND_LINEAR_CURVE)) { LineSegments* geom = context->scene->get(geomID); - Vec3ff v0,v1,v2,v3; - if (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR) - geom->gather_safe(v0,v1,v2,v3,primID,geom->segment(primID),ray.time()); - else - geom->gather(v0,v1,v2,v3,primID,geom->segment(primID)); + Vec3ff v0,v1,v2,v3; geom->gather_safe(v0,v1,v2,v3,primID,geom->segment(primID),ray.time()); return isa::RoundLinearCurveIntersector1<1>().intersect(true,ray,context,geom,pre,v0,v1,v2,v3,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } else if (gtype == Geometry::GTY_CONE_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_CONE_LINEAR_CURVE)) { LineSegments* geom = context->scene->get(geomID); Vec3ff v0 = zero, v1 = zero; bool cL = false, cR = false; - if (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR) - geom->gather_safe(v0,v1,cL,cR,primID,geom->segment(primID),ray.time()); - else - geom->gather(v0,v1,cL,cR,primID,geom->segment(primID)); + geom->gather_safe(v0,v1,cL,cR,primID,geom->segment(primID),ray.time()); return isa::ConeCurveIntersector1<1>().intersect(true,ray,context,geom,pre,v0,v1,cL,cR,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } else @@ -502,7 +492,7 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene { using Intersector = isa::OrientedCurve1Intersector1; using Curve = isa::TensorLinearCubicBezierSurface3fa; - if (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR) + if (geom->numTimeSegments() > 0 && (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR)) { Curve curve; if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & RTC_FEATURE_FLAG_NORMAL_ORIENTED_HERMITE_CURVE)) { @@ -524,33 +514,20 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene Vec3ff v0,v1,v2,v3; Vec3fa n0,n1,n2,n3; if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & RTC_FEATURE_FLAG_NORMAL_ORIENTED_HERMITE_CURVE)) - geom->gather_hermite(v0,v1,n0,n1,v2,v3,n2,n3,geom->curve(primID)); + geom->gather_hermite_safe(v0,v1,n0,n1,v2,v3,n2,n3,geom->curve(primID),ray.time()); else - geom->gather(v0,v1,v2,v3,n0,n1,n2,n3,geom->curve(primID)); + geom->gather_safe(v0,v1,v2,v3,n0,n1,n2,n3,geom->curve(primID),ray.time()); isa::convert_to_bezier(gtype, v0,v1,v2,v3, n0,n1,n2,n3); return Intersector().intersect(pre,ray,context,geom,primID,v0,v1,v2,v3,n0,n1,n2,n3,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } } else if (feature_mask & (RTC_FEATURE_FLAG_FLAT_CURVES | RTC_FEATURE_FLAG_ROUND_CURVES)) { Vec3ff v0,v1,v2,v3; - if (feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR) - { - if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & (RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE | RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE))) { - geom->gather_hermite_safe(v0,v1,v2,v3,geom->curve(primID),ray.time()); - } - else { - geom->gather_safe(v0,v1,v2,v3,geom->curve(primID),ray.time()); - } - } - else { - if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & (RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE | RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE))) { - geom->gather_hermite(v0,v1,v2,v3,geom->curve(primID)); - } - else { - geom->gather(v0,v1,v2,v3,geom->curve(primID)); - } - } - + if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & (RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE | RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE))) + geom->gather_hermite_safe(v0,v1,v2,v3,geom->curve(primID),ray.time()); + else + geom->gather_safe(v0,v1,v2,v3,geom->curve(primID),ray.time()); + isa::convert_to_bezier(gtype, v0,v1,v2,v3); if (stype == Geometry::GTY_SUBTYPE_FLAT_CURVE && (feature_mask & RTC_FEATURE_FLAG_FLAT_CURVES)) From 787389499ad8bfa995e892a298ad1a798e76e510 Mon Sep 17 00:00:00 2001 From: Stefan Werner Date: Fri, 10 Oct 2025 16:08:20 +0200 Subject: [PATCH 6/6] Simplified use of SYCL specialization constants for motion blur curves. --- kernels/common/scene_curves.h | 8 ++++---- kernels/common/scene_line_segments.h | 12 ++++++------ kernels/sycl/rthwif_embree.cpp | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/kernels/common/scene_curves.h b/kernels/common/scene_curves.h index 2b74b320b5..7350a20ecd 100644 --- a/kernels/common/scene_curves.h +++ b/kernels/common/scene_curves.h @@ -189,9 +189,9 @@ namespace embree } /*! loads curve vertices for specified time */ - __forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, Vec3ff& p2, Vec3ff& p3, size_t i, float time) const + __forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, Vec3ff& p2, Vec3ff& p3, size_t i, float time, const bool motion_blur = true) const { - if (hasMotionBlur()) gather(p0,p1,p2,p3,i,time); + if (hasMotionBlur() && motion_blur) gather(p0,p1,p2,p3,i,time); else gather(p0,p1,p2,p3,i); } @@ -218,9 +218,9 @@ namespace embree } /*! loads curve vertices for specified time for mblur and non-mblur case */ - __forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, Vec3ff& p2, Vec3ff& p3, Vec3fa& n0, Vec3fa& n1, Vec3fa& n2, Vec3fa& n3, size_t i, float time) const + __forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, Vec3ff& p2, Vec3ff& p3, Vec3fa& n0, Vec3fa& n1, Vec3fa& n2, Vec3fa& n3, size_t i, float time, bool motion_blur = true) const { - if (hasMotionBlur()) gather(p0,p1,p2,p3,n0,n1,n2,n3,i,time); + if (hasMotionBlur() && motion_blur) gather(p0,p1,p2,p3,n0,n1,n2,n3,i,time); else gather(p0,p1,p2,p3,n0,n1,n2,n3,i); } diff --git a/kernels/common/scene_line_segments.h b/kernels/common/scene_line_segments.h index 065d68c2c4..a672abd8d2 100644 --- a/kernels/common/scene_line_segments.h +++ b/kernels/common/scene_line_segments.h @@ -193,9 +193,9 @@ namespace embree } /*! loads curve vertices for specified time for mblur and non-mblur case */ - __forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, unsigned int vid, float time) const + __forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, unsigned int vid, float time, const bool motion_blur = true) const { - if (hasMotionBlur()) gather(p0,p1,vid,time); + if (hasMotionBlur() && motion_blur) gather(p0,p1,vid,time); else gather(p0,p1,vid); } @@ -250,9 +250,9 @@ namespace embree } /*! loads cone curve vertices for specified time for mblur and non-mblur geometry */ - __forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, bool& cL, bool& cR, unsigned int primID, size_t vid, float time) const + __forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, bool& cL, bool& cR, unsigned int primID, size_t vid, float time, const bool motion_blur = true) const { - if (hasMotionBlur()) gather(p0,p1,cL,cR,primID,vid,time); + if (hasMotionBlur() && motion_blur) gather(p0,p1,cL,cR,primID,vid,time); else gather(p0,p1,cL,cR,primID,vid); } @@ -335,9 +335,9 @@ namespace embree } /*! loads curve vertices for specified time for mblur and non-mblur geometry */ - __forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, Vec3ff& p2, Vec3ff& p3, unsigned int primID, size_t vid, float time) const + __forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, Vec3ff& p2, Vec3ff& p3, unsigned int primID, size_t vid, float time, const bool motion_blur = true) const { - if (hasMotionBlur()) gather(p0,p1,p2,p3,primID,vid,time); + if (hasMotionBlur() && motion_blur) gather(p0,p1,p2,p3,primID,vid,time); else gather(p0,p1,p2,p3,primID,vid); } diff --git a/kernels/sycl/rthwif_embree.cpp b/kernels/sycl/rthwif_embree.cpp index e81e859d5b..95dc05f26e 100644 --- a/kernels/sycl/rthwif_embree.cpp +++ b/kernels/sycl/rthwif_embree.cpp @@ -469,20 +469,20 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene if (gtype == Geometry::GTY_FLAT_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_FLAT_LINEAR_CURVE)) { LineSegments* geom = context->scene->get(geomID); - Vec3ff v0, v1; geom->gather_safe(v0,v1,geom->segment(primID),ray.time()); + Vec3ff v0, v1; geom->gather_safe(v0,v1,geom->segment(primID),ray.time(), feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR); return isa::FlatLinearCurveIntersector1<1>::intersect(true,ray,context,geom,pre,v0,v1,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } else if (gtype == Geometry::GTY_ROUND_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_ROUND_LINEAR_CURVE)) { LineSegments* geom = context->scene->get(geomID); - Vec3ff v0,v1,v2,v3; geom->gather_safe(v0,v1,v2,v3,primID,geom->segment(primID),ray.time()); + Vec3ff v0,v1,v2,v3; geom->gather_safe(v0,v1,v2,v3,primID,geom->segment(primID),ray.time(), feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR); return isa::RoundLinearCurveIntersector1<1>().intersect(true,ray,context,geom,pre,v0,v1,v2,v3,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } else if (gtype == Geometry::GTY_CONE_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_CONE_LINEAR_CURVE)) { LineSegments* geom = context->scene->get(geomID); Vec3ff v0 = zero, v1 = zero; bool cL = false, cR = false; - geom->gather_safe(v0,v1,cL,cR,primID,geom->segment(primID),ray.time()); + geom->gather_safe(v0,v1,cL,cR,primID,geom->segment(primID),ray.time(), feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR); return isa::ConeCurveIntersector1<1>().intersect(true,ray,context,geom,pre,v0,v1,cL,cR,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } else @@ -516,7 +516,7 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & RTC_FEATURE_FLAG_NORMAL_ORIENTED_HERMITE_CURVE)) geom->gather_hermite_safe(v0,v1,n0,n1,v2,v3,n2,n3,geom->curve(primID),ray.time()); else - geom->gather_safe(v0,v1,v2,v3,n0,n1,n2,n3,geom->curve(primID),ray.time()); + geom->gather_safe(v0,v1,v2,v3,n0,n1,n2,n3,geom->curve(primID),ray.time(), feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR); isa::convert_to_bezier(gtype, v0,v1,v2,v3, n0,n1,n2,n3); return Intersector().intersect(pre,ray,context,geom,primID,v0,v1,v2,v3,n0,n1,n2,n3,Intersect1Epilog1_HWIF(ray,context,geomID,primID,filter)); } @@ -526,7 +526,7 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & (RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE | RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE))) geom->gather_hermite_safe(v0,v1,v2,v3,geom->curve(primID),ray.time()); else - geom->gather_safe(v0,v1,v2,v3,geom->curve(primID),ray.time()); + geom->gather_safe(v0,v1,v2,v3,geom->curve(primID),ray.time(), feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR); isa::convert_to_bezier(gtype, v0,v1,v2,v3);