TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
Graphics

The graphics backend interface, renderer, images and custom drawing. More...

Topics

 Vulkan backend
 The Vulkan graphics backend, and sharing a host's device and images.

Classes

struct  tachyon::d3d12::D3D12SceneRender
 What GraphicsContext::RenderScene's record gets on Direct3D 12 (ScenePayload::As): the window frame's command list with the scene's color and depth textures set as its render targets (color cleared to the scene's clear color, depth to 1), and the viewport and scissor set to all of it. More...
struct  tachyon::d3d12::DebugConfig
 Where the debug layer's messages go. More...
struct  tachyon::d3d12::ExternalDevice
 A host's device and queue, for the GUI to render on (SetExternalDevice) instead of making its own. More...
class  tachyon::d3d12::D3D12GraphicsContext
class  tachyon::Buffer
class  tachyon::CustomDrawContext
 Passed to custom-draw callbacks (ElementStorage::AddCustomDraw / AddCustomDrawAfter): geometry lookups and drawing calls in a current space the callback switches with SetSpace or SetSpaceRaw, also between calls. More...
class  tachyon::PostLayoutContext
 Context for post-layout callbacks (AddPostLayout). More...
struct  tachyon::GpuInfo
 A GPU as the graphics API reports it, for ChooseGpu. More...
class  tachyon::GraphicsContext
 A graphics backend: the device, the window contexts that render the GUI's windows, and the images and text atlases they draw with. More...
struct  tachyon::UVRect
 The part of an image to draw, in UV: 0,0 is its top-left corner and 1,1 its bottom-right. More...
struct  tachyon::ImageDisplay
 How an image is shown, in this order: More...
class  tachyon::Image
 An image made by GraphicsContext::CreateImage; the backend defines its contents. More...
class  tachyon::ImageSet
 The images the shaders can sample, each at an ImageIndex. Implemented by the backend. More...
class  tachyon::ImageBatcher
class  tachyon::ImageSetTextAtlasManager< ImageSetT, ImageT >
struct  tachyon::PrimitiveRenderPass
 One contiguous same-kind run of primitives, drawn with one call; or, with replay set, a cached scope's draw (its own passes), and the other fields unused. More...
struct  tachyon::PrimitiveRenderTarget
class  tachyon::PrimitiveRenderer
struct  tachyon::glsl_float4
struct  tachyon::BoxPrimitive
struct  tachyon::GlyphPrimitive
struct  tachyon::DotPrimitive
struct  tachyon::LinePrimitive
struct  tachyon::TrianglePrimitive
struct  tachyon::QuadPrimitive
struct  tachyon::CirclePrimitive
 A circle outline: the ring lineWidth wide around center at radius, its color and dashes running clockwise from the right (+x towards +y), as LineStyle sets them. More...
struct  tachyon::OccluderPrimitive
 Depth only: marks pos/size as covered by opaque content drawn after it, so what was drawn before under it is skipped (its fragments fail the depth test early). More...
struct  tachyon::PrimitiveSpec
struct  tachyon::GPUDrawPushConstants
struct  tachyon::LineStyle
struct  tachyon::StyleBlend
 A box's look as a mix of up to four of its state styles (flat GPU style indices, as GUIRenderer::StyleIndex gives them), each with its share; the shares add up to 1, the heaviest first. More...
class  tachyon::GUIRenderer
struct  tachyon::RHI::GpuPipeline
struct  tachyon::RHI::UploadRequest
class  tachyon::RHI::RenderDevice
 Device-lifetime operations. More...
class  tachyon::RHI::RenderCommandList
 One frame's recording surface for one window. More...
struct  tachyon::metal::MetalSceneRender
 What GraphicsContext::RenderScene's record gets on Metal (ScenePayload::As): the window frame's command buffer and a render command encoder on the scene's color and depth textures (color cleared to the scene's clear color, depth to 1), with the viewport set to all of it. More...
struct  tachyon::metal::ExternalDevice
 A host's device and queue, for the GUI to render on (SetExternalDevice) instead of making its own. More...
