cudaPatchTable.h
Go to the documentation of this file.
//
// Copyright 2015 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#ifndef OPENSUBDIV3_OSD_CUDA_PATCH_TABLE_H
#define OPENSUBDIV3_OSD_CUDA_PATCH_TABLE_H
#include "../version.h"
#include "../osd/nonCopyable.h"
#include "../osd/types.h"
#include <vector>
namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {
namespace Far{
class PatchTable;
};
namespace Osd {
class CudaPatchTable : private NonCopyable<CudaPatchTable> {
public:
static CudaPatchTable *Create(Far::PatchTable const *patchTable,
void *deviceContext = NULL);
~CudaPatchTable();
void *GetPatchArrayBuffer() const { return _patchArrays; }
void *GetPatchIndexBuffer() const { return _indexBuffer; }
void *GetPatchParamBuffer() const { return _patchParamBuffer; }
void *GetVaryingPatchArrayBuffer() const {
return _varyingPatchArrays;
}
void *GetVaryingPatchIndexBuffer() const {
return _varyingIndexBuffer;
}
int GetNumFVarChannels() const { return (int)_fvarPatchArrays.size(); }
void *GetFVarPatchArrayBuffer(int fvarChannel) const {
return _fvarPatchArrays[fvarChannel];
}
void *GetFVarPatchIndexBuffer(int fvarChannel = 0) const {
return _fvarIndexBuffers[fvarChannel];
}
void *GetFVarPatchParamBuffer(int fvarChannel = 0) const {
return _fvarParamBuffers[fvarChannel];
}
protected:
CudaPatchTable();
bool allocate(Far::PatchTable const *patchTable);
void *_patchArrays;
void *_indexBuffer;
void *_patchParamBuffer;
void *_varyingPatchArrays;
void *_varyingIndexBuffer;
std::vector<void *> _fvarPatchArrays;
std::vector<void *> _fvarIndexBuffers;
std::vector<void *> _fvarParamBuffers;
};
} // end namespace Osd
} // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;
} // end namespace OpenSubdiv
#endif // OPENSUBDIV3_OSD_CUDA_PATCH_TABLE_H
OpenSubdiv
Definition: limits.h:32
OpenSubdiv::OPENSUBDIV_VERSION::Far::PatchTable
Container for arrays of parametric patches.
Definition: patchTable.h:55
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable
CUDA patch table.
Definition: cudaPatchTable.h:51
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetFVarPatchArrayBuffer
void * GetFVarPatchArrayBuffer(int fvarChannel) const
Returns the cuda memory of the array of Osd::PatchArray buffer.
Definition: cudaPatchTable.h:81
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_fvarParamBuffers
std::vector< void * > _fvarParamBuffers
Definition: cudaPatchTable.h:109
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::Create
static CudaPatchTable * Create(Far::PatchTable const *patchTable, void *deviceContext=NULL)
Creator. Returns NULL if error.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_varyingPatchArrays
void * _varyingPatchArrays
Definition: cudaPatchTable.h:104
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetVaryingPatchIndexBuffer
void * GetVaryingPatchIndexBuffer() const
Returns the cuda memory of the array of varying control vertices.
Definition: cudaPatchTable.h:73
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_fvarIndexBuffers
std::vector< void * > _fvarIndexBuffers
Definition: cudaPatchTable.h:108
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetVaryingPatchArrayBuffer
void * GetVaryingPatchArrayBuffer() const
Returns the cuda memory of the array of Osd::PatchArray buffer.
Definition: cudaPatchTable.h:69
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_varyingIndexBuffer
void * _varyingIndexBuffer
Definition: cudaPatchTable.h:105
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::~CudaPatchTable
~CudaPatchTable()
Destructor.
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetPatchArrayBuffer
void * GetPatchArrayBuffer() const
Returns the cuda memory of the array of Osd::PatchArray buffer.
Definition: cudaPatchTable.h:60
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_fvarPatchArrays
std::vector< void * > _fvarPatchArrays
Definition: cudaPatchTable.h:107
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::allocate
bool allocate(Far::PatchTable const *patchTable)
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetPatchIndexBuffer
void * GetPatchIndexBuffer() const
Returns the cuda memory of the patch control vertices.
Definition: cudaPatchTable.h:63
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetNumFVarChannels
int GetNumFVarChannels() const
Returns the number of face-varying channels buffers.
Definition: cudaPatchTable.h:78
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_patchArrays
void * _patchArrays
Definition: cudaPatchTable.h:100
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetPatchParamBuffer
void * GetPatchParamBuffer() const
Returns the cuda memory of the array of Osd::PatchParam buffer.
Definition: cudaPatchTable.h:66
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetFVarPatchIndexBuffer
void * GetFVarPatchIndexBuffer(int fvarChannel=0) const
Returns the cuda memory of the array of face-varying control vertices.
Definition: cudaPatchTable.h:86
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::GetFVarPatchParamBuffer
void * GetFVarPatchParamBuffer(int fvarChannel=0) const
Returns the cuda memory of the array of face-varying param.
Definition: cudaPatchTable.h:91
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::CudaPatchTable
CudaPatchTable()
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_patchParamBuffer
void * _patchParamBuffer
Definition: cudaPatchTable.h:102
OpenSubdiv::OPENSUBDIV_VERSION::Osd::CudaPatchTable::_indexBuffer
void * _indexBuffer
Definition: cudaPatchTable.h:101