Blender V4.5
evaluator_capi.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2015 Blender Foundation
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 *
5 * Author: Sergey Sharybin. */
6
8
9#include <opensubdiv/osd/glslPatchShaderSource.h>
10
11#include "MEM_guardedalloc.h"
12
14
16{
17 OpenSubdiv_EvaluatorCache *evaluator_cache = MEM_new<OpenSubdiv_EvaluatorCache>(__func__);
18 evaluator_cache->impl = openSubdiv_createEvaluatorCacheInternal(evaluator_type);
19 return evaluator_cache;
20}
21
23{
24 if (!evaluator_cache) {
25 return;
26 }
27
29 MEM_delete(evaluator_cache);
30}
31
33{
34 /* Using a global string to avoid dealing with memory allocation/ownership. */
35 static std::string patch_basis_source;
36 if (patch_basis_source.empty()) {
37 patch_basis_source = OpenSubdiv::Osd::GLSLPatchShaderSource::GetPatchBasisShaderSource();
38 }
39 return patch_basis_source.c_str();
40}
Read Guarded memory(de)allocation.
OpenSubdiv_EvaluatorCacheImpl * openSubdiv_createEvaluatorCacheInternal(eOpenSubdivEvaluator evaluator_type)
void openSubdiv_deleteEvaluatorCacheInternal(OpenSubdiv_EvaluatorCacheImpl *evaluator_cache)
void openSubdiv_deleteEvaluatorCache(OpenSubdiv_EvaluatorCache *evaluator_cache)
const char * openSubdiv_getGLSLPatchBasisSource()
OpenSubdiv_EvaluatorCache * openSubdiv_createEvaluatorCache(eOpenSubdivEvaluator evaluator_type)
eOpenSubdivEvaluator
OpenSubdiv_EvaluatorCacheImpl * impl