Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
ZoneShaderNodeRhi.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
9#include <PhosphorRendering/phosphorrendering_export.h>
10
11#include <QImage>
12#include <QQuickItem>
13
14#include <memory>
15
16#include <rhi/qrhi.h>
17
18namespace PhosphorRendering {
19
35class PHOSPHORRENDERING_EXPORT ZoneShaderNodeRhi : public ShaderNodeRhi
36{
37public:
38 explicit ZoneShaderNodeRhi(QQuickItem* item);
40
51 quint64 instanceId() const
52 {
53 return m_instanceId;
54 }
55
65 void setZoneCounts(int total, int highlighted);
66
77
78 void prepare() override;
79 void releaseResources() override;
80
81private:
86 void uploadLabelsTexture(QRhi* rhi, QRhiCommandBuffer* cb);
87
88 ZoneLabelTexture m_labels;
93 QList<QRect> m_prevTileRects;
98 bool m_labelsNeedFullClear = false;
99 std::unique_ptr<QRhiTexture> m_labelsTexture;
100 std::unique_ptr<QRhiSampler> m_labelsSampler;
101 quint64 m_instanceId = 0;
102 bool m_labelsTextureDirty = false;
103 bool m_labelsInitialized = false;
104 // Cap how many times we retry RHI texture/sampler creation. Without a cap,
105 // a permanent failure (driver wedged, persistent OOM) turns prepare() into
106 // a hot loop that runs init + logs every frame forever. The vertex-shader
107 // load in tools/shader-render's RenderEffect uses the same one-shot-latch
108 // pattern; we mirror it here for the daemon's render path.
109 int m_labelsInitFailureCount = 0;
110 bool m_labelsInitGaveUp = false;
111};
112
113} // namespace PhosphorRendering
QSGRenderNode for fullscreen-quad shader rendering via Qt RHI (Vulkan / OpenGL)
Definition ShaderNodeRhi.h:115
QSGRenderNode for zone overlay rendering, delegating to ShaderNodeRhi.
Definition ZoneShaderNodeRhi.h:36
quint64 instanceId() const
Per-instance identifier, monotonically increasing across all ZoneShaderNodeRhi instances in this proc...
Definition ZoneShaderNodeRhi.h:51
void setLabelsTexture(const ZoneLabelTexture &labels)
Stage the sparse zone-labels payload.
void setZoneCounts(int total, int highlighted)
Publish zone and highlighted counts to the shader.
Definition ShaderCompiler.h:15
Sparse zone-labels payload: the full screen-addressed texture size plus only the glyph tiles that act...
Definition ZoneLabelTexture.h:46