From ca6f0feecfcca3dd22acd72da23ec4303cfc5346 Mon Sep 17 00:00:00 2001 From: Cory Kramer Date: Tue, 27 Sep 2022 10:13:44 -0400 Subject: [PATCH] Avoid referring to std::vector members when T is incomplete. This is not legal according to the C++ standard, and causes build errors when using --std=c++20 --- opensubdiv/far/patchTable.cpp | 54 ----------------------------------- opensubdiv/far/patchTable.h | 52 +++++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 56 deletions(-) diff --git a/opensubdiv/far/patchTable.cpp b/opensubdiv/far/patchTable.cpp index 2c7613be..fde8ce23 100644 --- a/opensubdiv/far/patchTable.cpp +++ b/opensubdiv/far/patchTable.cpp @@ -125,23 +125,6 @@ PatchTable::~PatchTable() { // // PatchArrays // -struct PatchTable::PatchArray { - - PatchArray(PatchDescriptor d, int np, Index v, Index p, Index qo) : - desc(d), numPatches(np), vertIndex(v), - patchIndex(p), quadOffsetIndex (qo) { } - - void print() const; - - PatchDescriptor desc; // type of patches in the array - - int numPatches; // number of patches in the array - - Index vertIndex, // index to the first control vertex - patchIndex, // absolute index of the first patch in the array - quadOffsetIndex; // index of the first quad offset entry - -}; // debug helper void @@ -166,43 +149,6 @@ PatchTable::reservePatchArrays(int numPatchArrays) { _patchArrays.reserve(numPatchArrays); } -// -// FVarPatchChannel -// -// Stores a record for each patch in the primitive : -// -// - Each patch in the PatchTable has a corresponding patch in each -// face-varying patch channel. Patch vertex indices are sorted in the same -// patch-type order as PatchTable::PTables. Face-varying data for a patch -// can therefore be quickly accessed by using the patch primitive ID as -// index into patchValueOffsets to locate the face-varying control vertex -// indices. -// -// - Face-varying channels can have a different interpolation modes -// -// - Unlike "vertex" patches, there are no transition masks required -// for face-varying patches. -// -// - Face-varying patches still require boundary edge masks. -// -// - currently most patches with sharp boundaries but smooth interiors have -// to be isolated to level 10 : we need a special type of bicubic patch -// similar to single-crease to resolve this condition without requiring -// isolation if possible -// -struct PatchTable::FVarPatchChannel { - - Sdc::Options::FVarLinearInterpolation interpolation; - - PatchDescriptor regDesc; - PatchDescriptor irregDesc; - - int stride; - - std::vector patchValues; - std::vector patchParam; -}; - void PatchTable::allocateVaryingVertices( PatchDescriptor desc, int numPatches) { diff --git a/opensubdiv/far/patchTable.h b/opensubdiv/far/patchTable.h index 8be51ccb..d2e9d5a6 100644 --- a/opensubdiv/far/patchTable.h +++ b/opensubdiv/far/patchTable.h @@ -545,8 +545,22 @@ private: // // Patch arrays // + struct PatchArray { + PatchArray(PatchDescriptor d, int np, Index v, Index p, Index qo) : + desc(d), numPatches(np), vertIndex(v), + patchIndex(p), quadOffsetIndex (qo) { } + + void print() const; + + PatchDescriptor desc; // type of patches in the array + + int numPatches; // number of patches in the array + + Index vertIndex, // index to the first control vertex + patchIndex, // absolute index of the first patch in the array + quadOffsetIndex; // index of the first quad offset entry + }; - struct PatchArray; typedef std::vector PatchArrayVector; PatchArray & getPatchArray(Index arrayIndex); @@ -574,7 +588,41 @@ private: // Face-varying patch channels // - struct FVarPatchChannel; + // + // FVarPatchChannel + // + // Stores a record for each patch in the primitive : + // + // - Each patch in the PatchTable has a corresponding patch in each + // face-varying patch channel. Patch vertex indices are sorted in the same + // patch-type order as PatchTable::PTables. Face-varying data for a patch + // can therefore be quickly accessed by using the patch primitive ID as + // index into patchValueOffsets to locate the face-varying control vertex + // indices. + // + // - Face-varying channels can have a different interpolation modes + // + // - Unlike "vertex" patches, there are no transition masks required + // for face-varying patches. + // + // - Face-varying patches still require boundary edge masks. + // + // - currently most patches with sharp boundaries but smooth interiors have + // to be isolated to level 10 : we need a special type of bicubic patch + // similar to single-crease to resolve this condition without requiring + // isolation if possible + // + struct FVarPatchChannel { + Sdc::Options::FVarLinearInterpolation interpolation; + + PatchDescriptor regDesc; + PatchDescriptor irregDesc; + + int stride; + + std::vector patchValues; + std::vector patchParam; + }; typedef std::vector FVarPatchChannelVector; FVarPatchChannel & getFVarPatchChannel(int channel);