class  tachyon::metal::MetalGraphicsContext
class  tachyon::NullGraphicsContext
 A graphics backend that draws nothing: the UI is built, laid out and recorded as usual, but no GPU is used and windows stay empty. More...
struct  tachyon::sdlgpu::SDLGPUSceneRender
 What GraphicsContext::RenderScene's record gets on SDL GPU (ScenePayload::As): the window frame's command buffer, outside any pass, and the scene's color and depth textures, cleared already (color to the scene's clear color, depth to 1). More...
struct  tachyon::sdlgpu::DebugConfig
 Where SDL GPU's messages go. More...
class  tachyon::sdlgpu::SDLGPUGraphicsContext

Typedefs

using tachyon::PipelineSet = std::array<RHI::GpuPipeline, kPrimitiveKindCount>
using tachyon::DeviceAddress = uint64_t
 Shader-visible buffer address.
using tachyon::RHI::ResidentBufferId = uint64_t
 GPU storage kept across frames (UploadResidentBuffers); 0 is none.

Enumerations

enum class  tachyon::d3d12::DebugSeverity : uint8_t { tachyon::d3d12::DebugSeverity::Info , tachyon::d3d12::DebugSeverity::Warning , tachyon::d3d12::DebugSeverity::Error }
 How serious a debug-layer message is. More...
enum class  tachyon::DrawSpace : uint8_t { tachyon::DrawSpace::Local , tachyon::DrawSpace::Screen }
 The coordinate space a CustomDrawContext draws in. More...
enum class  tachyon::GpuKind : uint8_t {
  tachyon::GpuKind::Other , tachyon::GpuKind::Integrated , tachyon::GpuKind::Discrete , tachyon::GpuKind::Virtual ,
  tachyon::GpuKind::Cpu
}
 What kind of GPU a device is. More...
enum class  tachyon::DeviceScope { tachyon::DeviceScope::Frame , tachyon::DeviceScope::Application }
 When a deferred GPU resource destruction runs: Frame once the GPU has finished the frames that may use it, Application at Cleanup. More...
enum class  tachyon::ImageChannel : uint8_t {
  tachyon::ImageChannel::Red , tachyon::ImageChannel::Green , tachyon::ImageChannel::Blue , tachyon::ImageChannel::Alpha ,
  tachyon::ImageChannel::Zero , tachyon::ImageChannel::One
}
 A channel of an image's pixel, or a constant, for ImageDisplay. More...
enum class  tachyon::ImageFormat {
  tachyon::ImageFormat::UNDEFINED , tachyon::ImageFormat::R8 , tachyon::ImageFormat::R8_SRGB , tachyon::ImageFormat::R8G8 ,
  tachyon::ImageFormat::R8G8_SRGB , tachyon::ImageFormat::R8G8B8 , tachyon::ImageFormat::R8G8B8_SRGB , tachyon::ImageFormat::R8G8B8A8 ,
  tachyon::ImageFormat::R8G8B8A8_SRGB
}
 Pixel formats for GraphicsContext::CreateImage, 8 bits per channel. More...
enum class  tachyon::Sampler { tachyon::Sampler::UNDEFINED , tachyon::Sampler::NearestRepeat , tachyon::Sampler::LinearRepeat , tachyon::Sampler::LinearClampToEdge }
 How an image is filtered and addressed when sampled. More...
enum  tachyon::ImageIndex : uint32_t { tachyon::Invalid = 0 }
 Index of an image in the graphics context's image set, as the shaders sample it. More...
enum class  tachyon::PrimitiveKind : uint8_t {
  tachyon::PrimitiveKind::Box = 0 , tachyon::PrimitiveKind::Glyph , tachyon::PrimitiveKind::Dot , tachyon::PrimitiveKind::Line ,
  tachyon::PrimitiveKind::Triangle , tachyon::PrimitiveKind::Quad , tachyon::PrimitiveKind::Circle , tachyon::PrimitiveKind::Occluder ,
  tachyon::PrimitiveKind::Count
}
enum class  tachyon::PrimitiveShape : uint8_t { tachyon::PrimitiveShape::Quad , tachyon::PrimitiveShape::Triangle }
 The vertices a primitive's vertex shader is run for; gl_VertexIndex divided by their count is the primitive, the remainder the corner. More...
