Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorShaders::IUboProfile Class Referenceabstract

Pluggable UBO concern for the shared shader render engine. More...

#include <PhosphorShaders/IUboProfile.h>

Inheritance diagram for PhosphorShaders::IUboProfile:
[legend]

Public Member Functions

virtual ~IUboProfile ()=default
virtual int baseSize () const =0
 Byte size of the base UBO region (sizeof the concrete struct).
virtual const void * data () const =0
 Read-only view of the filled UBO bytes (for updateDynamicBuffer).
virtual void * mutableData ()=0
 Mutable view — used by the node's multipass qt_Matrix pin/restore, which writes the leading mat4 directly at offset 0.
virtual void fill (const UboFrameState &state)=0
 Populate the UBO from a per-frame node snapshot.
virtual UboUploadRegionList fullUploadRegions () const
 Region(s) covering the whole base struct, for the first (full) upload.
virtual UboUploadRegionList dirtyRegions (const UboDirtyFlags &flags) const =0
 Region(s) to upload for the given dirty flags, reproducing the legacy broader-subsumes-narrower dispatch.
virtual bool hasAppFields () const
 Whether this profile exposes the two consumer escape-hatch int slots.
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.
virtual bool readsQtOpacity () const
 Whether fill() writes UboFrameState::qtOpacity into the buffer.

Detailed Description

Pluggable UBO concern for the shared shader render engine.

ShaderNodeRhi owns the SRB/pipeline/multipass/binding machinery; the ONLY part that varies between the overlay/animation runtime and a future surface-decoration runtime is the uniform buffer: its struct, byte size, per-frame fill, and dirty-upload region dispatch. This interface abstracts exactly that seam — bindings stay unabstracted because the surface binding map (UBO@0, iChannel0-7@2-9, uTexture0@11) is a strict subset of the overlay map. Numbers from PhosphorShaders::Bindings (ShaderBindings.h).

Implementations hold their concrete UBO POD struct and expose its bytes via data()/mutableData() so the node can drive updateDynamicBuffer directly.

Constructor & Destructor Documentation

◆ ~IUboProfile()

virtual PhosphorShaders::IUboProfile::~IUboProfile ( )
virtualdefault

Member Function Documentation

◆ baseSize()

virtual int PhosphorShaders::IUboProfile::baseSize ( ) const
pure virtual

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

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

Implemented in PhosphorShaders::BaseUniformProfile, and PhosphorSurfaceShaders::SurfaceUniformProfile.

◆ consumeSelfRefreshedSceneHeader()

virtual bool PhosphorShaders::IUboProfile::consumeSelfRefreshedSceneHeader ( )
inlinevirtual

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.

Consumes the flag: a second call answers false.

EXISTS BECAUSE fill() HAD NO WAY TO SAY SO. It writes into the profile's own buffer, while what actually reaches the GPU is chosen separately by dirtyRegions() from the CALLER's flags, with no channel back. So a field the profile refreshes on its own schedule was written to memory nobody uploaded. iDate is the one such field: it advances once a second on a clock of its own, not on any node-side event.

Defaults to false, which is exactly the behaviour every implementation had before this existed, so a profile with no self-scheduled field ignores it. Appended at the end of the interface deliberately: this is an installed header, and new virtuals go last.

Reimplemented in PhosphorShaders::BaseUniformProfile.

◆ data()

virtual const void * PhosphorShaders::IUboProfile::data ( ) const
pure virtual

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

Implemented in PhosphorShaders::BaseUniformProfile, and PhosphorSurfaceShaders::SurfaceUniformProfile.

◆ dirtyRegions()

virtual UboUploadRegionList PhosphorShaders::IUboProfile::dirtyRegions ( const UboDirtyFlags & flags) const
pure virtual

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.

Implemented in PhosphorShaders::BaseUniformProfile, and PhosphorSurfaceShaders::SurfaceUniformProfile.

◆ fill()

virtual void PhosphorShaders::IUboProfile::fill ( const UboFrameState & state)
pure virtual

Populate the UBO from a per-frame node snapshot.

Implementations read only the subset of state they need.

Implemented in PhosphorShaders::BaseUniformProfile, and PhosphorSurfaceShaders::SurfaceUniformProfile.

◆ fullUploadRegions()

virtual UboUploadRegionList PhosphorShaders::IUboProfile::fullUploadRegions ( ) const
inlinevirtual

Region(s) covering the whole base struct, for the first (full) upload.

◆ hasAppFields()

virtual bool PhosphorShaders::IUboProfile::hasAppFields ( ) const
inlinevirtual

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

Reimplemented in PhosphorShaders::BaseUniformProfile, and PhosphorSurfaceShaders::SurfaceUniformProfile.

◆ mutableData()

virtual void * PhosphorShaders::IUboProfile::mutableData ( )
pure virtual

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

Implemented in PhosphorShaders::BaseUniformProfile, and PhosphorSurfaceShaders::SurfaceUniformProfile.

◆ readsQtOpacity()

virtual bool PhosphorShaders::IUboProfile::readsQtOpacity ( ) const
inlinevirtual

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 in PhosphorSurfaceShaders::SurfaceUniformProfile.

◆ setAppField0()

virtual void PhosphorShaders::IUboProfile::setAppField0 ( int )
inlinevirtual

Write the consumer's escape-hatch int slots. No-op by default.

Reimplemented in PhosphorShaders::BaseUniformProfile.

◆ setAppField1()

virtual void PhosphorShaders::IUboProfile::setAppField1 ( int )
inlinevirtual

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