Blender
V5.3
source
blender
gpu
intern
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
9
#include "
BLI_math_vector_types.hh
"
10
#include "
BLI_span.hh
"
11
#include "
BLI_task.hh
"
12
13
#include "
GPU_attribute_convert.hh
"
14
15
namespace
blender::gpu
{
16
17
template
<
typename
GPUType>
18
static
void
convert_normals_impl
(
const
Span<float3>
src,
MutableSpan<GPUType>
dst)
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
27
template
<>
void
convert_normals
(
const
Span<float3>
src,
MutableSpan<int1010102_norm>
dst)
28
{
29
convert_normals_impl
(src, dst);
30
}
31
template
<>
void
convert_normals
(
const
Span<float3>
src,
MutableSpan<short4>
dst)
32
{
33
convert_normals_impl
(src, dst);
34
}
35
36
}
// namespace blender::gpu
BLI_math_vector_types.hh
BLI_span.hh
BLI_task.hh
GPU_attribute_convert.hh
blender::IndexRange
Definition
BLI_index_range.hh:54
blender::MutableSpan
Definition
BLI_span.hh:447
blender::Span
Definition
BLI_span.hh:74
blender::Span::index_range
constexpr IndexRange index_range() const
Definition
BLI_span.hh:405
blender::gpu
Definition
blf_internal_types.hh:35
blender::gpu::convert_normals_impl
static void convert_normals_impl(const Span< float3 > src, MutableSpan< GPUType > dst)
Definition
gpu_vertex_format_normals.cc:18
blender::gpu::convert_normals
void convert_normals(Span< float3 > src, MutableSpan< GPUType > dst)
blender::threading::parallel_for
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
Generated on
for Blender by
doxygen
1.18.0