| 285 | } |
| 286 | |
| 287 | void initModule(pybind11::module& m) |
| 288 | { |
| 289 | using namespace pybind11::literals; |
| 290 | |
| 291 | pybind11::class_<float16_t>(m, "float16_t"); |
| 292 | |
| 293 | // Declare all vector types. |
| 294 | // We do this before defining the bindings to allow explicit casts between vector types. |
| 295 | |
| 296 | pybind11::class_<bool2> bool2Type(m, "bool2"); |
| 297 | pybind11::class_<bool3> bool3Type(m, "bool3"); |
| 298 | pybind11::class_<bool4> bool4Type(m, "bool4"); |
| 299 | |
| 300 | pybind11::class_<int2> int2Type(m, "int2"); |
| 301 | pybind11::class_<int3> int3Type(m, "int3"); |
| 302 | pybind11::class_<int4> int4Type(m, "int4"); |
| 303 | |
| 304 | pybind11::class_<uint2> uint2Type(m, "uint2"); |
| 305 | pybind11::class_<uint3> uint3Type(m, "uint3"); |
| 306 | pybind11::class_<uint4> uint4Type(m, "uint4"); |
| 307 | |
| 308 | pybind11::class_<float2> float2Type(m, "float2"); |
| 309 | pybind11::class_<float3> float3Type(m, "float3"); |
| 310 | pybind11::class_<float4> float4Type(m, "float4"); |
| 311 | |
| 312 | pybind11::class_<float16_t2> float16_t2Type(m, "float16_t2"); |
| 313 | pybind11::class_<float16_t3> float16_t3Type(m, "float16_t3"); |
| 314 | pybind11::class_<float16_t4> float16_t4Type(m, "float16_t4"); |
| 315 | |
| 316 | // bool2, bool3, bool4 |
| 317 | defineVecType<bool2, false>(bool2Type); |
| 318 | defineVecType<bool3, false>(bool3Type); |
| 319 | defineVecType<bool4, false>(bool4Type); |
| 320 | |
| 321 | // int2, int3, int4 |
| 322 | defineVecType<int2, true>(int2Type); |
| 323 | defineVecType<int3, true>(int3Type); |
| 324 | defineVecType<int4, true>(int4Type); |
| 325 | |
| 326 | // uint2, uint3, uint4 |
| 327 | defineVecType<uint2, true>(uint2Type); |
| 328 | defineVecType<uint3, true>(uint3Type); |
| 329 | defineVecType<uint4, true>(uint4Type); |
| 330 | |
| 331 | // float2, float3, float4 |
| 332 | defineVecType<float2, true>(float2Type); |
| 333 | defineVecType<float3, true>(float3Type); |
| 334 | defineVecType<float4, true>(float4Type); |
| 335 | |
| 336 | // float16_t2, float16_t3, float16_t4 |
| 337 | defineVecType<float16_t2, false>(float16_t2Type); |
| 338 | defineVecType<float16_t3, false>(float16_t3Type); |
| 339 | defineVecType<float16_t4, false>(float16_t4Type); |
| 340 | |
| 341 | // float3x3, float4x4 |
| 342 | // Note: We register these as simple data types without any operations because semantics may change in the future. |
| 343 | pybind11::class_<float3x3>(m, "float3x3"); |
| 344 | pybind11::class_<float3x4>(m, "float3x4"); |
no test coverage detected