Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorShaders::CustomColors Namespace Reference

Canonical key format for the customColors[N] slots in BaseUniforms. More...

Functions

QString colorKey (int slot)
 Format a customColor key from a 0-based slot index.
 

Variables

constexpr int kColorCount = 16
 Number of color slots in BaseUniforms::customColors[16].
 

Detailed Description

Canonical key format for the customColors[N] slots in BaseUniforms.

Sibling to CustomParams::slotKey — the slot-keyed map decoder in PhosphorRendering::ShaderEffect::setShaderParams consumes both formats.

Color params produce keys of the form "customColor<N>" where N is 1-based. There is no sub-component split because each color occupies a full vec4 (rgba) — so the single-arg overload is the only one needed.

Three current consumers:

PhosphorShaders::ShaderRegistry::ParameterInfo::uniformName() — overlay-shader encoder for color params (uses internal lookup table; identical output) • PhosphorRendering::ShaderEffect::setShaderParams — decoder for both runtime paths • AnimationShaderRegistry::translateAnimationParams — animation shaders route color-typed params through this helper too. The encoder advances a separate colorSlot counter independently of the float customParams allocator (see AnimationShaderContract.h for the independence rationale) and enforces the 16-slot kColorCount budget; overflow is dropped with a qCWarning. The AnimationShaderContract::colorKey helper is a thin forwarder onto this function.

Lifted alongside CustomParams::slotKey so a future format drift (renaming the prefix, switching to 0-based indexing, etc.) only has to change here and every consumer stays in sync.

Function Documentation

◆ colorKey()

QString PhosphorShaders::CustomColors::colorKey ( int  slot)
inline

Format a customColor key from a 0-based slot index.

Slot 0 → "customColor1", slot 15 → "customColor16". Out-of-range values return an empty QString rather than wrapping around — same graceful-degradation contract as CustomParams::slotKey(int).

Variable Documentation

◆ kColorCount

constexpr int PhosphorShaders::CustomColors::kColorCount = 16
inlineconstexpr

Number of color slots in BaseUniforms::customColors[16].