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

Classes

class  ShaderCompiler
 Static utility for GLSL → SPIR-V compilation with include resolution and caching. More...
 
class  ShaderEffect
 QQuickItem that renders a fullscreen fragment shader via Qt RHI. More...
 
struct  ShaderNodeLiveness
 Shared liveness block linking a render node to the ShaderEffect that tracks it. More...
 
class  ShaderNodeRhi
 QSGRenderNode for fullscreen-quad shader rendering via Qt RHI (Vulkan / OpenGL) More...
 
struct  WarmShaderBakeResult
 Result of warmShaderBakeCacheForPaths for reporting to UI. More...
 
struct  ZoneColor
 Parsed zone color data for shader rendering. More...
 
struct  ZoneData
 Per-zone payload pushed into the UBO each frame. More...
 
struct  ZoneDataSnapshot
 Thread-safe zone data snapshot for the render thread. More...
 
struct  ZoneLabelTexture
 Sparse zone-labels payload: the full screen-addressed texture size plus only the glyph tiles that actually carry a number. More...
 
struct  ZoneLabelTile
 One rendered zone-label glyph (number) plus where its top-left sits in the full, screen-addressed labels texture. More...
 
struct  ZoneRect
 Parsed zone rectangle data for shader rendering. More...
 
class  ZoneShaderNodeRhi
 QSGRenderNode for zone overlay rendering, delegating to ShaderNodeRhi. More...
 
struct  ZoneShaderUniforms
 GPU uniform buffer layout — BaseUniforms + zone extension. More...
 
class  ZoneUniformExtension
 IUniformExtension implementation for zone data. More...
 

Functions

PHOSPHORRENDERING_EXPORT QVariant peelQmlVariant (const QVariant &value)
 Peel the QML delivery wrappers off a property value and return the inner QVariant.
 
constexpr bool isConsumerBinding (int binding) noexcept
 
PHOSPHORRENDERING_EXPORT WarmShaderBakeResult warmShaderBakeCacheForPaths (const QString &vertexPath, const QString &fragmentPath, const QStringList &includePaths={}, const QString &paramPreamble={}, const QString &entryPrologue={}, const QList< PhosphorShaders::EntryCandidate > &entryCandidates={})
 Pre-load cache warming: load, bake, and insert shaders for the given paths into the shared bake cache.
 

Variables

constexpr int kMaxUserTextureSlots = 4
 Public mirror of ShaderNodeRhi::kMaxUserTextures (4 user-texture slots at SRB bindings 7..10).
 
constexpr int kDefaultUserTextureSvgSize = 1024
 Default per-axis rasterisation size for an SVG user texture, used until a slot's shader param overrides it.
 
constexpr int kMaxBufferPasses = 4
 
constexpr int kMaxUserTextures = 4
 
constexpr int kMaxCustomParams = 8
 
constexpr int kMaxCustomColors = 16
 
constexpr int kFirstFreeConsumerBinding = 1
 First slot usable via setExtraBinding()
 
constexpr int kMaxConsumerBinding = 31
 Highest portable SRB binding.
 
constexpr int kReservedBindingRangeStart = 2
 First library-managed binding above 0.
 
constexpr int kReservedBindingRangeEnd = 12
 Last library-managed binding.
 
constexpr int kUserTextureBaseBinding = 7
 First SRB binding for the user-texture slots (slot 0 → binding 7).
 
constexpr int MaxZones = 64
 Maximum number of zones the zone-aware UBO supports.
 
constexpr std::size_t kZoneExtensionBytes = 4 * sizeof(float[MaxZones][4]) + 4 * sizeof(float)
 Size of the zone extension region: four vec4[MaxZones] arrays, plus the uZoneScale scalar and the std140 tail pad that rounds it to 16 bytes.
 

Function Documentation

◆ isConsumerBinding()

constexpr bool PhosphorRendering::isConsumerBinding ( int  binding)
constexprnoexcept
Returns
true if binding is usable by consumers via setExtraBinding().

◆ peelQmlVariant()

PHOSPHORRENDERING_EXPORT QVariant PhosphorRendering::peelQmlVariant ( const QVariant &  value)

Peel the QML delivery wrappers off a property value and return the inner QVariant.

Handles a QJSValue and a QVariant nested inside a QVariant, in any order and interleaved, up to a fixed depth (a chain deeper than that is already pathological, and an unbounded peel would hang on a self- referencing one).

Returns the PEELED variant only — it deliberately does not convert to a payload type, because the two call sites that need it want different terminal conversions (ShaderEffect::setWallpaperTextureVariant wants a QImage, ZoneShaderItem::setLabelsTextureVariant wants a ZoneLabelTexture through a registered converter). Each caller keeps its own conversion and its own handling of an invalid or unconvertible result.

