Photon Common Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph Namespace Reference

The root for all renderer implementations. More...

Namespaces

namespace  detail
 Implementation detail mainly for internal usages.
 
namespace  math
 
namespace  os
 
namespace  string_utils
 Contains various string manipulation helpers.
 

Classes

class  CommandLineArguments
 Helper for parsing command line arguments. More...
 
class  Config
 
class  FileIOError
 
class  FilesystemError
 
class  IllegalOperationException
 
class  IniFile
 INI file I/O. This class is useful for recording various settings across the entire engine project. As a low-level I/O class in Common library, it can be used regardless the engine initialization state (see init_render_engine() and exit_render_engine() in Engine library for more details). More...
 
class  InvalidArgumentException
 
class  IOException
 
class  Logger
 
struct  LogGroup
 
class  LogGroups
 
class  LogicalException
 General exception thrown on logical error. More...
 
class  NumericException
 
class  OutOfRangeException
 
class  OverflowException
 
class  RuntimeException
 General exception thrown on runtime error. More...
 
struct  TAlignedArray
 Aligned version of std::array. This type shares the same traits as std::array. [class.mem] section 20 (https://timsong-cpp.github.io/cppwp/n3337/class.mem#20) supports that the alignment can pass through to the inherited std::array as long as the derived type is also a standard-layout type. More...
 
class  TimerStatsReport
 
class  Timestamp
 Represents a point in time. More...
 
class  UninitializedObjectException
 

Concepts

concept  CPhotonException
 

Typedefs

using StdUnorderedStringSet
 Unordered std::string set with support for heterogeneous string key lookup. Supports std::string_view and literal (C-style) string lookup in addition to the original std::string lookup. The heterogeneous access can save redundant dynamic allocations when querying the map.
 
template<typename Value >
using TStdUnorderedStringMap
 Unordered std::string map with support for heterogeneous string key lookup. Supports std::string_view and literal (C-style) string lookup in addition to the original std::string lookup. The heterogeneous access can save redundant dynamic allocations when querying the map.
 
using Exception = std::exception
 
using LogHandler = std::function<void(ELogLevel logLevel, std::string_view logString)>
 
template<typename T >
using TAlignedMemoryUniquePtr = std::unique_ptr<T, detail::AlignedMemoryDeleter>
 
using real = float
 
using integer = int
 
using hiReal = float64
 
using hiInteger = int64
 
using int8 = std::int8_t
 Fixed-size integer types.
 
using uint8 = std::uint8_t
 
using int16 = std::int16_t
 
using uint16 = std::uint16_t
 
using int32 = std::int32_t
 
using uint32 = std::uint32_t
 
using int64 = std::int64_t
 
using uint64 = std::uint64_t
 
using int8f = std::int_fast8_t
 Fastest integer types with size guarantee. For example, uint32f is an unsigned integer with at least 32 bits.
 
using uint8f = std::uint_fast8_t
 
using int16f = std::int_fast16_t
 
using uint16f = std::uint_fast16_t
 
using int32f = std::int_fast32_t
 
using uint32f = std::uint_fast32_t
 
using int64f = std::int_fast64_t
 
using uint64f = std::uint_fast64_t
 
using float32 = float
 Fixed-size floating-point types.
 
using float64 = double
 

Enumerations

enum class  ELogLevel {
  Debug , Note , Warning , Error ,
  DebugOnce , NoteOnce , WarningOnce , ErrorOnce
}
 

Functions

void debug_break ()
 
std::string obtain_stack_trace ()
 
template<CPhotonException ExceptionType, typename... Args>
void throw_formatted (const std::format_string< Args... > msgFormat, Args &&... args)
 
constexpr bool is_once (const ELogLevel logLevel)
 
LogGroups get_core_log_groups ()
 
 PH_DECLARE_LOG_GROUP (PhotonRenderer)
 
template<typename T = void>
auto make_aligned_memory (std::size_t numBytes, std::size_t alignmentInBytes) -> TAlignedMemoryUniquePtr< T >
 Create an aligned memory resource.
 
template<typename T >
void from_bytes (const std::byte *srcBytes, T *out_dstValue)
 
template<typename T >
void to_bytes (const T &srcValue, std::byte *out_dstBytes)
 
template<std::size_t N>
void reverse_bytes (std::byte *bytes)
 
template<typename T >
T * start_implicit_lifetime_as (void *ptr) noexcept
 Wrapper for std::start_lifetime_as(). Primarily a fallback when C++23 is not available. This function may touch the storage. For cv overloads or one that does not touch the storage, use std::start_lifetime_as() (requires C++23).
 
template<typename T >
T * start_implicit_lifetime_as_array (void *ptr, std::size_t numArrayElements) noexcept
 Wrapper for std::start_lifetime_as_array(). Primarily a fallback when C++23 is not available. This function may touch the storage. For cv overloads or one that does not touch the storage, use std::start_lifetime_as_array() (requires C++23).
 
constexpr real operator""_r (const long double cookedValue)
 
template<typename T >
consteval std::size_t sizeof_in_bits ()
 Calculates number of bits an instance of type T occupies.
 
template<typename T , std::size_t N>
constexpr std::array< T, N > make_array (const T &element)
 Creates an std::array filled with the same element.
 
template<std::integral DstType, std::integral SrcType>
DstType lossless_integer_cast (const SrcType &src)
 
template<std::floating_point DstType, std::floating_point SrcType>
DstType lossless_float_cast (const SrcType &src)
 
template<typename DstType , typename SrcType >
DstType lossless_cast (const SrcType &src)
 Cast numeric value to another type without any loss of information. If there is any possible overflow or numeric precision loss, exception is thrown.
 
template<typename DstType , typename SrcType >
DstType lossless_cast (const SrcType &src, DstType *const out_dst)
 
 PH_DEFINE_LOG_GROUP (PhotonRenderer, Core)
 

Detailed Description

The root for all renderer implementations.

Typedef Documentation

◆ Exception

using ph::Exception = std::exception

◆ float32

using ph::float32 = float

Fixed-size floating-point types.

◆ float64

using ph::float64 = double

◆ hiInteger

◆ hiReal

◆ int16

using ph::int16 = std::int16_t

◆ int16f

using ph::int16f = std::int_fast16_t

◆ int32

using ph::int32 = std::int32_t

◆ int32f

using ph::int32f = std::int_fast32_t

◆ int64

using ph::int64 = std::int64_t

◆ int64f

using ph::int64f = std::int_fast64_t

◆ int8

using ph::int8 = std::int8_t

Fixed-size integer types.

◆ int8f

using ph::int8f = std::int_fast8_t

Fastest integer types with size guarantee. For example, uint32f is an unsigned integer with at least 32 bits.

◆ integer

using ph::integer = int

◆ LogHandler

using ph::LogHandler = std::function<void(ELogLevel logLevel, std::string_view logString)>

◆ real

using ph::real = float

◆ StdUnorderedStringSet

Initial value:
std::unordered_set<
std::string, detail::HeterogeneousStringHash, std::equal_to<>>

Unordered std::string set with support for heterogeneous string key lookup. Supports std::string_view and literal (C-style) string lookup in addition to the original std::string lookup. The heterogeneous access can save redundant dynamic allocations when querying the map.

◆ TAlignedMemoryUniquePtr

template<typename T >
using ph::TAlignedMemoryUniquePtr = std::unique_ptr<T, detail::AlignedMemoryDeleter>

◆ TStdUnorderedStringMap

template<typename Value >
using ph::TStdUnorderedStringMap
Initial value:
std::unordered_map<
std::string, Value, detail::HeterogeneousStringHash, std::equal_to<>>

Unordered std::string map with support for heterogeneous string key lookup. Supports std::string_view and literal (C-style) string lookup in addition to the original std::string lookup. The heterogeneous access can save redundant dynamic allocations when querying the map.

◆ uint16

using ph::uint16 = std::uint16_t

◆ uint16f

using ph::uint16f = std::uint_fast16_t

◆ uint32

using ph::uint32 = std::uint32_t

◆ uint32f

using ph::uint32f = std::uint_fast32_t

◆ uint64

using ph::uint64 = std::uint64_t

◆ uint64f

using ph::uint64f = std::uint_fast64_t

◆ uint8

using ph::uint8 = std::uint8_t

◆ uint8f

using ph::uint8f = std::uint_fast8_t

Enumeration Type Documentation

◆ ELogLevel

enum class ph::ELogLevel
strong
Enumerator
Debug 
Note 
Warning 
Error 
DebugOnce 
NoteOnce 
WarningOnce 
ErrorOnce 

Function Documentation

◆ debug_break()

void ph::debug_break ( )

◆ from_bytes()

template<typename T >
void ph::from_bytes ( const std::byte * srcBytes,
T * out_dstValue )
inline

◆ get_core_log_groups()

LogGroups ph::get_core_log_groups ( )

◆ is_once()

bool ph::is_once ( const ELogLevel logLevel)
inlineconstexpr

◆ lossless_cast() [1/2]

template<typename DstType , typename SrcType >
DstType ph::lossless_cast ( const SrcType & src)
inline

Cast numeric value to another type without any loss of information. If there is any possible overflow or numeric precision loss, exception is thrown.

Exceptions
OverflowExceptionIf overflow happens.
NumericxceptionIf any numeric precision loss happens.

◆ lossless_cast() [2/2]

template<typename DstType , typename SrcType >
DstType ph::lossless_cast ( const SrcType & src,
DstType *const out_dst )
inline

◆ lossless_float_cast()

template<std::floating_point DstType, std::floating_point SrcType>
DstType ph::lossless_float_cast ( const SrcType & src)
inline

◆ lossless_integer_cast()

template<std::integral DstType, std::integral SrcType>
DstType ph::lossless_integer_cast ( const SrcType & src)
inline

◆ make_aligned_memory()

template<typename T = void>
auto ph::make_aligned_memory ( std::size_t numBytes,
std::size_t alignmentInBytes ) -> TAlignedMemoryUniquePtr<T>
inline

Create an aligned memory resource.

The returned memory resource will follow the life time of std::unique_ptr. Note that the memory allocated by this function is raw memory–placement new is required before any use of the memory content, otherwise it is UB by C++ standard (for non-implicit-lifetime types). For implicit-lifetime types, accessing the raw memory without placement new has defined behavior after C++20.

Template Parameters
TThe type to create memory for. alignmentInBytes should be compatible with the type.
Parameters
numBytesNumber of bytes to allocate. Must be an integer multiple of alignmentInBytes.
alignmentInBytesHow many bytes to align (so the returned pointer is an integer multiple of alignmentInBytes). Must be an integer power of 2 and a multiple of sizeof(void*).
Returns
Pointer to the beginning of newly allocated memory. nullptr on failure.
Note
This function is thread safe.

◆ make_array()

template<typename T , std::size_t N>
std::array< T, N > ph::make_array ( const T & element)
inlineconstexpr

Creates an std::array filled with the same element.

Note
The element does not need to be default-constructible.

◆ obtain_stack_trace()

std::string ph::obtain_stack_trace ( )

◆ operator""_r()

real ph::operator""_r ( const long double cookedValue)
inlineconstexpr

◆ PH_DECLARE_LOG_GROUP()

ph::PH_DECLARE_LOG_GROUP ( PhotonRenderer )

◆ PH_DEFINE_LOG_GROUP()

ph::PH_DEFINE_LOG_GROUP ( PhotonRenderer ,
Core  )

◆ reverse_bytes()

template<std::size_t N>
void ph::reverse_bytes ( std::byte * bytes)
inline

◆ sizeof_in_bits()

template<typename T >
std::size_t ph::sizeof_in_bits ( )
inlineconsteval

Calculates number of bits an instance of type T occupies.

◆ start_implicit_lifetime_as()

template<typename T >
T * ph::start_implicit_lifetime_as ( void * ptr)
inlinenoexcept

Wrapper for std::start_lifetime_as(). Primarily a fallback when C++23 is not available. This function may touch the storage. For cv overloads or one that does not touch the storage, use std::start_lifetime_as() (requires C++23).

Note
Starting lifetime of an array of unsigned char or std::byte implicitly creates objects within the region of storage. See [intro.object] section 13 (https://timsong-cpp.github.io/cppwp/intro.object#13).

◆ start_implicit_lifetime_as_array()

template<typename T >
T * ph::start_implicit_lifetime_as_array ( void * ptr,
std::size_t numArrayElements )
inlinenoexcept

Wrapper for std::start_lifetime_as_array(). Primarily a fallback when C++23 is not available. This function may touch the storage. For cv overloads or one that does not touch the storage, use std::start_lifetime_as_array() (requires C++23).

Note
Starting lifetime of an array of unsigned char or std::byte implicitly creates objects within the region of storage. See [intro.object] section 13 (https://timsong-cpp.github.io/cppwp/intro.object#13).

◆ throw_formatted()

template<CPhotonException ExceptionType, typename... Args>
void ph::throw_formatted ( const std::format_string< Args... > msgFormat,
Args &&... args )
inline

◆ to_bytes()

template<typename T >
void ph::to_bytes ( const T & srcValue,
std::byte * out_dstBytes )
inline