Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::Lumina::Pipeline Class Reference

Loads shader artifacts and orchestrates draw calls with strongly typed constants and attributes. More...

#include <spk_pipeline.hpp>

Collaboration diagram for spk::Lumina::Pipeline:
Collaboration graph

Classes

class  Constant
 Encapsulates a shader resource (UBO, SSBO, or sampler) bound by a pipeline. More...
class  Object
 Represents a drawable entity configured with pipeline attributes. More...

Public Member Functions

 Pipeline (const std::string &p_input)
 Builds a pipeline from a JSON artifact string.
 Pipeline (Pipeline &&p_other) noexcept=default
 Moves pipeline ownership to a new instance.
Pipelineoperator= (Pipeline &&p_other) noexcept=default
 Move-assigns pipeline ownership.
 Pipeline (const Pipeline &)=delete
Pipelineoperator= (const Pipeline &)=delete
Object createObject ()
 Instantiates a drawable object using the pipeline layout.
std::shared_ptr< spk::OpenGL::BufferSetObjectcreateBufferSet () const
 Creates a buffer set matching the pipeline's vertex layout.
spk::OpenGL::FrameBufferObjectframeBuffer (const std::wstring &p_name)
 Accesses a framebuffer configured on the pipeline.
const spk::OpenGL::FrameBufferObjectframeBuffer (const std::wstring &p_name) const
 Accesses a framebuffer configured on the pipeline.

Static Public Member Functions

static Pipeline fromFile (const std::filesystem::path &p_filePath)
 Loads a pipeline definition from disk.
static ConstantinsertConstant (const std::string &p_jsonBlock)
 Inserts a global constant from a JSON description block.
static ConstantinsertConstant (const std::wstring &p_jsonBlock)
 Wide-string overload for insertConstant.
static bool containConstant (const std::wstring &p_name)
 Check if the constant defined by name exist in the global registry.
static Constantconstant (const std::wstring &p_name)
 Retrieves a mutable constant defined by name in the global registry.
static ConstantgetOrCreateConstant (const std::string &p_jsonBlock)
 Retrieves or creates a constant from a JSON description block.
static ConstantgetOrCreateConstant (const std::wstring &p_jsonBlock)
 Wide-string overload for getOrCreateConstant.

Friends

class Object

Detailed Description

Loads shader artifacts and orchestrates draw calls with strongly typed constants and attributes.

spk::Lumina::Pipeline pipeline = spk::Lumina::Pipeline::fromFile("shaders/lighting.json");
auto object = pipeline.createObject();
object.attribute(L"model").as<spk::OpenGL::UBO>().setData(models[0]);
object.render();
TResourceType & as()
Returns the attribute as the requested resource type.
Definition spk_pipeline.hpp:579
Attribute & attribute(const std::wstring &p_name)
Retrieves a named attribute configured on the pipeline.
Definition spk_pipeline.hpp:665
Loads shader artifacts and orchestrates draw calls with strongly typed constants and attributes.
Definition spk_pipeline.hpp:38
static Pipeline fromFile(const std::filesystem::path &p_filePath)
Loads a pipeline definition from disk.
Definition spk_pipeline.cpp:729
Object createObject()
Instantiates a drawable object using the pipeline layout.
Definition spk_pipeline.cpp:749

Constructor & Destructor Documentation

◆ Pipeline() [1/2]

spk::Lumina::Pipeline::Pipeline ( const std::string & p_input)
explicit

Builds a pipeline from a JSON artifact string.

Parameters
p_inputJSON description following the Lumina pipeline schema.

◆ Pipeline() [2/2]

spk::Lumina::Pipeline::Pipeline ( Pipeline && p_other)
defaultnoexcept

Moves pipeline ownership to a new instance.

Parameters
p_otherPipeline to move from.

Member Function Documentation

◆ constant()

Pipeline::Constant & spk::Lumina::Pipeline::constant ( const std::wstring & p_name)
static

Retrieves a mutable constant defined by name in the global registry.

Parameters
p_nameConstant name declared in Lumina artifacts or pre-registered.
Returns
Reference to the managed constant resource.
Exceptions
std::runtime_errorWhen the constant cannot be found.
Here is the caller graph for this function:

