Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorSurfaceShaders::SurfaceUniformProfile Class Reference

IUboProfile implementation for the surface-decoration runtime — the distinct 672-byte SurfaceUniforms layout, the same size as the overlay/animation BaseUniforms but not the same members. More...

#include <PhosphorSurface/SurfaceUniformProfile.h>

Inheritance diagram for PhosphorSurfaceShaders::SurfaceUniformProfile:
[legend]

Public Member Functions

 SurfaceUniformProfile ()
 ~SurfaceUniformProfile () override=default
int baseSize () const override
 Byte size of the base UBO region (sizeof the concrete struct).
const void * data () const override
 Read-only view of the filled UBO bytes (for updateDynamicBuffer).
void * mutableData () override
 Mutable view — used by the node's multipass qt_Matrix pin/restore, which writes the leading mat4 directly at offset 0.
void fill (const PhosphorShaders::UboFrameState &state) override
 Populate the UBO from a per-frame node snapshot.
PhosphorShaders::UboUploadRegionList dirtyRegions (const PhosphorShaders::UboDirtyFlags &flags) const override
 Region(s) to upload for the given dirty flags, reproducing the legacy broader-subsumes-narrower dispatch.
bool hasAppFields () const override
 Whether this profile exposes the two consumer escape-hatch int slots.
bool readsQtOpacity () const override
 Whether fill() writes UboFrameState::qtOpacity into the buffer.
Public Member Functions inherited from PhosphorShaders::IUboProfile
virtual ~IUboProfile ()=default
virtual UboUploadRegionList fullUploadRegions () const
 Region(s) covering the whole base struct, for the first (full) upload.
virtual void setAppField0 (int)
 Write the consumer's escape-hatch int slots. No-op by default.
virtual void setAppField1 (int)
virtual bool consumeSelfRefreshedSceneHeader ()
 Whether the last fill() wrote a field the caller's own dirty flags do not know about, and so needs the SCENE-HEADER region uploaded even though nothing node-side changed.

Detailed Description

IUboProfile implementation for the surface-decoration runtime — the distinct 672-byte SurfaceUniforms layout, the same size as the overlay/animation BaseUniforms but not the same members.

Reuses the shared PhosphorRendering::ShaderNodeRhi engine with the surface UBO. The surface binding map (UBO@0, iChannel0-7@2-9, uTexture0@11, uTexture1-3@12-14) is a strict subset of the overlay map, so only the UBO concern differs — this class is that difference. Numbers from PhosphorShaders::Bindings (ShaderBindings.h), which is the one table.

fill() reads the surface-only fields of UboFrameState (qtOpacity, surfaceScale, surfaceFocused, time, surfaceSize/FrameTopLeft/FrameSize) plus the shared customParams/customColors/channelResolution/mouse/ textureResolution; it ignores the overlay-only fields BaseUniformProfile uses.

Constructor & Destructor Documentation

◆ SurfaceUniformProfile()

PhosphorSurfaceShaders::SurfaceUniformProfile::SurfaceUniformProfile ( )

◆ ~SurfaceUniformProfile()

PhosphorSurfaceShaders::SurfaceUniformProfile::~SurfaceUniformProfile ( )
overridedefault

Member Function Documentation

◆ baseSize()

int PhosphorSurfaceShaders::SurfaceUniformProfile::baseSize ( ) const
inlineoverridevirtual

Byte size of the base UBO region (sizeof the concrete struct).

Drives the node's UBO allocation and the IUniformExtension offset.

Implements PhosphorShaders::IUboProfile.

◆ data()

const void * PhosphorSurfaceShaders::SurfaceUniformProfile::data ( ) const
inlineoverridevirtual

Read-only view of the filled UBO bytes (for updateDynamicBuffer).

Implements PhosphorShaders::IUboProfile.

◆ dirtyRegions()

PhosphorShaders::UboUploadRegionList PhosphorSurfaceShaders::SurfaceUniformProfile::dirtyRegions ( const PhosphorShaders::UboDirtyFlags & flags) const
overridevirtual

Region(s) to upload for the given dirty flags, reproducing the legacy broader-subsumes-narrower dispatch.

Returns a fixed-capacity list — this runs per dirty frame and must not allocate.

Implements PhosphorShaders::IUboProfile.

◆ fill()

void PhosphorSurfaceShaders::SurfaceUniformProfile::fill ( const PhosphorShaders::UboFrameState & state)
overridevirtual

Populate the UBO from a per-frame node snapshot.

Implementations read only the subset of state they need.

Implements PhosphorShaders::IUboProfile.

◆ hasAppFields()

bool PhosphorSurfaceShaders::SurfaceUniformProfile::hasAppFields ( ) const
inlineoverridevirtual

Whether this profile exposes the two consumer escape-hatch int slots.

Reimplemented from PhosphorShaders::IUboProfile.

◆ mutableData()

void * PhosphorSurfaceShaders::SurfaceUniformProfile::mutableData ( )
inlineoverridevirtual

Mutable view — used by the node's multipass qt_Matrix pin/restore, which writes the leading mat4 directly at offset 0.

Implements PhosphorShaders::IUboProfile.

◆ readsQtOpacity()

bool PhosphorSurfaceShaders::SurfaceUniformProfile::readsQtOpacity ( ) const
inlineoverridevirtual

Whether fill() writes UboFrameState::qtOpacity into the buffer.

A node raises the scene region on an inherited-opacity change only for a profile that answers true, so a profile that pins qt_Opacity does not re-upload on every frame of an ancestor fade. Defaults to false. Appended last, which keeps the layout for code that only calls the interface; an out-of-tree implementation rebuilds against the new header, as for consumeSelfRefreshedSceneHeader (SOVERSION 0).

Reimplemented from PhosphorShaders::IUboProfile.


The documentation for this class was generated from the following file: