Blender V4.5
types_float2.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#include "util/types_base.h"
8
10
11#ifndef __KERNEL_NATIVE_VECTOR_TYPES__
12struct float2 {
13 float x, y;
14
15# ifndef __KERNEL_GPU__
16 __forceinline float operator[](int i) const;
17 __forceinline float &operator[](int i);
18# endif
19};
20
21# ifndef __KERNEL_GPU__
23{
24 util_assert(i >= 0);
25 util_assert(i < 2);
26 return *(&x + i);
27}
28
30{
31 util_assert(i >= 0);
32 util_assert(i < 2);
33 return *(&x + i);
34}
35# endif
36
37ccl_device_inline float2 make_float2(const float x, const float y)
38{
39 float2 a = {x, y};
40 return a;
41}
42#endif /* __KERNEL_NATIVE_VECTOR_TYPES__ */
43
45{
46 return {f, f};
47}
48
49ccl_device_inline void print_float2(const ccl_private char *label, const float2 a)
50{
51#ifdef __KERNEL_PRINTF__
52 printf("%s: %.8f %.8f\n", label, (double)a.x, (double)a.y);
53#endif
54}
55
#define util_assert(statement)
#define ccl_private
#define ccl_device_inline
#define __forceinline
#define CCL_NAMESPACE_END
#define printf(...)
float x
float y
__forceinline float operator[](int i) const
i
Definition text_draw.cc:230
ccl_device_inline void print_float2(const ccl_private char *label, const float2 a)
ccl_device_inline float2 make_float2(const float x, const float y)