working on endianness with vulkan images

This commit is contained in:
2024-12-17 00:11:21 +01:00
parent a85ad6378e
commit c636229875
12 changed files with 162 additions and 109 deletions

View File

@@ -11,6 +11,38 @@ namespace mlx
std::ranges::reverse(value_representation);
return std::bit_cast<T>(value_representation);
}
constexpr std::uint32_t Rmask() noexcept
{
if constexpr(std::endian::native == std::endian::big)
return 0xFF000000;
else
return 0x000000FF;
}
constexpr std::uint32_t Gmask() noexcept
{
if constexpr(std::endian::native == std::endian::big)
return 0x00FF0000;
else
return 0x0000FF00;
}
constexpr std::uint32_t Bmask() noexcept
{
if constexpr(std::endian::native == std::endian::big)
return 0x0000FF00;
else
return 0x00FF0000;
}
constexpr std::uint32_t Amask() noexcept
{
if constexpr(std::endian::native == std::endian::big)
return 0x000000FF;
else
return 0xFF000000;
}
}
#endif