|
| | AnimationUniformExtension () |
| int | extensionSize () const override |
| | Size in bytes of the extension region (must respect std140 alignment).
|
| void | write (char *buffer, int offset) const override |
| | Write extension data into buffer starting at offset.
|
| bool | isDirty () const override |
| | Whether the extension data has changed since the last write.
|
| void | clearDirty () override |
| | Mark as clean after a successful write.
|
| bool | requiresPhysicalResolution () const override |
| | Animation shaders pair iResolution with logical-pixel extension fields (iAnchorSize, iAnchorPosInFbo, iSurfaceScreenPos) for UV / clip-space ratios, and use the vertex-stage vTexCoord instead of gl_FragCoord — so the legacy DPR-scaling of iResolution would mismatch units across the UBO and shrink the rendered card by 1/DPR (fly-in) or shift the anchor UV remap by the same factor (broken-glass, morph).
|
| void | setISurfaceScreenPos (const QVector4D &pos) |
| | Surface origin in logical screen pixels (.xy) plus host screen dimensions (.zw).
|
| void | setIAnchorSize (const QSizeF &size) |
| | Anchor (card) pixel size in logical pixels.
|
| void | setIAnchorPosInFbo (const QPointF &pos) |
| | Anchor's top-left position inside the shader item's FBO, in logical pixels.
|
| void | setISwitchDelta (const QVector4D &v) |
| | Transition-class fields (bytes 48..143 of the extension, UBO offsets 720..815).
|
| void | setIStripMotion (const QVector4D &v) |
| void | setIStripRect (const QVector4D &v) |
| void | setIFromRect (const QVector4D &v) |
| void | setIToRect (const QVector4D &v) |
| void | setIStripAxis (const QVector2D &v) |
| void | setIOldWindowOpacity (float v) |
| void | setIHasOldWindow (bool has) |
| void | setIIconRect (const QVector4D &rect) |
| | Minimize target (the kwin path's iIconRect): x/y/w/h in the same space as iSurfaceScreenPos.
|
| void | setIMoveTrail (const QVector< QVector2D > &trail) |
| | Move-trail ring (the kwin path's iMoveTrail): up to 16 offsets of past window origins RELATIVE to the current origin, newest first, ~15 ms apart, logical px y-down.
|
| void | setIMoveMesh (const QVector< QVector2D > &mesh) |
| | Wobble lattice (the kwin path's iMoveMesh): 16 per-node deflections from the node's ideal grid spot on the current frame, node (i,j) = [i + 4*j], row 0 at the top, logical px y-down.
|
| void | setIAnchorRectInTexture (const QVector4D &rect) |
| | Card's UV sub-rect within uTexture0, as (x, y, width, height) in the captured texture's [0, 1] space.
|
| virtual | ~IUniformExtension ()=default |
IUniformExtension that appends animation-shader spatial uniforms after PhosphorShaders::BaseUniforms in the UBO.
Carries the surface-on- screen rect (iSurfaceScreenPos), the captured card's pixel size (iAnchorSize), its top-left within the FBO (iAnchorPosInFbo), and its UV sub-rect within the captured texture (iAnchorRectInTexture) — read by vertex shaders that map the FBO quad onto the card and by fragment shaders that want card-space sampling and screen-relative noise / edge fades.
Why an extension and not a BaseUniforms member: the zone-shader path (ZoneShaderItem via ZoneUniformExtension) shares BaseUniforms with the animation path. An earlier revision grew BaseUniforms directly to add the first of these per-leg fields; that change broke zone- shader rendering on multi-VS setups in a way the team couldn't reproduce in a controlled test (likely a transitively-included- common.glsl cache-key gap in shaderCacheKey, but unconfirmed). Keeping BaseUniforms at 672 bytes and routing animation-only fields through this extension isolates the two pipelines: zone shaders attach ZoneUniformExtension (kZoneExtensionBytes after base) and never observe these fields at all; animation shaders attach AnimationUniformExtension (672 bytes after base) — iSurfaceScreenPos at offset 672, iAnchorSize at 688, iAnchorPosInFbo at 696, iAnchorRectInTexture at 704, then the transition-class tail (iSwitchDelta 720 through iHasOldWindow 812, iIconRect 816, iMoveTrail 832, iMoveMesh 1088-1343) — matching the trailing-field layout data/animations/shared/animation_uniforms.glsl's UBO branch declares.
Cross-runtime parity: the kwin-effect path uses classic GL setUniform lookups for these names (see paint_shader_window.cpp) — independent of the UBO mechanism, works without any extension. Author-side GLSL is identical across runtimes (the #ifdef PLASMAZONES_KWIN branch of animation_uniforms.glsl declares them as default-block uniforms; the UBO branch declares them inside AnimationUniforms { ... }).
Ownership: created per-leg by SurfaceAnimator::attachShaderToAnchor and installed on the plain ShaderEffect it creates via ShaderEffect::setUniformExtension(shared_ptr). The shared_ptr stays alive in the animator's per-track storage, so consumer-side updates (syncShaderGeometryNow calls setISurfaceScreenPos / setIAnchorSize) reach the same instance the render thread reads.
Threading: write is called on the render thread during prepare(); setI* is called on the GUI thread from syncShaderGeometryNow. m_mutex serializes both — sync phase normally blocks the render thread but some Qt render loops can advance through prepare() before the next sync fires, so the lock is required to prevent torn copies. The lost-dirty race (a setter landing between the render thread's copy and its dirty-clear) is defended on the consumer side: uploadExtensionToUbo clears the flag BEFORE copying, so such a setter re-arms it and the value uploads next frame.
| void PhosphorAnimation::AnimationUniformExtension::setIAnchorRectInTexture |
( |
const QVector4D & | rect | ) |
|
|
inline |
Card's UV sub-rect within uTexture0, as (x, y, width, height) in the captured texture's [0, 1] space.
The daemon renders the shader anchor into uTexture0; when the anchor is larger than the visible card — a PopupFrame capture item that bundles the glow margin so the glow animates with the card — this rect is the card's region within that texture. animation.vert divides texCoord by it so anchor-extent shaders see vTexCoord as [0, 1] over the card (the glow margin falls outside [0, 1]), and surfaceColor() multiplies by it so card-space samples address the card region of the texture. A bare card-sized anchor carries the (0, 0, 1, 1) identity, which makes both folds a passthrough. Pushed by syncShaderGeometryNow alongside iAnchorSize. Mirrors the kwin-effect's same-named uniform (frame's sub-rect within KWin's shadow-padded redirected FBO).