texture_format.h
| File Path | engine/include/conjure/rhi/texture_format.h |
| API ↗ | Devices and swapchains |
Texture formats the engine uses. The list is deliberately short: every renderer target, vertex stream and asset payload is one of these, and engine/src/rhi/texture_format_mapping.h maps each one to its NVRHI format (verified at compile time). The block-compressed formats are reserved for a later cook step and never produced yet.
Enumerations
texture_format
enum class texture_format : u8 {
UNKNOWN = 0,
R8_UNORM,
RG8_UNORM,
RGBA8_UNORM,
RGBA8_SRGB,
BGRA8_SRGB,
RG16_SNORM,
RGBA16_SNORM,
R16_FLOAT,
RG16_FLOAT,
RGBA16_FLOAT,
R32_FLOAT,
RG32_FLOAT,
RGB32_FLOAT,
RGBA32_FLOAT,
R32_UINT,
R11G11B10_FLOAT,
D32_FLOAT,
BC1_SRGB,
BC5_UNORM,
BC7_SRGB,
COUNT
};
Functions
Public
block_size
block_size[[nodiscard]] constexpr u32 block_size(
texture_format format) noexcept;Width and height in pixels of one storage block: 4 for the compressed formats, 1 otherwise (0 for UNKNOWN).
bytes_per_block
bytes_per_block[[nodiscard]] constexpr u32 bytes_per_block(
texture_format format) noexcept;Bytes of one storage block: bytes_per_pixel() for uncompressed formats, 8 for BC1 and 16 for BC5 and BC7.
bytes_per_pixel
bytes_per_pixel[[nodiscard]] constexpr u32 bytes_per_pixel(
texture_format format) noexcept;Bytes of one pixel of an uncompressed format. 0 for UNKNOWN and for block-compressed formats, whose storage is described by bytes_per_block() and block_size().
is_compressed
is_compressed[[nodiscard]] constexpr bool is_compressed(
texture_format format) noexcept;True for the block-compressed formats (BC1, BC5, BC7).
is_depth
is_depth[[nodiscard]] constexpr bool is_depth(
texture_format format) noexcept;True for depth formats (D32_FLOAT).
is_srgb
is_srgb[[nodiscard]] constexpr bool is_srgb(
texture_format format) noexcept;True for formats whose values are sRGB encoded and decoded by the sampler.
parse_texture_format
parse_texture_format[[nodiscard]] CONJURE_API core::result<texture_format> parse_texture_format(
std::string_view name) noexcept;Parses an enumerator name case-insensitively. Fails with core::error_code::INVALID_ARGUMENT for anything that is not a format name; "UNKNOWN" parses to UNKNOWN.
row_pitch
row_pitch[[nodiscard]] constexpr u64 row_pitch(
texture_format format,
u32 width) noexcept;Bytes of one tightly packed row of width pixels, rounded up to whole blocks for the compressed formats. 0 for UNKNOWN.
to_string
to_string[[nodiscard]] CONJURE_API std::string_view to_string(
texture_format format) noexcept;The enumerator name of a format ("RGBA8_SRGB"); "UNKNOWN" for UNKNOWN and out-of-range values.