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
8#include <PhosphorRendering/phosphorrendering_export.h>
9
10#include <QImage>
11#include <QQuickItem>
12
13#include <memory>
14
15#include <rhi/qrhi.h>
16
17namespace PhosphorRendering {
18
34class PHOSPHORRENDERING_EXPORT ZoneShaderNodeRhi : public ShaderNodeRhi
35{
36public:
37 explicit ZoneShaderNodeRhi(QQuickItem* item);
39
50 quint64 instanceId() const
51 {
52 return m_instanceId;
53 }
54
64 void setZoneCounts(int total, int highlighted);
65
74 void setLabelsTexture(const QImage& image);
75
76 void prepare() override;
77 void releaseResources() override;
78
79private:
81 void uploadLabelsTexture(QRhi* rhi, QRhiCommandBuffer* cb);
82
83 QImage m_labelsImage;
84 QImage m_transparentFallbackImage;
85 std::unique_ptr<QRhiTexture> m_labelsTexture;
86 std::unique_ptr<QRhiSampler> m_labelsSampler;
87 quint64 m_instanceId = 0;
88 bool m_labelsTextureDirty = false;
89 bool m_labelsInitialized = false;
90 // Cap how many times we retry RHI texture/sampler creation. Without a cap,
91 // a permanent failure (driver wedged, persistent OOM) turns prepare() into
92 // a hot loop that runs init + logs every frame forever. The vertex-shader
93 // load in tools/shader-render's RenderEffect uses the same one-shot-latch
94 // pattern; we mirror it here for the daemon's render path.
95 int m_labelsInitFailureCount = 0;
96 bool m_labelsInitGaveUp = false;
97};
98
99} // namespace PhosphorRendering
QSGRenderNode for fullscreen-quad shader rendering via Qt RHI (Vulkan / OpenGL)
Definition ShaderNodeRhi.h:114
QSGRenderNode for zone overlay rendering, delegating to ShaderNodeRhi.
Definition ZoneShaderNodeRhi.h:35
void setLabelsTexture(const QImage &image)
Stage a labels texture image.
quint64 instanceId() const
Per-instance identifier, monotonically increasing across all ZoneShaderNodeRhi instances in this proc...
Definition ZoneShaderNodeRhi.h:50
void setZoneCounts(int total, int highlighted)
Publish zone and highlighted counts to the shader.
Definition ShaderCompiler.h:15