Photon Common Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
config.h File Reference

Configurations for the entire toolset. More...

#include <cstddef>
#include <string>

Go to the source code of this file.

Classes

class  ph::Config
 

Namespaces

namespace  ph
 The root for all renderer implementations.
 

Macros

#define PH_ENGINE_VERSION   "2.0.0"
 Version of Photon.
 
#define PH_PSDL_VERSION   "1.1.0"
 Version of Photon Scene Description Language.
 
#define PH_DEBUG   0
 Enable debug functionalities. Assertions will be enabled on debug mode.
 
#define PH_PROFILING   0
 
#define PH_ABORT_ON_ASSERTION_FAILED   1
 Abort the engine on assertion fail.
 
#define PH_PRINT_STACK_TRACE_ON_ASSERTION_FAILED   1
 Perform and print a stack trace when assertion failed.
 
#define PH_STRICT_FLOATING_POINT_SIZES   1
 Assuring floating point types has specified sizes.
 
#define PH_USE_DOUBLE_REAL   0
 Use double precision real numbers.
 
#define PH_ENABLE_DEBUG_LOG   PH_DEBUG
 Enable debug log level.
 
#define PH_ENSURE_LOCKFREE_ALGORITHMS_ARE_LOCKLESS   1
 
#define PH_MEMORY_ARENA_DEFAULT_BLOCK_SIZE_IN_BYTES   (static_cast<std::size_t>(512) * 1024)
 Default block size for memory arena. Default value is 512 KiB.
 
#define PH_TFUNCTION_DEFAULT_MIN_SIZE_IN_BYTES   (static_cast<std::size_t>(64))
 
#define PH_ENABLE_HIT_EVENT_STATS   0
 Enable statistics recording for hit events.
 
#define PH_STRICT_OBJECT_LIFETIME   0
 Being strict about object lifetime. Some compiler versions and different standards may be using an object lifetime model that can be optimized more aggressively (e.g., constant folding on const instances), which may cause UB or malfunctions on some low-level code. It is then advisible to turn on this option if such behavior is observed on the host platform. Note that turning this option off does not mean the source code will be non-conforming to the standard, it means the opposite–follow the latest standard strictly. Turning this option on is a fallback when things do not go as planned.
 
#define PH_LOG_FILE_DIRECTRY   "./Logs/"
 Directory that stores engine log file.
 
#define PH_CONFIG_DIRECTORY   "./Config/"
 
#define PH_SCRIPT_DIRECTORY   "./Script/"
 
#define PH_INTERNAL_RESOURCE_DIRECTORY   "./InternalResource/"
 Resources that are integrated as part of the renderer.
 
#define PH_RENDERER_RESOURCE_DIRECTORY   "./Photon-v2-Resource/Resource/"
 Resources that are optional for the renderer.
 
#define PH_RENDER_MODE_LINEAR_SRGB   0
 
#define PH_RENDER_MODE_ACES   1
 
#define PH_RENDER_MODE_SPECTRAL   2
 
#define PH_RENDER_MODE_FULL_SPECTRAL   3
 
#define PH_RENDER_MODE   PH_RENDER_MODE_LINEAR_SRGB
 
#define PH_STRICT_ASYMMETRIC_IMPORTANCE_TRANSPORT   0
 Being strict about the symmetricity of importance transport. There are many sources of asymmetry between light and importance transport, but not all of them can be handled gracefully. One example is when shading normals are used for light transport, it is equivalent to using an asymmetric, modified BSDF. However, the correction factor to restore consistency between light and importance transport can have high variance and makes the result unusable for some scenes. This option (when disabled) attempt to fix that by introducing a small bias.
 
#define PH_SPECTRUM_SAMPLED_MIN_WAVELENGTH_NM   350
 
#define PH_SPECTRUM_SAMPLED_MAX_WAVELENGTH_NM   850
 
#define PH_SPECTRUM_SAMPLED_NUM_SAMPLES   100
 
#define PH_HIT_PROBE_DEPTH   8
 
#define PH_SDL_MAX_FIELDS   64
 
#define PH_SDL_MAX_FUNCTIONS   64
 
#define PH_HIT_PROBE_CACHE_BYTES   32
 Number of available bytes for a probe's cache. Note that a byte is not necessarily 8-bit.
 
#define PH_NUMERIC_IMAGE_MAX_ELEMENTS   4
 
#define PH_USE_SIMD   0
 

Detailed Description

Configurations for the entire toolset.

Hardware Dependent Instruction Sets

Use PH_USE_SIMD to check if SIMD intrinsics can be used. You can also check for a more specific instruction set, as listed below:

  • SSE Family
    • PH_USE_SSE
    • PH_USE_SSE2
    • PH_USE_SSE3
    • PH_USE_SSSE3
    • PH_USE_SSE4_1
    • PH_USE_SSE4_2
  • AVX Family
    • PH_USE_AVX
    • PH_USE_AVX2

Beware that mixing SSE and AVX instructions can result in significant performance degradation under certain microarchitectures, see https://stackoverflow.com/questions/41303780/why-is-this-sse-code-6-times-slower-without-vzeroupper-on-skylake.

Macro Definition Documentation

◆ PH_ABORT_ON_ASSERTION_FAILED

#define PH_ABORT_ON_ASSERTION_FAILED   1

Abort the engine on assertion fail.

◆ PH_CONFIG_DIRECTORY

#define PH_CONFIG_DIRECTORY   "./Config/"

◆ PH_DEBUG

#define PH_DEBUG   0

Enable debug functionalities. Assertions will be enabled on debug mode.

◆ PH_ENABLE_DEBUG_LOG

#define PH_ENABLE_DEBUG_LOG   PH_DEBUG

