Skip to content

Engine → Renderer → shader_asset.h

shader_asset

Syntax

class CONJURE_API shader_asset

Constructors

AccessSignatureDescription
publicshader_asset();
publicexplicit shader_asset( shader_program_desc desc);
publicshader_asset( const shader_asset &) = default;
publicshader_asset( shader_asset &&) noexcept = default;

Destructors

AccessSignatureDescription
public~shader_asset();

Variables

AccessNameTypeDefaultDescription
privatemDescshader_program_desc{}

Functions

Public

built_in_programs

[[nodiscard]] static std::span<const shader_program_desc> built_in_programs() noexcept;

Every program the renderer loads, one entry per shader permutation: the pass programs (pipeline variants that differ only in render state share an entry), the blit and the Dear ImGui backend's program. The ImGui entry is listed in every configuration but is loaded only by an editor build's renderer created with enableImGui and a swapchain.

desc

[[nodiscard]] const shader_program_desc &desc() const noexcept;

find_built_in

[[nodiscard]] static core::result<shader_asset> find_built_in(
    std::string_view name,
    std::string_view pixelDefines = {},
    std::string_view vertexDefines = {});

The built-in program with this name whose pixel and vertex define strings both equal the given ones ("" matches a stage without defines, it is not a wildcard), or core::error_code::NOT_FOUND naming all three.

validate

[[nodiscard]] core::result<void> validate(
    rhi::shader_library &library) const;

Succeeds when the library's index has a blob for its backend for every stage of the program (vertex, pixel, compute, in that order; a stage with an "" entry is skipped). Fails with renderer_error::SHADER_NOT_FOUND naming the first missing shader key. Reads the index only: a blob file that is listed but missing on disk is found when the renderer loads it, not here.

Operator Overloads

Public

operator=

shader_asset &operator=(
    const shader_asset &) = default;
shader_asset &operator=(
    shader_asset &&) noexcept = default;

operator==

[[nodiscard]] bool operator==(
    const shader_asset &other) const noexcept = default;