Engine → RHI → shader_library.h
shader_library
| Type | Class |
| Namespace | conjure::rhi |
| Include File Path | engine/include/conjure/rhi/shader_library.h |
| Source File Path | engine/src/rhi/shader_library.cpp |
| API ↗ | Shaders |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | explicit shader_library(
create_tag); |
Important
Copy constructor and assignment has been deleted.
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~shader_library(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mImpl | std::unique_ptr<impl> | {} |
Functions
Public
backend
backend[[nodiscard]] graphics_backend backend() const noexcept;The backend whose blob column was selected.
contains
contains[[nodiscard]] bool contains(
const shader_key &key) const;True when an entry with a blob for this backend matches the key (no file access; the lookup key is composed in a heap string, so the call may allocate).
directory
directory[[nodiscard]] const std::filesystem::path &directory() const noexcept;The directory index.json was opened from.
entry_count
entry_count[[nodiscard]] usize entry_count() const noexcept;Number of entries in the index, including entries without a blob for this backend.
get
get[[nodiscard]] core::result<shader_blob> get(
const shader_key &key);Returns the compiled blob, loading it lazily. Fails with core::error_code::NOT_FOUND when no entry matches the key or the entry has no blob for this backend, and IO_FAILURE when the blob file cannot be read or is empty. A returned blob is never empty.
loaded_blob_count
loaded_blob_count[[nodiscard]] usize loaded_blob_count() const noexcept;Number of blobs currently loaded in memory.
open
open[[nodiscard]] static core::result<std::unique_ptr<shader_library>> open(
device &device,
const std::filesystem::path &shaderDirectory);Opens <shaderDirectory>/index.json and selects the blob set for the device's backend. Fails with core::error_code::NOT_FOUND when the index is missing, IO_FAILURE when it cannot be read and PARSE_FAILURE when it is not valid JSON or not a valid index (the message names the entry).
reload
reload[[nodiscard]] core::result<void> reload();Re-reads index.json and drops every cached blob (development hot reload). On failure the previous index stays in effect and the error is returned.