Skip to main content

Module fragment

Module fragment 

Source
Expand description

What an effect reads, which is what decides whether a frame needs a pass.

Most effects draw over what is already there and need nothing: a wavy border, a glow, spikes. They are ordinary elements and this module has nothing to say about them. Rounded corners need the node’s own pixels, but only where each of its surfaces already is, so they are drawn inline: each surface through a program of its own (CLIPPED_SURFACE), with no capture (tests::rounding_needs_no_capture). An effect that needs the node’s pixels all at once – a shadow derived from their silhouette – cannot be one element in a flat list, because a flat list has nowhere to say “after the things below me, before the things above me”.

So inputs is the declaration, and the renderer reads it. This crate holds the declaration and the shader text; crates/solium/src/pass.rs is what compiles and runs it.

Structs§

Corners
Four corner radii, independently – what lets a window be square-topped and round-bottomed, or any other combination, rather than one radius applied uniformly.

Enums§

Effect
One effect on one node.
Inputs
What an effect needs before it can draw.

Constants§

CLIPPED_SOLID
The same, for a single-pixel buffer: smithay draws one as a solid colour, which no texture program reaches, so it is a pixel program over the surface’s rectangle with the colour as a uniform. v_coords runs 0..1 across that rectangle. Smithay prepends #version 100 itself. tests::the_solid_program_is_a_pixel_program, and wirecheck’s case 11h, which draws one.
CLIPPED_SURFACE
Rounded corners for one client surface, drawn where it is: the surface’s texture coordinate is taken into the client’s rectangle through input_to_geo, and the distance field is ROUNDED_CORNERS’ own, measured there. So a subsurface’s corner that coincides with the client’s is cut and its others are not, and the band is one screen pixel at any zoom (geo_px), which the old shader’s own comment could not promise. tests::the_clipped_program_is_shaped_the_way_smithay_requires, and wirecheck’s case 11h, which draws a root surface and a subsurface through it.
COLOUR_UNIFORM
A single-pixel buffer’s colour, premultiplied.
GEO_PX_UNIFORM
How many screen pixels one of the client’s own is: the antialias band is one screen pixel wide at any zoom.
GEO_SIZE_UNIFORM
The client’s size in its own physical pixels.
INPUT_TO_GEO_UNIFORM
The 3x3 matrix taking a surface’s texture coordinate to the client’s own physical pixels, column-major. Computed per draw by whoever draws the surface; wirecheck’s case 11h sets it by hand.
RADIUS_UNIFORM
The four corner radii a rounded-corner program takes, in physical pixels, packed (top_left, top_right, bottom_left, bottom_right).
ROUNDED_CORNERS
Rounded corners, as a fragment program over the node’s own texture.
SIZE_UNIFORM
The texture’s size in physical pixels.