Blender V5.3
gpu_vertex_format_normals.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10#include "BLI_span.hh"
11#include "BLI_task.hh"
12
14
15namespace blender::gpu {
16
17template<typename GPUType>
19{
20 threading::parallel_for(src.index_range(), 2048, [&](const IndexRange range) {
21 for (const int i : range) {
22 dst[i] = convert_normal<GPUType>(src[i]);
23 }
24 });
25}
26
28{
29 convert_normals_impl(src, dst);
30}
31template<> void convert_normals(const Span<float3> src, MutableSpan<short4> dst)
32{
33 convert_normals_impl(src, dst);
34}
35
36} // namespace blender::gpu
constexpr IndexRange index_range() const
Definition BLI_span.hh:405
static void convert_normals_impl(const Span< float3 > src, MutableSpan< GPUType > dst)
void convert_normals(Span< float3 > src, MutableSpan< GPUType > dst)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
Definition BLI_task.hh:69