Skip to content

Commit c35e5d1

Browse files
stefanatworkCopilot
andcommitted
sycl: query the committed hit candidate type once in rtcIntersectRTHW
The epilogue of rtcIntersectRTHW asked the ray query twice whether the committed hit is a hardware triangle (once to fetch the barycentrics / normal, once to decide whether instance IDs need to be read back). Evaluate it once and reuse the result. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2bdaec8 commit c35e5d1

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎kernels/sycl/rthwif_embree.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,12 +726,14 @@ SYCL_EXTERNAL __attribute__((always_inline)) void rtcIntersectRTHW(sycl::global_
726726

727727
if (valid)
728728
{
729+
const bool hw_triangle = intel_get_hit_candidate(query, intel_hit_type_committed_hit) == intel_candidate_type_triangle;
730+
729731
float t = intel_get_hit_distance(query, intel_hit_type_committed_hit);
730732
float2 uv(ray.u, ray.v);
731733
unsigned int geomID = intel_get_hit_geometry_id(query, intel_hit_type_committed_hit);
732734

733735
unsigned int primID = ray.primID;
734-
if (intel_get_hit_candidate(query, intel_hit_type_committed_hit) == intel_candidate_type_triangle) {
736+
if (hw_triangle) {
735737
primID = intel_get_hit_triangle_primitive_id(query, intel_hit_type_committed_hit);
736738
uv = intel_get_hit_barycentrics (query, intel_hit_type_committed_hit);
737739
}
@@ -763,7 +765,7 @@ SYCL_EXTERNAL __attribute__((always_inline)) void rtcIntersectRTHW(sycl::global_
763765
#endif
764766

765767
/* calculate geometry normal for hardware accelerated triangles */
766-
if (intel_get_hit_candidate(query, intel_hit_type_committed_hit) == intel_candidate_type_triangle)
768+
if (hw_triangle)
767769
ray.Ng = intel_get_hit_triangle_normal(query, intel_hit_type_committed_hit);
768770

769771
rayhit_i->hit.Ng_x = ray.Ng.x;

0 commit comments

Comments
 (0)