Skip to content

Commit

Permalink
Merge branch 'release-1.0.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
gregjohnson committed Sep 22, 2021
2 parents 5a7071d + d076e47 commit dcdd2e1
Show file tree
Hide file tree
Showing 13 changed files with 392 additions and 11 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,14 @@
Version History
---------------

### Open VKL 1.0.1

- Fixed issue in `structuredRegular` and `vdb` interval iterators that could
lead to erroneous initial intervals for certain ray inputs
- Fixed handling of `intervalResolutionHint` interval iterator context
parameter for `amr`, `particle`, and `unstructured` volumes with small
numbers of cells / primitives

### Open VKL 1.0.0

- The version 1.0 release marks long term API stability (until v2.0)
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -19,7 +19,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)

## Establish project ##

project(openvkl VERSION 1.0.0 LANGUAGES C CXX)
project(openvkl VERSION 1.0.1 LANGUAGES C CXX)

## Add openvkl specific macros ##

Expand Down
10 changes: 9 additions & 1 deletion README.md
@@ -1,6 +1,6 @@
# Intel® Open Volume Kernel Library

This is release v1.0.0 of Intel® Open VKL. For changes and new features
This is release v1.0.1 of Intel® Open VKL. For changes and new features
see the [changelog](CHANGELOG.md). Visit http://www.openvkl.org for more
information.

Expand Down Expand Up @@ -33,6 +33,14 @@ example renderers to demonstrate how to best use the Open VKL API.

## Version History

### Open VKL 1.0.1

- Fixed issue in `structuredRegular` and `vdb` interval iterators that
could lead to erroneous initial intervals for certain ray inputs
- Fixed handling of `intervalResolutionHint` interval iterator context
parameter for `amr`, `particle`, and `unstructured` volumes with
small numbers of cells / primitives

### Open VKL 1.0.0