enum class  tachyon::TriangleEdges : uint8_t { tachyon::TriangleEdges::None = 0 , tachyon::TriangleEdges::Edge01 = 1 << 0 , tachyon::TriangleEdges::Edge12 = 1 << 1 , tachyon::TriangleEdges::Edge20 = 1 << 2 }
 A triangle's edges, for the ones drawn without a soft edge: where it meets another triangle of the same shape (a polygon's fan), so no seam shows between them. More...
enum class  tachyon::RHI::ResidentState : uint8_t { tachyon::RHI::ResidentState::Gone , tachyon::RHI::ResidentState::Pending , tachyon::RHI::ResidentState::Ready }
 Where a resident buffer is. More...
enum class  tachyon::sdlgpu::DebugSeverity : uint8_t { tachyon::sdlgpu::DebugSeverity::Info , tachyon::sdlgpu::DebugSeverity::Warning , tachyon::sdlgpu::DebugSeverity::Error }
 How serious a message from SDL GPU's debug mode is. More...

Functions

std::string_view tachyon::GpuKindName (GpuKind kind)
 The kind's name, as a preference names it: "integrated", "discrete", "virtual", "cpu", "other".
std::optional< size_t > tachyon::ChooseGpu (std::span< const GpuInfo > gpus, std::string_view preference)
 Which of gpus preference asks for:
std::string tachyon::GpuPreference (std::string_view appPreference)
 The GPU preference in effect: the TACHYON_GPU environment variable when it's set, for a run without changing code; else appPreference.
int32_t tachyon::SnapPx (float v)
 Round half up, the same rule the box shader uses.
IntRect tachyon::SnapAbsolute (float4 px)
 A box with no snapped parent: each edge to the nearest pixel.
float4 tachyon::PixelBounds (const float3x2 &toPixels, IntRect r)
 The bounds of a rect mapped to window pixels, { x0, y0, x1, y1 }.
IntRect tachyon::SnapToParent (float4 parentPx, IntRect parentSnapped, float4 childPx)
 A nested box: each edge keeps its rounded distance from the parent's snapped edge on the same side.

Variables

constexpr float tachyon::kPrimitiveDepthStep = 1.0f / float(1 << 22)
 The depth between two primitives drawn one after the other; past the depth range all are at the nearest depth.
constexpr size_t tachyon::kPrimitiveKindCount = size_t(PrimitiveKind::Count)
constexpr PrimitiveSpec tachyon::kPrimitiveSpecs [kPrimitiveKindCount]
 Push-constant slot order matches the shaders' (all_common.slang: box, glyph, dot, line, triangle).

Detailed Description

The graphics backend interface, renderer, images and custom drawing.

Typedef Documentation

◆ PipelineSet

◆ DeviceAddress

using tachyon::DeviceAddress = uint64_t

#include <gui_core/graphics/gui_render_primitives.h>

Shader-visible buffer address.

uint64_t on every modern API (VkDeviceAddress / D3D12_GPU_VIRTUAL_ADDRESS / MTLGPUAddress).

◆ ResidentBufferId

#include <gui_core/graphics/gui_rhi.h>

GPU storage kept across frames (UploadResidentBuffers); 0 is none.

Enumeration Type Documentation

◆ DebugSeverity [1/2]

enum class tachyon::d3d12::DebugSeverity : uint8_t
strong

#include <gui_core/graphics/d3d12/d3d12_graphics_context.h>

How serious a debug-layer message is.

Enumerator
Info 
Warning 
Error 

◆ DrawSpace

enum class tachyon::DrawSpace : uint8_t
strong

#include <gui_core/graphics/gui_custom_draw_context.h>

The coordinate space a CustomDrawContext draws in.

Enumerator
Local 

The default: the registered element's content space, (0,0) at its padding box's top-left.

