Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
ShaderParamPreamble.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
6#include <PhosphorShaders/phosphorshaders_export.h>
7
8#include <QList>
9#include <QString>
10
11namespace PhosphorShaders {
12
23inline constexpr int kMaxImageSlots = 4;
24
26{
34 enum class Pool {
35 Scalar,
36 Color,
37 Image,
38 };
39
40 QString id;
42
48 int explicitSlot = -1;
49};
50
64PHOSPHORSHADERS_EXPORT QString buildParamPreamble(const QList<PreambleParam>& params);
65
70PHOSPHORSHADERS_EXPORT bool isValidParamId(const QString& id);
71
94PHOSPHORSHADERS_EXPORT QString spliceAfterVersion(const QString& source, const QString& block);
95
113PHOSPHORSHADERS_EXPORT QString kwinDefineBlock(const QString& eol = QStringLiteral("\n"));
114
115} // namespace PhosphorShaders
Definition ShaderEffect.h:33
constexpr int kMaxImageSlots
One declared shader parameter, in metadata declaration order, as fed to buildParamPreamble.
Definition ShaderParamPreamble.h:23
PHOSPHORSHADERS_EXPORT QString buildParamPreamble(const QList< PreambleParam > &params)
Build the generated #define p_<id> <glsl-accessor> preamble for a shader's declared parameters.
PHOSPHORSHADERS_EXPORT QString kwinDefineBlock(const QString &eol=QStringLiteral("\n"))
The preprocessor block that selects the COMPOSITOR branch of a pack's source, newline-terminated with...
PHOSPHORSHADERS_EXPORT QString spliceAfterVersion(const QString &source, const QString &block)
Splice block into source immediately after its #version line, then emit a #line <n> 0 directive so th...
PHOSPHORSHADERS_EXPORT bool isValidParamId(const QString &id)
True if id is a valid GLSL identifier body ([A-Za-z0-9_], non-empty) — the p_ prefix supplies the lea...
Definition ShaderParamPreamble.h:26
Pool
Which UBO region the parameter occupies.
Definition ShaderParamPreamble.h:34
int explicitSlot
Explicit slot from metadata, or -1 to auto-assign by declaration order within the parameter's pool.
Definition ShaderParamPreamble.h:48
QString id
Definition ShaderParamPreamble.h:40
Pool pool
Definition ShaderParamPreamble.h:41