1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
// Copyright 2009 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#ifdef OSPRAY_ENABLE_VOLUMES
#pragma once
#include "common/Embree.h"
#ifdef ISPC
#include "openvkl/openvkl.isph"
// comment break to prevent clang-format from reordering openvkl includes
#include "openvkl/device/openvkl.isph"
#else
#include "openvkl/openvkl.h"
// comment break to prevent clang-format from reordering openvkl includes
#include "openvkl/device/openvkl.h"
#endif
#include "common/FeatureFlags.ih"
#include "rkcommon/math/box.ih"
// c++ shared
#include "VolumeShared.h"
OSPRAY_BEGIN_ISPC_NAMESPACE
// Helper functions ///////////////////////////////////////////////////////////
inline float Volume_getSample(const Volume *uniform volume, const vec3f &P)
{
return vklComputeSampleV(&volume->vklSampler, &((const vkl_vec3f &)P));
}
inline vec3f Volume_getGradient(const Volume *uniform volume,
const vec3f &P,
const uniform FeatureFlagsHandler &ffh)
{
const uniform FeatureFlags ff = getFeatureFlags(ffh);
vkl_vec3f result = vklComputeGradientV(&volume->vklSampler,
&((const vkl_vec3f &)P)
#ifdef OSPRAY_TARGET_SYCL
,
0,
0.f,
ff.volume
#endif
);
// TODO: remove it once VKL no longer returns sporadic NaNs
if (isnan(result.x))
result.x = 1.f;
if (isnan(result.y))
result.y = 1.f;
if (isnan(result.z))
result.z = 1.f;
return *((varying vec3f *)&result);
}
RTC_SYCL_INDIRECTLY_CALLABLE unmasked void Volume_intersect_kernel(
RTCIntersectFunctionNArguments *uniform args);
OSPRAY_END_ISPC_NAMESPACE
#endif
|