Its contentTransform (a node view's pan and zoom) and every ancestor's apply when drawing.

Screen 

Absolute layout pixels: the space of stored element rects and event.state.screenPos.

◆ GpuKind

enum class tachyon::GpuKind : uint8_t
strong

#include <gui_core/graphics/gui_gpu_choice.h>

What kind of GPU a device is.

Enumerator
Other 
Integrated 
Discrete 
Virtual 
Cpu 

◆ DeviceScope

enum class tachyon::DeviceScope
strong

#include <gui_core/graphics/gui_graphics_context.h>

When a deferred GPU resource destruction runs: Frame once the GPU has finished the frames that may use it, Application at Cleanup.

Enumerator
Frame 
Application 

◆ ImageChannel

enum class tachyon::ImageChannel : uint8_t
strong

#include <gui_core/graphics/gui_image.h>

A channel of an image's pixel, or a constant, for ImageDisplay.

Enumerator
Red 
Green 
Blue 
Alpha 
Zero 
One 

◆ ImageFormat

enum class tachyon::ImageFormat
strong

#include <gui_core/graphics/gui_image.h>

Pixel formats for GraphicsContext::CreateImage, 8 bits per channel.

The _SRGB formats decode sRGB to linear when sampled.

Enumerator
UNDEFINED 
R8 
R8_SRGB 
R8G8 
R8G8_SRGB 
R8G8B8 
R8G8B8_SRGB 
R8G8B8A8 
R8G8B8A8_SRGB 

◆ Sampler

enum class tachyon::Sampler
strong

#include <gui_core/graphics/gui_image.h>

How an image is filtered and addressed when sampled.

Enumerator
UNDEFINED 
NearestRepeat 
LinearRepeat 
LinearClampToEdge 

◆ ImageIndex

enum tachyon::ImageIndex : uint32_t

#include <gui_core/graphics/gui_image.h>

Index of an image in the graphics context's image set, as the shaders sample it.

Invalid (0) is no image.

Enumerator
Invalid 
Examples
host_device/host_device.cpp.

◆ PrimitiveKind

enum class tachyon::PrimitiveKind : uint8_t
strong

#include <gui_core/graphics/gui_render_primitives.h>

Enumerator
Box 
Glyph 
Dot 
Line 
Triangle 
Quad 
Circle 
Occluder 
Count 

◆ PrimitiveShape

enum class tachyon::PrimitiveShape : uint8_t
strong

#include <gui_core/graphics/gui_render_primitives.h>

The vertices a primitive's vertex shader is run for; gl_VertexIndex divided by their count is the primitive, the remainder the corner.

Enumerator
Quad 

4 corners of its rectangle, drawn as two indexed triangles (0,1,3, 0,3,2)

Triangle 

3 corners of one triangle around its shape (clipped per fragment)

◆ TriangleEdges

enum class tachyon::TriangleEdges : uint8_t
strong

#include <gui_core/graphics/gui_renderer.h>

A triangle's edges, for the ones drawn without a soft edge: where it meets another triangle of the same shape (a polygon's fan), so no seam shows between them.

Enumerator
None 
Edge01 

p0 to p1

Edge12 

p1 to p2

Edge20 

p2 to p0

◆ ResidentState

enum class tachyon::RHI::ResidentState : uint8_t
strong

#include <gui_core/graphics/gui_rhi.h>

Where a resident buffer is.

Enumerator
Gone 

released, or never made (or lost with its device)

Pending 

its copy to the GPU isn't recorded yet: it can't be drawn from this frame

Ready 

on the GPU: draws recorded from now on can read it

◆ DebugSeverity [2/2]

enum class tachyon::sdlgpu::DebugSeverity : uint8_t
strong

#include <gui_core/graphics/sdlgpu/sdlgpu_graphics_context.h>

How serious a message from SDL GPU's debug mode is.

Enumerator
Info 
Warning 
Error 

Function Documentation

◆ GpuKindName()

std::string_view tachyon::GpuKindName ( GpuKind kind)

#include <gui_core/graphics/gui_gpu_choice.h>

The kind's name, as a preference names it: "integrated", "discrete", "virtual", "cpu", "other".

◆ ChooseGpu()