◆ warmShaderBakeCacheForPaths()

PHOSPHORRENDERING_EXPORT WarmShaderBakeResult PhosphorRendering::warmShaderBakeCacheForPaths ( const QString &  vertexPath,
const QString &  fragmentPath,
const QStringList &  includePaths = {},
const QString &  paramPreamble = {},
const QString &  entryPrologue = {},
const QList< PhosphorShaders::EntryCandidate > &  entryCandidates = {} 
)

Pre-load cache warming: load, bake, and insert shaders for the given paths into the shared bake cache.

Safe to call from any thread.

Parameters
vertexPathPath to the vertex shader file
fragmentPathPath to the fragment shader file
includePathsDirectories to search for #include directives
paramPreambleGenerated #define p_<id> ... block spliced after the fragment shader's #version (T1.1). MUST match what the live ShaderNodeRhi::loadFragmentShader splices for the same effect, since both compute the same bake-cache key (which is fingerprinted on the preamble) — a mismatch would let this warm entry serve the wrong SPIR-V to the live load. Empty (the default) is a no-op splice.
entryPrologueT1.4 entry-point prologue (#version/include/in-out) prepended to an entry-only fragment source before expansion. Empty (default) disables assembly.
entryCandidatesT1.4 entry functions + their generated main(), applied when the fragment defines no main(). MUST match what ShaderNodeRhi::loadFragmentShader uses for the same shader so warm + live agree on key and source.
Returns
success and error message for UI reporting

Variable Documentation

◆ kDefaultUserTextureSvgSize

constexpr int PhosphorRendering::kDefaultUserTextureSvgSize = 1024
inlineconstexpr

Default per-axis rasterisation size for an SVG user texture, used until a slot's shader param overrides it.

◆ kFirstFreeConsumerBinding

constexpr int PhosphorRendering::kFirstFreeConsumerBinding = 1
constexpr

First slot usable via setExtraBinding()

◆ kMaxBufferPasses

constexpr int PhosphorRendering::kMaxBufferPasses = 4
constexpr

◆ kMaxConsumerBinding

constexpr int PhosphorRendering::kMaxConsumerBinding = 31
constexpr

Highest portable SRB binding.

31 matches Qt RHI's minimum guarantee (minMaxShaderResourceBindingCount) across all backends — Vulkan/D3D11/ Metal/OpenGL all advertise at least 32 bindings. Going higher risks pipeline-creation failure on conservative drivers.

◆ kMaxCustomColors

constexpr int PhosphorRendering::kMaxCustomColors = 16
constexpr

◆ kMaxCustomParams

constexpr int PhosphorRendering::kMaxCustomParams = 8
constexpr

◆ kMaxUserTextures

constexpr int PhosphorRendering::kMaxUserTextures = 4
constexpr

◆ kMaxUserTextureSlots

constexpr int PhosphorRendering::kMaxUserTextureSlots = 4
inlineconstexpr

Public mirror of ShaderNodeRhi::kMaxUserTextures (4 user-texture slots at SRB bindings 7..10).

Re-declared here so member-array sizes can use the named constant without pulling in the heavy rhi/qrhi.h transitive chain that ShaderNodeRhi.h carries. Kept in sync via a static_assert in shadereffect.cpp.

◆ kReservedBindingRangeEnd

constexpr int PhosphorRendering::kReservedBindingRangeEnd = 12
constexpr

Last library-managed binding.

◆ kReservedBindingRangeStart

constexpr int PhosphorRendering::kReservedBindingRangeStart = 2
constexpr

First library-managed binding above 0.

◆ kUserTextureBaseBinding

constexpr int PhosphorRendering::kUserTextureBaseBinding = 7
constexpr

First SRB binding for the user-texture slots (slot 0 → binding 7).

Both setSourceTextureProvider's slot-0 override and the QImage-uploaded user textures key off this base.

◆ kZoneExtensionBytes

constexpr std::size_t PhosphorRendering::kZoneExtensionBytes = 4 * sizeof(float[MaxZones][4]) + 4 * sizeof(float)
inlineconstexpr

Size of the zone extension region: four vec4[MaxZones] arrays, plus the uZoneScale scalar and the std140 tail pad that rounds it to 16 bytes.

Derived rather than spelled as a literal so bumping MaxZones cannot leave the assert below asserting the old size.

◆ MaxZones

constexpr int PhosphorRendering::MaxZones = 64
constexpr

Maximum number of zones the zone-aware UBO supports.