Enable debug log level.

◆ PH_ENABLE_HIT_EVENT_STATS

#define PH_ENABLE_HIT_EVENT_STATS   0

Enable statistics recording for hit events.

◆ PH_ENGINE_VERSION

#define PH_ENGINE_VERSION   "2.0.0"

Version of Photon.

◆ PH_ENSURE_LOCKFREE_ALGORITHMS_ARE_LOCKLESS

#define PH_ENSURE_LOCKFREE_ALGORITHMS_ARE_LOCKLESS   1

◆ PH_HIT_PROBE_CACHE_BYTES

#define PH_HIT_PROBE_CACHE_BYTES   32

Number of available bytes for a probe's cache. Note that a byte is not necessarily 8-bit.

◆ PH_HIT_PROBE_DEPTH

#define PH_HIT_PROBE_DEPTH   8

◆ PH_INTERNAL_RESOURCE_DIRECTORY

#define PH_INTERNAL_RESOURCE_DIRECTORY   "./InternalResource/"

Resources that are integrated as part of the renderer.

◆ PH_LOG_FILE_DIRECTRY

#define PH_LOG_FILE_DIRECTRY   "./Logs/"

Directory that stores engine log file.

◆ PH_MEMORY_ARENA_DEFAULT_BLOCK_SIZE_IN_BYTES

#define PH_MEMORY_ARENA_DEFAULT_BLOCK_SIZE_IN_BYTES   (static_cast<std::size_t>(512) * 1024)

Default block size for memory arena. Default value is 512 KiB.

◆ PH_NUMERIC_IMAGE_MAX_ELEMENTS

#define PH_NUMERIC_IMAGE_MAX_ELEMENTS   4

◆ PH_PRINT_STACK_TRACE_ON_ASSERTION_FAILED

#define PH_PRINT_STACK_TRACE_ON_ASSERTION_FAILED   1

Perform and print a stack trace when assertion failed.

◆ PH_PROFILING

#define PH_PROFILING   0

◆ PH_PSDL_VERSION

#define PH_PSDL_VERSION   "1.1.0"

Version of Photon Scene Description Language.

◆ PH_RENDER_MODE

#define PH_RENDER_MODE   PH_RENDER_MODE_LINEAR_SRGB

◆ PH_RENDER_MODE_ACES

#define PH_RENDER_MODE_ACES   1

◆ PH_RENDER_MODE_FULL_SPECTRAL

#define PH_RENDER_MODE_FULL_SPECTRAL   3

◆ PH_RENDER_MODE_LINEAR_SRGB

#define PH_RENDER_MODE_LINEAR_SRGB   0

◆ PH_RENDER_MODE_SPECTRAL

#define PH_RENDER_MODE_SPECTRAL   2

◆ PH_RENDERER_RESOURCE_DIRECTORY

#define PH_RENDERER_RESOURCE_DIRECTORY   "./Photon-v2-Resource/Resource/"

Resources that are optional for the renderer.

◆ PH_SCRIPT_DIRECTORY

#define PH_SCRIPT_DIRECTORY   "./Script/"

◆ PH_SDL_MAX_FIELDS

#define PH_SDL_MAX_FIELDS   64

◆ PH_SDL_MAX_FUNCTIONS

#define PH_SDL_MAX_FUNCTIONS   64

◆ PH_SPECTRUM_SAMPLED_MAX_WAVELENGTH_NM

#define PH_SPECTRUM_SAMPLED_MAX_WAVELENGTH_NM   850

◆ PH_SPECTRUM_SAMPLED_MIN_WAVELENGTH_NM

#define PH_SPECTRUM_SAMPLED_MIN_WAVELENGTH_NM   350

◆ PH_SPECTRUM_SAMPLED_NUM_SAMPLES

#define PH_SPECTRUM_SAMPLED_NUM_SAMPLES   100

◆ PH_STRICT_ASYMMETRIC_IMPORTANCE_TRANSPORT

#define PH_STRICT_ASYMMETRIC_IMPORTANCE_TRANSPORT   0

Being strict about the symmetricity of importance transport. There are many sources of asymmetry between light and importance transport, but not all of them can be handled gracefully. One example is when shading normals are used for light transport, it is equivalent to using an asymmetric, modified BSDF. However, the correction factor to restore consistency between light and importance transport can have high variance and makes the result unusable for some scenes. This option (when disabled) attempt to fix that by introducing a small bias.

See also: "SPPM implementation is not symmetric" https://github.com/mmp/pbrt-v3/issues/209

◆ PH_STRICT_FLOATING_POINT_SIZES

#define PH_STRICT_FLOATING_POINT_SIZES   1

Assuring floating point types has specified sizes.

◆ PH_STRICT_OBJECT_LIFETIME

#define PH_STRICT_OBJECT_LIFETIME   0

Being strict about object lifetime. Some compiler versions and different standards may be using an object lifetime model that can be optimized more aggressively (e.g., constant folding on const instances), which may cause UB or malfunctions on some low-level code. It is then advisible to turn on this option if such behavior is observed on the host platform. Note that turning this option off does not mean the source code will be non-conforming to the standard, it means the opposite–follow the latest standard strictly. Turning this option on is a fallback when things do not go as planned.

◆ PH_TFUNCTION_DEFAULT_MIN_SIZE_IN_BYTES

#define PH_TFUNCTION_DEFAULT_MIN_SIZE_IN_BYTES   (static_cast<std::size_t>(64))

◆ PH_USE_DOUBLE_REAL

#define PH_USE_DOUBLE_REAL   0

Use double precision real numbers.

◆ PH_USE_SIMD

#define PH_USE_SIMD   0