std::optional< size_t > tachyon::ChooseGpu ( std::span< const GpuInfo > gpus,
std::string_view preference )

#include <gui_core/graphics/gui_gpu_choice.h>

Which of gpus preference asks for:

  • a kind ("discrete", "integrated", "virtual", "cpu"): the first of that kind;
  • a number: the GPU at that place in the list, from 0;
  • other text: the first whose name holds it, ignoring case ("radeon"). Empty, or nothing that matches: none, and the graphics API's own choice stands.

◆ GpuPreference()

std::string tachyon::GpuPreference ( std::string_view appPreference)

#include <gui_core/graphics/gui_gpu_choice.h>

The GPU preference in effect: the TACHYON_GPU environment variable when it's set, for a run without changing code; else appPreference.

◆ SnapPx()

int32_t tachyon::SnapPx ( float v)
inline

#include <gui_core/graphics/gui_pixel_snap.h>

Round half up, the same rule the box shader uses.

◆ SnapAbsolute()

IntRect tachyon::SnapAbsolute ( float4 px)
inline

#include <gui_core/graphics/gui_pixel_snap.h>

A box with no snapped parent: each edge to the nearest pixel.

◆ PixelBounds()

float4 tachyon::PixelBounds ( const float3x2 & toPixels,
IntRect r )
inline

#include <gui_core/graphics/gui_pixel_snap.h>

The bounds of a rect mapped to window pixels, { x0, y0, x1, y1 }.

◆ SnapToParent()

IntRect tachyon::SnapToParent ( float4 parentPx,
IntRect parentSnapped,
float4 childPx )
inline

#include <gui_core/graphics/gui_pixel_snap.h>

A nested box: each edge keeps its rounded distance from the parent's snapped edge on the same side.

Variable Documentation

◆ kPrimitiveDepthStep

float tachyon::kPrimitiveDepthStep = 1.0f / float(1 << 22)
inlineconstexpr

#include <gui_core/graphics/gui_render_primitives.h>

The depth between two primitives drawn one after the other; past the depth range all are at the nearest depth.

◆ kPrimitiveKindCount

size_t tachyon::kPrimitiveKindCount = size_t(PrimitiveKind::Count)
inlineconstexpr

◆ kPrimitiveSpecs

PrimitiveSpec tachyon::kPrimitiveSpecs[kPrimitiveKindCount]
inlineconstexpr

#include <gui_core/graphics/gui_render_primitives.h>

Initial value:
= {
{ "box_shader", sizeof(BoxPrimitive), 0 },
{ "glyph_shader", sizeof(GlyphPrimitive), 1 },
{ "dot_shader", sizeof(DotPrimitive), 2, PrimitiveShape::Triangle },
{ "line_shader", sizeof(LinePrimitive), 3 },
{ "triangle_shader", sizeof(TrianglePrimitive), 4 },
{ "quad_shader", sizeof(QuadPrimitive), 4 },
{ "circle_shader", sizeof(CirclePrimitive), 3 },
{ "occluder_shader", sizeof(OccluderPrimitive), 0, PrimitiveShape::Quad, true },
}
@ Triangle
3 corners of one triangle around its shape (clipped per fragment)
Definition gui_render_primitives.h:227
@ Quad
4 corners of its rectangle, drawn as two indexed triangles (0,1,3, 0,3,2)
Definition gui_render_primitives.h:226
Definition gui_render_primitives.h:33
A circle outline: the ring lineWidth wide around center at radius, its color and dashes running clock...
Definition gui_render_primitives.h:171
Definition gui_render_primitives.h:57
Definition gui_render_primitives.h:98
Depth only: marks pos/size as covered by opaque content drawn after it, so what was drawn before unde...
Definition gui_render_primitives.h:193
Definition gui_render_primitives.h:142
Definition gui_render_primitives.h:124

Push-constant slot order matches the shaders' (all_common.slang: box, glyph, dot, line, triangle).

The block is exactly 128 bytes, with no room for more addresses, so Quad shares the Triangle slot, Circle the Line slot and Occluder the Box slot: each pass writes its own buffer address into its slot before drawing, and a draw call holds one kind.