◆ containConstant()

bool spk::Lumina::Pipeline::containConstant ( const std::wstring & p_name)
static

Check if the constant defined by name exist in the global registry.

Parameters
p_nameConstant name declared in Lumina artifacts or pre-registered.
Returns
The existance status.
Here is the caller graph for this function:

◆ createBufferSet()

std::shared_ptr< spk::OpenGL::BufferSetObject > spk::Lumina::Pipeline::createBufferSet ( ) const

Creates a buffer set matching the pipeline's vertex layout.

Returns
Shared pointer to a newly allocated buffer set.

◆ createObject()

Pipeline::Object spk::Lumina::Pipeline::createObject ( )

Instantiates a drawable object using the pipeline layout.

Returns
Object pre-populated with attribute constants and buffer set.

◆ frameBuffer() [1/2]

spk::OpenGL::FrameBufferObject & spk::Lumina::Pipeline::frameBuffer ( const std::wstring & p_name)

Accesses a framebuffer configured on the pipeline.

Parameters
p_nameName of the framebuffer attachment set in the artifact.
Returns
Reference to the framebuffer object.
Exceptions
std::runtime_errorWhen the framebuffer is missing.

◆ frameBuffer() [2/2]

const spk::OpenGL::FrameBufferObject & spk::Lumina::Pipeline::frameBuffer ( const std::wstring & p_name) const

Accesses a framebuffer configured on the pipeline.

Parameters
p_nameName of the framebuffer attachment set in the artifact.
Returns
Constant reference to the framebuffer object.
Exceptions
std::runtime_errorWhen the framebuffer is missing.

◆ fromFile()

Pipeline spk::Lumina::Pipeline::fromFile ( const std::filesystem::path & p_filePath)
static

Loads a pipeline definition from disk.

Parameters
p_filePathPath to the JSON artifact describing the pipeline.
Returns
Fully constructed pipeline ready to spawn drawable objects.

◆ getOrCreateConstant() [1/2]

Pipeline::Constant & spk::Lumina::Pipeline::getOrCreateConstant ( const std::string & p_jsonBlock)
static

Retrieves or creates a constant from a JSON description block.

Parameters
p_jsonBlockJSON string describing the data block.
Returns
Reference to the created or existing constant.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOrCreateConstant() [2/2]

Pipeline::Constant & spk::Lumina::Pipeline::getOrCreateConstant ( const std::wstring & p_jsonBlock)
static

Wide-string overload for getOrCreateConstant.

Parameters
p_jsonBlockJSON string describing the data block.
Returns
Reference to the created or existing constant.
Here is the call graph for this function:

◆ insertConstant() [1/2]

Pipeline::Constant & spk::Lumina::Pipeline::insertConstant ( const std::string & p_jsonBlock)
static

Inserts a global constant from a JSON description block.

The JSON must match a single entry of the "constants" array in a compiled Lumina artifact, e.g.:

{ "name": "ViewRegionConstant", "type": "UBO", "size": 64, "members": [ ... ], "dynamicArrayLayout": { ... } // optional }

If a constant with the same name already exists, this verifies that its kind and size are compatible and returns it; otherwise a new constant is created, with a binding point allocated from the internal counter.

Parameters
p_jsonBlockJSON string describing the data block.
Returns
Reference to the created or existing constant.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertConstant() [2/2]

Pipeline::Constant & spk::Lumina::Pipeline::insertConstant ( const std::wstring & p_jsonBlock)
static

Wide-string overload for insertConstant.

The string must contain UTF-8 JSON encoded in a std::wstring; it will be converted to UTF-8 internally before parsing.

Parameters
p_jsonBlockJSON string describing the data block.
Returns
Reference to the created or existing constant.
Here is the call graph for this function:

◆ operator=()

Pipeline & spk::Lumina::Pipeline::operator= ( Pipeline && p_other)
defaultnoexcept

Move-assigns pipeline ownership.

Parameters
p_otherPipeline to move from.
Returns
Reference to this pipeline.

The documentation for this class was generated from the following files:
  • includes/structure/lumina/spk_pipeline.hpp
  • srcs/structure/lumina/spk_pipeline.cpp