Skip to content

Commit

Permalink
Restore unit tests for texture3d (#1437)
Browse files Browse the repository at this point in the history
OIIO master recently removed support for Field3D, which is rarely used
and the project is effectively unmaintained and isn't able to build
against the newer OpenEXR releases that we want to encourage people to
use.

So the primary purpose of this patch is to switch our unit test for
texture3d from using a field3d file (and thus would not run when using
newer OIIO) to a roughly equivalent test using openvdb (which is
supported, assuming OIIO is built in the presence of OpenVDB).

But, ha, I discovered two things, either one of which means that we
had actually not been unit testing texture3d at all lately: (1) To
discover whether the installed OIIO supported openvdb (and therefore
whether to bother running the test), we were relying on a totally
nonexistant OPENIMAGEIO_BIN cmake varaible. I don't know what that was
supposed to be (did I mean OIIOTOOL_BIN? but that also is not a
thing), but anyway, it caused it to always skip the test. (2) Oh boy,
the OIIO that we were relying on for may tests, provided by the ASWF
docker containers, was an OIIO that was not built in the presence of
OpenVDB (even though our OSL testing containers DO have OpenVDB), so
again it skipped the test because it needs that OIIO-side support for
texture3d() to know how to read openvdb files. Fix this by building
OIIO from scratch with openvdb support when doing the "VFX Platform
2022" test, rather than relying on the one in the container.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
  • Loading branch information
lgritz committed Nov 20, 2021
1 parent 1ff9aec commit 748b895
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -179,6 +179,7 @@ jobs:
CXX: g++
CC: gcc
CMAKE_CXX_STANDARD: 17
OPENIMAGEIO_VERSION: release
PYBIND11_VERSION: v2.7.1
PYTHON_VERSION: 3.9
USE_BATCHED: b8_AVX2
Expand All @@ -203,6 +204,7 @@ jobs:
src/build-scripts/ci-startup.bash
- name: Dependencies
run: |
rm -rf /usr/local/include/OpenImageIO /usr/local/lib/cmake/OpenImageIO
src/build-scripts/gh-installdeps.bash
- name: Build
run: |
Expand Down
8 changes: 4 additions & 4 deletions src/cmake/testing.cmake
Expand Up @@ -304,11 +304,11 @@ macro (osl_add_all_tests)
TESTSUITE ( python-oslquery )
endif ()

# Only run field3d-related tests if the local OIIO was built with f3d support.
execute_process ( COMMAND ${OPENIMAGEIO_BIN} --help
# Only run openvdb-related tests if the local OIIO has openvdb support.
execute_process ( COMMAND ${OpenImageIO_LIB_DIR}/../bin/oiiotool --help
OUTPUT_VARIABLE oiiotool_help )
if (oiiotool_help MATCHES "field3d")
TESTSUITE ( texture-field3d )
if (oiiotool_help MATCHES "openvdb")
TESTSUITE ( texture3d )
endif()

# Only run pointcloud tests if Partio is found
Expand Down
Binary file removed testsuite/texture-field3d/dense_float.f3d
Binary file not shown.
Binary file removed testsuite/texture-field3d/dense_half.f3d
Binary file not shown.
Binary file removed testsuite/texture-field3d/ref/out.tif
Binary file not shown.
Binary file removed testsuite/texture-field3d/sparse_float.f3d
Binary file not shown.
Binary file removed testsuite/texture-field3d/sparse_half.f3d
Binary file not shown.
Binary file added testsuite/texture3d/ref/out.tif
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file added testsuite/texture3d/sphere.vdb
Binary file not shown.
Expand Up @@ -3,8 +3,8 @@
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage

shader
test (string filename = "data/sparse_half.f3d",
test (string filename = "data/sphere.vdb",
output color Cout = 0)
{
Cout = (color) texture3d (filename, point(u,v,0.5));
Cout = (color) texture3d (filename, point(u*2-1,v*2-1,0));
}

0 comments on commit 748b895

Please sign in to comment.