Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
ShaderParamPreamble.h File Reference
#include <PhosphorShaders/phosphorshaders_export.h>
#include <QList>
#include <QString>

Go to the source code of this file.

Classes

struct  PhosphorShaders::PreambleParam
 One declared shader parameter, in metadata declaration order, as fed to buildParamPreamble. More...

Namespaces

namespace  PhosphorShaders

Enumerations

enum class  PhosphorShaders::ShaderStage { PhosphorShaders::Vertex , PhosphorShaders::Fragment }
 The pipeline stage a source is compiled for, as stripVaryingLocations needs to tell a varying from a vertex input or a fragment output. More...

Functions

PHOSPHORSHADERS_EXPORT QString PhosphorShaders::buildParamPreamble (const QList< PreambleParam > &params)
 Build the generated #define p_<id> <glsl-accessor> preamble for a shader's declared parameters.
PHOSPHORSHADERS_EXPORT bool PhosphorShaders::isValidParamId (const QString &id)
 True if id is a valid GLSL identifier body ([A-Za-z0-9_], non-empty) — the p_ prefix supplies the leading character, so a leading digit is fine.
PHOSPHORSHADERS_EXPORT bool PhosphorShaders::isReservedAnimationParamId (const QString &id)
 True if p_<id> would COLLIDE with a #define p_... a shared family header already owns.
PHOSPHORSHADERS_EXPORT QString PhosphorShaders::spliceAfterVersion (const QString &source, const QString &block)
 Splice block into source immediately after its #version line, then emit a lineDirective re-anchoring source string 0 so the author's subsequent lines keep their original numbers despite the inserted block.
PHOSPHORSHADERS_EXPORT int PhosphorShaders::versionDirectiveEnd (const QString &source)
 Locate the first REAL #version directive of source: the first line whose first non-whitespace token is #version outside any // or /* … */ comment, with a leading UTF-8 BOM (U+FEFF) skipped.
PHOSPHORSHADERS_EXPORT QString PhosphorShaders::kwinDefineBlock (const QString &eol=QStringLiteral("\n"))
 The preprocessor block that selects the COMPOSITOR branch of a pack's source, newline-terminated with eol and ready for spliceAfterVersion.
PHOSPHORSHADERS_EXPORT QString PhosphorShaders::stripVaryingLocations (const QString &source, ShaderStage stage)
 Remove the layout(location = N) qualifier from every varying of source: the out declarations of a vertex stage and the in declarations of a fragment stage.
PHOSPHORSHADERS_EXPORT QString PhosphorShaders::kwinGlesDialect (const QString &source)
 source as KWin 6.8 hands it to the driver: every line that starts with #version blanked (its newline kept, so line numbers do not move), and KWin's GLSL ES 300 prologue (the version line, the GL_OES_EGL_image_external require and its default precision declarations) prepended.
PHOSPHORSHADERS_EXPORT QString PhosphorShaders::kwinDesktopDialect (const QString &source)
 source as KWin 6.7 hands it to the driver on a desktop GL context: every line that starts with #version blanked (newline kept) and #version 140 prepended, with no precision or extension lines.
PHOSPHORSHADERS_EXPORT QString PhosphorShaders::kwinTopDownTexcoordsDefine (const QString &eol=QStringLiteral("\n"))
 The #define KWin 6.8's per-window animation path and the decoration present shader splice beside kwinDefineBlock, telling a shader that the offscreen texture KWin hands an effect is top-down.
PHOSPHORSHADERS_EXPORT QString PhosphorShaders::kwinCompositorSource (const QString &source, ShaderStage stage, const QString &extraDefines={}, bool *synthesizedVersion=nullptr)
 The compositor branch of source exactly as the effect hands it to KWin: kwinDefineBlock and extraDefines spliced after #version, then the varying locations of stage stripped.
PHOSPHORSHADERS_EXPORT QString PhosphorShaders::lineDirective (int line, int sourceString, const QString &eol=QStringLiteral("\n"))
 A #line re-anchor that numbers the NEXT line line of source string sourceString under every GLSL dialect a shader here compiles in, terminated with eol.

Variables

constexpr int PhosphorShaders::kMaxImageSlots = 4
 Image-pool budget: overlay/zone image params bind to uTexture0..3.