Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
donner::gpu::shader::ShaderResult< T > Class Template Reference

Result of a fallible shader IR operation: exactly one of a value of type T or a ShaderError. More...

#include "donner/gpu/shader/ShaderResult.h"

Public Member Functions

 ShaderResult (T &&result)
 Construct from a successful result.
 ShaderResult (const T &result)
 Construct from a successful result by copy.
 ShaderResult (ShaderError &&error)
 Construct from an error.
 ShaderResult (const ShaderError &error)
 Construct from an error by copy.
T & result () &
 Returns the contained result.
T && result () &&
 Returns the contained result (move).
const T & result () const &
 Returns the contained result.
ShaderErrorerror () &
 Returns the contained error.
ShaderError && error () &&
 Returns the contained error (move).
const ShaderErrorerror () const &
 Returns the contained error.
bool hasResult () const noexcept
 Returns true if this result contains a value.
bool hasError () const noexcept
 Returns true if this result contains an error.

Detailed Description

template<typename T>
class donner::gpu::shader::ShaderResult< T >

Result of a fallible shader IR operation: exactly one of a value of type T or a ShaderError.

Mirrors the accessor shape of donner::gpu::Result so call sites read the same across the GPU module, but carries the IR-local error type.

Template Parameters
TResult type.

Constructor & Destructor Documentation

◆ ShaderResult() [1/4]

template<typename T>
donner::gpu::shader::ShaderResult< T >::ShaderResult ( T && result)
inline

Construct from a successful result.

Parameters
resultResult value.

◆ ShaderResult() [2/4]

template<typename T>
donner::gpu::shader::ShaderResult< T >::ShaderResult ( const T & result)
inline

Construct from a successful result by copy.

Parameters
resultResult value.

◆ ShaderResult() [3/4]

template<typename T>
donner::gpu::shader::ShaderResult< T >::ShaderResult ( ShaderError && error)
inline

Construct from an error.

Parameters
errorError value.

◆ ShaderResult() [4/4]

template<typename T>
donner::gpu::shader::ShaderResult< T >::ShaderResult ( const ShaderError & error)
inline

Construct from an error by copy.

Parameters
errorError value.

Member Function Documentation

◆ error() [1/3]

template<typename T>
ShaderError & donner::gpu::shader::ShaderResult< T >::error ( ) &
inline

Returns the contained error.

Precondition
There is a valid error, i.e. hasError() returns true.

◆ error() [2/3]

template<typename T>
ShaderError && donner::gpu::shader::ShaderResult< T >::error ( ) &&
inline

Returns the contained error (move).

Precondition
There is a valid error, i.e. hasError() returns true.

◆ error() [3/3]

template<typename T>
const ShaderError & donner::gpu::shader::ShaderResult< T >::error ( ) const &
inline

Returns the contained error.

Precondition
There is a valid error, i.e. hasError() returns true.

◆ result() [1/3]

template<typename T>
T & donner::gpu::shader::ShaderResult< T >::result ( ) &
inline

Returns the contained result.

Precondition
There is a valid result, i.e. hasResult() returns true.

◆ result() [2/3]

template<typename T>
T && donner::gpu::shader::ShaderResult< T >::result ( ) &&
inline

Returns the contained result (move).

Precondition
There is a valid result, i.e. hasResult() returns true.

◆ result() [3/3]

template<typename T>
const T & donner::gpu::shader::ShaderResult< T >::result ( ) const &
inline

Returns the contained result.

Precondition
There is a valid result, i.e. hasResult() returns true.

The documentation for this class was generated from the following file: