Merge pull request #892 from davidgyu/release_api_review

Addressed some FVar PatchTable API review notes
This commit is contained in:
barfowl 2016-10-14 21:21:53 -07:00 committed by GitHub
commit 86bd917c97
8 changed files with 28 additions and 10 deletions

View File

@ -822,7 +822,7 @@ display() {
glBindVertexArray(g_vao);
OpenSubdiv::Far::PatchDescriptor fvarDesc =
g_mesh->GetFarPatchTable()->GetFVarChannelPatchDescriptor(0);
g_mesh->GetFarPatchTable()->GetFVarPatchDescriptor(0);
OpenSubdiv::Osd::PatchArrayVector const & patches =
g_mesh->GetPatchTable()->GetPatchArrays();

View File

@ -484,7 +484,7 @@ PatchTable::GetFVarChannelLinearInterpolation(int channel) const {
return c.interpolation;
}
PatchDescriptor
PatchTable::GetFVarChannelPatchDescriptor(int channel) const {
PatchTable::GetFVarPatchDescriptor(int channel) const {
FVarPatchChannel const & c = getFVarPatchChannel(channel);
return c.desc;
}
@ -615,7 +615,7 @@ PatchTable::EvaluateBasisFaceVarying(
PatchParam param = getPatchFVarPatchParam(handle.patchIndex, channel);
PatchDescriptor::Type patchType = param.IsRegular()
? PatchDescriptor::REGULAR
: GetFVarChannelPatchDescriptor(channel).GetType();
: GetFVarPatchDescriptor(channel).GetType();
if (patchType == PatchDescriptor::REGULAR) {
internal::GetBSplineWeights(param, s, t, wP, wDs, wDt, wDss, wDst, wDtt);

View File

@ -298,11 +298,11 @@ public:
/// \brief Returns the number of face-varying channels
int GetNumFVarChannels() const;
/// \brief Deprecated Returns the interpolation mode for \p channel
/// \brief Deprecated @see PatchTable#GetFVarPatchDescriptor
Sdc::Options::FVarLinearInterpolation GetFVarChannelLinearInterpolation(int channel = 0) const;
/// \brief Returns the patch descriptor for \p channel
PatchDescriptor GetFVarChannelPatchDescriptor(int channel = 0) const;
PatchDescriptor GetFVarPatchDescriptor(int channel = 0) const;
/// \brief Returns the value indices for a given patch in \p channel
ConstIndexArray GetPatchFVarValues(PatchHandle const & handle, int channel = 0) const;

View File

@ -1272,7 +1272,7 @@ PatchTableFactory::populateAdaptivePatches(
for (int fvc=0; fvc<(int)context.fvarChannelIndices.size(); ++fvc) {
PatchDescriptor desc = table->GetFVarChannelPatchDescriptor(fvc);
PatchDescriptor desc = table->GetFVarPatchDescriptor(fvc);
Index pidx = table->getPatchIndex(arrayIndex, 0);
int ofs = pidx * desc.GetNumControlVertices();
@ -1461,7 +1461,7 @@ PatchTableFactory::populateAdaptivePatches(
BuilderContext::PatchTuple fvarPatch(patch);
PatchDescriptor desc = table->GetFVarChannelPatchDescriptor(fvc);
PatchDescriptor desc = table->GetFVarPatchDescriptor(fvc);
PatchParam fvarPatchParam = patchParam;

View File

@ -79,6 +79,9 @@ public:
/// Returns the CL memory of the varying control vertices
cl_mem GetVaryingPatchIndexBuffer() const { return _varyingIndexBuffer; }
/// Returns the number of face-varying channel buffers
int GetNumFVarChannels() const { return (int)_fvarPatchArrays.size(); }
/// Returns the CL memory of the array of Osd::PatchArray buffer
cl_mem GetFVarPatchArrayBuffer(int fvarChannel = 0) const { return _fvarPatchArrays[fvarChannel]; }

View File

@ -57,7 +57,7 @@ CpuPatchTable::CpuPatchTable(const Far::PatchTable *farPatchTable) {
for (int fvc=0; fvc<farPatchTable->GetNumFVarChannels(); ++fvc) {
_fvarPatchArrays[fvc].reserve(nPatchArrays);
_fvarIndexBuffers[fvc].reserve(
numPatches*farPatchTable->GetFVarChannelPatchDescriptor(fvc).GetNumControlVertices());
numPatches*farPatchTable->GetFVarPatchDescriptor(fvc).GetNumControlVertices());
_fvarParamBuffers[fvc].reserve(numPatches);
}
_patchParamBuffer.reserve(numPatches);
@ -86,7 +86,7 @@ CpuPatchTable::CpuPatchTable(const Far::PatchTable *farPatchTable) {
// face-varying
for (int fvc=0; fvc<farPatchTable->GetNumFVarChannels(); ++fvc) {
PatchArray fvarPatchArray(
farPatchTable->GetFVarChannelPatchDescriptor(fvc), numPatches, 0, 0);
farPatchTable->GetFVarPatchDescriptor(fvc), numPatches, 0, 0);
_fvarPatchArrays[fvc].push_back(fvarPatchArray);
Far::ConstIndexArray

View File

@ -74,6 +74,9 @@ public:
return _varyingIndexBuffer;
}
/// Returns the number of face-varying channels buffers
int GetNumFVarChannels() const { return (int)_fvarPatchArrays.size(); }
/// Returns the cuda memory of the array of Osd::PatchArray buffer
void *GetFVarPatchArrayBuffer(int fvarChannel) const {
return _fvarPatchArrays[fvarChannel];

View File

@ -51,6 +51,7 @@ public:
static GLPatchTable *Create(Far::PatchTable const *farPatchTable,
void *deviceContext = NULL);
/// Returns the patch arrays for vertex index buffer data
PatchArrayVector const &GetPatchArrays() const {
return _patchArrays;
}
@ -75,6 +76,7 @@ public:
return _patchParamTexture;
}
/// Returns the patch arrays for varying index buffer data
PatchArrayVector const &GetVaryingPatchArrays() const {
return _varyingPatchArrays;
}
@ -89,20 +91,30 @@ public:
return _varyingIndexTexture;
}
/// Returns the number of face-varying channel buffers
int GetNumFVarChannels() const { return (int)_fvarPatchArrays.size(); }
/// Returns the patch arrays for face-varying index buffer data
PatchArrayVector const &GetFVarPatchArrays(int fvarChannel = 0) const {
return _fvarPatchArrays[fvarChannel];
}
/// Returns the GL texture buffer containing the face-varying control vertices
/// Returns the GL index buffer containing face-varying control vertices
GLuint GetFVarPatchIndexBuffer(int fvarChannel = 0) const {
return _fvarIndexBuffers[fvarChannel];
}
/// Returns the GL texture buffer containing face-varying control vertices
GLuint GetFVarPatchIndexTextureBuffer(int fvarChannel = 0) const {
return _fvarIndexTextures[fvarChannel];
}
/// Returns the GL index buffer containing face-varying patch params
GLuint GetFVarPatchParamBuffer(int fvarChannel = 0) const {
return _fvarParamBuffers[fvarChannel];
}
/// Returns the GL texture buffer containing face-varying patch params
GLuint GetFVarPatchParamTextureBuffer(int fvarChannel = 0) const {
return _fvarParamTextures[fvarChannel];
}