HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_OSDEval Class Reference

#include <GU_OSDEval.h>

Public Member Functions

 ~GU_OSDEval ()
 
bool initEvaluator (CE_Context &context, int tuple_size)
 
bool setTopology (const GU_OSDTopology &topology, CE_Context &context)
 
bool setPatchCoords (UT_Span< const int > patchFace, UT_Span< const float > patchU, UT_Span< const float > patchV)
 Upload patch coordinates. Call when capture changes. More...
 
bool evaluate (const cl::Buffer &coarseData, cl::Buffer &outResult, cl::Buffer *outDu=nullptr, cl::Buffer *outDv=nullptr)
 
const CE_OSDRefinementrefinement () const
 
bool isValid () const
 
bool refineAttribute (CE_Context &context, const cl::Buffer &coarseData, int tuple_size, CE_FloatArray &refinedOut)
 
int numFaces () const
 
int numPatches () const
 
int numPatchArrays () const
 
const cl::BufferfaceToPatchBuffer ()
 
const cl::BufferpatchToFaceBuffer ()
 int[numPatchFaces] table mapping patch face -> coarse face id. More...
 
cl::Buffer patchArrayBuffer () const
 Delegates to CE_OSDRefinement: More...
 
cl::Buffer patchIndexBuffer () const
 
cl::Buffer patchParamBuffer () const
 

Detailed Description

GPU-side evaluator for subdivision surface limit attributes. Owns topology, evaluator, and cached patch/refined buffers.

Definition at line 28 of file GU_OSDEval.h.

Constructor & Destructor Documentation

GU_OSDEval::~GU_OSDEval ( )

Member Function Documentation

bool GU_OSDEval::evaluate ( const cl::Buffer coarseData,
cl::Buffer outResult,
cl::Buffer outDu = nullptr,
cl::Buffer outDv = nullptr 
)

Evaluate a coarse attribute on the limit surface. Call order requirement: initEvaluator() -> setTopology() -> setPatchCoords() before evaluate(). setPatchCoords() must be called again after every successful setTopology() and whenever the patch face/u/v inputs change. If setPatchCoords() captured zero points, evaluate() returns false. coarseData is already on GPU (e.g. from GA_CEAttribute::bufferR()). outDu/outDv are optional derivative outputs and are caller-owned.

const cl::Buffer* GU_OSDEval::faceToPatchBuffer ( )

int2[numFaces] table: (firstPatchIdx, patchCount) per coarse face. Built on first call, cached until next setTopology().

bool GU_OSDEval::initEvaluator ( CE_Context context,
int  tuple_size 
)

Initialize evaluator kernels for a tuple size. Must be called before evaluate().

bool GU_OSDEval::isValid ( ) const
inline

Returns true when evaluator + topology are initialized. Patch coordinates are tracked separately via setPatchCoords().

Definition at line 70 of file GU_OSDEval.h.

int GU_OSDEval::numFaces ( ) const
inline

Definition at line 86 of file GU_OSDEval.h.

int GU_OSDEval::numPatchArrays ( ) const
int GU_OSDEval::numPatches ( ) const
cl::Buffer GU_OSDEval::patchArrayBuffer ( ) const

Delegates to CE_OSDRefinement:

cl::Buffer GU_OSDEval::patchIndexBuffer ( ) const
cl::Buffer GU_OSDEval::patchParamBuffer ( ) const
const cl::Buffer* GU_OSDEval::patchToFaceBuffer ( )

int[numPatchFaces] table mapping patch face -> coarse face id.

bool GU_OSDEval::refineAttribute ( CE_Context context,
const cl::Buffer coarseData,
int  tuple_size,
CE_FloatArray refinedOut 
)

Stencil-eval coarse -> refined control points. Lazily creates/caches evaluator for the given tuple_size. refinedOut must be pre-allocated to numRefinedVerts * tuple_size.

const CE_OSDRefinement* GU_OSDEval::refinement ( ) const
inline

Definition at line 66 of file GU_OSDEval.h.

bool GU_OSDEval::setPatchCoords ( UT_Span< const int patchFace,
UT_Span< const float patchU,
UT_Span< const float patchV 
)

Upload patch coordinates. Call when capture changes.

bool GU_OSDEval::setTopology ( const GU_OSDTopology topology,
CE_Context context 
)

Build CL topology from an OpenSubdiv TopologyRefiner. Caller must call initEvaluator() first.


The documentation for this class was generated from the following file: