@@ -584,21 +584,19 @@ __forceinline bool invokeTriangleIntersectionFilter(intel_ray_query_t& query, Ge
584584 return ishit;
585585}
586586
587- __forceinline bool commit_potential_hit (intel_ray_query_t & query, RayHit& ray, bool scale_v) {
588- /* Xe3 may store UVs in UNORM format, so we can't use negative V coordinates here
589- Leaving the CPU code path as is, GPUs will apply the scale later. */
590- float v = scale_v ? madd (ray.v , 0 .5f , 0 .5f ) : ray.v ;
591- intel_ray_query_commit_potential_hit_override (query, ray.tfar , float2 (ray.u , v));
587+ __forceinline bool commit_potential_hit (intel_ray_query_t & query, RayHit& ray, float &ray_v) {
588+ ray_v = ray.v ;
589+ intel_ray_query_commit_potential_hit_override (query, ray.tfar , float2 (ray.u , ray.v ));
592590 return false ;
593591}
594592
595- __forceinline bool commit_potential_hit (intel_ray_query_t & query, Ray& ray, bool ) {
593+ __forceinline bool commit_potential_hit (intel_ray_query_t & query, Ray& ray, float & ) {
596594 intel_ray_query_commit_potential_hit_override (query, ray.tfar , float2 (0 .0f , 0 .0f ));
597595 return true ;
598596}
599597
600598template <typename Ray>
601- __forceinline void trav_loop (intel_ray_query_t & query, Ray& ray, Scene* scene, sycl::private_ptr<RayQueryContext> context, const RTCFeatureFlags feature_mask)
599+ __forceinline void trav_loop (intel_ray_query_t & query, Ray& ray, Scene* scene, sycl::private_ptr<RayQueryContext> context, const RTCFeatureFlags feature_mask, float &ray_v )
602600{
603601 Scenes scenes (scene);
604602 while (!intel_is_traversal_done (query))
@@ -647,8 +645,7 @@ __forceinline void trav_loop(intel_ray_query_t& query, Ray& ray, Scene* scene, s
647645 if (candidate == intel_candidate_type_procedural)
648646 {
649647 if (intersect_primitive (query,ray,scenes,geom,context,geomID,primID,feature_mask)) {
650- bool scale_v = geom->getTypeMask () & Geometry::MTY_FLAT_CURVES ;
651- if (commit_potential_hit (query, ray, scale_v))
648+ if (commit_potential_hit (query, ray, ray_v))
652649 break ; // shadow rays break at first hit
653650 }
654651 }
@@ -726,8 +723,9 @@ SYCL_EXTERNAL __attribute__((always_inline)) void rtcIntersectRTHW(sycl::global_
726723 intel_ray_query_start_traversal (query);
727724 intel_ray_query_sync (query);
728725
726+ float hit_v = 0 .0f ;
729727 if (args->feature_mask & TRAV_LOOP_FEATURES ) {
730- trav_loop (query,ray,scene,&context,args->feature_mask );
728+ trav_loop (query,ray,scene,&context,args->feature_mask , hit_v );
731729 }
732730
733731 bool valid = intel_has_committed_hit (query);
@@ -739,27 +737,22 @@ SYCL_EXTERNAL __attribute__((always_inline)) void rtcIntersectRTHW(sycl::global_
739737 unsigned int geomID = intel_get_hit_geometry_id (query, intel_hit_type_committed_hit);
740738
741739 unsigned int primID = ray.primID ;
742- if (intel_get_hit_candidate (query, intel_hit_type_committed_hit) == intel_candidate_type_triangle)
740+ if (intel_get_hit_candidate (query, intel_hit_type_committed_hit) == intel_candidate_type_triangle) {
743741 primID = intel_get_hit_triangle_primitive_id (query, intel_hit_type_committed_hit);
742+ }
743+ else {
744+ /* Xe3 hardware stores UV as UNORM. Since ribbons use a range of -1.0 to 1.0
745+ the V coordinate needs to be passed in a separate variable. */
746+ if ((args->feature_mask & RTC_FEATURE_FLAG_FLAT_CURVES ) ||
747+ (args->feature_mask & RTC_FEATURE_FLAG_NORMAL_ORIENTED_CURVES ))
748+ uv.y () = hit_v;
749+ }
744750
745751 rayhit_i->ray .tfar = t;
746752 rayhit_i->hit .geomID = geomID;
747753 rayhit_i->hit .primID = primID;
748754 rayhit_i->hit .u = uv.x ();
749755 rayhit_i->hit .v = uv.y ();
750-
751- if (RTC_FEATURE_FLAG_CURVES & TRAV_LOOP_FEATURES ) {
752- if (intel_get_hit_candidate (query, intel_hit_type_committed_hit) == intel_candidate_type_procedural)
753- {
754- Geometry* geom = scene->get (geomID);
755- if (geom->getTypeMask () & Geometry::MTY_CURVES &&
756- (geom->getCurveType () == Geometry::GTY_SUBTYPE_FLAT_CURVE || geom->getCurveType () == Geometry::GTY_SUBTYPE_ORIENTED_CURVE ))
757- {
758- /* for curves we need to convert the v coordinates from [0,1] to [-1,1] */
759- rayhit_i->hit .v = rayhit_i->hit .v * 2 .0f - 1 .0f ;
760- }
761- }
762- }
763756
764757#if RTC_MAX_INSTANCE_LEVEL_COUNT > 1
765758 for (uint32_t l=0 ; l<RTC_MAX_INSTANCE_LEVEL_COUNT ; l++) {
@@ -839,8 +832,9 @@ SYCL_EXTERNAL __attribute__((always_inline)) void rtcOccludedRTHW(sycl::global_p
839832 intel_ray_query_start_traversal (query);
840833 intel_ray_query_sync (query);
841834
835+ float v_unused MAYBE_UNUSED = 0 .0f ;
842836 if (args->feature_mask & TRAV_LOOP_FEATURES ) {
843- trav_loop (query,ray,scene,&context,args->feature_mask );
837+ trav_loop (query,ray,scene,&context,args->feature_mask , v_unused );
844838 }
845839
846840 if (intel_has_committed_hit (query))
0 commit comments