Blender V5.0
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
6#include "BLI_span.hh"
7#include "BLI_task.hh"
8
10
11namespace blender::gpu {
12
13template<typename GPUType>
15{
16 threading::parallel_for(src.index_range(), 2048, [&](const IndexRange range) {
17 for (const int i : range) {
18 dst[i] = convert_normal<GPUType>(src[i]);
19 }
20 });
21}
22
24{
25 convert_normals_impl(src, dst);
26}
27template<> void convert_normals(const Span<float3> src, MutableSpan<short4> dst)
28{
29 convert_normals_impl(src, dst);
30}
31
32} // namespace blender::gpu
constexpr IndexRange index_range() const
Definition BLI_span.hh:401
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:93