/**
The GPU half of the built-in effects: one `@fragment` entry point per effect,
each a thin wrapper around the transform in `sparkles.ui.effect_shaders`.
Device-only, and outside `sparkles:ui`'s source paths on purpose: only
`shader-compile` ever compiles this module, with LDC's Vulkan target (which
predefines `LDC_DCompute`), and what it produces — GLSL for both OpenGL
dialects, and SPIR-V for Vulkan 1.3 and 1.1 — lands under `generated/`, which
`sparkles.ui.effect` string-imports. An ordinary build never sees it — its
`Sampler2D.sample` names a SPIR-V intrinsic no CPU has.
The interface is raylib's: `fragTexCoord`/`fragColor` are the varyings its
default vertex shader emits, `texture0` the sampler it binds, `finalColor`
the output. `uExtentCells` and the per-effect uniforms are what
`ui_raylib.effect_gpu` uploads at composite time. On Vulkan the same names
hold: the varyings at locations 0 and 1, the images beside the shared
sampler, and the uniforms one block `sparkles:ui-vulkan` fills by name.
*/
@compute(CompileFor.deviceOnly) @profiles(gl330, gles100, vulkan13, vulkan11)
module (module) effectsThe GPU half of the built-in effects: one @fragment entry point per effect,
each a thin wrapper around the transform in sparkles.ui.effect_shaders.
Device-only, and outside sparkles:ui's source paths on purpose: only
shader-compile ever compiles this module, with LDC's Vulkan target (which
predefines LDC_DCompute), and what it produces — GLSL for both OpenGL
dialects, and SPIR-V for Vulkan 1.3 and 1.1 — lands under generated/, which
sparkles.ui.effect string-imports. An ordinary build never sees it — its
Sampler2D.sample names a SPIR-V intrinsic no CPU has.
The interface is raylib's: fragTexCoord/fragColor are the varyings its
default vertex shader emits, texture0 the sampler it binds, finalColor
the output. uExtentCells and the per-effect uniforms are what
ui_raylib.effect_gpu uploads at composite time. On Vulkan the same names
hold: the varyings at locations 0 and 1, the images beside the shared
sampler, and the uniforms one block sparkles:ui-vulkan fills by name.
effects;
import (package) sparklessparkles.(module) sparkles.shadersSingle-source shaders (SHD): one D function that runs per cell on the CPU
and, compiled by LDC's Vulkan target, per fragment on the GPU.
The vocabulary is GLSL's, spelled in D. vec2/vec3/vec4 are the
compiler's own vector types where it has them (LDC, every size) and a
lookalike struct where it does not (DMD below 16 bytes), the built-ins
(floor, mod, dot, clamp, mix, …) are the GLSL set over both, and
the constructors are v2/v3/v4 because a __vector alias cannot be
called. A function written against this module reads like the shader it
becomes, and the CPU path calls the very same function.
Device compilation is opt-in by target. Under -mdcompute-targets=…
(which predefines LDC_DCompute) the module attributes (compute,
fragment, @input, @uniform,
Sampler2D) are LDC's real ldc.dcompute symbols, and every module marked
@compute is subject to LDC's device rules and emitted to SPIR-V. Without
it they are inert stand-ins, so an ordinary dub build sees plain D — no
device rules, no SPIR-V, no LDC dependency.
The pipeline that turns a @fragment function into the GLSL sparkles:ui-raylib
loads is apps/shader-compile; the spec is docs/specs/ui/effects.md (EFX20).
shaders;
static import (package) sparklessparkles.(package) sparkles.uiui.(module) sparkles.ui.effect_shadersThe built-in effects, written once (EFX20).
Each transform here is the implementation: ui-tui calls it per cell
through the adapters in sparkles.ui.effect, and libs/ui/shaders/effects.d
wraps it in a @fragment entry point that shader-compile turns into the
GLSL ui-raylib loads. There is no second, hand-written GPU copy to drift.
Cell coordinates, float colours. at is the cell relative to the
bracket's origin and extent the bracket's size in cells — on the GPU the
fragment shader floors fragTexCoord * uExtentCells to get the same at —
and color is the cell's resolved colour in [0, 1], which is what a
sampler returns and what the CPU adapter converts a byte colour to.
The module is @compute(CompileFor.hostAndDevice): plain D in an ordinary
build (the attribute is inert outside a dcompute build — LDC_DCompute),
device code when the shader pipeline compiles it. That is also why it
carries no tests — a device module may not hold a string literal, and a
test's name is one. Its tests live beside the adapters in
sparkles.ui.effect.
effect_shaders;
import (package) sparklessparkles.(package) sparkles.uiui.(module) sparkles.ui.crt_shadersThe CRT's geometry, written once (CRT8, CRT10): where a screen position
reads from on the tube. The tube's fragment shader (libs/ui/shaders/effects.d)
samples at what these return, and sparkles.ui.crt_projection maps
the pointer and the displayed pixel through the very same functions — so
the cursor drawn on the GPU and the point input lands on cannot drift apart.
They used to be a pair, a GLSL curve() and a hand twin on the CPU, that no
compiler could hold together; two bugs of exactly that shape — a lens applied
in the wrong space, a screen fit hardcoded to one curvature — were found by
eye.
All positions are normalized and y-flipped: the texture coordinate a
fragment shader is handed, with (0, 0) at the bottom left.
The module is @compute(CompileFor.hostAndDevice), like
sparkles.ui.effect_shaders, and for the same reason carries no tests:
they live in sparkles.ui.crt_projection, beside the maps that use it.
crt_shaders : (alias) effects.crtCurve = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.ui.crt_shaders.crtCurve(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) coord, in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) apex, float tilt, float curvature) pure nothrow @nogc @safeThe barrel bend, fitted to the screen (CRT10).
apex is the point the bend is centred on when tilt is above one half —
the pointer, so the surface is flat directly under it and the far side curves
away — and the screen's middle otherwise. Tilting softens the bend to five
eighths.
The bend pushes a point at radius r out by 1 + k r², so an edge midpoint,
at r = 1/2, lands at 1 + k/4; scaling by the reciprocal seats it back on
the screen edge at any curvature, and leaves a flat screen (k = 0) a 1:1
blit. The corners overhang and are cut: that is the rounded tube face. Exact
with tilt off — an apex that is not the centre deforms the four edges by
different amounts, and one scalar cannot seat all four.
crtCurve, (alias) effects.crtLens = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.ui.crt_shaders.crtLens(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv, in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) centre, float aspect, float radius, float power) pure nothrow @nogc @safeThe magnifier lens (CRT6), applied in texture space after the bend: inside
the lens, uv is pulled toward centre by a dome profile of strength
power; outside it is untouched. centre itself stays fixed, which is why
the lens is centred on the pointer's own UI position — the cursor drawn there
is the point the lens does not move.
crtLens, (alias) effects.crtLensDistance = float sparkles.ui.crt_shaders.crtLensDistance(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv, in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) centre, float aspect, float radius) pure nothrow @nogc @safeHow far uv is from the lens centre centre, as a fraction of the lens
radius — aspect (width over height) makes the lens round on screen. One
or more is outside the lens.
crtLensDistance, (alias) effects.crtLensRim = float sparkles.ui.crt_shaders.crtLensRim(float n) pure nothrow @nogc @safeThe lens rim's brightness at lens distance n (from crtLensDistance):
a thin ring just inside the edge, zero elsewhere.
crtLensRim;
/**
The tier-0 bracket (`EFX8` on the GPU): sample the rendered subtree, floor
the texture coordinate to the cell — the very `at` the terminal hands the
same function — and run the transform on the texel's colour, keeping its
alpha.
*/
private (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.tier0!(phosphor)(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells) pure nothrow @nogc @safeThe tier-0 bracket (EFX8 on the GPU): sample the rendered subtree, floor
the texture coordinate to the cell — the very at the terminal hands the
same function — and run the transform on the texel's colour, keeping its
alpha.
tier0(alias transform)((alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor,
(struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0, (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCellsuExtentCells) @safe pure nothrow @nogc
{
const (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) texeltexel = (parameter) ldc.dcompute.Sampler2D texture0texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord) * sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).opBinary!("*", sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]))(const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
fragColor;
const (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) atat = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.math.floor!(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) v) pure nothrow @nogc @safeGLSL floor.
floor((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
uExtentCells);
return sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) rgb, float w) pure nothrow @nogc @safeConstructs a float4; with one argument, a broadcast; from an rgb triple
and an alpha, GLSL's vec4(rgb, a).
v4(transform((local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) atat, (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCellsuExtentCells, (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) texeltexel.xyz), (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) texeltexel.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safew);
}
/// ditto
@(constant) ldc.dcompute._shader ldc.dcompute.fragment = _shader(ShaderStage.fragment)Graphics shader stages (Vulkan/SPIR-V target only).
@fragment`` marks a function in a @compute module as a fragment (pixel)
shader entry point. The function itself stays an ordinary D function; the
compiler synthesises the shader interface around it from its signature:
each @input parameter becomes an Input interface variable named
after the parameter, at the next location (a GLSL in/varying),
each @uniform parameter becomes a plain uniform named after the
parameter (a GLSL uniform),
each Sampler2D parameter becomes a combined image + sampler pair at
the next descriptor binding (a GLSL sampler2D), and
the return value is stored to the fragment's colour output at
location 0.
Examples
@compute(CompileFor.deviceOnly) module foo;
import ldc.dcompute;
@fragment __vector(float[4]) tint(@input __vector(float[2]) fragTexCoord,
@input __vector(float[4]) fragColor, Sampler2D texture0,
@uniform float uAmount)
{
return texture0.sample(fragTexCoord) * fragColor * uAmount;
}
fragment (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.scanlines(@(_input()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, @(_input()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, @(_uniform()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells)The tier-0 bracket (EFX8 on the GPU): sample the rendered subtree, floor
the texture coordinate to the cell — the very at the terminal hands the
same function — and run the transform on the texel's colour, keeping its
alpha.
scanlines(@(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, @(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor,
(struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCellsuExtentCells)
=> sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.tier0!(scanlines)(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells) pure nothrow @nogc @safeThe tier-0 bracket (EFX8 on the GPU): sample the rendered subtree, floor
the texture coordinate to the cell — the very at the terminal hands the
same function — and run the transform on the texel's colour, keeping its
alpha.
tier0!((module) sparkles.shadersSingle-source shaders (SHD): one D function that runs per cell on the CPU
and, compiled by LDC's Vulkan target, per fragment on the GPU.
The vocabulary is GLSL's, spelled in D. vec2/vec3/vec4 are the
compiler's own vector types where it has them (LDC, every size) and a
lookalike struct where it does not (DMD below 16 bytes), the built-ins
(floor, mod, dot, clamp, mix, …) are the GLSL set over both, and
the constructors are v2/v3/v4 because a __vector alias cannot be
called. A function written against this module reads like the shader it
becomes, and the CPU path calls the very same function.
Device compilation is opt-in by target. Under -mdcompute-targets=…
(which predefines LDC_DCompute) the module attributes (compute,
fragment, @input, @uniform,
Sampler2D) are LDC's real ldc.dcompute symbols, and every module marked
@compute is subject to LDC's device rules and emitted to SPIR-V. Without
it they are inert stand-ins, so an ordinary dub build sees plain D — no
device rules, no SPIR-V, no LDC dependency.
The pipeline that turns a @fragment function into the GLSL sparkles:ui-raylib
loads is apps/shader-compile; the spec is docs/specs/ui/effects.md (EFX20).
sparkles.(package) sparkles.uiui.(module) sparkles.ui.effect_shadersThe built-in effects, written once (EFX20).
Each transform here is the implementation: ui-tui calls it per cell
through the adapters in sparkles.ui.effect, and libs/ui/shaders/effects.d
wraps it in a @fragment entry point that shader-compile turns into the
GLSL ui-raylib loads. There is no second, hand-written GPU copy to drift.
Cell coordinates, float colours. at is the cell relative to the
bracket's origin and extent the bracket's size in cells — on the GPU the
fragment shader floors fragTexCoord * uExtentCells to get the same at —
and color is the cell's resolved colour in [0, 1], which is what a
sampler returns and what the CPU adapter converts a byte colour to.
The module is @compute(CompileFor.hostAndDevice): plain D in an ordinary
build (the attribute is inert outside a dcompute build — LDC_DCompute),
device code when the shader pipeline compiles it. That is also why it
carries no tests — a device module may not hold a string literal, and a
test's name is one. Its tests live beside the adapters in
sparkles.ui.effect.
effect_shaders.sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.ui.effect_shaders.scanlines(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) at, in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) extent, in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) color) pure nothrow @nogc @safeEvery other row darkened — the raster a CRT's beam skips.
scanlines)((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor, (parameter) ldc.dcompute.Sampler2D texture0texture0, (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCellsuExtentCells);
/// ditto
@(constant) ldc.dcompute._shader ldc.dcompute.fragment = _shader(ShaderStage.fragment)Graphics shader stages (Vulkan/SPIR-V target only).
@fragment`` marks a function in a @compute module as a fragment (pixel)
shader entry point. The function itself stays an ordinary D function; the
compiler synthesises the shader interface around it from its signature:
each @input parameter becomes an Input interface variable named
after the parameter, at the next location (a GLSL in/varying),
each @uniform parameter becomes a plain uniform named after the
parameter (a GLSL uniform),
each Sampler2D parameter becomes a combined image + sampler pair at
the next descriptor binding (a GLSL sampler2D), and
the return value is stored to the fragment's colour output at
location 0.
Examples
@compute(CompileFor.deviceOnly) module foo;
import ldc.dcompute;
@fragment __vector(float[4]) tint(@input __vector(float[2]) fragTexCoord,
@input __vector(float[4]) fragColor, Sampler2D texture0,
@uniform float uAmount)
{
return texture0.sample(fragTexCoord) * fragColor * uAmount;
}
fragment (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.phosphor(@(_input()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, @(_input()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, @(_uniform()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells)The tier-0 bracket (EFX8 on the GPU): sample the rendered subtree, floor
the texture coordinate to the cell — the very at the terminal hands the
same function — and run the transform on the texel's colour, keeping its
alpha.
phosphor(@(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, @(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor,
(struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCellsuExtentCells)
=> sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.tier0!(phosphor)(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells) pure nothrow @nogc @safeThe tier-0 bracket (EFX8 on the GPU): sample the rendered subtree, floor
the texture coordinate to the cell — the very at the terminal hands the
same function — and run the transform on the texel's colour, keeping its
alpha.
tier0!((module) sparkles.shadersSingle-source shaders (SHD): one D function that runs per cell on the CPU
and, compiled by LDC's Vulkan target, per fragment on the GPU.
The vocabulary is GLSL's, spelled in D. vec2/vec3/vec4 are the
compiler's own vector types where it has them (LDC, every size) and a
lookalike struct where it does not (DMD below 16 bytes), the built-ins
(floor, mod, dot, clamp, mix, …) are the GLSL set over both, and
the constructors are v2/v3/v4 because a __vector alias cannot be
called. A function written against this module reads like the shader it
becomes, and the CPU path calls the very same function.
Device compilation is opt-in by target. Under -mdcompute-targets=…
(which predefines LDC_DCompute) the module attributes (compute,
fragment, @input, @uniform,
Sampler2D) are LDC's real ldc.dcompute symbols, and every module marked
@compute is subject to LDC's device rules and emitted to SPIR-V. Without
it they are inert stand-ins, so an ordinary dub build sees plain D — no
device rules, no SPIR-V, no LDC dependency.
The pipeline that turns a @fragment function into the GLSL sparkles:ui-raylib
loads is apps/shader-compile; the spec is docs/specs/ui/effects.md (EFX20).
sparkles.(package) sparkles.uiui.(module) sparkles.ui.effect_shadersThe built-in effects, written once (EFX20).
Each transform here is the implementation: ui-tui calls it per cell
through the adapters in sparkles.ui.effect, and libs/ui/shaders/effects.d
wraps it in a @fragment entry point that shader-compile turns into the
GLSL ui-raylib loads. There is no second, hand-written GPU copy to drift.
Cell coordinates, float colours. at is the cell relative to the
bracket's origin and extent the bracket's size in cells — on the GPU the
fragment shader floors fragTexCoord * uExtentCells to get the same at —
and color is the cell's resolved colour in [0, 1], which is what a
sampler returns and what the CPU adapter converts a byte colour to.
The module is @compute(CompileFor.hostAndDevice): plain D in an ordinary
build (the attribute is inert outside a dcompute build — LDC_DCompute),
device code when the shader pipeline compiles it. That is also why it
carries no tests — a device module may not hold a string literal, and a
test's name is one. Its tests live beside the adapters in
sparkles.ui.effect.
effect_shaders.sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.ui.effect_shaders.phosphor(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) at, in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) extent, in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) color) pure nothrow @nogc @safeTinted toward a green phosphor, keeping each cell's own luminance.
Luminance rather than a flat green, so text stays readable and the tint reads
as a display characteristic rather than as a colour wash: a bright cell is
bright green and a dim one is dim green, which is what a monochrome tube does.
Rec. 601 luma, because a naive average makes blue text vanish.
phosphor)((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor, (parameter) ldc.dcompute.Sampler2D texture0texture0, (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCellsuExtentCells);
/// ditto
@(constant) ldc.dcompute._shader ldc.dcompute.fragment = _shader(ShaderStage.fragment)Graphics shader stages (Vulkan/SPIR-V target only).
@fragment`` marks a function in a @compute module as a fragment (pixel)
shader entry point. The function itself stays an ordinary D function; the
compiler synthesises the shader interface around it from its signature:
each @input parameter becomes an Input interface variable named
after the parameter, at the next location (a GLSL in/varying),
each @uniform parameter becomes a plain uniform named after the
parameter (a GLSL uniform),
each Sampler2D parameter becomes a combined image + sampler pair at
the next descriptor binding (a GLSL sampler2D), and
the return value is stored to the fragment's colour output at
location 0.
Examples
@compute(CompileFor.deviceOnly) module foo;
import ldc.dcompute;
@fragment __vector(float[4]) tint(@input __vector(float[2]) fragTexCoord,
@input __vector(float[4]) fragColor, Sampler2D texture0,
@uniform float uAmount)
{
return texture0.sample(fragTexCoord) * fragColor * uAmount;
}
fragment (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.dim(@(_input()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, @(_input()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, @(_uniform()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells)The tier-0 bracket (EFX8 on the GPU): sample the rendered subtree, floor
the texture coordinate to the cell — the very at the terminal hands the
same function — and run the transform on the texel's colour, keeping its
alpha.
dim(@(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, @(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor,
(struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCellsuExtentCells)
=> sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.tier0!(dim)(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells) pure nothrow @nogc @safeThe tier-0 bracket (EFX8 on the GPU): sample the rendered subtree, floor
the texture coordinate to the cell — the very at the terminal hands the
same function — and run the transform on the texel's colour, keeping its
alpha.
tier0!((module) sparkles.shadersSingle-source shaders (SHD): one D function that runs per cell on the CPU
and, compiled by LDC's Vulkan target, per fragment on the GPU.
The vocabulary is GLSL's, spelled in D. vec2/vec3/vec4 are the
compiler's own vector types where it has them (LDC, every size) and a
lookalike struct where it does not (DMD below 16 bytes), the built-ins
(floor, mod, dot, clamp, mix, …) are the GLSL set over both, and
the constructors are v2/v3/v4 because a __vector alias cannot be
called. A function written against this module reads like the shader it
becomes, and the CPU path calls the very same function.
Device compilation is opt-in by target. Under -mdcompute-targets=…
(which predefines LDC_DCompute) the module attributes (compute,
fragment, @input, @uniform,
Sampler2D) are LDC's real ldc.dcompute symbols, and every module marked
@compute is subject to LDC's device rules and emitted to SPIR-V. Without
it they are inert stand-ins, so an ordinary dub build sees plain D — no
device rules, no SPIR-V, no LDC dependency.
The pipeline that turns a @fragment function into the GLSL sparkles:ui-raylib
loads is apps/shader-compile; the spec is docs/specs/ui/effects.md (EFX20).
sparkles.(package) sparkles.uiui.(module) sparkles.ui.effect_shadersThe built-in effects, written once (EFX20).
Each transform here is the implementation: ui-tui calls it per cell
through the adapters in sparkles.ui.effect, and libs/ui/shaders/effects.d
wraps it in a @fragment entry point that shader-compile turns into the
GLSL ui-raylib loads. There is no second, hand-written GPU copy to drift.
Cell coordinates, float colours. at is the cell relative to the
bracket's origin and extent the bracket's size in cells — on the GPU the
fragment shader floors fragTexCoord * uExtentCells to get the same at —
and color is the cell's resolved colour in [0, 1], which is what a
sampler returns and what the CPU adapter converts a byte colour to.
The module is @compute(CompileFor.hostAndDevice): plain D in an ordinary
build (the attribute is inert outside a dcompute build — LDC_DCompute),
device code when the shader pipeline compiles it. That is also why it
carries no tests — a device module may not hold a string literal, and a
test's name is one. Its tests live beside the adapters in
sparkles.ui.effect.
effect_shaders.sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.ui.effect_shaders.dim(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) at, in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) extent, in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) color) pure nothrow @nogc @safeUniformly darkened — an inactive pane, without the view knowing it is one.
dim)((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor, (parameter) ldc.dcompute.Sampler2D texture0texture0, (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCellsuExtentCells);
/// ditto
@(constant) ldc.dcompute._shader ldc.dcompute.fragment = _shader(ShaderStage.fragment)Graphics shader stages (Vulkan/SPIR-V target only).
@fragment`` marks a function in a @compute module as a fragment (pixel)
shader entry point. The function itself stays an ordinary D function; the
compiler synthesises the shader interface around it from its signature:
each @input parameter becomes an Input interface variable named
after the parameter, at the next location (a GLSL in/varying),
each @uniform parameter becomes a plain uniform named after the
parameter (a GLSL uniform),
each Sampler2D parameter becomes a combined image + sampler pair at
the next descriptor binding (a GLSL sampler2D), and
the return value is stored to the fragment's colour output at
location 0.
Examples
@compute(CompileFor.deviceOnly) module foo;
import ldc.dcompute;
@fragment __vector(float[4]) tint(@input __vector(float[2]) fragTexCoord,
@input __vector(float[4]) fragColor, Sampler2D texture0,
@uniform float uAmount)
{
return texture0.sample(fragTexCoord) * fragColor * uAmount;
}
fragment (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.spectrum(@(_input()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, @(_input()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, @(_uniform()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells)The tier-0 bracket (EFX8 on the GPU): sample the rendered subtree, floor
the texture coordinate to the cell — the very at the terminal hands the
same function — and run the transform on the texel's colour, keeping its
alpha.
spectrum(@(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, @(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor,
(struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCellsuExtentCells)
=> sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.tier0!(spectrum)(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells) pure nothrow @nogc @safeThe tier-0 bracket (EFX8 on the GPU): sample the rendered subtree, floor
the texture coordinate to the cell — the very at the terminal hands the
same function — and run the transform on the texel's colour, keeping its
alpha.
tier0!((module) sparkles.shadersSingle-source shaders (SHD): one D function that runs per cell on the CPU
and, compiled by LDC's Vulkan target, per fragment on the GPU.
The vocabulary is GLSL's, spelled in D. vec2/vec3/vec4 are the
compiler's own vector types where it has them (LDC, every size) and a
lookalike struct where it does not (DMD below 16 bytes), the built-ins
(floor, mod, dot, clamp, mix, …) are the GLSL set over both, and
the constructors are v2/v3/v4 because a __vector alias cannot be
called. A function written against this module reads like the shader it
becomes, and the CPU path calls the very same function.
Device compilation is opt-in by target. Under -mdcompute-targets=…
(which predefines LDC_DCompute) the module attributes (compute,
fragment, @input, @uniform,
Sampler2D) are LDC's real ldc.dcompute symbols, and every module marked
@compute is subject to LDC's device rules and emitted to SPIR-V. Without
it they are inert stand-ins, so an ordinary dub build sees plain D — no
device rules, no SPIR-V, no LDC dependency.
The pipeline that turns a @fragment function into the GLSL sparkles:ui-raylib
loads is apps/shader-compile; the spec is docs/specs/ui/effects.md (EFX20).
sparkles.(package) sparkles.uiui.(module) sparkles.ui.effect_shadersThe built-in effects, written once (EFX20).
Each transform here is the implementation: ui-tui calls it per cell
through the adapters in sparkles.ui.effect, and libs/ui/shaders/effects.d
wraps it in a @fragment entry point that shader-compile turns into the
GLSL ui-raylib loads. There is no second, hand-written GPU copy to drift.
Cell coordinates, float colours. at is the cell relative to the
bracket's origin and extent the bracket's size in cells — on the GPU the
fragment shader floors fragTexCoord * uExtentCells to get the same at —
and color is the cell's resolved colour in [0, 1], which is what a
sampler returns and what the CPU adapter converts a byte colour to.
The module is @compute(CompileFor.hostAndDevice): plain D in an ordinary
build (the attribute is inert outside a dcompute build — LDC_DCompute),
device code when the shader pipeline compiles it. That is also why it
carries no tests — a device module may not hold a string literal, and a
test's name is one. Its tests live beside the adapters in
sparkles.ui.effect.
effect_shaders.sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.ui.effect_shaders.spectrum(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) at, in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) extent, in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) color) pure nothrow @nogc @safeA hue sweep across the bracket's columns, at each cell's own luminance.
Why a column-wise built-in exists. scanlines varies down the rows, so
it needs height before it reads as anything: in a four-row panel only one or
two lines are ever darkened and the effect looks like noise. Position is two
axes, and a specimen that only exercises one of them under-demonstrates the
tier. This varies along ``at.x, which every bracket has plenty of, and lands a
different truecolor value in each cell.
Luminance is kept, as in phosphor: the hue says where the cell is,
the brightness still says what it is, and text stays readable.
spectrum)((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor, (parameter) ldc.dcompute.Sampler2D texture0texture0, (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCellsuExtentCells);
/**
The tier-1 bracket (`EFX11`): sample at the warped position. Outside `[0, 1]`
is off the subtree, not a clamped edge — a barrel distortion that smeared its
border pixels outward would be hiding the shape it exists to show.
Transparent is the honest answer and composites over whatever the bracket
sits on.
*/
@(constant) ldc.dcompute._shader ldc.dcompute.fragment = _shader(ShaderStage.fragment)Graphics shader stages (Vulkan/SPIR-V target only).
@fragment`` marks a function in a @compute module as a fragment (pixel)
shader entry point. The function itself stays an ordinary D function; the
compiler synthesises the shader interface around it from its signature:
each @input parameter becomes an Input interface variable named
after the parameter, at the next location (a GLSL in/varying),
each @uniform parameter becomes a plain uniform named after the
parameter (a GLSL uniform),
each Sampler2D parameter becomes a combined image + sampler pair at
the next descriptor binding (a GLSL sampler2D), and
the return value is stored to the fragment's colour output at
location 0.
Examples
@compute(CompileFor.deviceOnly) module foo;
import ldc.dcompute;
@fragment __vector(float[4]) tint(@input __vector(float[2]) fragTexCoord,
@input __vector(float[4]) fragColor, Sampler2D texture0,
@uniform float uAmount)
{
return texture0.sample(fragTexCoord) * fragColor * uAmount;
}
fragment (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.curvature(@(_input()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, @(_input()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, @(_uniform()) float uAmount)The tier-1 bracket (EFX11): sample at the warped position. Outside [0, 1]
is off the subtree, not a clamped edge — a barrel distortion that smeared its
border pixels outward would be hiding the shape it exists to show.
Transparent is the honest answer and composites over whatever the bracket
sits on.
curvature(@(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, @(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor,
(struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uAmountuAmount)
{
const (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uvuv = (package) sparklessparkles.(package) sparkles.uiui.(module) sparkles.ui.effect_shadersThe built-in effects, written once (EFX20).
Each transform here is the implementation: ui-tui calls it per cell
through the adapters in sparkles.ui.effect, and libs/ui/shaders/effects.d
wraps it in a @fragment entry point that shader-compile turns into the
GLSL ui-raylib loads. There is no second, hand-written GPU copy to drift.
Cell coordinates, float colours. at is the cell relative to the
bracket's origin and extent the bracket's size in cells — on the GPU the
fragment shader floors fragTexCoord * uExtentCells to get the same at —
and color is the cell's resolved colour in [0, 1], which is what a
sampler returns and what the CPU adapter converts a byte colour to.
The module is @compute(CompileFor.hostAndDevice): plain D in an ordinary
build (the attribute is inert outside a dcompute build — LDC_DCompute),
device code when the shader pipeline compiles it. That is also why it
carries no tests — a device module may not hold a string literal, and a
test's name is one. Its tests live beside the adapters in
sparkles.ui.effect.
effect_shaders.sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.ui.effect_shaders.curvature(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv, float amount) pure nothrow @nogc @safeBarrel distortion — the tier-1 warp: rewrites a normalised position, and so
has no per-cell form (EFX12). The backend samples the subtree at what this
returns and treats anything outside [0, 1] as off the tube.
The screen fit keeps the midpoint of each edge on the edge whatever the
amount, which is the same 1 / (1 + k/4) the CRT's own projection derives.
curvature((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, (parameter) float uAmountuAmount);
if ((local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex < 0.0f || (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex > 1.0f || (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey < 0.0f || (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey > 1.0f)
return sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(float s) pure nothrow @nogc @safeConstructs a float4; with one argument, a broadcast; from an rgb triple
and an alpha, GLSL's vec4(rgb, a).
v4(0.0f);
return (parameter) ldc.dcompute.Sampler2D texture0texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uvuv) * sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).opBinary!("*", sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]))(const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
fragColor;
}
// ── bloom: four passes (tier 2) ─────────────────────────────────────────────
// Extract the bright part at half size, blur it horizontally, then vertically,
// then add it back over the bracket. `ui_raylib.effect_gpu` chains them: each
// pass draws the previous one's image as `texture0`, and the composite also
// reads the blurred glow as `texture1`. `uResolution` is the size of the image
// a pass writes.
/// ditto
@(constant) ldc.dcompute._shader ldc.dcompute.fragment = _shader(ShaderStage.fragment)Graphics shader stages (Vulkan/SPIR-V target only).
@fragment`` marks a function in a @compute module as a fragment (pixel)
shader entry point. The function itself stays an ordinary D function; the
compiler synthesises the shader interface around it from its signature:
each @input parameter becomes an Input interface variable named
after the parameter, at the next location (a GLSL in/varying),
each @uniform parameter becomes a plain uniform named after the
parameter (a GLSL uniform),
each Sampler2D parameter becomes a combined image + sampler pair at
the next descriptor binding (a GLSL sampler2D), and
the return value is stored to the fragment's colour output at
location 0.
Examples
@compute(CompileFor.deviceOnly) module foo;
import ldc.dcompute;
@fragment __vector(float[4]) tint(@input __vector(float[2]) fragTexCoord,
@input __vector(float[4]) fragColor, Sampler2D texture0,
@uniform float uAmount)
{
return texture0.sample(fragTexCoord) * fragColor * uAmount;
}
fragment (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.bloomExtract(@(_input()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, ldc.dcompute.Sampler2D texture0, @(_uniform()) float uBloomThreshold)The tier-1 bracket (EFX11): sample at the warped position. Outside [0, 1]
is off the subtree, not a clamped edge — a barrel distortion that smeared its
border pixels outward would be hiding the shape it exists to show.
Transparent is the honest answer and composites over whatever the bracket
sits on.
bloomExtract(@(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, (struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uBloomThresholduBloomThreshold)
=> sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) rgb, float w) pure nothrow @nogc @safeConstructs a float4; with one argument, a broadcast; from an rgb triple
and an alpha, GLSL's vec4(rgb, a).
v4((package) sparklessparkles.(package) sparkles.uiui.(module) sparkles.ui.effect_shadersThe built-in effects, written once (EFX20).
Each transform here is the implementation: ui-tui calls it per cell
through the adapters in sparkles.ui.effect, and libs/ui/shaders/effects.d
wraps it in a @fragment entry point that shader-compile turns into the
GLSL ui-raylib loads. There is no second, hand-written GPU copy to drift.
Cell coordinates, float colours. at is the cell relative to the
bracket's origin and extent the bracket's size in cells — on the GPU the
fragment shader floors fragTexCoord * uExtentCells to get the same at —
and color is the cell's resolved colour in [0, 1], which is what a
sampler returns and what the CPU adapter converts a byte colour to.
The module is @compute(CompileFor.hostAndDevice): plain D in an ordinary
build (the attribute is inert outside a dcompute build — LDC_DCompute),
device code when the shader pipeline compiles it. That is also why it
carries no tests — a device module may not hold a string literal, and a
test's name is one. Its tests live beside the adapters in
sparkles.ui.effect.
effect_shaders.sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.ui.effect_shaders.bloomBright(in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) color, float threshold) pure nothrow @nogc @safeBloom's bright pass: what of color glows, faded in over a quarter
of luminance above threshold. Rec. 709 luma, not luma's Rec. 601 —
the weights the pass has always used.
Deliberately not weighted by alpha: the bracket's texture is premultiplied
nowhere, and weighting it dimmed the glow of every translucent element.
bloomBright((parameter) ldc.dcompute.Sampler2D texture0texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord).xyz,
(parameter) float uBloomThresholduBloomThreshold), 1.0f);
/**
A nine-tap Gaussian along `dir`, `uBloomRadius` output pixels per tap. Each
tap is weighted and added on its own, in the order the hand-written pass
used, so the float rounding matches it.
*/
private (alias) sparkles.shaders.types.vec3 = sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])The vector types under their GLSL names.
vec3 sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) effects.bloomBlur(ldc.dcompute.Sampler2D texture0, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) dir, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolution, float uBloomRadius) pure nothrow @nogc @safeA nine-tap Gaussian along dir, uBloomRadius output pixels per tap. Each
tap is weighted and added on its own, in the order the hand-written pass
used, so the float rounding matches it.
bloomBlur((struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0, (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv, (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) dirdir, (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolutionuResolution,
float (parameter) float uBloomRadiusuBloomRadius) @safe pure nothrow @nogc
{
enum float (constant) float effects.bloomBlur.w0 = 0.227027Fw0 = 0.2270270270f, (constant) float effects.bloomBlur.w1 = 0.194595Fw1 = 0.1945945946f, (constant) float effects.bloomBlur.w2 = 0.121622Fw2 = 0.1216216216f,
(constant) float effects.bloomBlur.w3 = 0.0540541Fw3 = 0.0540540541f, (constant) float effects.bloomBlur.w4 = 0.0162162Fw4 = 0.0162162162f;
const (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) ss = (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) dirdir * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
uBloomRadius / sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("/", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
uResolution;
(alias) sparkles.shaders.types.vec3 = sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])The vector types under their GLSL names.
vec3 (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum = (parameter) ldc.dcompute.Sampler2D texture0texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv).xyz * (constant) float effects.bloomBlur.w0 = 0.227027Fw0;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv + sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("+", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
s * 1.0f).xyz * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
w1;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
s * 1.0f).xyz * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
w1;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv + sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("+", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
s * 2.0f).xyz * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
w2;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
s * 2.0f).xyz * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
w2;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv + sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("+", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
s * 3.0f).xyz * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
w3;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
s * 3.0f).xyz * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
w3;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv + sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("+", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
s * 4.0f).xyz * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
w4;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
s * 4.0f).xyz * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
w4;
return (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sumsum;
}
/// ditto
@(constant) ldc.dcompute._shader ldc.dcompute.fragment = _shader(ShaderStage.fragment)Graphics shader stages (Vulkan/SPIR-V target only).
@fragment`` marks a function in a @compute module as a fragment (pixel)
shader entry point. The function itself stays an ordinary D function; the
compiler synthesises the shader interface around it from its signature:
each @input parameter becomes an Input interface variable named
after the parameter, at the next location (a GLSL in/varying),
each @uniform parameter becomes a plain uniform named after the
parameter (a GLSL uniform),
each Sampler2D parameter becomes a combined image + sampler pair at
the next descriptor binding (a GLSL sampler2D), and
the return value is stored to the fragment's colour output at
location 0.
Examples
@compute(CompileFor.deviceOnly) module foo;
import ldc.dcompute;
@fragment __vector(float[4]) tint(@input __vector(float[2]) fragTexCoord,
@input __vector(float[4]) fragColor, Sampler2D texture0,
@uniform float uAmount)
{
return texture0.sample(fragTexCoord) * fragColor * uAmount;
}
fragment (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.bloomBlurH(@(_input()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, ldc.dcompute.Sampler2D texture0, @(_uniform()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolution, @(_uniform()) float uBloomRadius)A nine-tap Gaussian along dir, uBloomRadius output pixels per tap. Each
tap is weighted and added on its own, in the order the hand-written pass
used, so the float rounding matches it.
bloomBlurH(@(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, (struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolutionuResolution, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uBloomRadiusuBloomRadius)
=> sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) rgb, float w) pure nothrow @nogc @safeConstructs a float4; with one argument, a broadcast; from an rgb triple
and an alpha, GLSL's vec4(rgb, a).
v4(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) effects.bloomBlur(ldc.dcompute.Sampler2D texture0, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) dir, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolution, float uBloomRadius) pure nothrow @nogc @safeA nine-tap Gaussian along dir, uBloomRadius output pixels per tap. Each
tap is weighted and added on its own, in the order the hand-written pass
used, so the float rounding matches it.
bloomBlur((parameter) ldc.dcompute.Sampler2D texture0texture0, (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safeConstructs a float2; with one argument, a broadcast.
v2(1.0f, 0.0f), (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolutionuResolution, (parameter) float uBloomRadiusuBloomRadius), 1.0f);
/// ditto
@(constant) ldc.dcompute._shader ldc.dcompute.fragment = _shader(ShaderStage.fragment)Graphics shader stages (Vulkan/SPIR-V target only).
@fragment`` marks a function in a @compute module as a fragment (pixel)
shader entry point. The function itself stays an ordinary D function; the
compiler synthesises the shader interface around it from its signature:
each @input parameter becomes an Input interface variable named
after the parameter, at the next location (a GLSL in/varying),
each @uniform parameter becomes a plain uniform named after the
parameter (a GLSL uniform),
each Sampler2D parameter becomes a combined image + sampler pair at
the next descriptor binding (a GLSL sampler2D), and
the return value is stored to the fragment's colour output at
location 0.
Examples
@compute(CompileFor.deviceOnly) module foo;
import ldc.dcompute;
@fragment __vector(float[4]) tint(@input __vector(float[2]) fragTexCoord,
@input __vector(float[4]) fragColor, Sampler2D texture0,
@uniform float uAmount)
{
return texture0.sample(fragTexCoord) * fragColor * uAmount;
}
fragment (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.bloomBlurV(@(_input()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, ldc.dcompute.Sampler2D texture0, @(_uniform()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolution, @(_uniform()) float uBloomRadius)A nine-tap Gaussian along dir, uBloomRadius output pixels per tap. Each
tap is weighted and added on its own, in the order the hand-written pass
used, so the float rounding matches it.
bloomBlurV(@(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, (struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolutionuResolution, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uBloomRadiusuBloomRadius)
=> sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) rgb, float w) pure nothrow @nogc @safeConstructs a float4; with one argument, a broadcast; from an rgb triple
and an alpha, GLSL's vec4(rgb, a).
v4(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) effects.bloomBlur(ldc.dcompute.Sampler2D texture0, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) dir, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolution, float uBloomRadius) pure nothrow @nogc @safeA nine-tap Gaussian along dir, uBloomRadius output pixels per tap. Each
tap is weighted and added on its own, in the order the hand-written pass
used, so the float rounding matches it.
bloomBlur((parameter) ldc.dcompute.Sampler2D texture0texture0, (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safeConstructs a float2; with one argument, a broadcast.
v2(0.0f, 1.0f), (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolutionuResolution, (parameter) float uBloomRadiusuBloomRadius), 1.0f);
/// ditto — `texture0` is the bracket, `texture1` the blurred glow.
@(constant) ldc.dcompute._shader ldc.dcompute.fragment = _shader(ShaderStage.fragment)Graphics shader stages (Vulkan/SPIR-V target only).
@fragment`` marks a function in a @compute module as a fragment (pixel)
shader entry point. The function itself stays an ordinary D function; the
compiler synthesises the shader interface around it from its signature:
each @input parameter becomes an Input interface variable named
after the parameter, at the next location (a GLSL in/varying),
each @uniform parameter becomes a plain uniform named after the
parameter (a GLSL uniform),
each Sampler2D parameter becomes a combined image + sampler pair at
the next descriptor binding (a GLSL sampler2D), and
the return value is stored to the fragment's colour output at
location 0.
Examples
@compute(CompileFor.deviceOnly) module foo;
import ldc.dcompute;
@fragment __vector(float[4]) tint(@input __vector(float[2]) fragTexCoord,
@input __vector(float[4]) fragColor, Sampler2D texture0,
@uniform float uAmount)
{
return texture0.sample(fragTexCoord) * fragColor * uAmount;
}
fragment (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.bloomComposite(@(_input()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, @(_input()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, ldc.dcompute.Sampler2D texture1, @(_uniform()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) colDiffuse, @(_uniform()) float uBloomIntensity)ditto — texture0 is the bracket, texture1 the blurred glow.
bloomComposite(@(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, @(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor,
(struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0, (struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture1texture1, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) colDiffusecolDiffuse,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uBloomIntensityuBloomIntensity)
=> (package) sparklessparkles.(package) sparkles.uiui.(module) sparkles.ui.effect_shadersThe built-in effects, written once (EFX20).
Each transform here is the implementation: ui-tui calls it per cell
through the adapters in sparkles.ui.effect, and libs/ui/shaders/effects.d
wraps it in a @fragment entry point that shader-compile turns into the
GLSL ui-raylib loads. There is no second, hand-written GPU copy to drift.
Cell coordinates, float colours. at is the cell relative to the
bracket's origin and extent the bracket's size in cells — on the GPU the
fragment shader floors fragTexCoord * uExtentCells to get the same at —
and color is the cell's resolved colour in [0, 1], which is what a
sampler returns and what the CPU adapter converts a byte colour to.
The module is @compute(CompileFor.hostAndDevice): plain D in an ordinary
build (the attribute is inert outside a dcompute build — LDC_DCompute),
device code when the shader pipeline compiles it. That is also why it
carries no tests — a device module may not hold a string literal, and a
test's name is one. Its tests live beside the adapters in
sparkles.ui.effect.
effect_shaders.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.ui.effect_shaders.bloomOver(in sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) base, in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) glow) pure nothrow @nogc @safeBloom's composite: glow added over base, "over" in straight alpha. The
glow brings its own coverage — its brightest channel — so a glow over a
transparent pixel shows instead of vanishing with it.
bloomOver(
(parameter) ldc.dcompute.Sampler2D texture0texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord) * sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).opBinary!("*", sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]))(const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
colDiffuse * sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).opBinary!("*", sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]))(const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
fragColor,
(parameter) ldc.dcompute.Sampler2D texture1texture1.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord).xyz * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
uBloomIntensity);
// ── the CRT's tube (tier 2) ─────────────────────────────────────────────────
// The composite pass of `sparkles.ui.crt.CrtEffect` (`EFX21`), after
// bloom's first three passes. It bends and magnifies the bracket with the
// geometry in `sparkles.ui.crt_shaders` — the functions the CPU's pointer maps
// call — then adds the glow, lights the UI elements the frame list names, draws
// the software cursor, and finishes with the beam. Every uniform but
// `uResolution` and `uTime` is an `EffectParam` the CRT writes each frame
// (`crtParamNames`), which is why their names are not this module's to change.
//
// Here rather than in a module of its own: the freshness stamp records the
// unit's modules, and a new one goes unseen until another input changes
// (`SHB4`, deferred), so a checkout with generated shaders would keep its stale
// set and fail to find this one's.
/// Signed distance from `p` to a box of half-extents `b` centred on the origin.
private float float effects.sdBox(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) b) pure nothrow @nogc @safeSigned distance from p to a box of half-extents b centred on the origin.
sdBox((alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp, (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) bb) @safe pure nothrow @nogc
{
const (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) dd = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.math.abs!(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) v) pure nothrow @nogc @safeGLSL abs.
abs((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp) - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
b;
return float sparkles.shaders.math.length!(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) v) pure nothrow @nogc @safeGLSL length.
length(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.math.max!(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) a, in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) b) pure nothrow @nogc @safeGLSL max.
max((local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) dd, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float s) pure nothrow @nogc @safeConstructs a float2; with one argument, a broadcast.
v2(0.0f))) + float sparkles.shaders.math.min!float(in float a, in float b) pure nothrow @nogc @safeGLSL min.
min(float sparkles.shaders.math.max!float(in float a, in float b) pure nothrow @nogc @safeGLSL max.
max((local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) dd.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex, (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) dd.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey), 0.0f);
}
/**
The software cursor (`CRT6`) at offset `p` from its hotspot, in UI pixels
with y up: an I-beam (`shape` 1), a horizontal resize arrow (3), else the
arrow. White fill, black outline, transparent outside.
*/
private (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.renderCursor(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p, float shape) pure nothrow @nogc @safeThe software cursor (CRT6) at offset p from its hotspot, in UI pixels
with y up: an I-beam (shape 1), a horizontal resize arrow (3), else the
arrow. White fill, black outline, transparent outside.
renderCursor((alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp, float (parameter) float shapeshape) @safe pure nothrow @nogc
{
// Masks combined with `&`/`|` and one select per shape, never an early
// return or a short-circuit chain: the pinned SPIR-V backend emits
// unstructured control flow for those here, which spirv-val rejects
// (sparkles#618). The masks are the hand-written shader's, unchanged; a
// fill wins over the outline, and anything outside a shape's box is
// transparent.
const (local variable) const(float) axax = float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safeGLSL abs.
abs((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex), (local variable) const(float) ayay = float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safeGLSL abs.
abs((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey);
const (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clearclear = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(float s) pure nothrow @nogc @safeConstructs a float4; with one argument, a broadcast; from an rgb triple
and an alpha, GLSL's vec4(rgb, a).
v4(0.0f), (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) whitewhite = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(float x, float y, float z, float w) pure nothrow @nogc @safeConstructs a float4; with one argument, a broadcast; from an rgb triple
and an alpha, GLSL's vec4(rgb, a).
v4(1.0f, 1.0f, 1.0f, 1.0f), (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) blackblack = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(float x, float y, float z, float w) pure nothrow @nogc @safeConstructs a float4; with one argument, a broadcast; from an rgb triple
and an alpha, GLSL's vec4(rgb, a).
v4(0.0f, 0.0f, 0.0f, 1.0f);
// I-beam
const (local variable) const(bool) ibBoxibBox = ((local variable) const(float) axax <= 5.0f) & ((local variable) const(float) ayay <= 9.0f);
const (local variable) const(bool) ibLineibLine = (((local variable) const(float) axax <= 1.5f) & ((local variable) const(float) ayay <= 7.5f))
| (((local variable) const(float) axax <= 4.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey >= -8.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey <= -5.5f))
| (((local variable) const(float) axax <= 4.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey >= 5.5f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey <= 8.0f));
const (local variable) const(bool) ibFillibFill = (((local variable) const(float) axax <= 0.5f) & ((local variable) const(float) ayay <= 6.5f))
| (((local variable) const(float) axax <= 3.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey >= -7.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey <= -6.5f))
| (((local variable) const(float) axax <= 3.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey >= 6.5f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey <= 7.0f));
const (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) iBeamiBeam = !(local variable) const(bool) ibBoxibBox ? (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clearclear : (local variable) const(bool) ibFillibFill ? (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) whitewhite : (local variable) const(bool) ibLineibLine ? (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) blackblack : (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clearclear;
// EW-resize <->
const (local variable) const(bool) ewBoxewBox = ((local variable) const(float) axax <= 9.5f) & ((local variable) const(float) ayay <= 5.5f);
const (local variable) const(bool) ewLineewLine = (((local variable) const(float) ayay <= 1.5f) & ((local variable) const(float) axax <= 6.5f))
| (((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex <= -2.5f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex >= -7.5f) & ((local variable) const(float) ayay <= -(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex - 2.5f))
| (((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex >= 2.5f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex <= 7.5f) & ((local variable) const(float) ayay <= (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex - 2.5f));
const (local variable) const(bool) ewFillewFill = (((local variable) const(float) ayay <= 0.5f) & ((local variable) const(float) axax <= 5.5f))
| (((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex <= -3.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex >= -6.5f) & ((local variable) const(float) ayay <= -(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex - 3.5f))
| (((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex >= 3.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex <= 6.5f) & ((local variable) const(float) ayay <= (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex - 3.5f));
const (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) resizeresize = !(local variable) const(bool) ewBoxewBox ? (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clearclear : (local variable) const(bool) ewFillewFill ? (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) whitewhite : (local variable) const(bool) ewLineewLine ? (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) blackblack : (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clearclear;
// The arrow.
const (local variable) const(bool) arBoxarBox = ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex >= -0.5f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex <= 13.5f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey >= -0.5f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey <= 19.5f);
const (local variable) const(bool) arLinearLine = (((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex >= 0.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey >= 0.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey <= 14.5f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex <= (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey)
& ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey - (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex * 0.35f <= 12.0f))
| (((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex >= 3.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex <= 7.5f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey >= 9.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey <= 17.5f));
const (local variable) const(bool) arFillarFill = (((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex >= 1.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey >= 1.5f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey <= 13.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex <= (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey - 0.5f)
& ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey - (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex * 0.35f <= 10.5f))
| (((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex >= 4.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex <= 6.5f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey >= 10.0f) & ((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey <= 16.5f));
const (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) arrowarrow = !(local variable) const(bool) arBoxarBox ? (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clearclear : (local variable) const(bool) arFillarFill ? (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) whitewhite : (local variable) const(bool) arLinearLine ? (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) blackblack : (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clearclear;
return ((parameter) float shapeshape > 0.5f) & ((parameter) float shapeshape < 1.5f) ? (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) iBeamiBeam : (parameter) float shapeshape > 2.5f ? (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) resizeresize : (local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) arrowarrow;
}
/// The CRT's composite pass (`EFX21`).
@(constant) ldc.dcompute._shader ldc.dcompute.fragment = _shader(ShaderStage.fragment)Graphics shader stages (Vulkan/SPIR-V target only).
@fragment`` marks a function in a @compute module as a fragment (pixel)
shader entry point. The function itself stays an ordinary D function; the
compiler synthesises the shader interface around it from its signature:
each @input parameter becomes an Input interface variable named
after the parameter, at the next location (a GLSL in/varying),
each @uniform parameter becomes a plain uniform named after the
parameter (a GLSL uniform),
each Sampler2D parameter becomes a combined image + sampler pair at
the next descriptor binding (a GLSL sampler2D), and
the return value is stored to the fragment's colour output at
location 0.
Examples
@compute(CompileFor.deviceOnly) module foo;
import ldc.dcompute;
@fragment __vector(float[4]) tint(@input __vector(float[2]) fragTexCoord,
@input __vector(float[4]) fragColor, Sampler2D texture0,
@uniform float uAmount)
{
return texture0.sample(fragTexCoord) * fragColor * uAmount;
}
fragment (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.crtTube(@(_input()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord, @(_input()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor, ldc.dcompute.Sampler2D texture0, ldc.dcompute.Sampler2D texture1, @(_uniform()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) colDiffuse, @(_uniform()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolution, @(_uniform()) float uTime, @(_uniform()) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) mouse, @(_uniform()) float mouseTilt, @(_uniform()) float mouseMagnify, @(_uniform()) float cursorShape, @(_uniform()) float uCurvature, @(_uniform()) float uScanlines, @(_uniform()) float uMask, @(_uniform()) float uChromaAberration, @(_uniform()) float uVignette, @(_uniform()) float uFlicker, @(_uniform()) float uBrightness, @(_uniform()) float uLensRadius, @(_uniform()) float uLensPower, @(_uniform()) float uBloomIntensity, @(_uniform()) float uUiReactive, @(_uniform()) float uFocusHalo, @(_uniform()) float uHoverGlow, @(_uniform()) float uSelectionBloom, @(_uniform()) float uDividerTension, @(_uniform()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uFocusRect, @(_uniform()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uHoverRect, @(_uniform()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSelectRect, @(_uniform()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSplitDivider, @(_uniform()) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uScrollbarThumb)The CRT's composite pass (EFX21).
crtTube(@(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, @(constant) ldc.dcompute._input ldc.dcompute.input = _input()Marks a @fragment parameter as an interface input (a varying).
input (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColorfragColor,
(struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture0texture0, (struct) ldc.dcompute.Sampler2DA sampled 2-D image: GLSL's sampler2D. As a @fragment parameter it
becomes a descriptor at the next image binding, named after the parameter.
Sampler2D (parameter) ldc.dcompute.Sampler2D texture1texture1, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) colDiffusecolDiffuse,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolutionuResolution, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uTimeuTime,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) mousemouse, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float mouseTiltmouseTilt, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float mouseMagnifymouseMagnify,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float cursorShapecursorShape, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uCurvatureuCurvature, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uScanlinesuScanlines,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uMaskuMask, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uChromaAberrationuChromaAberration, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uVignetteuVignette,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uFlickeruFlicker, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uBrightnessuBrightness, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uLensRadiusuLensRadius,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uLensPoweruLensPower, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uBloomIntensityuBloomIntensity,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uUiReactiveuUiReactive, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uFocusHalouFocusHalo, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uHoverGlowuHoverGlow,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uSelectionBloomuSelectionBloom, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform float (parameter) float uDividerTensionuDividerTension,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uFocusRectuFocusRect, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uHoverRectuHoverRect, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSelectRectuSelectRect,
@(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSplitDivideruSplitDivider, @(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()Marks a @fragment parameter as a uniform.
uniform (alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uScrollbarThumbuScrollbarThumb)
{
const (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) resres = (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolutionuResolution;
const (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) mm = (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) mousemouse / sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("/", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
res;
(alias) sparkles.shaders.types.vec2 = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])The vector types under their GLSL names.
vec2 (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.ui.crt_shaders.crtCurve(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) coord, in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) apex, float tilt, float curvature) pure nothrow @nogc @safeThe barrel bend, fitted to the screen (CRT10).
apex is the point the bend is centred on when tilt is above one half —
the pointer, so the surface is flat directly under it and the far side curves
away — and the screen's middle otherwise. Tilting softens the bend to five
eighths.
The bend pushes a point at radius r out by 1 + k r², so an edge midpoint,
at r = 1/2, lands at 1 + k/4; scaling by the reciprocal seats it back on
the screen edge at any curvature, and leaves a flat screen (k = 0) a 1:1
blit. The corners overhang and are cut: that is the rounded tube face. Exact
with tilt off — an apex that is not the centre deforms the four edges by
different amounts, and one scalar cannot seat all four.
crtCurve((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord, (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) mm, (parameter) float mouseTiltmouseTilt, (parameter) float uCurvatureuCurvature);
// The lens is applied in TEXTURE space, after curvature, so that its
// centre is the very point the software cursor is drawn at (`CRT6`).
float (local variable) float lensRimlensRim = 0.0f;
if ((parameter) float mouseMagnifymouseMagnify > 0.5f)
{
const (local variable) const(float) aspectaspect = (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) resres.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex / (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) resres.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey;
(local variable) float lensRimlensRim = float sparkles.ui.crt_shaders.crtLensRim(float n) pure nothrow @nogc @safeThe lens rim's brightness at lens distance n (from crtLensDistance):
a thin ring just inside the edge, zero elsewhere.
crtLensRim(float sparkles.ui.crt_shaders.crtLensDistance(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv, in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) centre, float aspect, float radius) pure nothrow @nogc @safeHow far uv is from the lens centre centre, as a fraction of the lens
radius — aspect (width over height) makes the lens round on screen. One
or more is outside the lens.
crtLensDistance((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv, (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) mm, (local variable) const(float) aspectaspect, (parameter) float uLensRadiusuLensRadius));
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.ui.crt_shaders.crtLens(in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv, in sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) centre, float aspect, float radius, float power) pure nothrow @nogc @safeThe magnifier lens (CRT6), applied in texture space after the bend: inside
the lens, uv is pulled toward centre by a dome profile of strength
power; outside it is untouched. centre itself stays fixed, which is why
the lens is centred on the pointer's own UI position — the cursor drawn there
is the point the lens does not move.
crtLens((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv, (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) mm, (local variable) const(float) aspectaspect, (parameter) float uLensRadiusuLensRadius, (parameter) float uLensPoweruLensPower);
}
// Subtle horizontal sync micro-jitter.
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safeConstructs a float2; with one argument, a broadcast.
v2((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex + float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safeGLSL sin.
sin((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey * 120.0f + (parameter) float uTimeuTime * 30.0f) * 0.00025f, (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey);
const (local variable) const(bool) onTubeonTube = (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex >= 0.0f && (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex <= 1.0f && (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey >= 0.0f && (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey <= 1.0f;
// The vector from the cursor's hotspot to this fragment, in UI pixels. A
// negative `cursorShape` means the window system draws the pointer itself
// (`PTR1`) and the tube must not draw a second one.
(alias) sparkles.shaders.types.vec4 = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])The vector types under their GLSL names.
vec4 (local variable) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) cursorColcursorCol = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(float s) pure nothrow @nogc @safeConstructs a float4; with one argument, a broadcast; from an rgb triple
and an alpha, GLSL's vec4(rgb, a).
v4(0.0f);
if ((parameter) float cursorShapecursorShape >= 0.0f && (local variable) const(bool) onTubeonTube)
{
const (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uiui = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safeConstructs a float2; with one argument, a broadcast.
v2((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex * (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) resres.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex, (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey * (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) resres.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey);
(local variable) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) cursorColcursorCol = sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) effects.renderCursor(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p, float shape) pure nothrow @nogc @safeThe software cursor (CRT6) at offset p from its hotspot, in UI pixels
with y up: an I-beam (shape 1), a horizontal resize arrow (3), else the
arrow. White fill, black outline, transparent outside.
renderCursor(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safeConstructs a float2; with one argument, a broadcast.
v2((local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uiui.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex - (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) mousemouse.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex, (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) mousemouse.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey - (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uiui.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey), (parameter) float cursorShapecursorShape);
}
(alias) sparkles.shaders.types.vec3 = sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])The vector types under their GLSL names.
vec3 (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.types.v3(float s) pure nothrow @nogc @safeConstructs a float3; with one argument, a broadcast.
v3(0.0f);
if ((local variable) const(bool) onTubeonTube)
{
const (local variable) const(float) cornercorner = float sparkles.shaders.math.smoothstep(float e0, float e1, float v) pure nothrow @nogc @safeGLSL smoothstep: Hermite interpolation between the edges.
smoothstep(0.0f, 0.012f, (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex) * float sparkles.shaders.math.smoothstep(float e0, float e1, float v) pure nothrow @nogc @safeGLSL smoothstep: Hermite interpolation between the edges.
smoothstep(0.0f, 0.012f, 1.0f - (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex)
* (float sparkles.shaders.math.smoothstep(float e0, float e1, float v) pure nothrow @nogc @safeGLSL smoothstep: Hermite interpolation between the edges.
smoothstep(0.0f, 0.012f, (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey) * float sparkles.shaders.math.smoothstep(float e0, float e1, float v) pure nothrow @nogc @safeGLSL smoothstep: Hermite interpolation between the edges.
smoothstep(0.0f, 0.012f, 1.0f - (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey));
const (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) cccc = (local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
v2(0.5f);
float (local variable) float caStrengthcaStrength = (parameter) float uChromaAberrationuChromaAberration + (parameter) float uChromaAberrationuChromaAberration * 0.2f * float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safeGLSL sin.
sin((parameter) float uTimeuTime * 3.0f);
if ((local variable) float lensRimlensRim > 0.0f)
(local variable) float caStrengthcaStrength = (local variable) float caStrengthcaStrength + 0.002f * (local variable) float lensRimlensRim;
const (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) caca = (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) cccc * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
caStrength;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.types.v3(float x, float y, float z) pure nothrow @nogc @safeConstructs a float3; with one argument, a broadcast.
v3((parameter) ldc.dcompute.Sampler2D texture0texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv + sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("+", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
ca).sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("+", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
x, (parameter) ldc.dcompute.Sampler2D texture0texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv).inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).y() inout pure nothrow @nogc @property return ref @safey,
(parameter) ldc.dcompute.Sampler2D texture0texture0.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
ca).sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
z);
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
v3(0.12f) * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
lensRim;
// `CRT3`: the blurred bright pass, sampled at the SAME warped `uv` as
// the content, so the glow curves with the tube.
if ((parameter) float uBloomIntensityuBloomIntensity > 0.0f)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
texture1.sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.sample!(ldc.dcompute.Sampler2D)(ldc.dcompute.Sampler2D s, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv) pure nothrow @nogc @safeSamples the image at normalised uv: GLSL's texture(s, uv), through
the shared sampler, or through sampler, a SamplerState parameter of
the entry point. The vocabulary's vectors in and out; the handles by
value, since one may not live in a function's memory.
sample((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv).xyz * (parameter) float uBloomIntensityuBloomIntensity;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
corner;
if ((parameter) float uUiReactiveuUiReactive > 0.5f)
{
// 1. Focus box: cathode halation around the border, a sharper beam inside.
if ((parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uFocusRectuFocusRect.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safez > 0.0f && (parameter) float uFocusHalouFocusHalo > 0.0f)
{
const (local variable) const(float) distdist = float effects.sdBox(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) b) pure nothrow @nogc @safeSigned distance from p to a box of half-extents b centred on the origin.
sdBox(((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
uFocusRect.xy) * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
res, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
v2((parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uFocusRectuFocusRect.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safez, (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uFocusRectuFocusRect.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safew) * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
res);
if ((local variable) const(float) distdist > -3.0f && (local variable) const(float) distdist < 14.0f)
{
const (local variable) const(float) pulsepulse = 0.85f + 0.15f * float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safeGLSL sin.
sin((parameter) float uTimeuTime * 3.5f);
const (local variable) const(float) halohalo = float sparkles.shaders.math.exp!float(in float v) pure nothrow @nogc @safeGLSL exp: e raised to v.
exp(-float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safeGLSL abs.
abs((local variable) const(float) distdist) * 0.28f) * (parameter) float uFocusHalouFocusHalo * 0.22f * (local variable) const(float) pulsepulse;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
v3(0.25f, 0.55f, 0.85f) * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
halo;
}
if ((local variable) const(float) distdist <= 0.0f)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.math.mix!(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) a, in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) b, float t) pure nothrow @nogc @safeGLSL mix: a` * (1 - `t`) + `b` * `t.
mix((local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol, (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol * 1.03f + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
v3(0.01f), 0.5f);
}
// 2. Hover box: phosphor excitation.
if ((parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uHoverRectuHoverRect.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safez > 0.0f && (parameter) float uHoverGlowuHoverGlow > 0.0f)
{
const (local variable) const(float) distdist = float effects.sdBox(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) b) pure nothrow @nogc @safeSigned distance from p to a box of half-extents b centred on the origin.
sdBox(((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
uHoverRect.xy) * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
res, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
v2((parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uHoverRectuHoverRect.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safez, (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uHoverRectuHoverRect.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safew) * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
res);
if ((local variable) const(float) distdist <= 10.0f)
{
const (local variable) const(float) surgesurge = float sparkles.shaders.math.exp!float(in float v) pure nothrow @nogc @safeGLSL exp: e raised to v.
exp(-float sparkles.shaders.math.max!float(in float a, in float b) pure nothrow @nogc @safeGLSL max.
max((local variable) const(float) distdist, 0.0f) * 0.35f)
* ((local variable) const(float) distdist < 0.0f ? 0.14f : 0.07f) * (parameter) float uHoverGlowuHoverGlow;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol + (sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
col * (local variable) const(float) surgesurge + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
v3(0.02f, 0.03f, 0.04f) * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
surge);
const (local variable) const(float) edgeedge = float sparkles.shaders.math.exp!float(in float v) pure nothrow @nogc @safeGLSL exp: e raised to v.
exp(-float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safeGLSL abs.
abs((local variable) const(float) distdist) * 0.5f) * (parameter) float uHoverGlowuHoverGlow * 0.12f;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.types.v3(float x, float y, float z) pure nothrow @nogc @safeConstructs a float3; with one argument, a broadcast.
v3((local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol.inout(float) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).x() inout pure nothrow @nogc @property return ref @safex + (local variable) const(float) edgeedge * 0.04f, (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol.inout(float) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).y() inout pure nothrow @nogc @property return ref @safey, (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol.inout(float) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).z() inout pure nothrow @nogc @property return ref @safez + (local variable) const(float) edgeedge * 0.06f);
}
}
// 3. Selection: phosphor overdrive inside, a horizontal bleed beside.
if ((parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSelectRectuSelectRect.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safez > 0.0f && (parameter) float uSelectionBloomuSelectionBloom > 0.0f)
{
const (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) pp = ((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
uSelectRect.xy) * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
res;
const (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) bb = sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safeConstructs a float2; with one argument, a broadcast.
v2((parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSelectRectuSelectRect.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safez, (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSelectRectuSelectRect.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safew) * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
res;
const (local variable) const(float) distdist = float effects.sdBox(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) b) pure nothrow @nogc @safeSigned distance from p to a box of half-extents b centred on the origin.
sdBox((local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) pp, (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) bb);
if ((local variable) const(float) distdist <= 0.0f)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
col * (0.16f * (parameter) float uSelectionBloomuSelectionBloom);
else if (float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safeGLSL abs.
abs((local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) pp.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey) <= (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) bb.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey && (local variable) const(float) distdist < 10.0f)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
col * (float sparkles.shaders.math.exp!float(in float v) pure nothrow @nogc @safeGLSL exp: e raised to v.
exp(-(local variable) const(float) distdist * 0.35f) * 0.10f * (parameter) float uSelectionBloomuSelectionBloom);
}
// 4. Dock split divider: a cathode seam, and tension beside it.
if ((parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSplitDivideruSplitDivider.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safez > 0.0f && (parameter) float uDividerTensionuDividerTension > 0.0f)
{
const (local variable) const(float) distdist = float effects.sdBox(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) b) pure nothrow @nogc @safeSigned distance from p to a box of half-extents b centred on the origin.
sdBox(((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
uSplitDivider.xy) * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
res,
sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safeConstructs a float2; with one argument, a broadcast.
v2((parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSplitDivideruSplitDivider.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safez, (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSplitDivideruSplitDivider.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safew) * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
res);
// Two independent tests rather than `if … else if (a && b)`:
// the pinned SPIR-V backend emits unstructured control flow
// for that shape here, which spirv-val rejects (sparkles#618).
const (local variable) const(bool) seamseam = float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safeGLSL abs.
abs((local variable) const(float) distdist) < 2.5f;
const (local variable) const(bool) halohalo = !(local variable) const(bool) seamseam & ((local variable) const(float) distdist >= 0.0f) & ((local variable) const(float) distdist < 6.0f);
if ((local variable) const(bool) seamseam)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol * (1.0f - (1.0f - float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safeGLSL abs.
abs((local variable) const(float) distdist) / 2.5f) * 0.12f * (parameter) float uDividerTensionuDividerTension);
if ((local variable) const(bool) halohalo)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
v3(0.02f, 0.04f, 0.06f) * (sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
exp(-(local variable) const(float) distdist * 0.55f) * 0.05f * (parameter) float uDividerTensionuDividerTension);
}
// 5. Scrollbar thumb flare.
if ((parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uScrollbarThumbuScrollbarThumb.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safez > 0.0f)
{
const (local variable) const(float) distdist = float effects.sdBox(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p, sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) b) pure nothrow @nogc @safeSigned distance from p to a box of half-extents b centred on the origin.
sdBox(((local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uvuv - sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("-", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
uScrollbarThumb.xy) * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
res,
sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safeConstructs a float2; with one argument, a broadcast.
v2((parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uScrollbarThumbuScrollbarThumb.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safez, (parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uScrollbarThumbuScrollbarThumb.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safew) * sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).opBinary!("*", sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]))(const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
res);
if ((local variable) const(float) distdist <= 4.0f)
{
const (local variable) const(float) flareflare = float sparkles.shaders.math.exp!float(in float v) pure nothrow @nogc @safeGLSL exp: e raised to v.
exp(-float sparkles.shaders.math.max!float(in float a, in float b) pure nothrow @nogc @safeGLSL max.
max((local variable) const(float) distdist, 0.0f) * 0.6f) * 0.08f;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol + (sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
col * (local variable) const(float) flareflare + sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("+", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
v3(0.03f) * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
flare);
}
}
}
}
// The shader-drawn cursor, over everything the tube shows.
if ((local variable) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) cursorColcursorCol.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safew > 0.0f)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.math.mix!(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) a, in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) b, float t) pure nothrow @nogc @safeGLSL mix: a` * (1 - `t`) + `b` * `t.
mix((local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol, (local variable) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) cursorColcursorCol.xyz, (local variable) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) cursorColcursorCol.inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safew);
// Scanlines.
const (local variable) const(float) scanlinescanline = float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safeGLSL sin.
sin((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey * (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) resres.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey * 3.14159265f);
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol * ((1.0f - (parameter) float uScanlinesuScanlines) + (parameter) float uScanlinesuScanlines * ((local variable) const(float) scanlinescanline * (local variable) const(float) scanlinescanline));
// The vertical roll hum bar.
const (local variable) const(float) rollroll = 0.5f + 0.5f * float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safeGLSL sin.
sin((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey * 5.0f - (parameter) float uTimeuTime * 2.2f);
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol * ((1.0f - (parameter) float uFlickeruFlicker * 5.7f) + (parameter) float uFlickeruFlicker * 5.7f * (local variable) const(float) rollroll);
// Phosphor decay flicker.
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol * ((1.0f - (parameter) float uFlickeruFlicker) + (parameter) float uFlickeruFlicker * float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safeGLSL sin.
sin((parameter) float uTimeuTime * 70.0f));
// The RGB phosphor triad.
const (local variable) const(float) subpixelsubpixel = float sparkles.shaders.math.mod!float(in float a, in float b) pure nothrow @nogc @safeGLSL mod: ``a - b * floor(a / b).
mod(float sparkles.shaders.math.floor!float(in float v) pure nothrow @nogc @safeGLSL floor.
floor((parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex * (local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) resres.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex), 3.0f);
const (local variable) const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) triadtriad = (local variable) const(float) subpixelsubpixel < 1.0f ? sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.types.v3(float x, float y, float z) pure nothrow @nogc @safeConstructs a float3; with one argument, a broadcast.
v3(1.05f, 0.88f, 0.88f)
: (local variable) const(float) subpixelsubpixel < 2.0f ? sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.types.v3(float x, float y, float z) pure nothrow @nogc @safeConstructs a float3; with one argument, a broadcast.
v3(0.88f, 1.05f, 0.88f)
: sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.types.v3(float x, float y, float z) pure nothrow @nogc @safeConstructs a float3; with one argument, a broadcast.
v3(0.88f, 0.88f, 1.05f);
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
mix(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
v3(1.0f), (local variable) const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) triadtriad, (parameter) float uMaskuMask);
// Vignette.
if ((parameter) float uVignetteuVignette > 0.001f)
{
const (local variable) const(float) vigvig = 16.0f * (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex * (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey
* (1.0f - (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safex) * (1.0f - (parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoordfragTexCoord.inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safey);
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = (local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
clamp(float sparkles.shaders.math.pow!float(in float a, in float b) pure nothrow @nogc @safeGLSL pow.
pow((local variable) const(float) vigvig, (parameter) float uVignetteuVignette), 0.0f, 1.0f);
}
// Gamma and contrast.
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol = sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.math.pow!(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]))(in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) a, in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) b) pure nothrow @nogc @safeGLSL pow.
pow((local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol, sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.types.v3(float s) pure nothrow @nogc @safeConstructs a float3; with one argument, a broadcast.
v3(0.95f)) * sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).opBinary!("*", float)(const(float) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against one value, on either side.
uBrightness;
return sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(in sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) rgb, float w) pure nothrow @nogc @safeConstructs a float4; with one argument, a broadcast; from an rgb triple
and an alpha, GLSL's vec4(rgb, a).
v4((local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) colcol, 1.0f) * sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).opBinary!("*", sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]))(const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
fragColor * sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).opBinary!("*", sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]))(const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) rhs) const pure nothrow @nogc @safeComponent-wise arithmetic against a vector of the same length,
whatever its names or layout. The result has this vector's names and
layout and the common component type.
colDiffuse;
}