Blender V5.3
GPU_attribute_convert.hh
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#pragma once
10
11#include <algorithm>
12#include <limits>
13
15#include "BLI_span.hh"
16
17namespace blender::gpu {
18
19template<typename GPUType> inline GPUType convert_normal(const float3 &src);
20
21template<> inline int1010102_norm convert_normal(const float3 &src)
22{
23 return int1010102_norm(float4(src, 0.0f));
24}
25
26template<> inline short4 convert_normal(const float3 &src)
27{
28 return short4(src * float(std::numeric_limits<short>::max()), 0);
29}
30
31template<typename GPUType> void convert_normals(Span<float3> src, MutableSpan<GPUType> dst);
32
33} // namespace blender::gpu
GPUType convert_normal(const float3 &src)
void convert_normals(Span< float3 > src, MutableSpan< GPUType > dst)
NormalizedIntVecBase< int32_t, 4, 10, 10, 10, 2 > int1010102_norm
VecBase< float, 4 > float4
VecBase< int16_t, 4 > short4
VecBase< float, 3 > float3