A shader_fragment_declaration declares a set
of inputs,
outputs, and parameters, as well as a sequence of zero or more
shader_fragment_local_declaration, and a sequence
of assignments of values to the declared
outputs.
A fragment shader may optionally define at most
one output of type float,
indicated with the depth keyword,
to which must be assigned a value representing the current desired fragment depth (overriding
the depth value typically calculated by the graphics system's rasterizer).
Each
shader_parameter_declaration and
shader_fragment_input_declaration introduces
a new term of the given type into the environment, accessible only
within the scope of the shader definition,
as shown by the shader_fragment_inputs_parameters rule:
Each local_value_declaration introduces
a new term of the given type into the environment, accessible in each
successive local_value_declaration and
in the shader_fragment_output_assignments,
as shown by the
shader_fragment_values rule:
The shader_fragment_local_declaration are evaluated from
top-to-bottom, in an identical manner to
let expressions,
as shown by the
shader_fragment_values rule:
shader fragment f is
parameter texture_0 : sampler_2d;
in uv : vector_2f;
out out0 : vector_4f as 0;
with
value rgba = T.texture (texture_0, uv);
as
out out0 = rgba;
end;
The shader_fragment_discard_declaration is described
as having type boolean, but
the result of the expression is effectively consumed by the
parasol language runtime and so this is
not observable in practice.