Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
BaseUniformProfile.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 <PhosphorShaders/phosphorshaders_export.h>
9
10#include <QtGlobal>
11
12namespace PhosphorShaders {
13
25class PHOSPHORSHADERS_EXPORT BaseUniformProfile : public IUboProfile
26{
27public:
29 ~BaseUniformProfile() override = default;
30
31 int baseSize() const override
32 {
33 return static_cast<int>(sizeof(BaseUniforms));
34 }
35
36 const void* data() const override
37 {
38 return &m_u;
39 }
40 void* mutableData() override
41 {
42 return &m_u;
43 }
44
45 void fill(const UboFrameState& state) override;
46
47 UboUploadRegionList dirtyRegions(const UboDirtyFlags& flags) const override;
48
49 bool hasAppFields() const override
50 {
51 return true;
52 }
53 void setAppField0(int value) override
54 {
55 m_u.appField0 = value;
56 }
57 void setAppField1(int value) override
58 {
59 m_u.appField1 = value;
60 }
61
66 {
67 const bool refreshed = m_sceneHeaderSelfRefreshed;
68 m_sceneHeaderSelfRefreshed = false;
69 return refreshed;
70 }
71
72private:
73 BaseUniforms m_u = {};
74
79 qint64 m_lastDateRefreshMs = 0;
80
84 bool m_sceneHeaderSelfRefreshed = false;
85};
86
87} // namespace PhosphorShaders
bool consumeSelfRefreshedSceneHeader() override
iDate is this profile's one self-scheduled field, so this is where the interface's hook earns its kee...
Definition BaseUniformProfile.h:65
void * mutableData() override
Mutable view — used by the node's multipass qt_Matrix pin/restore, which writes the leading mat4 dire...
Definition BaseUniformProfile.h:40
void fill(const UboFrameState &state) override
Populate the UBO from a per-frame node snapshot.
int baseSize() const override
Byte size of the base UBO region (sizeof the concrete struct).
Definition BaseUniformProfile.h:31
~BaseUniformProfile() override=default
const void * data() const override
Read-only view of the filled UBO bytes (for updateDynamicBuffer).
Definition BaseUniformProfile.h:36
UboUploadRegionList dirtyRegions(const UboDirtyFlags &flags) const override
Region(s) to upload for the given dirty flags, reproducing the legacy broader-subsumes-narrower dispa...
void setAppField1(int value) override
Definition BaseUniformProfile.h:57
void setAppField0(int value) override
Write the consumer's escape-hatch int slots. No-op by default.
Definition BaseUniformProfile.h:53
bool hasAppFields() const override
Whether this profile exposes the two consumer escape-hatch int slots.
Definition BaseUniformProfile.h:49
Pluggable UBO concern for the shared shader render engine.
Definition IUboProfile.h:202
Fixed-capacity list of upload regions.
Definition IUboProfile.h:29
Definition ShaderProfile.h:21
GPU uniform buffer layout following std140 rules (base region).
Definition BaseUniforms.h:37
Which conceptual blocks of the UBO changed since the last upload.
Definition IUboProfile.h:90
Snapshot of every node-side value a UBO profile's fill() may read for a single frame.
Definition IUboProfile.h:104