20#ifndef RHI_FRAME_PACKET_H
21#define RHI_FRAME_PACKET_H
145 return std::ranges::all_of(
count, []( uint32_t aCount ) {
return aCount == 0; } );
162static_assert(
sizeof(
RHI_LAYER_DIM ) == 16,
"RHI_LAYER_DIM is one vec4 of push constants" );
205 std::array<RHI_BufferHandle, RHI_SHAPES>
buffer;
250 for(
int shape = 0; shape <
RHI_SHAPES; ++shape )
272 std::array<RHI_BufferHandle, RHI_SHAPES>
buffer;
326 return std::ranges::any_of(
count, []( uint32_t aCount ) {
return aCount > 0; } ) || !
bitmapDraws.empty();
The Cairo implementation of the graphics abstraction layer.
RHI_SHAPE
Shapes a frame draws, each with its own array and pipelines.
RENDER_TARGET
RENDER_TARGET: Possible rendering targets.
@ TARGET_CACHED
Main rendering target (cached)
std::array< uint32_t, RHI_SHAPES > RHI_SHAPE_COUNTS
Elements of each shape, indexed by RHI_SHAPE.
constexpr int RHI_INSTANCED_SHAPES
RHI_HANDLE< RHI_TAG_TEXTURE > RHI_TextureHandle
RHI_HANDLE< RHI_TAG_BUFFER > RHI_BufferHandle
One textured bitmap quad with its own vertex buffer and texture.
RHI_TextureHandle texture
RHI_BufferHandle vertexBuffer
Cursor uniform block matching the CursorUBO layout in cursor.frag (std140).
float cursorPos[2]
NDC [-1, 1].
float cursorSize
small cross extent in pixels
int cursorType
0 = small cross, 1 = fullscreen, 2 = diagonal 45°
GPU geometry of one frame, built by GAL_MODERN after EndDrawing() and passed through the FRAME_MAILBO...
RHI_LINE_PIPELINE_KIND linePipelineKind
RHI_SHAPE_COUNTS negCount
bool gridFirst
Draw the grid before the layers instead of over them.
bool relativeDepth
Element depth is relative to its layer's slice in LAYER_RANGE::depthNear, and the projection scales d...
uint64_t bufferGeneration
Generation of the producer's buffers this descriptor was built from.
bool testAgainstStatic
Slices share the static target's layer order mapping, so this target can be depth tested against a co...
std::vector< LAYER_RANGE > layerRanges
uint32_t supersampleFactor
Layer FBO scale that the present blit downsamples.
std::vector< POLARITY_RUN > polarityRuns
static constexpr float RELATIVE_DEPTH_RANGE
Largest depth offset an element can have from its layer when relativeDepth is set.
CURSOR_UBO_DATA cursorUBO
std::vector< BITMAP_DRAW_DESC > bitmapDraws
std::array< RHI_BufferHandle, RHI_SHAPES > buffer
Each shape's buffer, normal elements before negatives.
Everything the render thread needs to draw one frame of a window.
FRAME_DRAW_DESC staticDrawDesc
TARGET_CACHED ranges go to staticDrawDesc and the rest to dynamicDrawDesc.
uint64_t bufferGeneration
Oldest buffer generation either descriptor uses, so resources retired before it are unreferenced.
FRAME_DRAW_DESC dynamicDrawDesc
uint64_t inputSerial
Inputs that had reached the canvas when this packet was built, so a frame answering one is never held...
uint64_t staticEpoch
Content generation of each pool.
Per-frame uniform block matching FrameUBO in frame_ubo.glsl (std140).
float projection[16]
column-major for GLSL
bool operator==(const FRAME_UBO_DATA &aOther) const =default
float viewScale
the view's scale, which levels of detail are compared with
float renderScale
target texels per viewport pixel, above 1 in a supersampled target
Grid uniform block matching the GridUBO layout in grid.frag (std140).
float gridSpacing[2]
visible spacing from GetVisibleGridSize
float minorLineWidth
pixels, at least 1 and drawn rounded to whole pixels
float majorLineWorld
world units, see GAL::gridMinorLineWidth()
float worldPixelSize
world units that majorLineWorld is divided by
int gridStyle
0 = lines, 1 = dots, 2 = small cross
int gridTick
coarse grid multiplier
float renderScale
as FRAME_UBO_DATA::renderScale
bool operator==(const GRID_UBO_DATA &aOther) const =default
One layer's instance ranges within the flat GPU buffers, normal instances before negatives.
std::array< RHI_BufferHandle, RHI_SHAPES > buffer
Buffers a retained scene layer owns per shape.
RHI_SHAPE_COUNTS negStart
bool difference
A diff layer (GAL::StartDiffLayer) that replaces what is under it with the colour difference,...
bool overlayAlpha
Elements flagged RHI_INSTANCE_OVERLAY_ALPHA, drawn with RHI_GAL_PIPELINES::GetPremultipliedVariant.
std::shared_ptr< const RHI_RUN_TABLE > cullRuns
Bounds of the range's buffers so off-screen runs are skipped.
bool hasNegatives
Subtractive instances go through a temp FBO so their erasure stays within the layer.
bool singleCoverage
Draw straight into the target using the range's own depth slice, either taking each pixel once at tra...
std::array< RHI_BufferHandle, RHI_SHAPES > negBuffer
bool NeedsTempFBO() const
float depthNear
Depth slice the range is drawn into.
float alpha
Compositing alpha.
RHI_SHAPE_COUNTS negCount
RENDER_TARGET target
Picks the static (cached) or dynamic scene pool for this range.
RHI_SHAPE_COUNTS start
Each shape's normal elements, then for an instanced shape its negatives.
uint32_t runStart
The range's runs in FRAME_DRAW_DESC::polarityRuns, none when its order does not matter.
A stretch of one layer range drawn in one polarity.
Fade of a whole layer towards a colour, laid out as the push constants of layer_dim....
float keep
1 leaves the layer as it is
bool operator==(const RHI_LAYER_DIM &aOther) const =default
Runs of each array a layer range draws from, indexed by element / RHI_CULL_RUN_LENGTH.