Blender  V3.3
multi_function_params.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
4 
5 namespace blender::fn {
6 
7 GMutableSpan MFParams::ensure_dummy_single_output(int data_index)
8 {
9  /* Lock because we are actually modifying #builder_ and it may be used by multiple threads. */
10  std::lock_guard lock{builder_->mutex_};
11 
12  for (const std::pair<int, GMutableSpan> &items : builder_->dummy_output_spans_) {
13  if (items.first == data_index) {
14  return items.second;
15  }
16  }
17 
18  const CPPType &type = builder_->mutable_spans_[data_index].type();
19  void *buffer = builder_->scope_.linear_allocator().allocate(
20  builder_->min_array_size_ * type.size(), type.alignment());
21  if (!type.is_trivially_destructible()) {
22  builder_->scope_.add_destruct_call(
23  [&type, buffer, mask = builder_->mask_]() { type.destruct_indices(buffer, mask); });
24  }
25  const GMutableSpan span{type, buffer, builder_->min_array_size_};
26  builder_->dummy_output_spans_.append({data_index, span});
27  return span;
28 }
29 
30 } // namespace blender::fn
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
volatile int lock
void * allocate(const int64_t size, const int64_t alignment)
void add_destruct_call(Func func)
LinearAllocator & linear_allocator()
ccl_global float * buffer
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513