From 8a8771c97d1cbeeaaf67e2bb8602d857ea28567b Mon Sep 17 00:00:00 2001 From: Takahito Tejima Date: Mon, 20 Jul 2015 17:13:51 -0700 Subject: [PATCH] Revert "Add ISPC limit surface evaluation" --- CMakeLists.txt | 11 - cmake/FindISPC.cmake | 94 --- examples/glEvalLimit/glEvalLimit.cpp | 36 +- examples/glEvalLimit/particles.cpp | 52 +- examples/glEvalLimit/particles.h | 11 +- opensubdiv/CMakeLists.txt | 26 +- opensubdiv/far/patchParam.h | 23 - opensubdiv/far/patchTable.h | 6 - opensubdiv/osd/CMakeLists.txt | 18 +- opensubdiv/osd/ispcEvalLimitKernel.ispc | 880 ------------------------ opensubdiv/osd/ispcEvalLimitKernel.isph | 55 -- opensubdiv/osd/ispcEvaluator.cpp | 289 -------- opensubdiv/osd/ispcEvaluator.h | 482 ------------- 13 files changed, 30 insertions(+), 1953 deletions(-) delete mode 100644 cmake/FindISPC.cmake delete mode 100644 opensubdiv/osd/ispcEvalLimitKernel.ispc delete mode 100644 opensubdiv/osd/ispcEvalLimitKernel.isph delete mode 100644 opensubdiv/osd/ispcEvaluator.cpp delete mode 100644 opensubdiv/osd/ispcEvaluator.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ab9fcb5f..a4ebb179 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,8 +197,6 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANGCC OR CMAKE_COMPILER_IS_IC endif() endforeach() - - list(APPEND OSD_COMPILER_FLAGS -std=c++11) endif() elseif(MSVC) @@ -323,9 +321,6 @@ endif() if(NOT NO_TBB) find_package(TBB 4.0) endif() -if(NOT NO_ISPC) - find_package(ISPC 1.6) -endif() if (NOT NO_OPENGL) find_package(OpenGL) endif() @@ -544,12 +539,6 @@ if (NOT NO_MAYA) endif() endif() -if(ISPC_FOUND) - add_definitions( - -DOPENSUBDIV_HAS_ISPC - ) -endif() - # Link examples & regressions dynamically against Osd set( OSD_LINK_TARGET osd_dynamic_cpu osd_dynamic_gpu ) diff --git a/cmake/FindISPC.cmake b/cmake/FindISPC.cmake deleted file mode 100644 index c57f2189..00000000 --- a/cmake/FindISPC.cmake +++ /dev/null @@ -1,94 +0,0 @@ -# -# Copyright 2013 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. -# - -# - Try to find Intel's ISPC -# Once done this will define -# -# ISPC_FOUND - System has ISPC -# ISPC_DIR - The ISPC directory - -# Obtain ISPC directory -if (WIN32) - #NOT IMPLEMENTED -elseif (APPLE) - #NOT IMPLEMENTED -else () - find_path(ISPC_DIR - NAMES - ispc - PATHS - ${ISPC_LOCATION} - NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH - DOC "The directory where ISPC reside") -endif () - -if (ISPC_DIR) - execute_process(COMMAND ${ISPC_DIR}/ispc --version OUTPUT_VARIABLE ISPC_VERSION) - string(REGEX MATCH "[0-9].[0-9].[0-9]" ISPC_VERSION ${ISPC_VERSION}) -endif () - -include(FindPackageHandleStandardArgs) - -find_package_handle_standard_args(ISPC - REQUIRED_VARS - ISPC_DIR - VERSION_VAR - ISPC_VERSION -) - -mark_as_advanced( ISPC_DIR ) - -MACRO (ispc_compile) - - SET(ISPC_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/osd_ispc_obj.dir) - - SET(ISPC_OBJECTS "") - - FOREACH(src ${ARGN}) - - GET_FILENAME_COMPONENT(fname ${src} NAME_WE) - - SET(results "${ISPC_TARGET_DIR}/${fname}.dev.o") - - ADD_CUSTOM_COMMAND( - OUTPUT ${results} ${ISPC_TARGET_DIR}/${fname}_ispc.h - COMMAND ${ISPC_DIR}/ispc - --pic - -O1 - --wno-perf - --woff - -h ${ISPC_TARGET_DIR}/${fname}_ispc.h - -MMM ${ISPC_TARGET_DIR}/${fname}.dev.idep - -o ${ISPC_TARGET_DIR}/${fname}.dev.o - ${CMAKE_CURRENT_SOURCE_DIR}/${src} - \; - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${src} - ) - - SET(ISPC_OBJECTS ${ISPC_OBJECTS} ${results}) - - ENDFOREACH() - -ENDMACRO() - diff --git a/examples/glEvalLimit/glEvalLimit.cpp b/examples/glEvalLimit/glEvalLimit.cpp index 82dfdb50..98ff3d1b 100644 --- a/examples/glEvalLimit/glEvalLimit.cpp +++ b/examples/glEvalLimit/glEvalLimit.cpp @@ -34,10 +34,6 @@ GLFWmonitor* g_primary=0; #include #include -#ifdef OPENSUBDIV_HAS_ISPC - #include -#endif - #ifdef OPENSUBDIV_HAS_TBB #include #endif @@ -108,8 +104,7 @@ enum KernelType { kCPU = 0, kCUDA = 3, kCL = 4, kGLXFB = 5, - kGLCompute = 6, - kISPC = 7 }; + kGLCompute = 6 }; enum EndCap { kEndCapBSplineBasis, kEndCapGregoryBasis }; @@ -174,10 +169,10 @@ float g_currentTime = 0; Stopwatch g_fpsTimer; //------------------------------------------------------------------------------ -int g_nParticles = 655360; +int g_nParticles = 65536; bool g_randomStart = true;//false; -bool g_animParticles = false; +bool g_animParticles = true; GLuint g_samplesVAO=0; @@ -444,9 +439,7 @@ updateGeom() { assert(g_particles); float elapsed = g_currentTime - g_prevTime; - if(elapsed != 0.0f) { - g_particles->Update(elapsed); - } + g_particles->Update(elapsed); g_prevTime = g_currentTime; std::vector const &patchCoords @@ -471,7 +464,7 @@ updateGeom() { } s.Stop(); - + g_evalTime = float(s.GetElapsed()); } @@ -655,20 +648,8 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level) { (vertexStencils, varyingStencils, nCoarseVertices, nverts, g_nParticles, g_patchTable, &glComputeEvaluatorCache); - - } #endif -#if defined(OPENSUBDIV_HAS_ISPC) && defined(OPENSUBDIV_HAS_TBB) - else if(g_kernel == kISPC) { - g_evalOutput = new EvalOutput - (vertexStencils, varyingStencils, - nCoarseVertices, nverts, g_nParticles, g_patchTable); - } -#endif + } // Create the 'uv particles' manager - this class manages the limit // location samples (ptex face index, (s,t) and updates them between frames. @@ -894,7 +875,7 @@ display() { } if (g_endCap != kEndCapBSplineBasis && - (g_kernel != kCPU && g_kernel != kOPENMP && g_kernel != kTBB && g_kernel != kISPC)) { + (g_kernel != kCPU && g_kernel != kOPENMP && g_kernel != kTBB)) { static char msg[] = "ERROR: This kernel only supports BSpline basis patches."; g_hud.DrawString(g_width/4, g_height/4+20, 1, 0, 0, msg); @@ -1148,9 +1129,6 @@ initHUD() { #ifdef OPENSUBDIV_HAS_TBB g_hud.AddPullDownButton(compute_pulldown, "TBB", kTBB); #endif -#if defined(OPENSUBDIV_HAS_ISPC) && defined(OPENSUBDIV_HAS_TBB) - g_hud.AddPullDownButton(compute_pulldown, "ISPC", kISPC); -#endif #ifdef OPENSUBDIV_HAS_CUDA g_hud.AddPullDownButton(compute_pulldown, "CUDA", kCUDA); #endif diff --git a/examples/glEvalLimit/particles.cpp b/examples/glEvalLimit/particles.cpp index add4049b..a07b9572 100644 --- a/examples/glEvalLimit/particles.cpp +++ b/examples/glEvalLimit/particles.cpp @@ -32,17 +32,17 @@ #ifdef OPENSUBDIV_HAS_TBB #include #include - +tbb::atomic g_tbbCounter; class TbbUpdateKernel { public: TbbUpdateKernel(float speed, STParticles::Position *positions, float *velocities, std::vector const &adjacency, - PatchHandleMap *patchHandleMap, + OpenSubdiv::Osd::PatchCoord *patchCoords, OpenSubdiv::Far::PatchMap const *patchMap) : _speed(speed), _positions(positions), _velocities(velocities), - _adjacency(adjacency), _patchHandleMap(patchHandleMap), _patchMap(patchMap) { + _adjacency(adjacency), _patchCoords(patchCoords), _patchMap(patchMap) { } void operator () (tbb::blocked_range const &r) const { @@ -76,13 +76,9 @@ public: OpenSubdiv::Far::PatchTable::PatchHandle const *handle = _patchMap->FindPatch(p->ptexIndex, p->s, p->t); if (handle) { - PatchHandleMap::accessor a; - if( !_patchHandleMap->find(a, handle)) { - _patchHandleMap->insert(a, handle); - } - std::vector &st = a->second; - st.push_back(p->s); - st.push_back(p->t); + int index = g_tbbCounter.fetch_and_add(1); + _patchCoords[index] = + OpenSubdiv::Osd::PatchCoord(*handle, p->s, p->t); } } } @@ -91,7 +87,7 @@ private: STParticles::Position *_positions; float *_velocities; std::vector const &_adjacency; - PatchHandleMap *_patchHandleMap; + OpenSubdiv::Osd::PatchCoord *_patchCoords; OpenSubdiv::Far::PatchMap const *_patchMap; }; #endif @@ -280,36 +276,18 @@ STParticles::Update(float deltaTime) { if (deltaTime == 0) return; float speed = GetSpeed() * std::max(0.001f, std::min(deltaTime, 0.5f)); + _patchCoords.clear(); + // XXX: this process should be parallelized. #ifdef OPENSUBDIV_HAS_TBB - _patchHandleMap.clear(); - + + _patchCoords.resize((int)GetNumParticles()); TbbUpdateKernel kernel(speed, &_positions[0], &_velocities[0], - _adjacency, &_patchHandleMap, _patchMap);; + _adjacency, &_patchCoords[0], _patchMap);; + g_tbbCounter = 0; tbb::blocked_range range(0, GetNumParticles(), 256); tbb::parallel_for(range, kernel); - - - int nCoord = 0; - for(PatchHandleMap::iterator i = _patchHandleMap.begin(); - i != _patchHandleMap.end(); - i ++) { - nCoord += (i->second.size() / 2); - } - - _patchCoords.resize(nCoord); - - int index = 0; - for(PatchHandleMap::iterator i = _patchHandleMap.begin(); - i != _patchHandleMap.end(); - i ++) { - for(int j = 0; j < i->second.size(); j += 2) { - _patchCoords[index].handle = *(i->first); - _patchCoords[index].s = i->second[j]; - _patchCoords[index].t = i->second[j+1]; - index ++; - } - } + _patchCoords.resize(g_tbbCounter); #else Position * p = &_positions[0]; float * dp = &_velocities[0]; @@ -345,7 +323,7 @@ STParticles::Update(float deltaTime) { OpenSubdiv::Osd::PatchCoord(*handle, p->s, p->t)); } } -#endif +#endif } // Dump adjacency info diff --git a/examples/glEvalLimit/particles.h b/examples/glEvalLimit/particles.h index ff4fa940..887add25 100644 --- a/examples/glEvalLimit/particles.h +++ b/examples/glEvalLimit/particles.h @@ -30,11 +30,6 @@ #include #include -#ifdef OPENSUBDIV_HAS_TBB -#include -typedef tbb::concurrent_hash_map< OpenSubdiv::Far::PatchTable::PatchHandle const*, std::vector > PatchHandleMap; -#endif - // // In order to emphasize the dynamic nature of the EvalLimit API, where the // locations can be arbitrarily updated before each evaluation, the glEvalLimit @@ -147,7 +142,7 @@ public: return _velocities; } - std::vector const &GetPatchCoords() const { + std::vector GetPatchCoords() const { return _patchCoords; } @@ -164,10 +159,6 @@ private: std::vector _positions; std::vector _velocities; - -#ifdef OPENSUBDIV_HAS_TBB - PatchHandleMap _patchHandleMap; -#endif std::vector _patchCoords; diff --git a/opensubdiv/CMakeLists.txt b/opensubdiv/CMakeLists.txt index 06d2f31a..4b3cec84 100644 --- a/opensubdiv/CMakeLists.txt +++ b/opensubdiv/CMakeLists.txt @@ -147,16 +147,9 @@ if (NOT NO_LIB) ) set_target_properties(osd_static_cpu PROPERTIES OUTPUT_NAME osdCPU CLEAN_DIRECT_OUTPUT 1) - if( ISPC_FOUND) - target_link_libraries(osd_static_cpu - osd_ispc_obj - ${PLATFORM_CPU_LIBRARIES} - ) - else() - target_link_libraries(osd_static_cpu - ${PLATFORM_CPU_LIBRARIES} - ) - endif() + target_link_libraries(osd_static_cpu + ${PLATFORM_CPU_LIBRARIES} + ) install( TARGETS osd_static_cpu DESTINATION "${CMAKE_LIBDIR_BASE}" ) @@ -207,16 +200,9 @@ if (NOT NO_LIB) ) endif() - if ( ISPC_FOUND) - target_link_libraries(osd_dynamic_cpu - osd_ispc_obj - ${PLATFORM_CPU_LIBRARIES} - ) - else() - target_link_libraries(osd_dynamic_cpu - ${PLATFORM_CPU_LIBRARIES} - ) - endif() + target_link_libraries(osd_dynamic_cpu + ${PLATFORM_CPU_LIBRARIES} + ) install( TARGETS osd_dynamic_cpu LIBRARY DESTINATION "${CMAKE_LIBDIR_BASE}" ) diff --git a/opensubdiv/far/patchParam.h b/opensubdiv/far/patchParam.h index 6c65258f..c5f0243f 100644 --- a/opensubdiv/far/patchParam.h +++ b/opensubdiv/far/patchParam.h @@ -116,15 +116,6 @@ struct PatchParam { /// void Normalize( float & u, float & v ) const; - /// This function is the reverse operation of function Normalize() - /// The (u,v) pair is converted from patch sub-parametric space to control - /// face parametric space. - /// - /// @param u u parameter - /// @param v v parameter - /// - void Denormalize( float & u, float & v) const; - unsigned int field0:32; unsigned int field1:32; }; @@ -170,20 +161,6 @@ PatchParam::Normalize( float & u, float & v ) const { v = (v - pv) / frac; } -inline void -PatchParam::Denormalize( float & u, float & v ) const { - - float frac = GetParamFraction(); - - // top left corner - float pu = (float)GetU()*frac; - float pv = (float)GetV()*frac; - - // normalize u,v coordinates - u = u * frac + pu; - v = v * frac + pv; -} - } // end namespace Far } // end namespace OPENSUBDIV_VERSION diff --git a/opensubdiv/far/patchTable.h b/opensubdiv/far/patchTable.h index 351a901f..39aa5302 100644 --- a/opensubdiv/far/patchTable.h +++ b/opensubdiv/far/patchTable.h @@ -68,12 +68,6 @@ public: Index arrayIndex, // Array index of the patch patchIndex, // Absolute Index of the patch vertIndex; // Relative offset to the first CV of the patch in array - - bool isEqual(const PatchHandle &other) { - return other.arrayIndex == arrayIndex && - other.patchIndex == patchIndex && - other.vertIndex == vertIndex; - } }; public: diff --git a/opensubdiv/osd/CMakeLists.txt b/opensubdiv/osd/CMakeLists.txt index 43268451..f457dddd 100755 --- a/opensubdiv/osd/CMakeLists.txt +++ b/opensubdiv/osd/CMakeLists.txt @@ -26,7 +26,6 @@ #------------------------------------------------------------------------------- # source & headers - set(CPU_SOURCE_FILES cpuEvaluator.cpp cpuKernel.cpp @@ -34,12 +33,8 @@ set(CPU_SOURCE_FILES cpuVertexBuffer.cpp ) -if( ISPC_FOUND) - list(APPEND CPU_SOURCE_FILES ispcEvaluator.cpp) -endif() - set(GPU_SOURCE_FILES ) -set(ISPC_SOURCE_FILES ) + set(INC_FILES ) set(PRIVATE_HEADER_FILES @@ -301,17 +296,6 @@ if( CUDA_FOUND ) endif() endif() -if( ISPC_FOUND) - list(APPEND ISPC_SOURCE_FILES - ispcEvalLimitKernel.ispc - ) - - # Compile ISPC code to objs - ispc_compile(${ISPC_SOURCE_FILES}) - ADD_LIBRARY(osd_ispc_obj STATIC ${ISPC_OBJECTS}) - SET_TARGET_PROPERTIES(osd_ispc_obj PROPERTIES LINKER_LANGUAGE C) -endif() - list(APPEND DOXY_HEADER_FILES ${CUDA_PUBLIC_HEADERS}) #------------------------------------------------------------------------------- diff --git a/opensubdiv/osd/ispcEvalLimitKernel.ispc b/opensubdiv/osd/ispcEvalLimitKernel.ispc deleted file mode 100644 index 3af62889..00000000 --- a/opensubdiv/osd/ispcEvalLimitKernel.ispc +++ /dev/null @@ -1,880 +0,0 @@ -// -// Copyright 2013 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. -// - - -#define MAX_CHANNEL 4 - -struct BufferDescriptor { - int offset; // offset to desired element data - int length; // number or length of the data - int stride; // stride to the next element -}; - -struct Point { - float x; - float y; - float z; -}; - -inline struct Point operator+(struct Point a, struct Point b) { - struct Point result; - result.x = a.x + b.x; - result.y = a.y + b.y; - result.z = a.z + b.z; - - return result; -} - -inline uniform struct Point operator+(uniform struct Point a, uniform struct Point b) { - uniform struct Point result; - result.x = a.x + b.x; - result.y = a.y + b.y; - result.z = a.z + b.z; - - return result; -} - -inline struct Point operator-(struct Point a, struct Point b) { - struct Point result; - result.x = a.x - b.x; - result.y = a.y - b.y; - result.z = a.z - b.z; - - return result; -} - -inline uniform struct Point operator-(uniform struct Point a, uniform struct Point b) { - uniform struct Point result; - result.x = a.x - b.x; - result.y = a.y - b.y; - result.z = a.z - b.z; - - return result; -} - -inline struct Point operator*(struct Point a, float b) { - struct Point result; - result.x = a.x * b; - result.y = a.y * b; - result.z = a.z * b; - - return result; -} - -inline uniform struct Point operator*(uniform struct Point a, uniform float b) { - uniform struct Point result; - result.x = a.x * b; - result.y = a.y * b; - result.z = a.z * b; - - return result; -} - -inline struct Point operator*(float b, struct Point a) { - struct Point result; - result.x = b * a.x; - result.y = b * a.y; - result.z = b * a.z; - - return result; -} - -inline uniform struct Point operator*(uniform float b, uniform struct Point a) { - uniform struct Point result; - result.x = b * a.x; - result.y = b * a.y; - result.z = b * a.z; - - return result; -} - -inline struct Point operator/(struct Point a, float b) { - struct Point result; - result.x = a.x / b; - result.y = a.y / b; - result.z = a.z / b; - - return result; -} - -inline uniform struct Point operator/(uniform struct Point a, uniform float b) { - uniform struct Point result; - result.x = a.x / b; - result.y = a.y / b; - result.z = a.z / b; - - return result; -} - -inline void cross(struct Point &a, struct Point &b, struct Point &c) -{ - c.x = a.y*b.z - a.z*b.y; - c.y = a.z*b.x - a.x*b.z; - c.z = a.x*b.y - a.y*b.x; -} - -inline uniform bool -nonQuadRoot(uniform unsigned int bitField) -{ - return (bitField >> 3) & 0x1; -} - -inline uniform unsigned int getU(uniform unsigned int bitField) -{ - return (uniform unsigned int)((bitField >> 22) & 0x3ff); -} - -inline uniform unsigned int getV(uniform unsigned int bitField) -{ - return (uniform unsigned int)((bitField >> 12) & 0x3ff); -} - -inline uniform unsigned int getBoundary(uniform unsigned int bitField) -{ - return (uniform unsigned int)((bitField >> 8) & 0xf); -} - -inline uniform unsigned int getDepth(uniform unsigned int bitField) -{ - return (uniform unsigned int)(bitField & 0xf); -} - -inline uniform float -getParamFraction(uniform unsigned int bitField){ - if (nonQuadRoot(bitField)) { - return 1.0f / (1 << (getDepth(bitField)-1)); - } else { - return 1.0f / (1 << getDepth(bitField)); - } -} - -inline void -adjustBoundaryWeights(uniform unsigned int bitField, - float sWeights[4], - float tWeights[4]) { - - uniform int boundary = getBoundary(bitField); - - if (boundary & 1) { - tWeights[2] -= tWeights[0]; - tWeights[1] += 2*tWeights[0]; - tWeights[0] = 0; - } - if (boundary & 2) { - sWeights[1] -= sWeights[3]; - sWeights[2] += 2*sWeights[3]; - sWeights[3] = 0; - } - if (boundary & 4) { - tWeights[1] -= tWeights[3]; - tWeights[2] += 2*tWeights[3]; - tWeights[3] = 0; - } - if (boundary & 8) { - sWeights[2] -= sWeights[0]; - sWeights[1] += 2*sWeights[0]; - sWeights[0] = 0; - } -} - -inline void -getBSplineWeights(float t, float point[4], float deriv[4]) { - // The four uniform cubic B-Spline basis functions evaluated at t: - float const one6th = 1.0f / 6.0f; - - float t2 = t * t; - float t3 = t * t2; - - point[0] = one6th * (1.0f - 3.0f*(t - t2) - t3); - point[1] = one6th * (4.0f - 6.0f*t2 + 3.0f*t3); - point[2] = one6th * (1.0f + 3.0f*(t + t2 - t3)); - point[3] = one6th * ( t3); - - // Derivatives of the above four basis functions at t: - deriv[0] = -0.5f*t2 + t - 0.5f; - deriv[1] = 1.5f*t2 - 2.0f*t; - deriv[2] = -1.5f*t2 + t + 0.5f; - deriv[3] = 0.5f*t2; -} - -inline void -getBezierWeights(float t, float point[4], float deriv[4]) { - // The four uniform cubic Bezier basis functions (in terms of t and its - // complement tC) evaluated at t: - float t2 = t*t; - float tC = 1.0f - t; - float tC2 = tC * tC; - - point[0] = tC2 * tC; - point[1] = tC2 * t * 3.0f; - point[2] = t2 * tC * 3.0f; - point[3] = t2 * t; - - // Derivatives of the above four basis functions at t: - deriv[0] = -3.0f * tC2; - deriv[1] = 9.0f * t2 - 12.0f * t + 3.0f; - deriv[2] = -9.0f * t2 + 6.0f * t; - deriv[3] = 3.0f * t2; -} - -inline void -getBSplineWeightsNoDerivative(float t, float point[4]) { - // The four uniform cubic B-Spline basis functions evaluated at t: - float const one6th = 1.0f / 6.0f; - - float t2 = t * t; - float t3 = t * t2; - - point[0] = one6th * (1.0f - 3.0f*(t - t2) - t3); - point[1] = one6th * (4.0f - 6.0f*t2 + 3.0f*t3); - point[2] = one6th * (1.0f + 3.0f*(t + t2 - t3)); - point[3] = one6th * ( t3); -} - -inline void -getBezierWeightsNoDerivative(float t, float point[4]) { - // The four uniform cubic Bezier basis functions (in terms of t and its - // complement tC) evaluated at t: - float t2 = t*t; - float tC = 1.0f - t; - float tC2 = tC * tC; - - point[0] = tC2 * tC; - point[1] = tC2 * t * 3.0f; - point[2] = t2 * tC * 3.0f; - point[3] = t2 * t; -} - -export void -evalBilinear(uniform unsigned int bitField, - uniform int nPoint, - uniform const float * uniform u, - uniform const float * uniform v, - uniform const int * uniform vertexIndices, - uniform const BufferDescriptor &inDesc, - uniform const float * uniform inQ, - uniform const BufferDescriptor &outDesc, - uniform float *uniform outQ, - uniform const BufferDescriptor &duDesc, - uniform float *uniform outDQU, - uniform const BufferDescriptor &dvDesc, - uniform float *uniform outDQV) -{ - uniform int nChannel = inDesc.length / 3; - assert(nChannel < MAX_CHANNEL); - - uniform Point controlVertices[MAX_CHANNEL*4]; - for(uniform int i=0; i<4; i++) { - uniform unsigned int id = vertexIndices[i]; - uniform const float * uniform pVertex = inQ + inDesc.offset + id * inDesc.stride; - for(uniform int c=0; c - - - -#ifdef __cplusplus -namespace ispc { /* namespace */ -#endif // __cplusplus -#ifndef __ISPC_STRUCT_BufferDescriptor__ -#define __ISPC_STRUCT_BufferDescriptor__ -struct BufferDescriptor { - int32_t offset; - int32_t length; - int32_t stride; -}; -#endif - - -/////////////////////////////////////////////////////////////////////////// -// Functions exported from ispc code -/////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) && !defined(__ISPC_NO_EXTERN_C) -extern "C" { -#endif // __cplusplus - extern void evalBSpline(int32_t bitField, int32_t nPoint, const float * u, const float * v, const int32_t * vertexIndices, const struct BufferDescriptor &inDesc, const float * inQ, const struct BufferDescriptor &outDesc, float * outQ, const struct BufferDescriptor &duDesc, float * outDQU, const struct BufferDescriptor &dvDesc, float * outDQV); - - extern void evalBilinear(int32_t bitField, int32_t nPoint, const float * u, const float * v, const int32_t * vertexIndices, const struct BufferDescriptor &inDesc, const float * inQ, const struct BufferDescriptor &outDesc, float * outQ, const struct BufferDescriptor &duDesc, float * outDQU, const struct BufferDescriptor &dvDesc, float * outDQV); - - extern void evalGregory(int32_t bitField, int32_t nPoint, const float * u, const float * v, const int32_t * vertexIndices, const struct BufferDescriptor &inDesc, const float * inQ, const struct BufferDescriptor &outDesc, float * outQ, const struct BufferDescriptor &duDesc, float * outDQU, const struct BufferDescriptor &dvDesc, float * outDQV); - - extern void evalBSplineNoDerivative(int32_t bitField, int32_t nPoint, const float * u, const float * v, const int32_t * vertexIndices, const struct BufferDescriptor &inDesc, const float * inQ, const struct BufferDescriptor &outDesc, float * outQ); - - extern void evalBilinearNoDerivative(int32_t bitField, int32_t nPoint, const float * u, const float * v, const int32_t * vertexIndices, const struct BufferDescriptor &inDesc, const float * inQ, const struct BufferDescriptor &outDesc, float * outQ); - - extern void evalGregoryNoDerivative(int32_t bitField, int32_t nPoint, const float * u, const float * v, const int32_t * vertexIndices, const struct BufferDescriptor &inDesc, const float * inQ, const struct BufferDescriptor &outDesc, float * outQ); - - extern void getSIMDWidth(int32_t &simdWidth); -#if defined(__cplusplus) && !defined(__ISPC_NO_EXTERN_C) -} /* end extern C */ -#endif // __cplusplus - - -#ifdef __cplusplus -} /* namespace */ -#endif // __cplusplus - -#endif // ISPC_ISPCEVALLIMITKERNEL_ISPH diff --git a/opensubdiv/osd/ispcEvaluator.cpp b/opensubdiv/osd/ispcEvaluator.cpp deleted file mode 100644 index a9b98d9b..00000000 --- a/opensubdiv/osd/ispcEvaluator.cpp +++ /dev/null @@ -1,289 +0,0 @@ -// -// 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. -// - -#include "ispcEvaluator.h" -#include "cpuKernel.h" -#include "../far/patchBasis.h" -#include "ispcEvalLimitKernel.isph" - -#include -#include - -namespace OpenSubdiv { -namespace OPENSUBDIV_VERSION { - -namespace Osd { - -#define grain_size 512 - -/* static */ -bool -IspcEvaluator::EvalStencils(const float *src, BufferDescriptor const &srcDesc, - float *dst, BufferDescriptor const &dstDesc, - const int * sizes, - const int * offsets, - const int * indices, - const float * weights, - int start, int end) { - - if (end <= start) return true; - if (srcDesc.length != dstDesc.length) return false; - - // XXX: we can probably expand cpuKernel.cpp to here. - CpuEvalStencils(src, srcDesc, dst, dstDesc, - sizes, offsets, indices, weights, start, end); - - return true; -} - -/* static */ -bool -IspcEvaluator::EvalStencils(const float *src, BufferDescriptor const &srcDesc, - float *dst, BufferDescriptor const &dstDesc, - float *du, BufferDescriptor const &duDesc, - float *dv, BufferDescriptor const &dvDesc, - const int * sizes, - const int * offsets, - const int * indices, - const float * weights, - const float * duWeights, - const float * dvWeights, - int start, int end) { - if (end <= start) return true; - if (srcDesc.length != dstDesc.length) return false; - if (srcDesc.length != duDesc.length) return false; - if (srcDesc.length != dvDesc.length) return false; - - CpuEvalStencils(src, srcDesc, - dst, dstDesc, - du, duDesc, - dv, dvDesc, - sizes, offsets, indices, - weights, duWeights, dvWeights, - start, end); - - return true; -} - -template -struct BufferAdapter { - BufferAdapter(T *p, int length, int stride) : - _p(p), _length(length), _stride(stride) { } - void Clear() { - for (int i = 0; i < _length; ++i) _p[i] = 0; - } - void AddWithWeight(T const *src, float w) { - if (_p) { - for (int i = 0; i < _length; ++i) { - _p[i] += src[i] * w; - } - } - } - const T *operator[] (int index) const { - return _p + _stride * index; - } - BufferAdapter & operator ++() { - if (_p) { - _p += _stride; - } - return *this; - } - - T *_p; - int _length; - int _stride; -}; - -/* static */ -bool -IspcEvaluator::EvalPatches(const float *src, BufferDescriptor const &srcDesc, - float *dst, BufferDescriptor const &dstDesc, - int numPatchCoords, - const PatchCoord *patchCoords, - const PatchArray *patchArrays, - const int *patchIndexBuffer, - const PatchParam *patchParamBuffer) { - if (srcDesc.length != dstDesc.length) return false; - - // Copy BufferDescriptor to ispc version - // Since memory alignment in ISPC may be different from C++, - // we use the assignment for each field instead of the assignment for - // the whole struct - ispc::BufferDescriptor ispcSrcDesc; - ispcSrcDesc.offset = srcDesc.offset; - ispcSrcDesc.length = srcDesc.length; - ispcSrcDesc.stride = srcDesc.stride; - - tbb::blocked_range range = tbb::blocked_range(0, numPatchCoords, grain_size); - tbb::parallel_for(range, [&](const tbb::blocked_range &r) - { - uint i = r.begin(); - - ispc::BufferDescriptor ispcDstDesc, ispcDuDesc, ispcDvDesc; - ispcDstDesc.offset = dstDesc.offset + dstDesc.offset + i * dstDesc.stride; - ispcDstDesc.length = dstDesc.length; - ispcDstDesc.stride = dstDesc.stride; - - while (i < r.end()) { - // the patch coordinates are sorted by patch handle - // the following code searches the coordinates that - // belongs to the same patch so that they can be evalauated - // with ISPC - int nCoord = 1; - Far::PatchTable::PatchHandle handle = patchCoords[i].handle; - while(i + nCoord < r.end() && - handle.isEqual(patchCoords[i + nCoord].handle) ) - nCoord ++; - - PatchArray const &array = patchArrays[handle.arrayIndex]; - int patchType = array.GetPatchType(); - Far::PatchParam const & param = patchParamBuffer[handle.patchIndex]; - - unsigned int bitField = param.field1; - - const int *cvs = &patchIndexBuffer[array.indexBase + handle.vertIndex]; - - __declspec( align(64) ) float u[nCoord]; - __declspec( align(64) ) float v[nCoord]; - - for(int n=0; n range = tbb::blocked_range(0, numPatchCoords, grain_size); - tbb::parallel_for(range, [&](const tbb::blocked_range &r) - { - uint i = r.begin(); - - ispc::BufferDescriptor ispcDstDesc, ispcDuDesc, ispcDvDesc; - ispcDstDesc.offset = dstDesc.offset + dstDesc.offset + i * dstDesc.stride; - ispcDstDesc.length = dstDesc.length; - ispcDstDesc.stride = dstDesc.stride; - - ispcDuDesc.offset = duDesc.offset + i * duDesc.stride; - ispcDuDesc.length = duDesc.length; - ispcDuDesc.stride = duDesc.stride; - - ispcDvDesc.offset = dvDesc.offset + i * dvDesc.stride; - ispcDvDesc.length = dvDesc.length; - ispcDvDesc.stride = dvDesc.stride; - while (i < r.end()) { - // the patch coordinates are sorted by patch handle - // the following code searches the coordinates that - // belongs to the same patch so that they can be evalauated - // with ISPC - int nCoord = 1; - Far::PatchTable::PatchHandle handle = patchCoords[i].handle; - while(i + nCoord < r.end() && - handle.isEqual(patchCoords[i + nCoord].handle) ) - nCoord ++; - - PatchArray const &array = patchArrays[handle.arrayIndex]; - int patchType = array.GetPatchType(); - Far::PatchParam const & param = patchParamBuffer[handle.patchIndex]; - - unsigned int bitField = param.field1; - - const int *cvs = &patchIndexBuffer[array.indexBase + handle.vertIndex]; - - __declspec( align(64) ) float u[nCoord]; - __declspec( align(64) ) float v[nCoord]; - - for(int n=0; n -#include -#include "../osd/bufferDescriptor.h" -#include "../osd/types.h" - -namespace OpenSubdiv { -namespace OPENSUBDIV_VERSION { - -namespace Osd { - -class IspcEvaluator { -public: - /// ---------------------------------------------------------------------- - /// - /// Stencil evaluations with StencilTable - /// - /// ---------------------------------------------------------------------- - - /// \brief Generic static eval stencils function. This function has a same - /// signature as other device kernels have so that it can be called - /// in the same way from OsdMesh template interface. - /// - /// @param srcBuffer Input primvar buffer. - /// must have BindCpuBuffer() method returning a - /// const float pointer for read - /// - /// @param srcDesc vertex buffer descriptor for the input buffer - /// - /// @param dstBuffer Output primvar buffer - /// must have BindCpuBuffer() method returning a - /// float pointer for write - /// - /// @param dstDesc vertex buffer descriptor for the output buffer - /// - /// @param stencilTable Far::StencilTable or equivalent - /// - /// @param instance not used in the cpu kernel - /// (declared as a typed pointer to prevent - /// undesirable template resolution) - /// - /// @param deviceContext not used in the cpu kernel - /// - template - static bool EvalStencils( - SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, - DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, - STENCIL_TABLE const *stencilTable, - const IspcEvaluator *instance = NULL, - void * deviceContext = NULL) { - - (void)instance; // unused - (void)deviceContext; // unused - - if (stencilTable->GetNumStencils() == 0) - return false; - - return EvalStencils(srcBuffer->BindCpuBuffer(), srcDesc, - dstBuffer->BindCpuBuffer(), dstDesc, - &stencilTable->GetSizes()[0], - &stencilTable->GetOffsets()[0], - &stencilTable->GetControlIndices()[0], - &stencilTable->GetWeights()[0], - /*start = */ 0, - /*end = */ stencilTable->GetNumStencils()); - } - - /// \brief Static eval stencils function which takes raw CPU pointers for - /// input and output. - /// - /// @param src Input primvar pointer. An offset of srcDesc - /// will be applied internally (i.e. the pointer - /// should not include the offset) - /// - /// @param srcDesc vertex buffer descriptor for the input buffer - /// - /// @param dst Output primvar pointer. An offset of dstDesc - /// will be applied internally. - /// - /// @param dstDesc vertex buffer descriptor for the output buffer - /// - /// @param sizes pointer to the sizes buffer of the stencil table - /// to apply for the range [start, end) - /// - /// @param offsets pointer to the offsets buffer of the stencil table - /// - /// @param indices pointer to the indices buffer of the stencil table - /// - /// @param weights pointer to the weights buffer of the stencil table - /// - /// @param start start index of stencil table - /// - /// @param end end index of stencil table - /// - static bool EvalStencils( - const float *src, BufferDescriptor const &srcDesc, - float *dst, BufferDescriptor const &dstDesc, - const int * sizes, - const int * offsets, - const int * indices, - const float * weights, - int start, int end); - - /// \brief Generic static eval stencils function with derivatives. - /// This function has a same signature as other device kernels - /// have so that it can be called in the same way from OsdMesh - /// template interface. - /// - /// @param srcBuffer Input primvar buffer. - /// must have BindCpuBuffer() method returning a - /// const float pointer for read - /// - /// @param srcDesc vertex buffer descriptor for the input buffer - /// - /// @param dstBuffer Output primvar buffer - /// must have BindCpuBuffer() method returning a - /// float pointer for write - /// - /// @param dstDesc vertex buffer descriptor for the output buffer - /// - /// @param duBuffer Output U-derivative buffer - /// must have BindCpuBuffer() method returning a - /// float pointer for write - /// - /// @param duDesc vertex buffer descriptor for the output buffer - /// - /// @param dvBuffer Output V-derivative buffer - /// must have BindCpuBuffer() method returning a - /// float pointer for write - /// - /// @param dvDesc vertex buffer descriptor for the output buffer - /// - /// @param stencilTable Far::StencilTable or equivalent - /// - /// @param instance not used in the cpu kernel - /// (declared as a typed pointer to prevent - /// undesirable template resolution) - /// - /// @param deviceContext not used in the cpu kernel - /// - template - static bool EvalStencils( - SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, - DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, - DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, - DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, - STENCIL_TABLE const *stencilTable, - const IspcEvaluator *instance = NULL, - void * deviceContext = NULL) { - - (void)instance; // unused - (void)deviceContext; // unused - - return EvalStencils(srcBuffer->BindCpuBuffer(), srcDesc, - dstBuffer->BindCpuBuffer(), dstDesc, - duBuffer->BindCpuBuffer(), duDesc, - dvBuffer->BindCpuBuffer(), dvDesc, - &stencilTable->GetSizes()[0], - &stencilTable->GetOffsets()[0], - &stencilTable->GetControlIndices()[0], - &stencilTable->GetWeights()[0], - &stencilTable->GetDuWeights()[0], - &stencilTable->GetDvWeights()[0], - /*start = */ 0, - /*end = */ stencilTable->GetNumStencils()); - } - - /// \brief Static eval stencils function with derivatives, which takes - /// raw CPU pointers for input and output. - /// - /// @param src Input primvar pointer. An offset of srcDesc - /// will be applied internally (i.e. the pointer - /// should not include the offset) - /// - /// @param srcDesc vertex buffer descriptor for the input buffer - /// - /// @param dst Output primvar pointer. An offset of dstDesc - /// will be applied internally. - /// - /// @param dstDesc vertex buffer descriptor for the output buffer - /// - /// @param du Output U-derivatives pointer. An offset of - /// duDesc will be applied internally. - /// - /// @param duDesc vertex buffer descriptor for the output buffer - /// - /// @param dv Output V-derivatives pointer. An offset of - /// dvDesc will be applied internally. - /// - /// @param dvDesc vertex buffer descriptor for the output buffer - /// - /// @param sizes pointer to the sizes buffer of the stencil table - /// - /// @param offsets pointer to the offsets buffer of the stencil table - /// - /// @param indices pointer to the indices buffer of the stencil table - /// - /// @param weights pointer to the weights buffer of the stencil table - /// - /// @param duWeights pointer to the du-weights buffer of the stencil table - /// - /// @param dvWeights pointer to the dv-weights buffer of the stencil table - /// - /// @param start start index of stencil table - /// - /// @param end end index of stencil table - /// - static bool EvalStencils( - const float *src, BufferDescriptor const &srcDesc, - float *dst, BufferDescriptor const &dstDesc, - float *du, BufferDescriptor const &duDesc, - float *dv, BufferDescriptor const &dvDesc, - const int * sizes, - const int * offsets, - const int * indices, - const float * weights, - const float * duWeights, - const float * dvWeights, - int start, int end); - - /// ---------------------------------------------------------------------- - /// - /// Limit evaluations with PatchTable - /// - /// ---------------------------------------------------------------------- - - /// \brief Generic limit eval function. This function has a same - /// signature as other device kernels have so that it can be called - /// in the same way. - /// - /// @param srcBuffer Input primvar buffer. - /// must have BindCpuBuffer() method returning a - /// const float pointer for read - /// - /// @param srcDesc vertex buffer descriptor for the input buffer - /// - /// @param dstBuffer Output primvar buffer - /// must have BindCpuBuffer() method returning a - /// float pointer for write - /// - /// @param dstDesc vertex buffer descriptor for the output buffer - /// - /// @param numPatchCoords number of patchCoords. - /// - /// @param patchCoords array of locations to be evaluated. - /// - /// @param patchTable CpuPatchTable or equivalent - /// XXX: currently Far::PatchTable can't be used - /// due to interface mismatch - /// - /// @param instance not used in the cpu evaluator - /// - /// @param deviceContext not used in the cpu evaluator - /// - template - static bool EvalPatches( - SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, - DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, - int numPatchCoords, - PATCHCOORD_BUFFER *patchCoords, - PATCH_TABLE *patchTable, - IspcEvaluator const *instance = NULL, - void * deviceContext = NULL) { - - (void)instance; // unused - (void)deviceContext; // unused - - return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc, - dstBuffer->BindCpuBuffer(), dstDesc, - numPatchCoords, - (const PatchCoord*)patchCoords->BindCpuBuffer(), - patchTable->GetPatchArrayBuffer(), - patchTable->GetPatchIndexBuffer(), - patchTable->GetPatchParamBuffer()); - } - - /// \brief Generic limit eval function with derivatives. This function has - /// a same signature as other device kernels have so that it can be - /// called in the same way. - /// - /// @param srcBuffer Input primvar buffer. - /// must have BindCpuBuffer() method returning a - /// const float pointer for read - /// - /// @param srcDesc vertex buffer descriptor for the input buffer - /// - /// @param dstBuffer Output primvar buffer - /// must have BindCpuBuffer() method returning a - /// float pointer for write - /// - /// @param dstDesc vertex buffer descriptor for the output buffer - /// - /// @param duBuffer Output U-derivatives buffer - /// must have BindCpuBuffer() method returning a - /// float pointer for write - /// - /// @param duDesc vertex buffer descriptor for the duBuffer - /// - /// @param dvBuffer Output V-derivatives buffer - /// must have BindCpuBuffer() method returning a - /// float pointer for write - /// - /// @param dvDesc vertex buffer descriptor for the dvBuffer - /// - /// @param numPatchCoords number of patchCoords. - /// - /// @param patchCoords array of locations to be evaluated. - /// - /// @param patchTable CpuPatchTable or equivalent - /// XXX: currently Far::PatchTable can't be used - /// due to interface mismatch - /// - /// @param instance not used in the cpu evaluator - /// - /// @param deviceContext not used in the cpu evaluator - /// - template - static bool EvalPatches( - SRC_BUFFER *srcBuffer, BufferDescriptor const &srcDesc, - DST_BUFFER *dstBuffer, BufferDescriptor const &dstDesc, - DST_BUFFER *duBuffer, BufferDescriptor const &duDesc, - DST_BUFFER *dvBuffer, BufferDescriptor const &dvDesc, - int numPatchCoords, - PATCHCOORD_BUFFER *patchCoords, - PATCH_TABLE *patchTable, - IspcEvaluator const *instance = NULL, - void * deviceContext = NULL) { - (void)instance; // unused - (void)deviceContext; // unused - - // XXX: PatchCoords is somewhat abusing vertex primvar buffer interop. - // ideally all buffer classes should have templated by datatype - // so that downcast isn't needed there. - // (e.g. Osd::CpuBuffer ) - // - return EvalPatches(srcBuffer->BindCpuBuffer(), srcDesc, - dstBuffer->BindCpuBuffer(), dstDesc, - duBuffer->BindCpuBuffer(), duDesc, - dvBuffer->BindCpuBuffer(), dvDesc, - numPatchCoords, - (const PatchCoord*)patchCoords->BindCpuBuffer(), - patchTable->GetPatchArrayBuffer(), - patchTable->GetPatchIndexBuffer(), - patchTable->GetPatchParamBuffer()); - } - - /// \brief Static limit eval function. It takes an array of PatchCoord - /// and evaluate limit values on given PatchTable. - /// - /// @param src Input primvar pointer. An offset of srcDesc - /// will be applied internally (i.e. the pointer - /// should not include the offset) - /// - /// @param srcDesc vertex buffer descriptor for the input buffer - /// - /// @param dst Output primvar pointer. An offset of dstDesc - /// will be applied internally. - /// - /// @param dstDesc vertex buffer descriptor for the output buffer - /// - /// @param numPatchCoords number of patchCoords. - /// - /// @param patchCoords array of locations to be evaluated. - /// - /// @param patchArrays an array of Osd::PatchArray struct - /// indexed by PatchCoord::arrayIndex - /// - /// @param patchIndexBuffer an array of patch indices - /// indexed by PatchCoord::vertIndex - /// - /// @param patchParamBuffer an array of Osd::PatchParam struct - /// indexed by PatchCoord::patchIndex - /// - static bool EvalPatches( - const float *src, BufferDescriptor const &srcDesc, - float *dst, BufferDescriptor const &dstDesc, - int numPatchCoords, - const PatchCoord *patchCoords, - const PatchArray *patchArrays, - const int *patchIndexBuffer, - const PatchParam *patchParamBuffer); - - /// \brief Static limit eval function. It takes an array of PatchCoord - /// and evaluate limit values on given PatchTable. - /// - /// @param src Input primvar pointer. An offset of srcDesc - /// will be applied internally (i.e. the pointer - /// should not include the offset) - /// - /// @param srcDesc vertex buffer descriptor for the input buffer - /// - /// @param dst Output primvar pointer. An offset of dstDesc - /// will be applied internally. - /// - /// @param dstDesc vertex buffer descriptor for the output buffer - /// - /// @param du Output U-derivatives pointer. An offset of - /// duDesc will be applied internally. - /// - /// @param duDesc vertex buffer descriptor for the du buffer - /// - /// @param dv Output V-derivatives pointer. An offset of - /// dvDesc will be applied internally. - /// - /// @param dvDesc vertex buffer descriptor for the dv buffer - /// - /// @param numPatchCoords number of patchCoords. - /// - /// @param patchCoords array of locations to be evaluated. - /// - /// @param patchArrays an array of Osd::PatchArray struct - /// indexed by PatchCoord::arrayIndex - /// - /// @param patchIndexBuffer an array of patch indices - /// indexed by PatchCoord::vertIndex - /// - /// @param patchParamBuffer an array of Osd::PatchParam struct - /// indexed by PatchCoord::patchIndex - /// - static bool EvalPatches( - const float *src, BufferDescriptor const &srcDesc, - float *dst, BufferDescriptor const &dstDesc, - float *du, BufferDescriptor const &duDesc, - float *dv, BufferDescriptor const &dvDesc, - int numPatchCoords, - PatchCoord const *patchCoords, - PatchArray const *patchArrays, - const int *patchIndexBuffer, - PatchParam const *patchParamBuffer); - - /// ---------------------------------------------------------------------- - /// - /// Other methods - /// - /// ---------------------------------------------------------------------- - - /// \brief synchronize all asynchronous computation invoked on this device. - static void Synchronize(void * /*deviceContext = NULL*/) { - // nothing. - } -}; - - -} // end namespace Osd - -} // end namespace OPENSUBDIV_VERSION -using namespace OPENSUBDIV_VERSION; - -} // end namespace OpenSubdiv - - -#endif // OPENSUBDIV3_OSD_CPU_EVALUATOR_H