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.
QString glslAccessor (int slot)
 GLSL author-facing accessor for a color slot — the form a shader author reads in fragment source, as opposed to colorKey()'s QVariantMap serialisation form.

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.

Reached the same way CustomParams::slotKey is, and by the same set: every family encodes through it, the daemon decodes through it once for all families, and the compositor decodes through it per family.

• Encoders. The overlay registry's ParameterInfo::uniformName() builds the same strings from an internal lookup table. Animation, surface and pointer reach this function through their contract headers' colorKey forwarders. Each encoder advances a colorSlot counter INDEPENDENTLY of the float customParams allocator (see AnimationShaderContract.h for why they are independent) and enforces the 16-slot kColorCount budget, dropping overflow with a qCWarning. • Decoders. PhosphorRendering::ShaderEffect::setShaderParams on the daemon, and the compositor's own per-family pack code.

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).

◆ glslAccessor()

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

GLSL author-facing accessor for a color slot — the form a shader author reads in fragment source, as opposed to colorKey()'s QVariantMap serialisation form.

Slot 0 → "customColors[0]". 0-based to match GLSL array indexing (colorKey() is 1-based for the uniform-key wire format). Out-of-range values return an empty QString.

Variable Documentation

◆ kColorCount

int PhosphorShaders::CustomColors::kColorCount = 16
inlineconstexpr

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