effects.dhover×992all
/**
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) effects

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.

effects
;
import
(package) sparkles
sparkles
.
(module) sparkles.shaders

Single-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) sparkles
sparkles
.
(package) sparkles.ui
ui
.
(module) sparkles.ui.effect_shaders

The 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) sparkles
sparkles
.
(package) sparkles.ui
ui
.
(module) sparkles.ui.crt_shaders

The 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 @safe

The 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 @safe

The 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 @safe

How 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 @safe

The 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 @safe

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.

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"]) fragTexCoord
fragTexCoord
,
(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"]) fragColor
fragColor
,
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
,
(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"]) uExtentCells
uExtentCells
) @safe pure nothrow @nogc
{ const
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) texel
texel
=
(parameter) ldc.dcompute.Sampler2D texture0
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 @safe

Samples 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"]) fragTexCoord
fragTexCoord
) *
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 @safe

Component-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"])) at
at
=
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 @safe

GLSL floor.

floor
(
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
*
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 @safe

Component-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 @safe

Constructs 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"])) at
at
,
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells
uExtentCells
,
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) texel
texel
.xyz),
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) texel
texel
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
);
} /// 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"]) fragTexCoord
fragTexCoord
, @
(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"]) fragColor
fragColor
,
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
, @
(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"]) uExtentCells
uExtentCells
)
=>
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 @safe

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.

tier0
!(
(module) sparkles.shaders

Single-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.ui
ui
.
(module) sparkles.ui.effect_shaders

The 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 @safe

Every other row darkened — the raster a CRT's beam skips.

scanlines
)(
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
,
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor
fragColor
,
(parameter) ldc.dcompute.Sampler2D texture0
texture0
,
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells
uExtentCells
);
/// 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"]) fragTexCoord
fragTexCoord
, @
(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"]) fragColor
fragColor
,
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
, @
(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"]) uExtentCells
uExtentCells
)
=>
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 @safe

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.

tier0
!(
(module) sparkles.shaders

Single-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.ui
ui
.
(module) sparkles.ui.effect_shaders

The 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 @safe

Tinted 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"]) fragTexCoord
fragTexCoord
,
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor
fragColor
,
(parameter) ldc.dcompute.Sampler2D texture0
texture0
,
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells
uExtentCells
);
/// 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"]) fragTexCoord
fragTexCoord
, @
(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"]) fragColor
fragColor
,
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
, @
(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"]) uExtentCells
uExtentCells
)
=>
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 @safe

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.

tier0
!(
(module) sparkles.shaders

Single-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.ui
ui
.
(module) sparkles.ui.effect_shaders

The 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 @safe

Uniformly darkened — an inactive pane, without the view knowing it is one.

dim
)(
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
,
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor
fragColor
,
(parameter) ldc.dcompute.Sampler2D texture0
texture0
,
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells
uExtentCells
);
/// 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"]) fragTexCoord
fragTexCoord
, @
(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"]) fragColor
fragColor
,
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
, @
(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"]) uExtentCells
uExtentCells
)
=>
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 @safe

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.

tier0
!(
(module) sparkles.shaders

Single-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.ui
ui
.
(module) sparkles.ui.effect_shaders

The 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 @safe

A 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"]) fragTexCoord
fragTexCoord
,
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) fragColor
fragColor
,
(parameter) ldc.dcompute.Sampler2D texture0
texture0
,
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uExtentCells
uExtentCells
);
/** 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"]) fragTexCoord
fragTexCoord
, @
(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"]) fragColor
fragColor
,
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uAmount
uAmount
)
{ const
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uv
uv
=
(package) sparkles
sparkles
.
(package) sparkles.ui
ui
.
(module) sparkles.ui.effect_shaders

The 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 @safe

Barrel 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"]) fragTexCoord
fragTexCoord
,
(parameter) float uAmount
uAmount
);
if (
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
< 0.0f ||
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
> 1.0f ||
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
< 0.0f ||
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
> 1.0f)
return
sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(float s) pure nothrow @nogc @safe

Constructs 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 texture0
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 @safe

Samples 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"])) uv
uv
) *
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 @safe

Component-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"]) fragTexCoord
fragTexCoord
,
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
,
@
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uBloomThreshold
uBloomThreshold
)
=>
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 @safe

Constructs a float4; with one argument, a broadcast; from an rgb triple and an alpha, GLSL's vec4(rgb, a).

v4
(
(package) sparkles
sparkles
.
(package) sparkles.ui
ui
.
(module) sparkles.ui.effect_shaders

The 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 @safe

Bloom'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 texture0
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 @safe

Samples 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"]) fragTexCoord
fragTexCoord
).xyz,
(parameter) float uBloomThreshold
uBloomThreshold
), 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 @safe

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.

bloomBlur
(
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
,
(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"]) uv
uv
,
(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"]) dir
dir
,
(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"]) uResolution
uResolution
,
float
(parameter) float uBloomRadius
uBloomRadius
) @safe pure nothrow @nogc
{ enum float
(constant) float effects.bloomBlur.w0 = 0.227027F
w0
= 0.2270270270f,
(constant) float effects.bloomBlur.w1 = 0.194595F
w1
= 0.1945945946f,
(constant) float effects.bloomBlur.w2 = 0.121622F
w2
= 0.1216216216f,
(constant) float effects.bloomBlur.w3 = 0.0540541F
w3
= 0.0540540541f,
(constant) float effects.bloomBlur.w4 = 0.0162162F
w4
= 0.0162162162f;
const
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) s
s
=
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) dir
dir
*
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 @safe

Component-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 @safe

Component-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"]) sum
sum
=
(parameter) ldc.dcompute.Sampler2D texture0
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 @safe

Samples 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"]) uv
uv
).xyz *
(constant) float effects.bloomBlur.w0 = 0.227027F
w0
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
+
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 @safe

Component-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 @safe

Samples 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"]) uv
uv
+
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 @safe

Component-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 @safe

Component-wise arithmetic against one value, on either side.

w1
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
+
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 @safe

Component-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 @safe

Samples 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"]) uv
uv
-
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 @safe

Component-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 @safe

Component-wise arithmetic against one value, on either side.

w1
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
+
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 @safe

Component-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 @safe

Samples 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"]) uv
uv
+
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 @safe

Component-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 @safe

Component-wise arithmetic against one value, on either side.

w2
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
+
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 @safe

Component-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 @safe

Samples 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"]) uv
uv
-
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 @safe

Component-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 @safe

Component-wise arithmetic against one value, on either side.

w2
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
+
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 @safe

Component-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 @safe

Samples 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"]) uv
uv
+
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 @safe

Component-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 @safe

Component-wise arithmetic against one value, on either side.

w3
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
+
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 @safe

Component-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 @safe

Samples 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"]) uv
uv
-
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 @safe

Component-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 @safe

Component-wise arithmetic against one value, on either side.

w3
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
+
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 @safe

Component-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 @safe

Samples 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"]) uv
uv
+
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 @safe

Component-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 @safe

Component-wise arithmetic against one value, on either side.

w4
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
+
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 @safe

Component-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 @safe

Samples 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"]) uv
uv
-
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 @safe

Component-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 @safe

Component-wise arithmetic against one value, on either side.

w4
;
return
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sum
sum
;
} /// 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"]) fragTexCoord
fragTexCoord
,
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
,
@
(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"]) uResolution
uResolution
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uBloomRadius
uBloomRadius
)
=>
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 @safe

Constructs 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 @safe

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.

bloomBlur
(
(parameter) ldc.dcompute.Sampler2D texture0
texture0
,
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
,
sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safe

Constructs a float2; with one argument, a broadcast.

v2
(1.0f, 0.0f),
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolution
uResolution
,
(parameter) float uBloomRadius
uBloomRadius
), 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"]) fragTexCoord
fragTexCoord
,
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
,
@
(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"]) uResolution
uResolution
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uBloomRadius
uBloomRadius
)
=>
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 @safe

Constructs 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 @safe

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.

bloomBlur
(
(parameter) ldc.dcompute.Sampler2D texture0
texture0
,
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
,
sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safe

Constructs a float2; with one argument, a broadcast.

v2
(0.0f, 1.0f),
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolution
uResolution
,
(parameter) float uBloomRadius
uBloomRadius
), 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"]) fragTexCoord
fragTexCoord
, @
(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"]) fragColor
fragColor
,
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
,
(struct) ldc.dcompute.Sampler2D

A 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 texture1
texture1
, @
(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"]) colDiffuse
colDiffuse
,
@
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uBloomIntensity
uBloomIntensity
)
=>
(package) sparkles
sparkles
.
(package) sparkles.ui
ui
.
(module) sparkles.ui.effect_shaders

The 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 @safe

Bloom'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 texture0
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 @safe

Samples 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"]) fragTexCoord
fragTexCoord
) *
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 @safe

Component-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 @safe

Component-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 texture1
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 @safe

Samples 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"]) fragTexCoord
fragTexCoord
).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 @safe

Component-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 @safe

Signed 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"]) p
p
,
(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"]) b
b
) @safe pure nothrow @nogc
{ const
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) d
d
=
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 @safe

GLSL abs.

abs
(
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
) -
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 @safe

Component-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 @safe

GLSL 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 @safe

GLSL max.

max
(
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) d
d
,
sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float s) pure nothrow @nogc @safe

Constructs 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 @safe

GLSL min.

min
(
float sparkles.shaders.math.max!float(in float a, in float b) pure nothrow @nogc @safe

GLSL max.

max
(
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) d
d
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
,
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) d
d
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
), 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 @safe

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.

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"]) p
p
, float
(parameter) float shape
shape
) @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) ax
ax
=
float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safe

GLSL abs.

abs
(
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
),
(local variable) const(float) ay
ay
=
float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safe

GLSL abs.

abs
(
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
);
const
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clear
clear
=
sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(float s) pure nothrow @nogc @safe

Constructs 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"])) white
white
=
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 @safe

Constructs 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"])) black
black
=
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 @safe

Constructs 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) ibBox
ibBox
= (
(local variable) const(float) ax
ax
<= 5.0f) & (
(local variable) const(float) ay
ay
<= 9.0f);
const
(local variable) const(bool) ibLine
ibLine
= ((
(local variable) const(float) ax
ax
<= 1.5f) & (
(local variable) const(float) ay
ay
<= 7.5f))
| ((
(local variable) const(float) ax
ax
<= 4.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
>= -8.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
<= -5.5f))
| ((
(local variable) const(float) ax
ax
<= 4.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
>= 5.5f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
<= 8.0f));
const
(local variable) const(bool) ibFill
ibFill
= ((
(local variable) const(float) ax
ax
<= 0.5f) & (
(local variable) const(float) ay
ay
<= 6.5f))
| ((
(local variable) const(float) ax
ax
<= 3.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
>= -7.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
<= -6.5f))
| ((
(local variable) const(float) ax
ax
<= 3.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
>= 6.5f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
<= 7.0f));
const
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) iBeam
iBeam
= !
(local variable) const(bool) ibBox
ibBox
?
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clear
clear
:
(local variable) const(bool) ibFill
ibFill
?
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) white
white
:
(local variable) const(bool) ibLine
ibLine
?
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) black
black
:
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clear
clear
;
// EW-resize <-> const
(local variable) const(bool) ewBox
ewBox
= (
(local variable) const(float) ax
ax
<= 9.5f) & (
(local variable) const(float) ay
ay
<= 5.5f);
const
(local variable) const(bool) ewLine
ewLine
= ((
(local variable) const(float) ay
ay
<= 1.5f) & (
(local variable) const(float) ax
ax
<= 6.5f))
| ((
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
<= -2.5f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
>= -7.5f) & (
(local variable) const(float) ay
ay
<= -
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
- 2.5f))
| ((
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
>= 2.5f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
<= 7.5f) & (
(local variable) const(float) ay
ay
<=
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
- 2.5f));
const
(local variable) const(bool) ewFill
ewFill
= ((
(local variable) const(float) ay
ay
<= 0.5f) & (
(local variable) const(float) ax
ax
<= 5.5f))
| ((
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
<= -3.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
>= -6.5f) & (
(local variable) const(float) ay
ay
<= -
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
- 3.5f))
| ((
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
>= 3.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
<= 6.5f) & (
(local variable) const(float) ay
ay
<=
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
- 3.5f));
const
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) resize
resize
= !
(local variable) const(bool) ewBox
ewBox
?
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clear
clear
:
(local variable) const(bool) ewFill
ewFill
?
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) white
white
:
(local variable) const(bool) ewLine
ewLine
?
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) black
black
:
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clear
clear
;
// The arrow. const
(local variable) const(bool) arBox
arBox
= (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
>= -0.5f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
<= 13.5f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
>= -0.5f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
<= 19.5f);
const
(local variable) const(bool) arLine
arLine
= ((
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
>= 0.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
>= 0.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
<= 14.5f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
<=
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
)
& (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
-
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
* 0.35f <= 12.0f))
| ((
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
>= 3.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
<= 7.5f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
>= 9.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
<= 17.5f));
const
(local variable) const(bool) arFill
arFill
= ((
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
>= 1.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
>= 1.5f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
<= 13.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
<=
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
- 0.5f)
& (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
-
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
* 0.35f <= 10.5f))
| ((
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
>= 4.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
<= 6.5f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
>= 10.0f) & (
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
<= 16.5f));
const
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) arrow
arrow
= !
(local variable) const(bool) arBox
arBox
?
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clear
clear
:
(local variable) const(bool) arFill
arFill
?
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) white
white
:
(local variable) const(bool) arLine
arLine
?
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) black
black
:
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) clear
clear
;
return (
(parameter) float shape
shape
> 0.5f) & (
(parameter) float shape
shape
< 1.5f) ?
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) iBeam
iBeam
:
(parameter) float shape
shape
> 2.5f ?
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) resize
resize
:
(local variable) const(sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"])) arrow
arrow
;
} /// 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"]) fragTexCoord
fragTexCoord
, @
(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"]) fragColor
fragColor
,
(struct) ldc.dcompute.Sampler2D

A 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 texture0
texture0
,
(struct) ldc.dcompute.Sampler2D

A 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 texture1
texture1
, @
(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"]) colDiffuse
colDiffuse
,
@
(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"]) uResolution
uResolution
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uTime
uTime
,
@
(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"]) mouse
mouse
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float mouseTilt
mouseTilt
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float mouseMagnify
mouseMagnify
,
@
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float cursorShape
cursorShape
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uCurvature
uCurvature
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uScanlines
uScanlines
,
@
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uMask
uMask
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uChromaAberration
uChromaAberration
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uVignette
uVignette
,
@
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uFlicker
uFlicker
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uBrightness
uBrightness
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uLensRadius
uLensRadius
,
@
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uLensPower
uLensPower
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uBloomIntensity
uBloomIntensity
,
@
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uUiReactive
uUiReactive
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uFocusHalo
uFocusHalo
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uHoverGlow
uHoverGlow
,
@
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uSelectionBloom
uSelectionBloom
, @
(constant) ldc.dcompute._uniform ldc.dcompute.uniform = _uniform()

Marks a @fragment parameter as a uniform.

uniform
float
(parameter) float uDividerTension
uDividerTension
,
@
(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"]) uFocusRect
uFocusRect
, @
(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"]) uHoverRect
uHoverRect
, @
(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"]) uSelectRect
uSelectRect
,
@
(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"]) uSplitDivider
uSplitDivider
, @
(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"]) uScrollbarThumb
uScrollbarThumb
)
{ const
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) res
res
=
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uResolution
uResolution
;
const
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) m
m
=
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) mouse
mouse
/
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 @safe

Component-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"]) uv
uv
=
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 @safe

The 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"]) fragTexCoord
fragTexCoord
,
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) m
m
,
(parameter) float mouseTilt
mouseTilt
,
(parameter) float uCurvature
uCurvature
);
// 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 lensRim
lensRim
= 0.0f;
if (
(parameter) float mouseMagnify
mouseMagnify
> 0.5f)
{ const
(local variable) const(float) aspect
aspect
=
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) res
res
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
/
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) res
res
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
;
(local variable) float lensRim
lensRim
=
float sparkles.ui.crt_shaders.crtLensRim(float n) pure nothrow @nogc @safe

The 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 @safe

How 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"]) uv
uv
,
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) m
m
,
(local variable) const(float) aspect
aspect
,
(parameter) float uLensRadius
uLensRadius
));
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
=
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 @safe

The 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"]) uv
uv
,
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) m
m
,
(local variable) const(float) aspect
aspect
,
(parameter) float uLensRadius
uLensRadius
,
(parameter) float uLensPower
uLensPower
);
} // Subtle horizontal sync micro-jitter.
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
=
sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safe

Constructs a float2; with one argument, a broadcast.

v2
(
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
+
float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safe

GLSL sin.

sin
(
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
* 120.0f +
(parameter) float uTime
uTime
* 30.0f) * 0.00025f,
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
);
const
(local variable) const(bool) onTube
onTube
=
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
>= 0.0f &&
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
<= 1.0f &&
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
>= 0.0f &&
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
<= 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"]) cursorCol
cursorCol
=
sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) sparkles.shaders.types.v4(float s) pure nothrow @nogc @safe

Constructs 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 cursorShape
cursorShape
>= 0.0f &&
(local variable) const(bool) onTube
onTube
)
{ const
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) ui
ui
=
sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safe

Constructs a float2; with one argument, a broadcast.

v2
(
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
*
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) res
res
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
,
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
*
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) res
res
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
);
(local variable) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) cursorCol
cursorCol
=
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 @safe

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.

renderCursor
(
sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safe

Constructs a float2; with one argument, a broadcast.

v2
(
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) ui
ui
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
-
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) mouse
mouse
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
,
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) mouse
mouse
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
-
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) ui
ui
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
),
(parameter) float cursorShape
cursorShape
);
}
(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"]) col
col
=
sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.types.v3(float s) pure nothrow @nogc @safe

Constructs a float3; with one argument, a broadcast.

v3
(0.0f);
if (
(local variable) const(bool) onTube
onTube
)
{ const
(local variable) const(float) corner
corner
=
float sparkles.shaders.math.smoothstep(float e0, float e1, float v) pure nothrow @nogc @safe

GLSL smoothstep: Hermite interpolation between the edges.

smoothstep
(0.0f, 0.012f,
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
) *
float sparkles.shaders.math.smoothstep(float e0, float e1, float v) pure nothrow @nogc @safe

GLSL 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"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
)
* (
float sparkles.shaders.math.smoothstep(float e0, float e1, float v) pure nothrow @nogc @safe

GLSL smoothstep: Hermite interpolation between the edges.

smoothstep
(0.0f, 0.012f,
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
) *
float sparkles.shaders.math.smoothstep(float e0, float e1, float v) pure nothrow @nogc @safe

GLSL 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"]) uv
uv
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
));
const
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) cc
cc
=
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
-
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 @safe

Component-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 caStrength
caStrength
=
(parameter) float uChromaAberration
uChromaAberration
+
(parameter) float uChromaAberration
uChromaAberration
* 0.2f *
float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safe

GLSL sin.

sin
(
(parameter) float uTime
uTime
* 3.0f);
if (
(local variable) float lensRim
lensRim
> 0.0f)
(local variable) float caStrength
caStrength
=
(local variable) float caStrength
caStrength
+ 0.002f *
(local variable) float lensRim
lensRim
;
const
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) ca
ca
=
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) cc
cc
*
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 @safe

Component-wise arithmetic against one value, on either side.

caStrength
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.types.v3(float x, float y, float z) pure nothrow @nogc @safe

Constructs a float3; with one argument, a broadcast.

v3
(
(parameter) ldc.dcompute.Sampler2D texture0
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 @safe

Samples 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"]) uv
uv
+
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 @safe

Component-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 @safe

Component-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 texture0
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 @safe

Samples 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"]) uv
uv
).
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).y() inout pure nothrow @nogc @property return ref @safe
y
,
(parameter) ldc.dcompute.Sampler2D texture0
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 @safe

Samples 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"]) uv
uv
-
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 @safe

Component-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 @safe

Component-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"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
+
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 @safe

Component-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 @safe

Component-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 uBloomIntensity
uBloomIntensity
> 0.0f)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
+
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 @safe

Component-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 @safe

Samples 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"]) uv
uv
).xyz *
(parameter) float uBloomIntensity
uBloomIntensity
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
*
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 @safe

Component-wise arithmetic against one value, on either side.

corner
;
if (
(parameter) float uUiReactive
uUiReactive
> 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"]) uFocusRect
uFocusRect
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
> 0.0f &&
(parameter) float uFocusHalo
uFocusHalo
> 0.0f)
{ const
(local variable) const(float) dist
dist
=
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 @safe

Signed 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"]) uv
uv
-
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 @safe

Component-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 @safe

Component-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 @safe

Component-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"]) uFocusRect
uFocusRect
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
,
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uFocusRect
uFocusRect
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
) *
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 @safe

Component-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) dist
dist
> -3.0f &&
(local variable) const(float) dist
dist
< 14.0f)
{ const
(local variable) const(float) pulse
pulse
= 0.85f + 0.15f *
float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safe

GLSL sin.

sin
(
(parameter) float uTime
uTime
* 3.5f);
const
(local variable) const(float) halo
halo
=
float sparkles.shaders.math.exp!float(in float v) pure nothrow @nogc @safe

GLSL exp: e raised to v.

exp
(-
float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safe

GLSL abs.

abs
(
(local variable) const(float) dist
dist
) * 0.28f) *
(parameter) float uFocusHalo
uFocusHalo
* 0.22f *
(local variable) const(float) pulse
pulse
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
+
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 @safe

Component-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 @safe

Component-wise arithmetic against one value, on either side.

halo
;
} if (
(local variable) const(float) dist
dist
<= 0.0f)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
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 @safe

GLSL mix: a` * (1 - `t`) + `b` * `t.

mix
(
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
,
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
* 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 @safe

Component-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"]) uHoverRect
uHoverRect
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
> 0.0f &&
(parameter) float uHoverGlow
uHoverGlow
> 0.0f)
{ const
(local variable) const(float) dist
dist
=
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 @safe

Signed 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"]) uv
uv
-
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 @safe

Component-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 @safe

Component-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 @safe

Component-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"]) uHoverRect
uHoverRect
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
,
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uHoverRect
uHoverRect
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
) *
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 @safe

Component-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) dist
dist
<= 10.0f)
{ const
(local variable) const(float) surge
surge
=
float sparkles.shaders.math.exp!float(in float v) pure nothrow @nogc @safe

GLSL exp: e raised to v.

exp
(-
float sparkles.shaders.math.max!float(in float a, in float b) pure nothrow @nogc @safe

GLSL max.

max
(
(local variable) const(float) dist
dist
, 0.0f) * 0.35f)
* (
(local variable) const(float) dist
dist
< 0.0f ? 0.14f : 0.07f) *
(parameter) float uHoverGlow
uHoverGlow
;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
+ (
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 @safe

Component-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) surge
surge
+
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 @safe

Component-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 @safe

Component-wise arithmetic against one value, on either side.

surge
);
const
(local variable) const(float) edge
edge
=
float sparkles.shaders.math.exp!float(in float v) pure nothrow @nogc @safe

GLSL exp: e raised to v.

exp
(-
float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safe

GLSL abs.

abs
(
(local variable) const(float) dist
dist
) * 0.5f) *
(parameter) float uHoverGlow
uHoverGlow
* 0.12f;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.types.v3(float x, float y, float z) pure nothrow @nogc @safe

Constructs a float3; with one argument, a broadcast.

v3
(
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
.
inout(float) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).x() inout pure nothrow @nogc @property return ref @safe
x
+
(local variable) const(float) edge
edge
* 0.04f,
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
.
inout(float) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).y() inout pure nothrow @nogc @property return ref @safe
y
,
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
.
inout(float) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]).z() inout pure nothrow @nogc @property return ref @safe
z
+
(local variable) const(float) edge
edge
* 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"]) uSelectRect
uSelectRect
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
> 0.0f &&
(parameter) float uSelectionBloom
uSelectionBloom
> 0.0f)
{ const
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) p
p
= (
(local variable) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) uv
uv
-
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 @safe

Component-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 @safe

Component-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"])) b
b
=
sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) sparkles.shaders.types.v2(float x, float y) pure nothrow @nogc @safe

Constructs a float2; with one argument, a broadcast.

v2
(
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSelectRect
uSelectRect
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
,
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSelectRect
uSelectRect
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
) *
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 @safe

Component-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) dist
dist
=
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 @safe

Signed 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"])) p
p
,
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) b
b
);
if (
(local variable) const(float) dist
dist
<= 0.0f)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
+
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 @safe

Component-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 uSelectionBloom
uSelectionBloom
);
else if (
float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safe

GLSL abs.

abs
(
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) p
p
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
) <=
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) b
b
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
&&
(local variable) const(float) dist
dist
< 10.0f)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
+
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 @safe

Component-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 @safe

GLSL exp: e raised to v.

exp
(-
(local variable) const(float) dist
dist
* 0.35f) * 0.10f *
(parameter) float uSelectionBloom
uSelectionBloom
);
} // 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"]) uSplitDivider
uSplitDivider
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
> 0.0f &&
(parameter) float uDividerTension
uDividerTension
> 0.0f)
{ const
(local variable) const(float) dist
dist
=
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 @safe

Signed 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"]) uv
uv
-
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 @safe

Component-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 @safe

Component-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 @safe

Constructs a float2; with one argument, a broadcast.

v2
(
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSplitDivider
uSplitDivider
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
,
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uSplitDivider
uSplitDivider
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
) *
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 @safe

Component-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) seam
seam
=
float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safe

GLSL abs.

abs
(
(local variable) const(float) dist
dist
) < 2.5f;
const
(local variable) const(bool) halo
halo
= !
(local variable) const(bool) seam
seam
& (
(local variable) const(float) dist
dist
>= 0.0f) & (
(local variable) const(float) dist
dist
< 6.0f);
if (
(local variable) const(bool) seam
seam
)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
* (1.0f - (1.0f -
float sparkles.shaders.math.abs!float(in float v) pure nothrow @nogc @safe

GLSL abs.

abs
(
(local variable) const(float) dist
dist
) / 2.5f) * 0.12f *
(parameter) float uDividerTension
uDividerTension
);
if (
(local variable) const(bool) halo
halo
)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
+
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 @safe

Component-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 @safe

Component-wise arithmetic against one value, on either side.

exp
(-
(local variable) const(float) dist
dist
* 0.55f) * 0.05f *
(parameter) float uDividerTension
uDividerTension
);
} // 5. Scrollbar thumb flare. if (
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uScrollbarThumb
uScrollbarThumb
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
> 0.0f)
{ const
(local variable) const(float) dist
dist
=
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 @safe

Signed 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"]) uv
uv
-
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 @safe

Component-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 @safe

Component-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 @safe

Constructs a float2; with one argument, a broadcast.

v2
(
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uScrollbarThumb
uScrollbarThumb
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).z() inout pure nothrow @nogc @property return ref @safe
z
,
(parameter) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) uScrollbarThumb
uScrollbarThumb
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
) *
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 @safe

Component-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) dist
dist
<= 4.0f)
{ const
(local variable) const(float) flare
flare
=
float sparkles.shaders.math.exp!float(in float v) pure nothrow @nogc @safe

GLSL exp: e raised to v.

exp
(-
float sparkles.shaders.math.max!float(in float a, in float b) pure nothrow @nogc @safe

GLSL max.

max
(
(local variable) const(float) dist
dist
, 0.0f) * 0.6f) * 0.08f;
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
+ (
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 @safe

Component-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) flare
flare
+
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 @safe

Component-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 @safe

Component-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"]) cursorCol
cursorCol
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
> 0.0f)
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
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 @safe

GLSL mix: a` * (1 - `t`) + `b` * `t.

mix
(
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
,
(local variable) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) cursorCol
cursorCol
.xyz,
(local variable) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]) cursorCol
cursorCol
.
inout(float) sparkles.math.vector.Vector!(float, 4LU, Layout.device, ["x", "y", "z", "w"]).w() inout pure nothrow @nogc @property return ref @safe
w
);
// Scanlines. const
(local variable) const(float) scanline
scanline
=
float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safe

GLSL sin.

sin
(
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
*
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) res
res
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
* 3.14159265f);
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
* ((1.0f -
(parameter) float uScanlines
uScanlines
) +
(parameter) float uScanlines
uScanlines
* (
(local variable) const(float) scanline
scanline
*
(local variable) const(float) scanline
scanline
));
// The vertical roll hum bar. const
(local variable) const(float) roll
roll
= 0.5f + 0.5f *
float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safe

GLSL sin.

sin
(
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
* 5.0f -
(parameter) float uTime
uTime
* 2.2f);
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
* ((1.0f -
(parameter) float uFlicker
uFlicker
* 5.7f) +
(parameter) float uFlicker
uFlicker
* 5.7f *
(local variable) const(float) roll
roll
);
// Phosphor decay flicker.
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
* ((1.0f -
(parameter) float uFlicker
uFlicker
) +
(parameter) float uFlicker
uFlicker
*
float sparkles.shaders.math.sin!float(in float v) pure nothrow @nogc @safe

GLSL sin.

sin
(
(parameter) float uTime
uTime
* 70.0f));
// The RGB phosphor triad. const
(local variable) const(float) subpixel
subpixel
=
float sparkles.shaders.math.mod!float(in float a, in float b) pure nothrow @nogc @safe

GLSL mod: ``a - b * floor(a / b).

mod
(
float sparkles.shaders.math.floor!float(in float v) pure nothrow @nogc @safe

GLSL floor.

floor
(
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
*
(local variable) const(sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"])) res
res
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
), 3.0f);
const
(local variable) const(sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"])) triad
triad
=
(local variable) const(float) subpixel
subpixel
< 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 @safe

Constructs a float3; with one argument, a broadcast.

v3
(1.05f, 0.88f, 0.88f)
:
(local variable) const(float) subpixel
subpixel
< 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 @safe

Constructs 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 @safe

Constructs 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"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
*
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 @safe

Component-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 @safe

Component-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"])) triad
triad
,
(parameter) float uMask
uMask
);
// Vignette. if (
(parameter) float uVignette
uVignette
> 0.001f)
{ const
(local variable) const(float) vig
vig
= 16.0f *
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
*
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
* (1.0f -
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).x() inout pure nothrow @nogc @property return ref @safe
x
) * (1.0f -
(parameter) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]) fragTexCoord
fragTexCoord
.
inout(float) sparkles.math.vector.Vector!(float, 2LU, Layout.device, ["x", "y"]).y() inout pure nothrow @nogc @property return ref @safe
y
);
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
*
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 @safe

Component-wise arithmetic against one value, on either side.

clamp
(
float sparkles.shaders.math.pow!float(in float a, in float b) pure nothrow @nogc @safe

GLSL pow.

pow
(
(local variable) const(float) vig
vig
,
(parameter) float uVignette
uVignette
), 0.0f, 1.0f);
} // Gamma and contrast.
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
=
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 @safe

GLSL pow.

pow
(
(local variable) sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) col
col
,
sparkles.math.vector.Vector!(float, 3LU, Layout.device, ["x", "y", "z"]) sparkles.shaders.types.v3(float s) pure nothrow @nogc @safe

Constructs 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 @safe

Component-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 @safe

Constructs 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"]) col
col
, 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 @safe

Component-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 @safe

Component-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
;
}