A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
/**
* @file MaterialConstants.hpp
* @brief Binding points for per-material shader constants — the second tier of the
* engine's constant-buffer layering (after per-frame FrameConstants at binding 0).
* @details A material shader authored with `#pragma param` gets a `layout(std140) uniform
* MaterialConstants { ... }` block auto-generated by ShaderParser; Shader::compile
* links it to MATERIAL_CONSTANTS_BINDING, and the render path binds the material's
* UBO there per draw. Material texture parameters get sampler units starting at
* MATERIAL_TEXTURE_UNIT_BASE, above the batch path's 0..7 multi-texture slots.
*/
#pragma once
#include "../../core/Types.hpp"
namespace esengine {
/** @brief Indexed UBO binding point for the per-material MaterialConstants block. */
inline constexpr u32 MATERIAL_CONSTANTS_BINDING = 1;
/** @brief GLSL block name; must match ShaderParser's generated block + Shader::compile lookup. */
inline constexpr const char* MATERIAL_CONSTANTS_BLOCK = "MaterialConstants";
/** @brief First sampler unit a material texture parameter may use (batch owns units 0..7). */
inline constexpr u32 MATERIAL_TEXTURE_UNIT_BASE = 8;
/**
* @brief The unit a PostProcess pass reads the scene's DEPTH at.
*
* @details The top of the engine range on purpose: units 0 and 1 are the pass
* input and the scene, and the loose-uniform path fills upward from 2,
* so the last one is the only one nothing else can reach. A fullscreen
* pass has no use for the batch's other units.
*/
inline constexpr u32 kSceneDepthUnit = 7;
/**
* @brief The unit a PostProcess pass reads the scene's surface record at: what a surface IS —
* octahedral normal in rg, roughness in b, metalness in a (0 = nothing wrote here).
*
* @details Just below the depth, on the same reasoning: the loose-uniform path fills upward from
* 2 and stops short of both, and a material's own textures start at 8.
*/
inline constexpr u32 kGBufferUnit = 6;
} // namespace esengine