Struct Provider
Defined in File resource-provider.h
Inheritance Relationships
Derived Type
public CE::Rendering::OpenGL::ResourceProvider(Class ResourceProvider)
Struct Documentation
-
struct Provider
Creates resources in one selected backend domain.
Uploads obey that backend’s owner-thread/current-context rules and copy transient CPU data before returning; returned handles do not borrow pixel/vertex storage. Uploaded contents are immutable for retained frames. A changed image or geometry requires a new handle and explicit publication by its owner. There is no generic in-place update, atomic batch, or residency-budget API. Global asset managers permit one active provider/loading owner; constructing another Loader does not create an independent cache/resource domain. Logical shared handles may outlive cache/provider teardown, but native use requires their original live backend domain. Final release follows backend retirement; it is not a promise of immediate native deletion.
Subclassed by CE::Rendering::OpenGL::ResourceProvider
Public Functions
-
Provider() = default
Create a distinct diagnostic provider identity without binding the global asset-cache domain.
-
inline Provider(const Provider&) noexcept
Copy adapter configuration with a new diagnostic identity; no asset-cache domain is shared by this operation.
-
inline Provider &operator=(const Provider&) noexcept
Preserve this provider’s diagnostic identity during base assignment.
- Returns:
This provider. Derived adapter configuration follows the derived type’s assignment contract.
-
virtual ~Provider()
Release global typed caches if this provider owns their active domain.
Cache handles are dropped before releasing the binding; external retained handles survive logically in their original backend domain. Quiesce loading/publication and arrange backend teardown in the owning runtime; this is not native resource migration.
-
inline CE::Diagnostics::DomainId diagnostic_id() const noexcept
Declaration:
[[nodiscard]]- Returns:
Stable identity for this provider instance; copying creates another identity, assignment preserves the destination.
-
void publish_events_to(CE::Events::EventBus::Publisher publisher)
Set the weak catalogue route before loading/binding managers.
Copies of Provider start unrouted.
-
CE::Events::EventBus::Publisher notification_publisher() const
Declaration:
[[nodiscard]]Copy the configured route under its mutex; retains no bus/Context.
-
inline virtual CE::Rendering::GraphicsDomain graphics_domain() const noexcept
Declaration:
[[nodiscard]]Forward the renderer’s retained native domain, or an empty token when unsupported.
-
inline virtual CE::Assets::Shaders::Builder *shader_asset_builder() noexcept
Declaration:
[[nodiscard]]- Returns:
Borrowed optional material/program builder, or null when unsupported. Retain this provider through use; the base implementation returns null.
-
virtual std::shared_ptr<Image> load_image(const std::filesystem::path &file)
Declaration:
[[nodiscard]]Decode a file on the CPU, then create a fresh immutable backend image.
- Parameters:
file – File opened during this call; no path/cache entry is published here.
- Returns:
Retained image from create_image(). The upload portion obeys backend owner/current-context requirements. Decode/upload/allocation failures propagate without returning a partial handle.
-
virtual std::shared_ptr<Image> create_image(const CE::Assets::Images::Decoded &image) = 0
Declaration:
[[nodiscard]]Upload fresh top-to-bottom RGBA8 contents on the backend loading owner.
- Parameters:
image – Nonzero dimensions and exactly four bytes per pixel, borrowed only through this call.
- Returns:
Independent immutable image; caller may immediately reuse/release CPU pixels. Backend validation/upload failures propagate; this operation publishes no cache entry.
-
virtual std::shared_ptr<const CE::Rendering::Sampling::Sampler> create_sampler(const CE::Rendering::Sampling::Options &options)
Declaration:
[[nodiscard]]Create or reuse an immutable backend sampler on its owner/current context.
- Parameters:
options – Valid filtering/wrap/anisotropy request.
- Returns:
Retained sampler; MaximumSupported may resolve to isotropic filtering. The base validates options then throws failed_operation because sampling overrides are optional. Concrete caching does not promise residency after final release.
-
virtual std::shared_ptr<Image> create_font_atlas(std::span<const unsigned char> alpha, CE::Rendering::Geometry::PixelSize size) = 0
Declaration:
[[nodiscard]]Upload one-channel glyph alpha without changing the font baker’s row/UV order.
- Parameters:
alpha – One byte per pixel, borrowed until this upload returns.
size – Nonzero dimensions matching alpha.size().
- Returns:
Independent immutable atlas handle. Requires backend owner/current context; malformed input and upload/allocation failures reject without cache publication.
-
virtual std::shared_ptr<CE::Rendering::Geometry::Buffer2D> upload_geometry(std::span<const CE::Rendering::Geometry::Vertex2D> vertices, CE::Rendering::Geometry::Topology topology) = 0
Declaration:
[[nodiscard]]Copy transient position/UV vertices into immutable backend geometry.
- Parameters:
vertices – Nonempty contiguous CPU vertices, borrowed only through the call.
topology – Primitive interpretation retained by the upload.
- Returns:
Independent retained geometry with matching layout/count/topology. Requires backend upload affinity; validation/native/allocation errors propagate. Atlas cells use strips; whole images/glyphs use independent triangles.
-
virtual std::shared_ptr<CE::Rendering::Geometry::Buffer2D> upload_geometry(std::span<const CE::Rendering::Geometry::Vertex2DColor> vertices, CE::Rendering::Geometry::Topology topology)
Declaration:
[[nodiscard]]Copy transient position/UV/RGBA vertices into immutable backend geometry.
- Parameters:
vertices – Nonempty contiguous CPU vertices, borrowed only through the call.
topology – Primitive interpretation retained by the upload.
- Returns:
Independent retained geometry with matching layout/count/topology. Requires backend upload affinity; validation/native/allocation errors propagate. The base throws failed_operation: unsupported adapters must reject rather than discard color.
Declaration:
[[nodiscard]]Compatibility wrapper borrowing a retained CPU array for the transient span upload.
- Parameters:
vertices – Owner of at least vertex_count contiguous vertices.
vertex_count – Nonzero array count, not bytes.
topology – Uploaded primitive interpretation.
- Returns:
Backend geometry independent of the CPU array. Null/zero input throws invalid_args. The CPU owner is retained only until the delegated upload returns; normal backend affinity/failures apply.
-
virtual std::shared_ptr<Program> link_program(const std::vector<std::filesystem::path> &stages) = 0
Declaration:
[[nodiscard]]Compile stage files and return a linked executable on the backend owner/current context.
See also
- Parameters:
stages – Stage paths borrowed through the call; backend extension/stage support applies.
- Returns:
Complete executable handle, never an unlinked recipe. File/compile/link/allocation failures propagate; this primitive performs no cache publication.
-
Provider() = default