Skip to content

Engine → Renderer

limits.h

Fixed budgets of the renderer. Those #defined in engine/shaders/shared/gpu_types.hlsli as CONJURE_<name> are compared with these by tests/renderer/test_gpu_types.cpp; the others (MAX_PASSES_PER_VIEW, the transient eviction windows and the upload budget among them) are CPU-only.

Constants

Name Type Value Description
BLOOM_MIP_COUNT inline constexpr u32 6 Mip levels of the bloom chain.
CUBEMAP_FACE_COUNT inline constexpr u32 6 Faces of a cubemap, in the +X, -X, +Y, -Y, +Z, -Z order of D3D and Vulkan.
ENVIRONMENT_MIP_COUNT inline constexpr u32 6 Mip levels of the environment cubemaps (sky and prefiltered specular).
EXPOSURE_HISTOGRAM_BINS inline constexpr u32 256 Bins of the auto-exposure luminance histogram.
INVALID_INDEX inline constexpr u32 0xFFFFFFFFu
LIGHT_TILE_SIZE inline constexpr u32 16
MATERIAL_TEXTURE_SLOTS inline constexpr u32 5 Number of texture slots of a material: base colour, metallic-roughness, normal, occlusion, emissive.
MAX_DEBUG_VERTICES inline constexpr u32 1u << 20
MAX_LIGHTS_PER_TILE inline constexpr u32 64
MAX_LIGHTS_PER_VIEW inline constexpr u32 1024
MAX_MATERIAL_SLOTS inline constexpr u32 8
MAX_PASSES_PER_VIEW inline constexpr u32 MAX_SHADOW_CASCADES + (2 * BLOOM_MIP_COUNT - 1) + 19 Passes one view's render graph executes at most: a pass per shadow cascade, the bloom chain (BLOOM_MIP_COUNT down passes, one up pass fewer) and nineteen single passes (shadow_atlas, depth_prepass, msaa_depth_resolve, light_cull, ssao_gtao, ssao_blur_h, ssao_blur_v, forward_opaque, skybox, forward_blend, world_sprites, debug_draw, msaa_hdr_resolve, exposure_histogram, exposure_adapt, tonemap, fxaa, screen_sprites, blit). The two resolves belong to MSAA and fxaa to the FXAA filter. render_stats::passNames holds MAX_VIEWS times this many. CPU-only: not mirrored in gpu_types.hlsli.
MAX_SHADOW_CASCADES inline constexpr u32 4
MAX_SPRITES_PER_FRAME inline constexpr u32 65536
MAX_VIEWS inline constexpr u32 8
TRANSIENT_EVICTION_FRAMES inline constexpr u32 120 Frames a single-sample transient texture, and every transient buffer, may stay pooled without use: it is kept while it has been unused for at most this many frames and released by the next end_frame.
TRANSIENT_MSAA_EVICTION_FRAMES inline constexpr u32 3 TRANSIENT_EVICTION_FRAMES for multisampled transient textures. An MSAA set is large (about 133 MB per view at 1080p and 4x) and every view size is its own pool entry, so it is released quickly: when a view's size or sample count changes, the old set lives this many frames past its last use beside the new one, so at most two of that view's sets are alive once the new size has held for TRANSIENT_MSAA_EVICTION_FRAMES frames. A size that changes on every frame (a viewport drag) keeps the sets of at most the last TRANSIENT_MSAA_EVICTION_FRAMES + 2 frames of that view alive, instead of one per frame of the last TRANSIENT_EVICTION_FRAMES. The cached binding sets that reference a multisampled texture are released on this window too, so they do not keep it alive longer.
UPLOAD_BUDGET_BYTES_PER_FRAME inline constexpr u64 u64{64} * 1024 * 1024 Bytes of asset payload uploaded per frame at most; the remainder waits for the next frame.