Remove the indirection previously used for the topology refiner to separate C and C++ code. Instead retrieve the base level in calling code and call opensubdiv API functions directly. This avoids copying arrays of mesh indices and should reduce function call overhead since index retrieval can now be inlined. It also lets us remove a lot of boilerplate shim code. The downside is increased need for WITH_OPENSUBDIV defines in various parts of blenkernel, but I think that is required to avoid the previous indirection and have the kernel deal with OpenSubdiv more directly. Pull Request: https://projects.blender.org/blender/blender/pulls/120825
33 lines
661 B
C++
33 lines
661 B
C++
/* SPDX-FileCopyrightText: 2019 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup bke
|
|
*/
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
#include "BKE_subdiv_topology.hh"
|
|
|
|
#include "BKE_subdiv.hh"
|
|
|
|
#ifdef WITH_OPENSUBDIV
|
|
# include "opensubdiv_topology_refiner_capi.hh"
|
|
#endif
|
|
|
|
namespace blender::bke::subdiv {
|
|
|
|
int topology_num_fvar_layers_get(const Subdiv *subdiv)
|
|
{
|
|
#ifdef WITH_OPENSUBDIV
|
|
const blender::opensubdiv::TopologyRefinerImpl *topology_refiner = subdiv->topology_refiner;
|
|
return topology_refiner->base_level().GetNumFVarChannels();
|
|
#else
|
|
UNUSED_VARS(subdiv);
|
|
return 0;
|
|
#endif
|
|
}
|
|
|
|
} // namespace blender::bke::subdiv
|