AngouriMath
Navigation
AngouriMath.Functions.Compilation.IntoSource
Classes within the AngouriMath.Functions.Compilation.IntoSource namespace
ShaderSource
Summary
Prints expressions as straight-line shader code: one statement per output, with every
subexpression that occurs more than once computed once into a local.
Remarks
The code computes what Compile<double, …> computes, the real-valued
reading: where the library's value is not real, the shader's isNaN or
unspecified, as the shading language's ownpow andsqrt leave it. A
node with no faithful form in that reading — a complex constant, a set, a rounding
rule whose tie-breaking the languages do not agree on — is declined, naming the node,
rather than printed as something close. WhatCompile refuses is declined with
the messageCompile gives.
Every expression is checked before anything is printed, so that printing has nothing
left to decline: the check is Refusal(AngouriMath.Entity), and Print(AngouriMath.Entity) prints
exactly the nodes it accepts.
Integer powers are multiplied out up to the fourth, and above that taken as
pow(abs(x), n) with the sign restored for an oddn :pow of a
negative base is undefined in both HLSL and GLSL, whilex^5 is defined for every
realx . A rational power with an odd denominator below ten is the real root
of a negative base, asCompile takes it, and is printed the same way.
SourceDialect
Summary
The dialects ShaderSource prints.
Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 6003 pages online