Blender V4.3
mtl_shader_interface_type.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8#pragma once
9
10#include "BLI_assert.h"
11#include "GPU_material.hh"
12
18
23
28
33
38
43
48
53
58
63
73
83
86};
87
89{
90 switch (type) {
94 return 1;
100 return 2;
101
105 return 3;
108 case MTL_DATATYPE_INT:
116 return 4;
117
128 return 8;
129
131 return 12;
132
144 return 16;
145
149 return 24;
150
160 return 32;
161
164 return 48;
165
168 return 64;
169 default:
170 BLI_assert(false);
171 return 0;
172 };
173}
174
176{
177 switch (type) {
181 return 1;
187 return 2;
188
194 case MTL_DATATYPE_INT:
205 return 4;
206
225 return 8;
226
241 return 16;
242
247 return 32;
248
249 default:
250 BLI_assert_msg(false, "Unrecognized MTL datatype.");
251 return 0;
252 };
253}
254
256{
257 switch (type) {
258 case GPU_FLOAT:
259 return MTL_DATATYPE_FLOAT;
260 case GPU_VEC2:
261 return MTL_DATATYPE_FLOAT2;
262 case GPU_VEC3:
263 return MTL_DATATYPE_FLOAT3;
264 case GPU_VEC4:
265 return MTL_DATATYPE_FLOAT4;
266 case GPU_MAT3:
268 case GPU_MAT4:
270 default:
271 BLI_assert(false && "Other types unsupported");
272 return MTL_DATATYPE_FLOAT;
273 }
274 return MTL_DATATYPE_FLOAT;
275}
#define BLI_assert(a)
Definition BLI_assert.h:50
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:57
unsigned int uint
eGPUType
@ GPU_VEC2
@ GPU_MAT4
@ GPU_VEC4
@ GPU_VEC3
@ GPU_MAT3
@ GPU_FLOAT
uint mtl_get_data_type_alignment(eMTLDataType type)
@ MTL_DATATYPE_INT1010102_NORM
@ MTL_DATATYPE_UINT1010102_NORM
uint mtl_get_data_type_size(eMTLDataType type)
eMTLDataType gpu_type_to_mtl_type(eGPUType type)