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

IUniformExtension implementation for zone data. More...

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

Inheritance diagram for PhosphorRendering::ZoneUniformExtension:
[legend]

Public Member Functions

 ZoneUniformExtension ()
 
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.
 
void updateFromZones (const QVector< ZoneData > &zones)
 Update zone data from a vector of ZoneData.
 
- Public Member Functions inherited from PhosphorShaders::IUniformExtension
virtual ~IUniformExtension ()=default
 
virtual bool requiresPhysicalResolution () const
 Whether iResolution in this extension's UBO should be uploaded in PHYSICAL pixels (DPR-scaled, matches gl_FragCoord) or LOGICAL pixels (matches the QQuickItem's bounds and Qt's auto-interpolated vTexCoord).
 

Detailed Description

IUniformExtension implementation for zone data.

Appends zone arrays (zoneRects, zoneFillColors, zoneBorderColors, zoneParams) after BaseUniforms in the UBO. Total extension size: MaxZones * 4 * sizeof(float) * 4 = 4096 bytes.

The zone data layout matches the GLSL UBO declaration in common.glsl exactly, and is binary-compatible with the zone region of ZoneShaderUniforms.

Threading
write() runs on the render thread during prepare(); updateFromZones() runs on the GUI thread (typically from updatePaintNode's sync phase). Sync phase is meant to block the render thread, but some Qt render loops can advance through prepare() before the next sync fires, so m_mutex serialises reads and writes of m_data to prevent torn copies.

Constructor & Destructor Documentation

◆ ZoneUniformExtension()

PhosphorRendering::ZoneUniformExtension::ZoneUniformExtension ( )
inline

Member Function Documentation

◆ clearDirty()

void PhosphorRendering::ZoneUniformExtension::clearDirty ( )
inlineoverridevirtual

Mark as clean after a successful write.

Implements PhosphorShaders::IUniformExtension.

◆ extensionSize()

int PhosphorRendering::ZoneUniformExtension::extensionSize ( ) const
inlineoverridevirtual

Size in bytes of the extension region (must respect std140 alignment).

Must be stable for the lifetime of the extension instance: the render node sizes the UBO and its staging buffer once when the extension is installed (via setUniformExtension) and reuses both across frames. A changing size silently bypasses the resize path and risks UBO write overruns. To change the size, install a fresh IUniformExtension instance with the new size — that triggers UBO recreation.

Implements PhosphorShaders::IUniformExtension.

◆ isDirty()

bool PhosphorRendering::ZoneUniformExtension::isDirty ( ) const
inlineoverridevirtual

Whether the extension data has changed since the last write.

Implements PhosphorShaders::IUniformExtension.

◆ updateFromZones()

void PhosphorRendering::ZoneUniformExtension::updateFromZones ( const QVector< ZoneData > &  zones)
inline

Update zone data from a vector of ZoneData.

Called on the GUI thread (typically from updatePaintNode's sync phase). Mutex-guarded against a concurrent write() on the render thread — see class Threading note.

◆ write()

void PhosphorRendering::ZoneUniformExtension::write ( char *  buffer,
int  offset 
) const
inlineoverridevirtual

Write extension data into buffer starting at offset.

Called on the render thread during prepare().

Implements PhosphorShaders::IUniformExtension.


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