Skip to content

Engine → RHI

backend.h

Graphics backends of the rhi module.

Structs

File Description
device_capabilities What the created device can do; filled by device::create from the adapter.

Enumerations

graphics_backend

enum class graphics_backend : u8 {
    NULL_DEVICE = 0,
    D3D12,
    VULKAN,
    COUNT
};

Constants

Name Type Value Description
MSAA_SAMPLE_COUNT_MAX inline constexpr u32 8 The highest MSAA sample count the engine uses: the highest bit of MSAA_SAMPLE_COUNTS_ALL. Loops over the counts run 'count <= MSAA_SAMPLE_COUNT_MAX; count *= 2'.
MSAA_SAMPLE_COUNTS_ALL inline constexpr u32 1u | 2u | 4u | 8u Every MSAA sample count the engine uses, as a mask whose bit value is the sample count: 1x, 2x, 4x and 8x.

Functions

Public

default_graphics_backend

[[nodiscard]] CONJURE_API graphics_backend default_graphics_backend() noexcept;

The backend the engine tries first: D3D12 when compiled, otherwise VULKAN when compiled, otherwise NULL_DEVICE.

is_backend_compiled

[[nodiscard]] CONJURE_API bool is_backend_compiled(
    graphics_backend backend) noexcept;

True when the backend was compiled into this build. NULL_DEVICE is always true.

is_valid_msaa_sample_counts

[[nodiscard]] constexpr bool is_valid_msaa_sample_counts(
    u32 mask) noexcept;

True when mask is a valid device_capabilities::msaaSampleCounts: it holds bit 1 (1x is always possible) and no bit outside MSAA_SAMPLE_COUNTS_ALL.

parse_graphics_backend

[[nodiscard]] CONJURE_API core::result<graphics_backend> parse_graphics_backend(
    std::string_view name) noexcept;

Parses a backend name case-insensitively, ignoring surrounding whitespace ("null", "d3d12", "vulkan"). Fails with core::error_code::INVALID_ARGUMENT for anything else.

to_string

[[nodiscard]] CONJURE_API std::string_view to_string(
    graphics_backend backend) noexcept;

The lower-case name of a backend: "null", "d3d12" or "vulkan"; "" for an out-of-range value.