// Copyright 2009-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 #pragma once #include "../common/scene.h" #include "../common/ray.h" #include "../common/point_query.h" #include "../bvh/node_intersector1.h" #include "../bvh/node_intersector_packet.h" namespace embree { namespace isa { template struct ArrayIntersector1 { typedef typename Intersector::Primitive Primitive; typedef typename Intersector::Precalculations Precalculations; template static __forceinline void intersect(const Accel::Intersectors* This, Precalculations& pre, RayHit& ray, RayQueryContext* context, const Primitive* prim, size_t num, const TravRay &tray, size_t& lazy_node) { for (size_t i=0; i static __forceinline bool occluded(const Accel::Intersectors* This, Precalculations& pre, Ray& ray, RayQueryContext* context, const Primitive* prim, size_t num, const TravRay &tray, size_t& lazy_node) { for (size_t i=0; i static __forceinline bool pointQuery(const Accel::Intersectors* This, PointQuery* query, PointQueryContext* context, const Primitive* prim, size_t num, const TravPointQuery &tquery, size_t& lazy_node) { bool changed = false; for (size_t i=0; i static __forceinline void intersectK(const vbool& valid, /* PrecalculationsK& pre, */ RayHitK& ray, RayQueryContext* context, const Primitive* prim, size_t num, size_t& lazy_node) { } template static __forceinline vbool occludedK(const vbool& valid, /* PrecalculationsK& pre, */ RayK& ray, RayQueryContext* context, const Primitive* prim, size_t num, size_t& lazy_node) { return valid; } }; template struct ArrayIntersectorK_1 { typedef typename Intersector::Primitive Primitive; typedef typename Intersector::Precalculations Precalculations; template static __forceinline void intersect(const vbool& valid, const Accel::Intersectors* This, Precalculations& pre, RayHitK& ray, RayQueryContext* context, const Primitive* prim, size_t num, const TravRayK &tray, size_t& lazy_node) { for (size_t i=0; i static __forceinline vbool occluded(const vbool& valid, const Accel::Intersectors* This, Precalculations& pre, RayK& ray, RayQueryContext* context, const Primitive* prim, size_t num, const TravRayK &tray, size_t& lazy_node) { vbool valid0 = valid; for (size_t i=0; i static __forceinline void intersect(const Accel::Intersectors* This, Precalculations& pre, RayHitK& ray, size_t k, RayQueryContext* context, const Primitive* prim, size_t num, const TravRay &tray, size_t& lazy_node) { for (size_t i=0; i static __forceinline bool occluded(const Accel::Intersectors* This, Precalculations& pre, RayK& ray, size_t k, RayQueryContext* context, const Primitive* prim, size_t num, const TravRay &tray, size_t& lazy_node) { for (size_t i=0; i struct ArrayIntersectorKStream { typedef typename IntersectorK::Primitive PrimitiveK; typedef typename IntersectorK::Precalculations PrecalculationsK; static __forceinline void intersectK(const vbool& valid, const Accel::Intersectors* This, /* PrecalculationsK& pre, */ RayHitK& ray, RayQueryContext* context, const PrimitiveK* prim, size_t num, size_t& lazy_node) { PrecalculationsK pre(valid,ray); // FIXME: might cause trouble for (size_t i=0; i occludedK(const vbool& valid, const Accel::Intersectors* This, /* PrecalculationsK& pre, */ RayK& ray, RayQueryContext* context, const PrimitiveK* prim, size_t num, size_t& lazy_node) { PrecalculationsK pre(valid,ray); // FIXME: might cause trouble vbool valid0 = valid; for (size_t i=0; i& ray, size_t k, RayQueryContext* context, const PrimitiveK* prim, size_t num, size_t& lazy_node) { PrecalculationsK pre(ray.tnear() <= ray.tfar,ray); // FIXME: might cause trouble for (size_t i=0; i& ray, size_t k, RayQueryContext* context, const PrimitiveK* prim, size_t num, size_t& lazy_node) { PrecalculationsK pre(ray.tnear() <= ray.tfar,ray); // FIXME: might cause trouble for (size_t i=0; i** __restrict__ inputPackets, RayQueryContext* context, const PrimitiveK* prim, size_t num, size_t& lazy_node) { size_t m_occluded = 0; for (size_t i=0; i &ray = *inputPackets[rayID / K]; const size_t k = rayID % K; PrecalculationsK pre(ray.tnear() <= ray.tfar,ray); // FIXME: might cause trouble if (IntersectorK::occluded(pre,ray,k,context,prim[i])) { m_occluded |= (size_t)1 << rayID; ray.tfar[k] = neg_inf; } } } return m_occluded; } }; } }