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

QSGRenderNode for zone overlay rendering, delegating to ShaderNodeRhi. More...

#include <phosphor-rendering/include/PhosphorRendering/ZoneShaderNodeRhi.h>

Inheritance diagram for PhosphorRendering::ZoneShaderNodeRhi:
[legend]

Public Member Functions

 ZoneShaderNodeRhi (QQuickItem *item)
 
 ~ZoneShaderNodeRhi () override
 
quint64 instanceId () const
 Per-instance identifier, monotonically increasing across all ZoneShaderNodeRhi instances in this process.
 
void setZoneCounts (int total, int highlighted)
 Publish zone and highlighted counts to the shader.
 
void setLabelsTexture (const QImage &image)
 Stage a labels texture image.
 
void prepare () override
 
void releaseResources () override
 
- Public Member Functions inherited from PhosphorRendering::ShaderNodeRhi
 ShaderNodeRhi (QQuickItem *item)
 
 ~ShaderNodeRhi () override
 
void invalidateItem ()
 Notify the render node that its owning item is being destroyed.
 
QSGRenderNode::StateFlags changedStates () const override
 
QSGRenderNode::RenderingFlags flags () const override
 
QRectF rect () const override
 
void prepare () override
 
void render (const RenderState *state) override
 
void releaseResources () override
 
void setUniformExtension (std::shared_ptr< PhosphorShaders::IUniformExtension > extension)
 
std::shared_ptr< PhosphorShaders::IUniformExtensionuniformExtension () const
 Access the currently-installed uniform extension (may be nullptr).
 
void setTime (double time)
 
void setTimeDelta (float delta)
 
void setFrame (int frame)
 
void setResolution (float width, float height)
 
void setMousePosition (const QPointF &pos)
 
void setIsReversed (bool reverse)
 Direction signal for asymmetric leg rendering.
 
void setCustomParams (int index, const QVector4D &params)
 
void setCustomColor (int index, const QColor &color)
 
void setAppField0 (int value)
 Write the consumer's two int slots inside BaseUniforms (offsets 88, 92).
 
void setAppField1 (int value)
 
bool setExtraBinding (int binding, QRhiTexture *texture, QRhiSampler *sampler)
 Bind a consumer-owned texture/sampler at the given binding number.
 
bool removeExtraBinding (int binding)
 
void setAudioSpectrum (const QVector< float > &spectrum)
 
void setUserTexture (int slot, const QImage &image)
 
void setUserTextureWrap (int slot, const QString &wrap)
 Set per-slot sampler address mode.
 
void setWallpaperTexture (const QImage &image)
 
void setUseWallpaper (bool use)
 
void setUseDepthBuffer (bool use)
 
void setSourceTextureProvider (QSGTextureProvider *provider)
 Live texture-provider override for user-texture slot 0 (SRB binding 7 / uTexture0).
 
QSGTextureProvider * sourceTextureProvider () const
 
void setBufferShaderPath (const QString &path)
 
void setBufferShaderPaths (const QStringList &paths)
 
void setBufferFeedback (bool enable)
 
void setBufferScale (qreal scale)
 
void setBufferWrap (const QString &wrap)
 
void setBufferWraps (const QStringList &wraps)
 
void setBufferFilter (const QString &filter)
 
void setBufferFilters (const QStringList &filters)
 
bool loadVertexShader (const QString &path)
 
bool loadFragmentShader (const QString &path)
 
void setVertexShaderSource (const QString &source)
 
void setFragmentShaderSource (const QString &source)
 
bool isShaderReady () const
 
QString shaderError () const
 
void invalidateShader ()
 
void invalidateUniforms ()
 
void setShaderIncludePaths (const QStringList &paths)
 

Additional Inherited Members

- Static Public Member Functions inherited from PhosphorRendering::ShaderNodeRhi
static QString normalizeWrapMode (const QString &wrap)
 Normalize wrap mode string to "clamp", "repeat", or "mirror" (static helper, safe to call from any thread — operates on its arguments only).
 
static QString normalizeFilterMode (const QString &filter)
 Normalize filter mode string to "nearest", "linear", or "mipmap".
 
static QRhiSampler::AddressMode wrapModeToRhiAddress (const QString &wrap)
 Map a normalized wrap-mode string to QRhiSampler::AddressMode.
 
- Protected Member Functions inherited from PhosphorRendering::ShaderNodeRhi
QRhi * safeRhi () const
 Thread-safe QRhi accessor.
 

Detailed Description

QSGRenderNode for zone overlay rendering, delegating to ShaderNodeRhi.

Inherits from ShaderNodeRhi which handles all base rendering: VBO, UBO, SRBs, pipelines, multipass, textures, shader baking, etc.

This subclass adds zone-specific state:

  • Labels texture at binding 1 (via setExtraBinding)
  • Zone count / highlighted count in BaseUniforms::appField0/appField1

Zone UBO data (rects, colors, params) is written by ZoneUniformExtension, which the host item registers via ShaderEffect::setUniformExtension(). The node does not hold a QVector<ZoneData> cache; it only reports counts to the shader via setZoneCounts().

Constructor & Destructor Documentation

◆ ZoneShaderNodeRhi()

PhosphorRendering::ZoneShaderNodeRhi::ZoneShaderNodeRhi ( QQuickItem *  item)
explicit

◆ ~ZoneShaderNodeRhi()

PhosphorRendering::ZoneShaderNodeRhi::~ZoneShaderNodeRhi ( )
override

Member Function Documentation

◆ instanceId()

quint64 PhosphorRendering::ZoneShaderNodeRhi::instanceId ( ) const
inline

Per-instance identifier, monotonically increasing across all ZoneShaderNodeRhi instances in this process.

Host items use this instead of pointer equality to detect node recreation: when the scene graph destroys the previous node and allocates a new one (e.g. on releaseResources), the new node gets a fresh id. Pointer equality is ABA-vulnerable when the allocator reuses the address — instance ids are not.

◆ prepare()

void PhosphorRendering::ZoneShaderNodeRhi::prepare ( )
override

◆ releaseResources()

void PhosphorRendering::ZoneShaderNodeRhi::releaseResources ( )
override

◆ setLabelsTexture()

void PhosphorRendering::ZoneShaderNodeRhi::setLabelsTexture ( const QImage &  image)

Stage a labels texture image.

Upload happens in prepare().

The host item builds an RGBA image with zone numbers drawn at zone centres; the shader samples it at binding 1 (uZoneLabels). A null / empty image binds a 1×1 transparent fallback so the descriptor set stays well-formed.

◆ setZoneCounts()

void PhosphorRendering::ZoneShaderNodeRhi::setZoneCounts ( int  total,
int  highlighted 
)

Publish zone and highlighted counts to the shader.

Writes BaseUniforms::appField0 (total) and appField1 (highlighted) — the shader uses these to bound its per-zone loops and gate highlight logic. Called from the host item's updatePaintNode() during the sync phase, alongside the ZoneUniformExtension update that carries the actual per-zone data.


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