IUniformExtension implementation for zone data. More...
#include <phosphor-rendering/include/PhosphorRendering/ZoneUniformExtension.h>
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. | |
| bool | setScale (float scale) |
| Set the logical-to-device scale the shader applies to the lengths in zoneParams (corner radius, border width). | |
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). | |
IUniformExtension implementation for zone data.
Appends zone arrays (zoneRects, zoneFillColors, zoneBorderColors, zoneParams) plus the trailing zoneScale scalar after BaseUniforms in the UBO. Total extension size is kZoneExtensionBytes (ZoneShaderCommon.h): the four arrays, plus the scalar and the 12 pad bytes std140 needs to close the block on a 16-byte boundary.
The zone data layout matches the GLSL UBO declaration in common.glsl exactly, and is binary-compatible with the zone region of ZoneShaderUniforms.
|
inline |
|
inlineoverridevirtual |
Mark as clean after a successful write.
Implements PhosphorShaders::IUniformExtension.
|
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.
|
inlineoverridevirtual |
Whether the extension data has changed since the last write.
Implements PhosphorShaders::IUniformExtension.
|
inline |
Set the logical-to-device scale the shader applies to the lengths in zoneParams (corner radius, border width).
Called from the item's updatePaintNode sync phase with the same device-pixel ratio the node's resolution is scaled by, so radius * uZoneScale lands in the same device-px space as iResolution and vFragCoord.
Separate from updateFromZones() because the two change on different clocks: zone contents churn per drag frame, the scale only when the overlay moves to a differently-scaled screen. Guarded by the same mutex and only marks dirty on an actual change, so a per-frame call from the sync phase costs nothing.
scale was rejected as out of contract, true otherwise (including a no-op re-set of the current value). Rejection keeps the last good scale, which renders correctly but is indistinguishable from working code, so the caller is expected to report it. The check cannot log here: this library's logging category is private to its src/ tree, and the caller owns a category that names the actual subsystem anyway.
|
inline |
|
inlineoverridevirtual |
Write extension data into buffer starting at offset.
Called on the render thread during prepare().
Implements PhosphorShaders::IUniformExtension.