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

◆ gpu_data_format_bytes()

MAYAFLUX_API size_t MayaFlux::Kakshya::gpu_data_format_bytes ( GpuDataFormat  fmt)
noexcept

Byte size of one element of a GpuDataFormat.

Single authoritative source for format sizing. Used by TextureAccess, ShaderSpec, and any other system that needs to derive byte counts from GpuDataFormat without duplicating the switch.

Parameters
fmtGpuDataFormat value.
Returns
Byte size of one element, or 0 for unrecognised formats.

Definition at line 9 of file NDData.cpp.

10{
11 switch (fmt) {
12 case GpuDataFormat::UINT8:
13 return 1;
14 case GpuDataFormat::UINT16:
15 return 2;
16 case GpuDataFormat::FLOAT32:
17 case GpuDataFormat::INT32:
18 case GpuDataFormat::UINT32:
19 return 4;
20 case GpuDataFormat::FLOAT64:
21 case GpuDataFormat::VEC2_F32:
22 return 8;
23 case GpuDataFormat::VEC3_F32:
24 return 12;
25 case GpuDataFormat::VEC4_F32:
26 case GpuDataFormat::VEC2_F64:
27 return 16;
28 case GpuDataFormat::VEC3_F64:
29 return 24;
30 case GpuDataFormat::VEC4_F64:
31 return 32;
32 default:
33 return 0;
34 }
35}

References FLOAT32, FLOAT64, INT32, UINT16, UINT32, UINT8, VEC2_F32, VEC2_F64, VEC3_F32, VEC3_F64, VEC4_F32, and VEC4_F64.

Referenced by MayaFlux::Portal::Graphics::ShaderSpec::Assemble::build(), and MayaFlux::Portal::Graphics::element_type_bytes().

+ Here is the caller graph for this function: