Skip to content

Commit 7873894

Browse files
committed
Simplified use of SYCL specialization constants for motion blur curves.
1 parent d366de1 commit 7873894

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

kernels/common/scene_curves.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ namespace embree
189189
}
190190

191191
/*! loads curve vertices for specified time */
192-
__forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, Vec3ff& p2, Vec3ff& p3, size_t i, float time) const
192+
__forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, Vec3ff& p2, Vec3ff& p3, size_t i, float time, const bool motion_blur = true) const
193193
{
194-
if (hasMotionBlur()) gather(p0,p1,p2,p3,i,time);
194+
if (hasMotionBlur() && motion_blur) gather(p0,p1,p2,p3,i,time);
195195
else gather(p0,p1,p2,p3,i);
196196
}
197197

@@ -218,9 +218,9 @@ namespace embree
218218
}
219219

220220
/*! loads curve vertices for specified time for mblur and non-mblur case */
221-
__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
221+
__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
222222
{
223-
if (hasMotionBlur()) gather(p0,p1,p2,p3,n0,n1,n2,n3,i,time);
223+
if (hasMotionBlur() && motion_blur) gather(p0,p1,p2,p3,n0,n1,n2,n3,i,time);
224224
else gather(p0,p1,p2,p3,n0,n1,n2,n3,i);
225225
}
226226

kernels/common/scene_line_segments.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ namespace embree
193193
}
194194

195195
/*! loads curve vertices for specified time for mblur and non-mblur case */
196-
__forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, unsigned int vid, float time) const
196+
__forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, unsigned int vid, float time, const bool motion_blur = true) const
197197
{
198-
if (hasMotionBlur()) gather(p0,p1,vid,time);
198+
if (hasMotionBlur() && motion_blur) gather(p0,p1,vid,time);
199199
else gather(p0,p1,vid);
200200
}
201201

@@ -250,9 +250,9 @@ namespace embree
250250
}
251251

252252
/*! loads cone curve vertices for specified time for mblur and non-mblur geometry */
253-
__forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, bool& cL, bool& cR, unsigned int primID, size_t vid, float time) const
253+
__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
254254
{
255-
if (hasMotionBlur()) gather(p0,p1,cL,cR,primID,vid,time);
255+
if (hasMotionBlur() && motion_blur) gather(p0,p1,cL,cR,primID,vid,time);
256256
else gather(p0,p1,cL,cR,primID,vid);
257257
}
258258

@@ -335,9 +335,9 @@ namespace embree
335335
}
336336

337337
/*! loads curve vertices for specified time for mblur and non-mblur geometry */
338-
__forceinline void gather_safe(Vec3ff& p0, Vec3ff& p1, Vec3ff& p2, Vec3ff& p3, unsigned int primID, size_t vid, float time) const
338+
__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
339339
{
340-
if (hasMotionBlur()) gather(p0,p1,p2,p3,primID,vid,time);
340+
if (hasMotionBlur() && motion_blur) gather(p0,p1,p2,p3,primID,vid,time);
341341
else gather(p0,p1,p2,p3,primID,vid);
342342
}
343343

kernels/sycl/rthwif_embree.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,20 +469,20 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene
469469
if (gtype == Geometry::GTY_FLAT_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_FLAT_LINEAR_CURVE))
470470
{
471471
LineSegments* geom = context->scene->get<LineSegments>(geomID);
472-
Vec3ff v0, v1; geom->gather_safe(v0,v1,geom->segment(primID),ray.time());
472+
Vec3ff v0, v1; geom->gather_safe(v0,v1,geom->segment(primID),ray.time(), feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR);
473473
return isa::FlatLinearCurveIntersector1<1>::intersect(true,ray,context,geom,pre,v0,v1,Intersect1Epilog1_HWIF<Ray>(ray,context,geomID,primID,filter));
474474
}
475475
else if (gtype == Geometry::GTY_ROUND_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_ROUND_LINEAR_CURVE))
476476
{
477477
LineSegments* geom = context->scene->get<LineSegments>(geomID);
478-
Vec3ff v0,v1,v2,v3; geom->gather_safe(v0,v1,v2,v3,primID,geom->segment(primID),ray.time());
478+
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);
479479
return isa::RoundLinearCurveIntersector1<1>().intersect(true,ray,context,geom,pre,v0,v1,v2,v3,Intersect1Epilog1_HWIF<Ray>(ray,context,geomID,primID,filter));
480480
}
481481
else if (gtype == Geometry::GTY_CONE_LINEAR_CURVE && (feature_mask & RTC_FEATURE_FLAG_CONE_LINEAR_CURVE))
482482
{
483483
LineSegments* geom = context->scene->get<LineSegments>(geomID);
484484
Vec3ff v0 = zero, v1 = zero; bool cL = false, cR = false;
485-
geom->gather_safe(v0,v1,cL,cR,primID,geom->segment(primID),ray.time());
485+
geom->gather_safe(v0,v1,cL,cR,primID,geom->segment(primID),ray.time(), feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR);
486486
return isa::ConeCurveIntersector1<1>().intersect(true,ray,context,geom,pre,v0,v1,cL,cR,Intersect1Epilog1_HWIF<Ray>(ray,context,geomID,primID,filter));
487487
}
488488
else
@@ -516,7 +516,7 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene
516516
if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & RTC_FEATURE_FLAG_NORMAL_ORIENTED_HERMITE_CURVE))
517517
geom->gather_hermite_safe(v0,v1,n0,n1,v2,v3,n2,n3,geom->curve(primID),ray.time());
518518
else
519-
geom->gather_safe(v0,v1,v2,v3,n0,n1,n2,n3,geom->curve(primID),ray.time());
519+
geom->gather_safe(v0,v1,v2,v3,n0,n1,n2,n3,geom->curve(primID),ray.time(), feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR);
520520
isa::convert_to_bezier(gtype, v0,v1,v2,v3, n0,n1,n2,n3);
521521
return Intersector().intersect(pre,ray,context,geom,primID,v0,v1,v2,v3,n0,n1,n2,n3,Intersect1Epilog1_HWIF<Ray>(ray,context,geomID,primID,filter));
522522
}
@@ -526,7 +526,7 @@ __forceinline bool intersect_primitive(intel_ray_query_t& query, Ray& ray, Scene
526526
if (basis == Geometry::GTY_BASIS_HERMITE && (feature_mask & (RTC_FEATURE_FLAG_ROUND_HERMITE_CURVE | RTC_FEATURE_FLAG_FLAT_HERMITE_CURVE)))
527527
geom->gather_hermite_safe(v0,v1,v2,v3,geom->curve(primID),ray.time());
528528
else
529-
geom->gather_safe(v0,v1,v2,v3,geom->curve(primID),ray.time());
529+
geom->gather_safe(v0,v1,v2,v3,geom->curve(primID),ray.time(), feature_mask & RTC_FEATURE_FLAG_MOTION_BLUR);
530530

531531
isa::convert_to_bezier(gtype, v0,v1,v2,v3);
532532

0 commit comments

Comments
 (0)