Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
AnimationShaderContract.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
7
8#include <QString>
9
11
191namespace AnimationShaderContract {
192
232inline constexpr const char* kITime = "iTime";
233
237inline constexpr const char* kIResolution = "iResolution";
238
244inline constexpr const char* kITimeDelta = "iTimeDelta";
245
252inline constexpr const char* kIFrame = "iFrame";
253
259inline constexpr const char* kIDate = "iDate";
260
275inline constexpr const char* kIIsReversed = "iIsReversed";
276
312inline constexpr const char* kISurfaceScreenPos = "iSurfaceScreenPos";
313
321inline constexpr const char* kIAnchorSize = "iAnchorSize";
322
343inline constexpr const char* kIAnchorPosInFbo = "iAnchorPosInFbo";
344
362inline constexpr const char* kIAnchorRectInTexture = "iAnchorRectInTexture";
363
382inline constexpr const char* kIFromRect = "iFromRect";
383inline constexpr const char* kIToRect = "iToRect";
384
406inline constexpr const char* kIIconRect = "iIconRect";
407
420inline constexpr const char* kUOldWindow = "uOldWindow";
421
432inline constexpr const char* kUSurfaceLayer = "uSurfaceLayer";
433
440inline constexpr const char* kIHasSurfaceLayer = "iHasSurfaceLayer";
441
450inline constexpr const char* kIHasOldWindow = "iHasOldWindow";
451
461inline constexpr const char* kIOldWindowOpacity = "iOldWindowOpacity";
462
471inline constexpr const char* kIMoveVelocity = "iMoveVelocity";
475inline constexpr const char* kIMoveOffset = "iMoveOffset";
482inline constexpr const char* kIMoveVelocity2 = "iMoveVelocity2";
491inline constexpr const char* kIMoveTrail = "iMoveTrail";
501inline constexpr const char* kIMoveMesh = "iMoveMesh";
508inline constexpr const char* kILayerRectInTexture = "iLayerRectInTexture";
509
523inline constexpr const char* kIWindowOpacity = "iWindowOpacity";
524
539inline constexpr int kMaxUserTextureSlots = 3;
540
546inline constexpr int kMaxBufferPasses = 4;
547
554inline constexpr const char* kIAudioSpectrumSize = "iAudioSpectrumSize";
555
561inline constexpr const char* kUAudioSpectrum = "uAudioSpectrum";
562
581inline constexpr const char* kIMouse = "iMouse";
582
589inline constexpr const char* kCustomParamsArray = "customParams";
590
604
610
618inline QString slotKey(int vec, char comp)
619{
621}
622
624inline QString slotKey(int slot)
625{
627}
628
652inline constexpr const char* kCustomColorsArray = "customColors";
654
662inline QString colorKey(int slot)
663{
665}
666
675
696
710inline bool isValidWrapToken(const QString& wrap)
711{
712 // Thin forwarder onto the cross-library canonical predicate in
713 // <PhosphorShaders/CustomParamsKey.h> (already included above), so all
714 // three shader families share one wrap vocabulary rather than each
715 // hand-rolling its own token list that can drift.
717}
718
727inline bool isValidFilterToken(const QString& filter)
728{
729 // Forwarder onto PhosphorShaders::isValidFilterToken, for the same reason
730 // as isValidWrapToken above.
732}
733
734} // namespace AnimationShaderContract
735
736} // namespace PhosphorAnimationShaders
737
738// The compile-time link between AnimationShaderContract::kMaxUserTextureSlots
739// and PhosphorRendering::kMaxUserTextures lives in
740// libs/phosphor-animation/src/contract_pins.cpp. It cannot live in this header
741// because translation units that only need contract definitions (notably the
742// kwin-effect, which already pulls in epoxy/gl.h via KWin) must not be forced
743// to also pull in <QtQuick/QSGTextureProvider> via ShaderNodeRhi.h — epoxy and
744// Qt's qopenglext.h declare overlapping GL function-pointer typedefs that
745// conflict when both end up in the same TU.
constexpr const char * kISurfaceScreenPos
vec4 iSurfaceScreenPos — the shader surface's position plus the host screen dimensions,...
Definition AnimationShaderContract.h:312
constexpr const char * kIMoveVelocity
vec2 iMoveVelocity — COMPOSITOR PATH ONLY.
Definition AnimationShaderContract.h:471
constexpr const char * kIAnchorPosInFbo
vec2 iAnchorPosInFbo is the anchor's top-left position inside the FBO, in logical pixels.
Definition AnimationShaderContract.h:343
constexpr const char * kIFromRect
vec4 iFromRect / vec4 iToRect — geometry-morph endpoints in logical screen pixels (x,...
Definition AnimationShaderContract.h:382
constexpr const char * kIMoveTrail
vec2 iMoveTrail[16] — COMPOSITOR PATH ONLY.
Definition AnimationShaderContract.h:491
constexpr const char * kIAnchorSize
vec2 iAnchorSize — captured anchor (card) pixel size in logical pixels.
Definition AnimationShaderContract.h:321
QString slotKey(int vec, char comp)
Format a customParams slot key — thin forwarder onto PhosphorShaders::CustomParams::slotKey,...
Definition AnimationShaderContract.h:618
constexpr const char * kUAudioSpectrum
sampler2D uAudioSpectrum — the CAVA spectrum texture (bars×1, R = bar value in 0.....
Definition AnimationShaderContract.h:561
constexpr const char * kIAnchorRectInTexture
vec4 iAnchorRectInTexture — the card's UV sub-rect within uTexture0, as (x, y, width,...
Definition AnimationShaderContract.h:362
constexpr const char * kIResolution
vec2 iResolution — surface size in logical pixels.
Definition AnimationShaderContract.h:237
constexpr const char * kCustomColorsArray
vec4 customColors[N] — per-effect declared color parameter slots.
Definition AnimationShaderContract.h:652
constexpr int kMaxCustomColors
Definition AnimationShaderContract.h:653
constexpr const char * kIAudioSpectrumSize
int iAudioSpectrumSize — CAVA bar count, 0 while the audio visualizer is off or cava is unavailable.
Definition AnimationShaderContract.h:554
constexpr int kMaxUserTextureSlots
Maximum number of user-declared textures per animation effect.
Definition AnimationShaderContract.h:539
constexpr const char * kIHasOldWindow
int iHasOldWindow — COMPOSITOR PATH ONLY.
Definition AnimationShaderContract.h:450
constexpr const char * kIDate
vec4 iDate — local-time (year, month, day, seconds-since-midnight).
Definition AnimationShaderContract.h:259
constexpr int kMaxParameterSlots
Number of float sub-slots (4 per vec4 × 8 vec4s = 32).
Definition AnimationShaderContract.h:609
constexpr const char * kIMoveVelocity2
vec2 iMoveVelocity2 — COMPOSITOR PATH ONLY.
Definition AnimationShaderContract.h:482
constexpr const char * kIMoveMesh
vec2 iMoveMesh[16] — COMPOSITOR PATH ONLY.
Definition AnimationShaderContract.h:501
bool isValidWrapToken(const QString &wrap)
The accepted texture wrap vocabulary, shared by every animation validation site (metadata parse in An...
Definition AnimationShaderContract.h:710
constexpr const char * kIToRect
Definition AnimationShaderContract.h:383
constexpr const char * kIOldWindowOpacity
float iOldWindowOpacity — COMPOSITOR PATH ONLY.
Definition AnimationShaderContract.h:461
bool isValidFilterToken(const QString &filter)
The accepted buffer filter vocabulary: linear / nearest / mipmap.
Definition AnimationShaderContract.h:727
constexpr const char * kIHasSurfaceLayer
int iHasSurfaceLayer — COMPOSITOR PATH ONLY.
Definition AnimationShaderContract.h:440
constexpr const char * kITimeDelta
float iTimeDelta — wall-clock seconds between consecutive paint ticks that fed this transition.
Definition AnimationShaderContract.h:244
constexpr const char * kIMouse
vec4 iMouse — cursor position in shader-local pixels.
Definition AnimationShaderContract.h:581
constexpr const char * kIIconRect
vec4 iIconRect — the window's task-manager icon rectangle in logical screen pixels (x,...
Definition AnimationShaderContract.h:406
constexpr const char * kIWindowOpacity
float iWindowOpacity — the window's effective rule-resolved opacity in [0.0, 1.0],...
Definition AnimationShaderContract.h:523
constexpr const char * kITime
float iTime — transition progress, normally in [0.0, 1.0].
Definition AnimationShaderContract.h:232
constexpr int kMaxCustomParams
Number of vec4 slots in the customParams array (8).
Definition AnimationShaderContract.h:603
constexpr const char * kUOldWindow
sampler2D uOldWindow — snapshot of the window's content captured at the old frame size just before th...
Definition AnimationShaderContract.h:420
constexpr const char * kILayerRectInTexture
Card/anchor-space [0,1] sub-rect of the animated surface WITHIN uSurfaceLayer's canvas (xy offset,...
Definition AnimationShaderContract.h:508
constexpr int kMaxBufferPasses
Multipass buffer-pass budget.
Definition AnimationShaderContract.h:546
QString colorKey(int slot)
Format a customColor slot key — thin forwarder onto PhosphorShaders::CustomColors::colorKey.
Definition AnimationShaderContract.h:662
constexpr const char * kIFrame
int iFrame — per-leg frame counter.
Definition AnimationShaderContract.h:252
constexpr const char * kIMoveOffset
vec2 iMoveOffset — COMPOSITOR PATH ONLY.
Definition AnimationShaderContract.h:475
constexpr const char * kCustomParamsArray
vec4 customParams[N] — per-effect declared parameter slots.
Definition AnimationShaderContract.h:589
constexpr const char * kIIsReversed
int iIsReversed — direction signal for asymmetric leg rendering.
Definition AnimationShaderContract.h:275
constexpr const char * kUSurfaceLayer
sampler2D uSurfaceLayer — COMPOSITOR PATH ONLY.
Definition AnimationShaderContract.h:432
Definition AnimationShaderContract.h:10
QString colorKey(int slot)
Format a customColor key from a 0-based slot index.
Definition CustomParamsKey.h:181
constexpr int kColorCount
Number of color slots in BaseUniforms::customColors[16].
Definition CustomParamsKey.h:175
QString slotKey(int vec, char comp)
Format a customParams slot key from explicit (vec, comp) pair.
Definition CustomParamsKey.h:95
constexpr int kVecCount
Number of vec4 slots in BaseUniforms::customParams[8].
Definition CustomParamsKey.h:82
constexpr int kFlatSlotCount
Number of float sub-slots across all vec4s (4 × kVecCount).
Definition CustomParamsKey.h:88
bool isValidFilterToken(const QString &filter)
The accepted buffer filter vocabulary: linear / nearest / mipmap.
Definition CustomParamsKey.h:48
bool isValidWrapToken(const QString &wrap)
The accepted texture / buffer wrap vocabulary, shared by every validation site across the shader regi...
Definition CustomParamsKey.h:39