Skip to main content

Module probe

Module probe 

Source
Expand description

One vertex of a vertex program, run to see what it does with chosen constants: the clip position a probe reads to learn what a constant is (a matrix the program places the vertex with, a table it reads the instance through).

A probe sets the constants it asks about to values that make the answer show, gives the program a vertex, and compares clip positions. What it does not ask about the program still reads: its buffers are the caller’s to answer (BufferReads, a table probe watches which it reads), and its textures are answered here with stated stand-ins (SAMPLE_STAND_IN, LOAD_STAND_IN, QUERY_STAND_IN), counted (TextureUse). A stand-in lets a program that reads a texture of its own still show what it does with the camera; where it also moves the vertex by the texel, a check of the clip position fails, and the probe names the stand-ins as the likely reason (TextureUse::stand_ins) rather than the constant it asked about.

The answering is AnsweredReads: every texture read of a run answered by the caller (Answer) and recorded, so a run shows what a program does with what it reads, apart from what any texture holds. The vertex probe answers with the stand-ins (StandIns); a pixel program run through a crate::ProgramShader takes it as its Sampler, and affine_uv reads from its records the map a program applies to a texture’s coordinate.

Structs§

AnsweredBuffers
A read-only sampler combining image answers (for example super::AnsweredReads) with finite structured views. Successful structured reads retain both request and answer; failed reads stop with the request and reason. Image reads are delegated unchanged. Stores and atomics are refused, even if images could answer them. Buffer lengths come only from extents, never from an image sampler’s absent-view policy.
AnsweredReads
A run’s texture reads, each answered by answer and recorded in the order the program made them (a read the answer refuses is not recorded; the run fails with its reason). As a Sampler (R a bind slot) it is a pixel program’s textures; stores, atomics and structured buffers are refused, as a sampler that gives none refuses them.
BufferExtent
The caller’s stated view extent. The adapter validates the stride and addressable word count.
BufferRead
One word requested from a structured buffer, in the sampler’s binding-slot vocabulary.
ProbeRun
One run’s answer: the clip position, the texture reads answered with stand-ins and the caller’s buffers as the run left them.
StandIns
The vertex probe’s answer: SAMPLE_STAND_IN, LOAD_STAND_IN and QUERY_STAND_IN to every read.
TextureUse
How many texture reads of a run were answered with a stand-in.
UvMap
The map a program applies to a texture coordinate, sampled = scale * input + offset on each axis (affine_uv).
VertexProbe
A vertex program made ready to run one vertex at a time.
Zeros
Buffers of zeros, for a program whose buffers the probe does not ask about.

Constants§

LOAD_STAND_IN
What a texel load is answered with: zero in every lane.
QUERY_STAND_IN
What a texture size or level-count query is answered with: one texel, one level, one sample.
SAMPLE_STAND_IN
What a texture sample of the program is answered with: mid grey in every lane.

Traits§

Answer
How the caller answers a run’s texture reads (AnsweredReads), each by its request; R names the texture (a program’s resource Element, or a bind slot). A load or a query is refused unless the answer gives one, so no read is answered by a value nobody stated.
BufferReads
A program’s buffers, as the caller answers them: count (1 to 4) words from word word of the buffer view, and a buffer’s length in words.

Functions§

affine_uv
The map from an input coordinate to the coordinate a program sampled at, from points (input, sampled) of runs at known inputs: on each axis a scale and an offset, fitted to the two points farthest apart on that axis and confirmed by every other point (at least four points, the inputs not on one line, so each axis is confirmed apart from the other). A point is on the map within two roundings of an f32 multiply and add (4 * f32::EPSILON of the sum of the magnitudes of the product, the offset and the sampled value), the most a program’s input * scale + offset in f32 is off the exact map. Where the points are not on such a map, a 2D affine map of three of them tells why: one that every point is on is a rotation or a shear (an axis takes the other); none, and the coordinate is not affine in the input (a warp, or one made from another input or from time). Each is refused with its reason.