MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ gpu_format()

std::optional< GpuDataFormat > MayaFlux::Kakshya::TensorDType::gpu_format ( ) const
nodiscardnoexcept

GpuDataFormat holding exactly this element, when one exists.

Half precision maps to UINT16, the raw half-float storage format.

Definition at line 78 of file TensorDType.cpp.

79{
80 if (kind == TensorDTypeKind::FLOAT && bits == 32) {
81 switch (lanes) {
82 case 1:
84 case 2:
86 case 3:
88 case 4:
90 default:
91 return std::nullopt;
92 }
93 }
94 if (kind == TensorDTypeKind::FLOAT && bits == 64) {
95 switch (lanes) {
96 case 1:
98 case 2:
100 case 3:
102 case 4:
104 default:
105 return std::nullopt;
106 }
107 }
108 if (lanes != 1)
109 return std::nullopt;
110 if (kind == TensorDTypeKind::INT && bits == 32)
112 if (kind == TensorDTypeKind::UINT && bits == 32)
114 if (kind == TensorDTypeKind::UINT && bits == 8)
116 if (kind == TensorDTypeKind::UINT && bits == 16)
118 if (kind == TensorDTypeKind::FLOAT && bits == 16)
120 return std::nullopt;
121}
@ VEC3_F64
glm::dvec3 (64-bit components)
@ FLOAT64
64-bit double (audio precision)
@ UINT16
uint16_t, R16F raw half-float storage, packed formats
@ VEC2_F64
glm::dvec2 (64-bit components)
@ VEC2_F32
glm::vec2 (32-bit components)
@ VEC4_F32
glm::vec4 (32-bit components)
@ VEC4_F64
glm::dvec4 (64-bit components)
@ FLOAT32
32-bit float (standard GPU)
@ VEC3_F32
glm::vec3 (32-bit components), not a sampled image format
@ UINT8
uint8_t, R8 / RGBA8 texel data

References bits, MayaFlux::Kakshya::FLOAT, MayaFlux::Kakshya::FLOAT32, MayaFlux::Kakshya::FLOAT64, MayaFlux::Kakshya::INT, MayaFlux::Kakshya::INT32, kind, lanes, MayaFlux::Kakshya::UINT, MayaFlux::Kakshya::UINT16, MayaFlux::Kakshya::UINT32, MayaFlux::Kakshya::UINT8, MayaFlux::Kakshya::VEC2_F32, MayaFlux::Kakshya::VEC2_F64, MayaFlux::Kakshya::VEC3_F32, MayaFlux::Kakshya::VEC3_F64, MayaFlux::Kakshya::VEC4_F32, and MayaFlux::Kakshya::VEC4_F64.