Expand description
What a layer draws with: the other half of the layer contract.
A layer makes its GPU objects through the Resources its hooks get and
keeps their handles, from vertices, indexes and textures in the
Context’s stores, the meshes the layers share
(RenderStaticData, globe) and the quads of a tile’s mask
(StoredQuads): Meshes, which draw a program over geometry with
textures, and Targets, textures of the layer’s own that its draws
draw into ahead of the frame and that its other draws sample. An object
goes once its last handle drops and the GPU is done with it.
Each frame, a layer pushes its draws into its Draws: into its main
Group, which draws at its place in the layers’ order and depth, and
into the groups of its targets. A Draw of a mesh says where it is
among the group’s draws, whether it may draw in the opaque pass, how it
tests depth (Depth) and whether it clips to its tile, and comes with
the values of its program’s blocks of each draw and, for a draw of a
tile, the tile’s projection. The engine writes the blocks once for the
group, uploads the meshes, and draws the group in the frame’s passes.
A layer sees its frame as a LayerFrame: the map’s, or a drape’s. A
layer that draws with the backend’s own commands asks the frame to lend
them (Draws::lend), at a time in the frame (LendAt), and gets them
with the frame and where it draws the map (Lent). What it makes with
them, the engine doesn’t know of: the layer frees it once the GPU is done
with it, through work it queues for after the GPU (AfterGpu).
The objects and their handles belong to the renderer’s thread.
Inside the engine, the renderer’s graphics state over its backend’s Gpu
(context) keeps the stores of what draws share, and the queue that
releases it in order.
Re-exports§
pub use crate::text::atlas::ImagePosition;pub use crate::text::atlas::ImagePositions;pub use crate::text::atlas::RectU16;
Modules§
- globe
- The globe’s tile meshes, which a layer that draws whole tiles draws on the globe, and the rows of the poles’ vertices.
- ground
- What a program of a layer that stands on terrain or hides behind it
declares. A program of a layer whose type stands on terrain
(
OnTerrain::Stands) declares the attributeGROUND_HEIGHT, which the engine fills, for a draw of its terrain variant, with the height of the ground under each of the draw’s points; one whose type hides behind the ground in front of it declares the textureGROUND_DEPTH, which the engine binds to the depth of the frame’s ground.
Structs§
- After
Gpu - Where a layer queues work that waits for the GPU: what runs once the GPU
finished the work that the renderer gave it so far, or once the
renderer’s graphics objects are lost, such as the freeing of what a
layer made with the commands a frame lent it (
Lent). - Atlas
Binding - Gives a draw the textures of its tile’s glyph and icon atlases, which change after the draw is made.
- Composite
- How a draw group’s draws composite onto the frame, after they draw into a texture of their own.
- Context
- What the renderer draws with: its device, and the stores of the textures, vertices, indexes, meshes and targets that draws share, which the GPU objects of each are made from and released with.
- Draw
- How a draw of a mesh draws: its place among its group’s draws, its pass, its depth and whether it clips.
- Draw
Geometry - What a mesh draws: its vertices, and the primitives its segments draw of them.
- Draws
- A layer’s draws of a frame, the map’s or a drape’s, which the engine
keeps between frames: its main group, which takes a place in the layers’
order and depth from the first frame that the layer has something to
draw in, even with no draws; a group of draws into each target of the
layer’s that the frame draws into (
target); and where the frame lends the layer the backend’s commands (lend). - Group
- A layer’s draws of a frame in one place in the layers’ order and depth, which the engine writes, uploads and draws in each of the frame’s passes, and what they share.
- Indexed
- The indexes of one kind of primitive, such as triangles or lines, over a vertex buffer, and the segments that draw them.
- Indexes
- Indexes, which don’t change once made: an upload moves them into their buffer.
- Layer
Frame - The frame a layer makes its draws for, as it reads it: the camera, the target’s size and scale, the light and ground, and what it draws into.
- Lent
- What a frame lends a layer
(
Layer::lend). - Mesh
- A handle of a mesh, the GPU objects of what a draw draws
(
DrawObjects), which the context’s store keeps while a clone of the handle lasts (Context::mesh). A layer keeps its meshes’ handles, in its tile values or its own state, and the draws it pushes name them (Group::push), so that the engine uploads and draws them after the layer made its draws. Clones of a handle are the same mesh. A mesh changes through the context, which the methods here take. - Raster
Layout Vertex - A vertex of a quad that draws an image over a tile: its position in tile
units (
a1), and where it samples the image (a2). - Render
Pass - The render passes a layer draws in. A bitmask (
Opaque | Translucentis a valid value), so a newtype rather than a Rust enum. The associated constants keep the C++ enumerator names. - Render
Static Data - The vertices and indices of the geometry the layers share.
- Render
Tile - A tile of a source that the frame draws: its id, its projection, and what of its contents the layers draw.
- Resources
- The renderer’s GPU resources, as a layer’s hooks make and read them: the
meshes it draws (
mesh) and the targets its draws draw into (target). What it makes stays while the layer keeps its handle. - Segment
Base - A range of a mesh’s vertices and indexes that one draw call draws, within the 16-bit indexes of one segment, and its instances.
- Shared
Attribute - Where an attribute reads vertices of the context’s store: at
offsetin each ofstridebytes, from the vertexvertex_offseton, asdata_type. - Shared
Vertices - Vertices of the context’s store that draws bind, with their count. They are equal where they are the same entry.
- Simple
Identity - A simple unique identifier.
- Stored
Quads - Quads in the context’s stores, and the segments that draw them.
- Target
- A texture that a layer’s draws draw into ahead of the frame, which its other draws sample: a handle of the target in the context’s store, which stays while a clone of the handle does.
- Texture2D
- A texture of the renderer: its size, format and sampler state, the image
it waits to upload, and once made, a texture of the backend’s
Gpu, which the texture lets go of when it replaces it or drops, and which bindings made of it hold until they go. The context changes it, and lends it to set up as aTextureMut. - Typed
Vertices - Dynamic vertices of the context’s store made of vertices of the type
V, which their holder can replace with others ofV(Context::update_vertices). - Uniforms
- The paint properties a draw reads from their uniforms instead, by name.
- Vertex
Attribute Array - Vertex attributes by the names of the program’s attributes they bind to,
each in a slot of the array, which
slot_offinds. - Vertices
- Vertices of the context’s store: their bytes until an upload writes them to a buffer, which frees them, and that buffer. Dynamic vertices take updates, each new bytes of as many vertices, which the next upload writes over the buffer’s; their uploads keep their bytes’ storage for the next update to fill.
Enums§
- Depth
- How a draw tests and writes depth.
- Draw
Indexes - The indexes a draw binds: its own, or those it shares through the context’s store.
- GpuEnd
- How the GPU’s work that a piece of work after it waited for ended.
- LendAt
- When a frame lends a layer the backend’s commands (
Draws::lend).
Constants§
- MAX_
SEGMENT_ VERTICES - The most vertices a segment holds, since they are addressed by 16-bit indices.
Functions§
- add_
point_ quads - Adds the quads that circles and heatmap points are drawn as, one for
each of
points, and indexes their triangles.vertexmakes each corner from the point doubled, with the corner’s right and top sides in the low bits. - cast_
matrix mas the column-majorf32s that a block’s matrix holds.- copy_
shared_ attributes - A copy of
attrs, all of whose attributes read vertices of the context’s store: the copy reads the same vertices, so draws of either bind the same buffers. - globe_
extrude_ scale - Radians per pixel on the sphere for a tile.
latitude_scaleis the cosine of the center latitude on the globe and 1 on Mercator. - mask_
quads - The vertices, indices and segments of a quad for each tile of
mask, none for a mask that keeps the whole tile, which draws the tile’s quad. - projection_
data - The projection data for this tile, of geometry at
originin it: the tile matrix plus the per-tile projection fields. - raw_
vertices countvertices ofdata_typeindataas the vertex attributename, none where there are no vertices.- refresh_
paint_ attributes - Copies again into
mesh’s paint attributes, throughrefresh, the values of its bucket’s paint properties thatchangessays feature state rewrote: a layer’spreparecalls it with what its tile’s entry took (TileEntry::take_changes). - texture_
size - The size of a texture of an image of
size. - to_
projection_ ubo - The block that a program reads
data, a tile’s projection, from. - zero_
to_ one_ clip_ z - Makes a 3D layer’s OpenGL matrix clip and write depth as Metal, Vulkan,
D3D12 and WebGPU do with it: clip z from -w to w becomes
2z - w, so that OpenGL clips what was below 0 and writes the depth range times the old z over w.
Type Aliases§
- Evaluated
Light - The style’s light, evaluated for the frame.
- Shared
Indexes - Indexes of the context’s store.
- Shared
Texture - A texture of the context’s store.
- Textures
- The textures a draw binds, by the slots of its program’s textures.