diff --git a/openvdb/openvdb/Grid.h b/openvdb/openvdb/Grid.h index d32f064c8d..870007686b 100644 --- a/openvdb/openvdb/Grid.h +++ b/openvdb/openvdb/Grid.h @@ -443,10 +443,10 @@ class OPENVDB_API GridBase: public MetaMap /// @} - /// @name I/O /// @{ +#if OPENVDB_ABI_VERSION_NUMBER < 14 /// @brief Read the grid topology from a stream. /// This will read only the grid structure, not the actual data buffers. virtual void readTopology(std::istream&) = 0; @@ -459,13 +459,12 @@ class OPENVDB_API GridBase: public MetaMap /// Read all of this grid's data buffers that intersect the given index-space bounding box. virtual void readBuffers(std::istream&, const CoordBBox&) = 0; -#if OPENVDB_ABI_VERSION_NUMBER < 14 OPENVDB_DEPRECATED_MESSAGE("This method is deprecated and will be removed. Delayed loading is no longer supported.") virtual void readNonresidentBuffers() const = 0; -#endif /// Write out all data buffers for this grid. virtual void writeBuffers(std::ostream&) const = 0; +#endif /// Read in the transform for this grid. void readTransform(std::istream& is) { transform().read(is); } @@ -931,6 +930,7 @@ class Grid: public GridBase /// @name I/O /// @{ +#if OPENVDB_ABI_VERSION_NUMBER < 14 /// @brief Read the grid topology from a stream. /// This will read only the grid structure, not the actual data buffers. void readTopology(std::istream&) override; @@ -943,14 +943,14 @@ class Grid: public GridBase /// Read all of this grid's data buffers that intersect the given index-space bounding box. void readBuffers(std::istream&, const CoordBBox&) override; -#if OPENVDB_ABI_VERSION_NUMBER < 14 OPENVDB_DEPRECATED_MESSAGE("This method is deprecated and will be removed. Delayed loading is no longer supported.") void readNonresidentBuffers() const override { } -#endif /// Write out all data buffers for this grid. void writeBuffers(std::ostream&) const override; +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + /// Output a human-readable description of this grid. void print(std::ostream& = std::cout, int verboseLevel = 1) const override; @@ -1624,6 +1624,7 @@ Grid::evalActiveVoxelDim() const //////////////////////////////////////// +#if OPENVDB_ABI_VERSION_NUMBER < 14 /// @internal Consider using the stream tagging mechanism (see io::Archive) /// to specify the float precision, but note that the setting is per-grid. @@ -1742,6 +1743,8 @@ Grid::writeBuffers(std::ostream& os) const } } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + //static template diff --git a/openvdb/openvdb/codecs/PointDataCodec.h b/openvdb/openvdb/codecs/PointDataCodec.h index 18484facd1..9f48c52041 100644 --- a/openvdb/openvdb/codecs/PointDataCodec.h +++ b/openvdb/openvdb/codecs/PointDataCodec.h @@ -8,6 +8,7 @@ #include +#include // io::readCompressedValues(), io::writeCompressedValues(), io::writeCompressedValuesSize() #include #include #include @@ -181,7 +182,14 @@ inline Index countPointDataPasses(const std::vector& leaves) { Index maxRequiredPasses = 0; for (const auto* leaf : leaves) { - const Index requiredPasses = leaf->buffers(); + const Index attributes = static_cast(leaf->attributeSet().size()); + const Index requiredPasses = + /*voxel buffer sizes*/ 1 + + /*voxel buffers*/ 1 + + /*attribute metadata*/ 1 + + /*attribute uniform values*/ attributes + + /*attribute buffers*/ attributes + + /*cleanup*/ 1; if (requiredPasses > maxRequiredPasses) { maxRequiredPasses = requiredPasses; } diff --git a/openvdb/openvdb/io/Archive.cc b/openvdb/openvdb/io/Archive.cc index d1d2451943..c197d0c4ac 100644 --- a/openvdb/openvdb/io/Archive.cc +++ b/openvdb/openvdb/io/Archive.cc @@ -1021,6 +1021,7 @@ Archive::readGrid(const GridDescriptor& gd, std::istream& is, const io::ReadOpti if (codec) { codec->readTopology(is, *codecData, readOptions, diagnostics); } else { +#if OPENVDB_ABI_VERSION_NUMBER < 14 io::StreamMetadata::Ptr allocateLeafBuffersMeta; if (readOptions.readMode == io::ReadMode::TopologyOnly) { // Signal Grid::readTopology to allocate leaf buffers and @@ -1040,6 +1041,7 @@ Archive::readGrid(const GridDescriptor& gd, std::istream& is, const io::ReadOpti } throw; } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 } } if (readBuffers) { @@ -1049,6 +1051,7 @@ Archive::readGrid(const GridDescriptor& gd, std::istream& is, const io::ReadOpti const Index64 size = static_cast(gd.getEndPos() - gd.getGridPos()); codec->readBuffers(is, size, *codecData, readOptions, diagnostics); } else { +#if OPENVDB_ABI_VERSION_NUMBER < 14 const auto& worldBBox = readOptions.clipBBox; const bool clip = worldBBox.isSorted(); if (clip) { @@ -1057,6 +1060,7 @@ Archive::readGrid(const GridDescriptor& gd, std::istream& is, const io::ReadOpti } else { grid->readBuffers(is); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 } } @@ -1242,7 +1246,9 @@ Archive::writeGrid(GridDescriptor& gd, GridBase::ConstPtr grid, if (codec) { codec->writeTopology(os, *grid, writeOptions); } else { +#if OPENVDB_ABI_VERSION_NUMBER < 14 grid->writeTopology(os); +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 } // Now we know the grid block storage position. @@ -1252,7 +1258,9 @@ Archive::writeGrid(GridDescriptor& gd, GridBase::ConstPtr grid, if (codec) { codec->writeBuffers(os, *grid, writeOptions); } else { +#if OPENVDB_ABI_VERSION_NUMBER < 14 grid->writeBuffers(os); +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 } // Now we know the end position of this grid. diff --git a/openvdb/openvdb/points/PointDataGrid.h b/openvdb/openvdb/points/PointDataGrid.h index 35988239af..1bf02805f0 100644 --- a/openvdb/openvdb/points/PointDataGrid.h +++ b/openvdb/openvdb/points/PointDataGrid.h @@ -31,7 +31,11 @@ #include // std::pair, std::make_pair #include +// This header is only needed when PointData I/O methods are present (ie ABI<14) +// otherwise, this header is included in the PointDataCodec instead. +#if OPENVDB_ABI_VERSION_NUMBER < 14 #include // io::readCompressedValues(), io::writeCompressedValues(), io::writeCompressedValuesSize() +#endif class TestPointDataLeaf; @@ -363,6 +367,7 @@ class PointDataLeafNode : public tree::LeafNode, io::PointDataGridMu // I/O methods +#if OPENVDB_ABI_VERSION_NUMBER < 14 void readTopology(std::istream& is, bool fromHalf = false); void writeTopology(std::ostream& os, bool toHalf = false) const; @@ -372,10 +377,11 @@ class PointDataLeafNode : public tree::LeafNode, io::PointDataGridMu void readBuffers(std::istream& is, const CoordBBox&, bool fromHalf = false); void writeBuffers(std::ostream& os, bool toHalf = false) const; - - Index64 memUsage() const; OPENVDB_DEPRECATED_MESSAGE("Use memUsage() instead. This method is deprecated and will be removed. Delayed loading is no longer supported.") Index64 memUsageIfLoaded() const { return memUsage(); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + + Index64 memUsage() const; void evalActiveBoundingBox(CoordBBox& bbox, bool visitVoxels = true) const; @@ -987,6 +993,8 @@ PointDataLeafNode::setOffsetOnly(Index offset, const ValueType& val) this->buffer().setValue(offset, val); } +#if OPENVDB_ABI_VERSION_NUMBER < 14 + template inline void PointDataLeafNode::readTopology(std::istream& is, bool fromHalf) @@ -1386,6 +1394,8 @@ PointDataLeafNode::writeBuffers(std::ostream& os, bool toHalf) const } } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + template inline Index64 PointDataLeafNode::memUsage() const diff --git a/openvdb/openvdb/points/PointDataIO.h b/openvdb/openvdb/points/PointDataIO.h index 110b93972b..710a2e7704 100644 --- a/openvdb/openvdb/points/PointDataIO.h +++ b/openvdb/openvdb/points/PointDataIO.h @@ -4,6 +4,10 @@ #ifndef OPENVDB_POINTS_POINT_DATA_IO_HAS_BEEN_INCLUDED #define OPENVDB_POINTS_POINT_DATA_IO_HAS_BEEN_INCLUDED +#include // for io::readCompressedValues(), etc +#include +#include + namespace openvdb { OPENVDB_USE_VERSION_NAMESPACE diff --git a/openvdb/openvdb/tree/InternalNode.h b/openvdb/openvdb/tree/InternalNode.h index 42558c4fcd..9d1e2dbb7e 100644 --- a/openvdb/openvdb/tree/InternalNode.h +++ b/openvdb/openvdb/tree/InternalNode.h @@ -458,6 +458,7 @@ class InternalNode /// Mark all values (both tiles and voxels) as active. void setValuesOn(); +#if OPENVDB_ABI_VERSION_NUMBER < 14 // // I/O // @@ -466,7 +467,7 @@ class InternalNode void writeBuffers(std::ostream&, bool toHalf = false) const; void readBuffers(std::istream&, bool fromHalf = false); void readBuffers(std::istream&, const CoordBBox&, bool fromHalf = false); - +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 // // Unsafe methods @@ -2394,6 +2395,8 @@ InternalNode::copyToDense(const CoordBBox& bbox, DenseT& dense) //////////////////////////////////////// +#if OPENVDB_ABI_VERSION_NUMBER < 14 + template inline void InternalNode::writeTopology(std::ostream& os, bool toHalf) const @@ -2463,6 +2466,8 @@ InternalNode::readTopology(std::istream& is, bool fromHalf) } } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + //////////////////////////////////////// @@ -3218,6 +3223,8 @@ InternalNode::combine2(const InternalNode& other, const OtherVa //////////////////////////////////////// +#if OPENVDB_ABI_VERSION_NUMBER < 14 + template inline void InternalNode::writeBuffers(std::ostream& os, bool toHalf) const @@ -3259,6 +3266,8 @@ InternalNode::readBuffers(std::istream& is, this->clip(clipBBox, background); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + //////////////////////////////////////// diff --git a/openvdb/openvdb/tree/LeafNode.h b/openvdb/openvdb/tree/LeafNode.h index 79c8b3d9a7..b3b25b2071 100644 --- a/openvdb/openvdb/tree/LeafNode.h +++ b/openvdb/openvdb/tree/LeafNode.h @@ -381,6 +381,7 @@ class LeafNode const Buffer& buffer() const { return mBuffer; } Buffer& buffer() { return mBuffer; } +#if OPENVDB_ABI_VERSION_NUMBER < 14 // // I/O methods // @@ -406,6 +407,7 @@ class LeafNode /// @param os the stream to which to write /// @param toHalf if true, output floating-point values as 16-bit half floats void writeBuffers(std::ostream& os, bool toHalf = false) const; +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 size_t streamingSize(bool toHalf = false) const; @@ -924,7 +926,10 @@ class LeafNode void setValueMaskOn(Index n) { mValueMask.setOn(n); } void setValueMaskOff(Index n) { mValueMask.setOff(n); } + +#if OPENVDB_ABI_VERSION_NUMBER < 14 inline void skipCompressedValues(bool seekable, std::istream&, bool fromHalf); +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 /// Compute the origin of the leaf node that contains the voxel with the given coordinates. static void evalNodeOrigin(Coord& xyz) { xyz &= ~(DIM - 1); } @@ -1326,6 +1331,8 @@ LeafNode::copyFromDense(const CoordBBox& bbox, const DenseT& dense, //////////////////////////////////////// +#if OPENVDB_ABI_VERSION_NUMBER < 14 + template inline void LeafNode::readTopology(std::istream& is, bool /*fromHalf*/) @@ -1342,10 +1349,6 @@ LeafNode::writeTopology(std::ostream& os, bool /*toHalf*/) const } -//////////////////////////////////////// - - - template inline void LeafNode::skipCompressedValues(bool seekable, std::istream& is, bool fromHalf) @@ -1440,6 +1443,8 @@ LeafNode::writeBuffers(std::ostream& os, bool toHalf) const mValueMask, /*childMask=*/NodeMaskType(), toHalf); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + //////////////////////////////////////// diff --git a/openvdb/openvdb/tree/LeafNodeBool.h b/openvdb/openvdb/tree/LeafNodeBool.h index 8caccdbbc6..da6342c63c 100644 --- a/openvdb/openvdb/tree/LeafNodeBool.h +++ b/openvdb/openvdb/tree/LeafNodeBool.h @@ -200,6 +200,7 @@ class LeafNode const Buffer& buffer() const { return mBuffer; } Buffer& buffer() { return mBuffer; } +#if OPENVDB_ABI_VERSION_NUMBER < 14 // // I/O methods // @@ -213,6 +214,7 @@ class LeafNode void readBuffers(std::istream& is, const CoordBBox&, bool fromHalf = false); /// Write out the topology and the origin. void writeBuffers(std::ostream&, bool toHalf = false) const; +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 // // Accessor methods @@ -976,6 +978,8 @@ LeafNode::offsetToGlobalCoord(Index n) const //////////////////////////////////////// +#if OPENVDB_ABI_VERSION_NUMBER < 14 + template inline void LeafNode::readTopology(std::istream& is, bool /*fromHalf*/) @@ -1038,6 +1042,8 @@ LeafNode::writeBuffers(std::ostream& os, bool /*toHalf*/) const mBuffer.mData.save(os); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + //////////////////////////////////////// diff --git a/openvdb/openvdb/tree/LeafNodeMask.h b/openvdb/openvdb/tree/LeafNodeMask.h index 41474874bd..82f33d533d 100644 --- a/openvdb/openvdb/tree/LeafNodeMask.h +++ b/openvdb/openvdb/tree/LeafNodeMask.h @@ -199,6 +199,7 @@ class LeafNode const Buffer& buffer() const { return mBuffer; } Buffer& buffer() { return mBuffer; } +#if OPENVDB_ABI_VERSION_NUMBER < 14 // // I/O methods // @@ -212,6 +213,7 @@ class LeafNode void readBuffers(std::istream& is, const CoordBBox&, bool fromHalf = false); /// Write out the topology and the origin. void writeBuffers(std::ostream&, bool toHalf = false) const; +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 // // Accessor methods @@ -962,6 +964,8 @@ LeafNode::offsetToGlobalCoord(Index n) const //////////////////////////////////////// +#if OPENVDB_ABI_VERSION_NUMBER < 14 + template inline void LeafNode::readTopology(std::istream& is, bool /*fromHalf*/) @@ -1017,6 +1021,8 @@ LeafNode::writeBuffers(std::ostream& os, bool /*toHalf*/) co os.write(reinterpret_cast(&mOrigin), sizeof(Coord::ValueType) * 3); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + //////////////////////////////////////// diff --git a/openvdb/openvdb/tree/RootNode.h b/openvdb/openvdb/tree/RootNode.h index 3eec43a7f9..c2f807e8e2 100644 --- a/openvdb/openvdb/tree/RootNode.h +++ b/openvdb/openvdb/tree/RootNode.h @@ -13,7 +13,6 @@ #include // for truncateRealToHalf() #include // for isZero(), isExactlyEqual(), etc. #include -#include // for backward compatibility only (see readTopology()) #include #include #include @@ -575,6 +574,7 @@ class RootNode void copyToDense(const CoordBBox& bbox, DenseT& dense) const; +#if OPENVDB_ABI_VERSION_NUMBER < 14 // // I/O // @@ -584,6 +584,7 @@ class RootNode void writeBuffers(std::ostream&, bool toHalf = false) const; void readBuffers(std::istream&, bool fromHalf = false); void readBuffers(std::istream&, const CoordBBox&, bool fromHalf = false); +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 // @@ -2347,6 +2348,8 @@ RootNode::copyToDense(const CoordBBox& bbox, DenseT& dense) const //////////////////////////////////////// +#if OPENVDB_ABI_VERSION_NUMBER < 14 + template inline bool RootNode::writeTopology(std::ostream& os, bool toHalf) const @@ -2468,6 +2471,8 @@ RootNode::readBuffers(std::istream& is, const CoordBBox& clipBBox, bool this->clip(clipBBox); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + //////////////////////////////////////// diff --git a/openvdb/openvdb/tree/Tree.h b/openvdb/openvdb/tree/Tree.h index 1ca127c290..f25cd37c8c 100644 --- a/openvdb/openvdb/tree/Tree.h +++ b/openvdb/openvdb/tree/Tree.h @@ -144,7 +144,7 @@ class OPENVDB_API TreeBase /// Return the total amount of memory in bytes occupied by this tree. virtual Index64 memUsage() const { return 0; } - +#if OPENVDB_ABI_VERSION_NUMBER < 14 // // I/O methods // @@ -162,12 +162,12 @@ class OPENVDB_API TreeBase /// Read all of this tree's data buffers that intersect the given bounding box. virtual void readBuffers(std::istream&, const CoordBBox&, bool saveFloatAsHalf = false) = 0; -#if OPENVDB_ABI_VERSION_NUMBER < 14 OPENVDB_DEPRECATED_MESSAGE("This method is deprecated and will be removed. Delayed loading is no longer supported.") virtual void readNonresidentBuffers() const = 0; -#endif + /// Write out all the data buffers for this tree. virtual void writeBuffers(std::ostream&, bool saveFloatAsHalf = false) const = 0; +#endif /// @brief Print statistics, memory usage and other information about this tree. /// @param os a stream to which to write textual information @@ -316,7 +316,7 @@ class Tree: public TreeBase /// @note Because RootNodes are resizable, the RootNode Log2Dim is 0 for all trees. static void getNodeLog2Dims(std::vector& dims); - +#if OPENVDB_ABI_VERSION_NUMBER < 14 // // I/O methods // @@ -333,13 +333,12 @@ class Tree: public TreeBase /// Read all of this tree's data buffers that intersect the given bounding box. void readBuffers(std::istream&, const CoordBBox&, bool saveFloatAsHalf = false) override; -#if OPENVDB_ABI_VERSION_NUMBER < 14 OPENVDB_DEPRECATED_MESSAGE("This method is deprecated and will be removed. Delayed loading is no longer supported.") void readNonresidentBuffers() const override { } -#endif /// Write out all data buffers for this tree. void writeBuffers(std::ostream&, bool saveFloatAsHalf = false) const override; +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 void print(std::ostream& os = std::cout, int verboseLevel = 1) const override; @@ -1251,6 +1250,8 @@ Tree::cbegin() const //////////////////////////////////////// +#if OPENVDB_ABI_VERSION_NUMBER < 14 + template void Tree::readTopology(std::istream& is, bool saveFloatAsHalf) @@ -1298,6 +1299,8 @@ Tree::writeBuffers(std::ostream &os, bool saveFloatAsHalf) const mRoot.writeBuffers(os, saveFloatAsHalf); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + template template diff --git a/openvdb/openvdb/unittest/TestCodec.cc b/openvdb/openvdb/unittest/TestCodec.cc index ce163f0920..faee09daa4 100644 --- a/openvdb/openvdb/unittest/TestCodec.cc +++ b/openvdb/openvdb/unittest/TestCodec.cc @@ -271,12 +271,15 @@ void testCodecIOImpl( ASSERT_TRUE(openvdb::io::CodecRegistry::isRegistered(GridT::gridType())); // test the io implementation (codec) testIOImpl(gridName, bgValue, fillValue); + +#if OPENVDB_ABI_VERSION_NUMBER < 14 // clear the codec registry (now read/write falls back to Tree I/O) openvdb::io::CodecRegistry::clear(); // ensure the codec is not registered ASSERT_FALSE(openvdb::io::CodecRegistry::isRegistered(GridT::gridType())); // test the io implementation (tree I/O) testIOImpl(gridName, bgValue, fillValue); +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 } TEST_F(TestCodec, testFloatCodecIO) { testCodecIOImpl("float_grid", 0.0f, 1.0f); } @@ -472,6 +475,8 @@ TEST_F(TestCodec, testBoolAndMaskConversionNoGridOffsets) runCase(ReadMode::Mask); } +#if OPENVDB_ABI_VERSION_NUMBER < 14 + TEST_F(TestCodec, testVec3FallsBackWithWarningNoGridOffsets) { using namespace openvdb; @@ -530,6 +535,8 @@ TEST_F(TestCodec, testVec3FallsBackWithWarningNoGridOffsets) std::remove(path.c_str()); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + TEST_F(TestCodec, testOffsetsAndNoOffsetsParity) { using namespace openvdb; diff --git a/openvdb/openvdb/unittest/TestGrid.cc b/openvdb/openvdb/unittest/TestGrid.cc index 724109ce53..c6e9a291d8 100644 --- a/openvdb/openvdb/unittest/TestGrid.cc +++ b/openvdb/openvdb/unittest/TestGrid.cc @@ -60,17 +60,19 @@ class ProxyTree: public openvdb::TreeBase TreeBasePtr copy() const override { return TreeBasePtr(new ProxyTree(*this)); } +#if OPENVDB_ABI_VERSION_NUMBER < 14 void readTopology(std::istream& is, bool = false) override { is.seekg(0, std::ios::beg); } void writeTopology(std::ostream& os, bool = false) const override { os.seekp(0); } void readBuffers(std::istream& is, const openvdb::CoordBBox&, bool /*saveFloatAsHalf*/=false) override { is.seekg(0); } -#if OPENVDB_ABI_VERSION_NUMBER < 14 + void readNonresidentBuffers() const override {} -#endif + void readBuffers(std::istream& is, bool /*saveFloatAsHalf*/=false) override { is.seekg(0); } void writeBuffers(std::ostream& os, bool /*saveFloatAsHalf*/=false) const override { os.seekp(0, std::ios::beg); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 bool empty() const { return true; } void clear() {} diff --git a/openvdb/openvdb/unittest/TestLeafBool.cc b/openvdb/openvdb/unittest/TestLeafBool.cc index 3bb4522001..e4e9892b94 100644 --- a/openvdb/openvdb/unittest/TestLeafBool.cc +++ b/openvdb/openvdb/unittest/TestLeafBool.cc @@ -340,6 +340,8 @@ TEST_F(TestLeafBool, testIO) } +#if OPENVDB_ABI_VERSION_NUMBER < 14 + TEST_F(TestLeafBool, testTreeIO) { LeafType leaf(openvdb::Coord(1, 3, 5)); @@ -368,6 +370,8 @@ TEST_F(TestLeafBool, testTreeIO) EXPECT_TRUE(leaf.onVoxelCount() == 2); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + TEST_F(TestLeafBool, testConstructors) { diff --git a/openvdb/openvdb/unittest/TestLeafIO.cc b/openvdb/openvdb/unittest/TestLeafIO.cc index 7e4cf04575..e7a1f04bec 100644 --- a/openvdb/openvdb/unittest/TestLeafIO.cc +++ b/openvdb/openvdb/unittest/TestLeafIO.cc @@ -115,6 +115,11 @@ class TestLeafIOTest: public ::testing::Test }; +// These tests round-trip through Archive using an ad hoc grid type built directly +// from tree/node templates, so no codec is ever registered for it and the read/write +// falls back to raw Tree I/O, which is disabled for ABI >= 14. +#if OPENVDB_ABI_VERSION_NUMBER < 14 + TEST_F(TestLeafIOTest, testBufferInt) { TestLeafIO::testBuffer(); } TEST_F(TestLeafIOTest, testBufferFloat) { TestLeafIO::testBuffer(); } TEST_F(TestLeafIOTest, testBufferDouble) { TestLeafIO::testBuffer(); } @@ -175,6 +180,7 @@ TEST_F(TestLeafIOTest, testBufferVec3R) } } + TEST_F(TestLeafIOTest, testTreeIOInt) { TestLeafIO::testTreeIO(); } TEST_F(TestLeafIOTest, testTreeIOFloat) { TestLeafIO::testTreeIO(); } TEST_F(TestLeafIOTest, testTreeIODouble) { TestLeafIO::testTreeIO(); } @@ -207,3 +213,5 @@ TEST_F(TestLeafIOTest, testTreeIOVec3R) EXPECT_TRUE(leaf.onVoxelCount() == 2); } + +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 diff --git a/openvdb/openvdb/unittest/TestLeafMask.cc b/openvdb/openvdb/unittest/TestLeafMask.cc index a9ebab62f3..d4b074ac2e 100644 --- a/openvdb/openvdb/unittest/TestLeafMask.cc +++ b/openvdb/openvdb/unittest/TestLeafMask.cc @@ -338,6 +338,8 @@ TEST_F(TestLeafMask, testIO) } +#if OPENVDB_ABI_VERSION_NUMBER < 14 + TEST_F(TestLeafMask, testTreeIO) { LeafType leaf(openvdb::Coord(1, 3, 5)); @@ -366,6 +368,8 @@ TEST_F(TestLeafMask, testTreeIO) EXPECT_TRUE(leaf.onVoxelCount() == 2); } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + TEST_F(TestLeafMask, testTopologyCopy) { diff --git a/openvdb/openvdb/unittest/TestPointCodec.cc b/openvdb/openvdb/unittest/TestPointCodec.cc index 0729f6cc98..72a01daa00 100644 --- a/openvdb/openvdb/unittest/TestPointCodec.cc +++ b/openvdb/openvdb/unittest/TestPointCodec.cc @@ -55,7 +55,9 @@ TEST_F(TestPointCodec, testPointIndexCodecIO) const std::string rawPath = "testPointIndexCodec_raw.vdb"; - // Phase 1: write/read without codec + // Phase 1: write/read without codec. This falls back to raw Tree I/O, + // which is disabled for ABI >= 14, so this phase is skipped there. +#if OPENVDB_ABI_VERSION_NUMBER < 14 { io::File f(rawPath); f.write(GridPtrVec{srcGrid}); @@ -84,6 +86,7 @@ TEST_F(TestPointCodec, testPointIndexCodecIO) EXPECT_EQ(rawTopo->getName(), std::string("point_index_grid")); std::remove(rawPath.c_str()); +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 const std::string codecPath = "testPointIndexCodec_codec.vdb"; @@ -208,7 +211,9 @@ TEST_F(TestPointCodec, testPointDataCodecIO) const std::string rawPath = "testPDG_A_raw.vdb"; - // Phase 1: write/read without codec + // Phase 1: write/read without codec. This falls back to raw Tree I/O, + // which is disabled for ABI >= 14, so this phase is skipped there. +#if OPENVDB_ABI_VERSION_NUMBER < 14 { io::File f(rawPath); f.write(GridPtrVec{srcGrid}); @@ -237,6 +242,7 @@ TEST_F(TestPointCodec, testPointDataCodecIO) EXPECT_EQ(rawTopo->activeVoxelCount(), Index64(4)); std::remove(rawPath.c_str()); +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 const std::string codecPath = "testPDG_A_codec.vdb"; diff --git a/openvdb/openvdb/unittest/TestPointDataLeaf.cc b/openvdb/openvdb/unittest/TestPointDataLeaf.cc index c5956e2991..fbf047d492 100644 --- a/openvdb/openvdb/unittest/TestPointDataLeaf.cc +++ b/openvdb/openvdb/unittest/TestPointDataLeaf.cc @@ -1,6 +1,7 @@ // Copyright Contributors to the OpenVDB Project // SPDX-License-Identifier: Apache-2.0 +#include #include #include #include @@ -1276,6 +1277,8 @@ TEST_F(TestPointDataLeaf, testIO) } +#if OPENVDB_ABI_VERSION_NUMBER < 14 + TEST_F(TestPointDataLeaf, testTreeIO) { using AttributeVec3s = TypedAttributeArray; @@ -1366,6 +1369,8 @@ TEST_F(TestPointDataLeaf, testTreeIO) } } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + TEST_F(TestPointDataLeaf, testSwap) { diff --git a/openvdb/openvdb/unittest/TestTree.cc b/openvdb/openvdb/unittest/TestTree.cc index 624906b199..e2e33884cd 100644 --- a/openvdb/openvdb/unittest/TestTree.cc +++ b/openvdb/openvdb/unittest/TestTree.cc @@ -831,6 +831,8 @@ TEST_F(TestTree, testIO) } +#if OPENVDB_ABI_VERSION_NUMBER < 14 + TEST_F(TestTree, testTreeIO) { const char* filename = "testTreeIO.dbg"; @@ -882,6 +884,8 @@ TEST_F(TestTree, testTreeIO) } } +#endif // OPENVDB_ABI_VERSION_NUMBER < 14 + TEST_F(TestTree, testNegativeIndexing) {