- The version 1.0 release marks long term API stability (until v2.0)
Expand Down
5 changes: 4 additions & 1 deletion examples/interactive/vklExamples.cpp
Expand Up @@ -249,7 +249,8 @@ void usage(const char *progname)
"\t-motionBlur structured | unstructured (structuredRegular and vdb)\n"
"\t-filter nearest | trilinear (structured and vdb) | tricubic "
"(structured and vdb)\n"
"\t-field wavelet | xyz | sphere | <vdb grid name>\n"
"\t-field wavelet | xyz | sphere | torus (vdb float only) | <vdb grid "
"name>\n"
"\t-file <filename>\n"
"\t-numParticles <N> (particle only)\n"
"\t-disable-vsync\n"
Expand Down Expand Up @@ -912,6 +913,8 @@ void setupVolume(ViewerParams &params,
params.filter,
temporalConfig,
numAttributes);
} else if (params.field == "torus") {
testingVolume = std::make_shared<TestingVdbTorusVolume>();
} else {
testingVolume =
std::make_shared<WaveletVdbVolumeFloat>(getOpenVKLDevice(),
Expand Down
2 changes: 1 addition & 1 deletion gitlab/.gitlab-ci.yml
Expand Up @@ -4,7 +4,7 @@
variables:
GIT_DEPTH: "15"
KW_PROJECT_NAME: openvkl
OPENVKL_RELEASE_PACKAGE_VERSION: "1.0.0"
OPENVKL_RELEASE_PACKAGE_VERSION: "1.0.1"
MACOSX_DEPLOYMENT_TARGET: "10.13"

stages:
Expand Down
13 changes: 10 additions & 3 deletions openvkl/devices/cpu/iterator/IteratorContext.cpp
Expand Up @@ -71,11 +71,17 @@ namespace openvkl {
const float defaultRangeBegin = 0.45f;
const float defaultRangeEnd = 0.55f;

for (int i = 0; i <= defaultDepth; i++) {
float f = float(i) / float(defaultDepth) * defaultRangeBegin;
hintToDepth.emplace_back(f, i);
// mapping defined for intervalResolutionHint in [0, defaultRangeBegin]
if (defaultDepth == 0) {
hintToDepth.emplace_back(0.f, 0);
} else {
for (int i = 0; i <= defaultDepth; i++) {
float f = float(i) / float(defaultDepth) * defaultRangeBegin;
hintToDepth.emplace_back(f, i);
}
}

// mapping defined for intervalResolutionHint in [defaultRangeEnd, 1)
for (int i = defaultDepth + 1; i <= bvhDepth - 1; i++) {
float f = defaultRangeEnd + float(i - (defaultDepth + 1)) /
float(bvhDepth - (defaultDepth + 1)) *
Expand All @@ -84,6 +90,7 @@ namespace openvkl {
hintToDepth.emplace_back(f, i);
}

// mapping defined for intervalResolutionHint == 1
hintToDepth.emplace_back(1.f, bvhDepth);
}

Expand Down
4 changes: 2 additions & 2 deletions openvkl/devices/cpu/math/math_utility.ih
Expand Up @@ -5,10 +5,10 @@

inline uniform float divide_safe(uniform float f)
{
return 1.f / ((abs(f) < 1e-8f) ? 1e-8f : f);
return 1.f / ((abs(f) < 1e-8f) ? (f >= 0.f ? 1e-8f : -1e-8f) : f);
}

inline varying float divide_safe(varying float f)
{
return 1.f / ((abs(f) < 1e-8f) ? 1e-8f : f);
return 1.f / ((abs(f) < 1e-8f) ? (f >= 0.f ? 1e-8f : -1e-8f) : f);
}
1 change: 1 addition & 0 deletions testing/CMakeLists.txt
Expand Up @@ -3,6 +3,7 @@

add_library(openvkl_testing STATIC
apps/AppInit.cpp
volume/TestingVdbTorusVolume.cpp
)

target_link_libraries(openvkl_testing PUBLIC
Expand Down
83 changes: 81 additions & 2 deletions testing/apps/tests/vdb_volume.cpp
Expand Up @@ -8,6 +8,7 @@

using namespace openvkl;

using openvkl::testing::TestingVdbTorusVolume;
using openvkl::testing::WaveletVdbVolumeFloat;
using openvkl::testing::XYZVdbVolumeFloat;

Expand Down Expand Up @@ -276,7 +277,8 @@ TEST_CASE("VDB volume sampling", "[volume_sampling]")
vklCommit(vklSampler);
const vec3i step(2);

// tricubic support span; ignore coordinates here since they will interpolate with background
// tricubic support span; ignore coordinates here since they will
// interpolate with background
const int lowerSpan = 1;
const int upperSpan = 2;

Expand Down Expand Up @@ -399,7 +401,8 @@ TEST_CASE("VDB volume sampling", "[volume_sampling]")
vklCommit(vklSampler);
const vec3i step(2);

// tricubic support span; ignore coordinates here since they will interpolate with background
// tricubic support span; ignore coordinates here since they will
// interpolate with background
const int lowerSpan = 1;
const int upperSpan = 2;

Expand Down Expand Up @@ -828,3 +831,79 @@ TEST_CASE("VDB volume strides", "[volume_strides]")

shutdownOpenVKL();
}

TEST_CASE("VDB volume special cases", "[interval_iterators]")
{
initializeOpenVKL();

SECTION("torus interval iteration")
{
TestingVdbTorusVolume *volume = nullptr;
REQUIRE_NOTHROW(volume = new TestingVdbTorusVolume());

VKLVolume vklVolume = volume->getVKLVolume(getOpenVKLDevice());

VKLSampler sampler = vklNewSampler(vklVolume);
vklCommit(sampler);

VKLIntervalIteratorContext intervalContext =
vklNewIntervalIteratorContext(sampler);
vklCommit(intervalContext);

std::vector<char> buffer(vklGetIntervalIteratorSize(intervalContext));

// failure case found from OSPRay
{
// intbits() representation of ray
const uint32_t rayOrigin[] = {1112900070, 1116163650, 1103628776};
const uint32_t rayDirection[] = {1081551625, 1098411576, 2984533223};

const vkl_range1f rayTRange = {0.f, inf};
const float time = 0.f;

VKLIntervalIterator intervalIterator =
vklInitIntervalIterator(intervalContext,
(vkl_vec3f *)&rayOrigin,
(vkl_vec3f *)&rayDirection,
&rayTRange,
time,
buffer.data());

int numIntervalsFound = 0;
VKLInterval prevInterval;

while (true) {
VKLInterval interval;
int result = vklIterateInterval(intervalIterator, &interval);
if (!result)
break;

INFO("tRange = " << interval.tRange.lower << " "
<< interval.tRange.upper
<< "\nvalueRange = " << interval.valueRange.lower
<< " " << interval.valueRange.upper
<< "\nnominalDeltaT = " << interval.nominalDeltaT);

REQUIRE(interval.tRange.lower >= 0.f);
REQUIRE(interval.tRange.upper >= 0.f);
REQUIRE(interval.tRange.upper > interval.tRange.lower);

if (numIntervalsFound > 0) {
REQUIRE(interval.tRange.lower == prevInterval.tRange.upper);
}

numIntervalsFound++;
prevInterval = interval;
}

REQUIRE(numIntervalsFound > 0);
}

vklRelease(intervalContext);
vklRelease(sampler);

REQUIRE_NOTHROW(delete volume);
}

shutdownOpenVKL();
}
1 change: 1 addition & 0 deletions testing/openvkl_testing.h
Expand Up @@ -17,3 +17,4 @@
#include "volume/RawHFileStructuredVolume.h"
#include "volume/TestingStructuredVolumeMulti.h"
#include "volume/TestingUnstructuredMixedSimple.h"
#include "volume/TestingVdbTorusVolume.h"
42 changes: 42 additions & 0 deletions testing/volume/TestingVdbTorusVolume.cpp
@@ -0,0 +1,42 @@
// Copyright 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#include "TestingVdbTorusVolume.h"

namespace openvkl {
namespace testing {

// Heavily based on Perlin's Java reference implementation of the improved
// perlin noise paper from Siggraph 2002 from here
// https://mrl.nyu.edu/~perlin/noise/
PerlinNoise::PerlinNoiseData::PerlinNoiseData()
{
const int permutation[256] = {
151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233,
7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10,
23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252,
219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87,
174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48,
27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, 133, 230,
220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25,
63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, 89, 18, 169,
200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186,
3, 64, 52, 217, 226, 250, 124, 123, 5, 202, 38, 147, 118, 126,
255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189,
28, 42, 223, 183, 170, 213, 119, 248, 152, 2, 44, 154, 163, 70,
221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98,
108, 110, 79, 113, 224, 232, 178, 185, 112, 104, 218, 246, 97, 228,
251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51,
145, 235, 249, 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157,
184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236,
205, 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66,
215, 61, 156, 180};

for (int i = 0; i < 256; i++)
p[256 + i] = p[i] = permutation[i];
}

PerlinNoise::PerlinNoiseData PerlinNoise::p;

} // namespace testing
} // namespace openvkl

0 comments on commit dcdd2e1

Please sign in to comment.