103 std::function<
void(
const ScenePayload& scene)> record)
override;
124 std::unique_ptr<Impl> m_impl;
The atlas that the colors of color styles are baked into: pages of 2D textures, one row per gradient,...
Definition gui_gradient_manager.h:65
Makes and manages the OS windows and delivers their input; GUIApplication::SetWindowBackend sets one,...
Definition gui_window_backend.h:112
A window's rendering state: made by GraphicsContext::CreateWindowContext for each OS window,...
Definition gui_window_backend.h:72
The images the shaders can sample, each at an ImageIndex. Implemented by the backend.
Definition gui_image.h:106
An image made by GraphicsContext::CreateImage; the backend defines its contents.
Definition gui_image.h:102
A value, or the Error saying why there is none.
Definition gui_result.h:36
What GraphicsContext::RenderScene's record gets: the backend's recording state, as the struct of the ...
Definition gui_graphics_api.h:41
Bakes serializable Styles into deduplicated runtime layout/visual styles; a StyleRef holds indices in...
Definition gui_style_manager.h:39
Definition gui_text_atlas_manager.h:17
ImageSet * GetImageSet() const override
The images the shaders sample, by ImageIndex.
uint32_t GetImageSlotCount() const override
How many images can be registered at once; 0 when the backend doesn't say.
void SetExternalDevice(const ExternalDevice &external)
Render on the host's device and queue instead of making them.
std::string_view GetDeviceName() const override
The GPU it renders with, as the driver names it ("NVIDIA GeForce RTX 4070"); empty before Initialize ...
Result< void > Initialize(IWindowBackend *windowBackend) override
Picks a GPU of the Metal 3 family (the system's default unless the app or TACHYON_GPU asks for anothe...
IWindowContext * CreateWindowContext(void *nativeWindowHandle, OSWindowHandle osHandle, ID id, int2 size, WindowFlags windowFlags, OnGuiFunc onGui) override
nativeWindowHandle is the window's NSWindow: the context adds a view with a CAMetalLayer to it.
void BeginFrame() override
Frees what the GPU is done with, and resets the renderer.
ImageIndex RegisterImage(Image *image) override
Adds the image to the image set; elements draw it by the returned index.
void UnregisterImage(ImageIndex index) override
Frees the index for reuse; the image stays (DestroyImageAtEnd destroys it).
void SetGpuPreference(std::string_view preference) override
Which GPU to render with, when there's more than one: a kind ("integrated", "discrete"),...
bool UpdateImageRows(Image *image, uint32_t firstRow, uint32_t rowCount, const void *data) override
Writes rowCount rows from firstRow into an image CreateImage made with pixels (not mipmapped): tightl...
void DestroyImageAtEnd(Image *img, DeviceScope scope, const std::source_location &loc=std::source_location::current()) override
Destroys the image and deletes the object once the GPU is done with it: for DeviceScope::Frame once i...
~MetalGraphicsContext() override
void SetImageSlotCount(uint32_t slots) override
4096 by default, 500,000 at most (an argument buffer's textures).
static bool CheckDeviceSupport(void *device, std::string *problems=nullptr)
Whether device (an id<MTLDevice>) runs the GUI's shaders; what it lacks, one line each,...
Image * CreateImage(void *data, uint2 size, ImageFormat format, Sampler sampler, bool mipmapped=false) override
R8G8B8 is widened to R8G8B8A8 (Metal has no 3-byte format), and R8 and R8G8 in sRGB too (macOS has no...
bool DeviceLost() const override
True once the GPU device is lost; RecreateDevice then makes a new one.
ImageIndex RegisterExternalImage(void *texture, Sampler sampler)
A texture the host renders (an id<MTLTexture>, a 3D viewport) in the image set, for the Image control...
Impl & Internal()
Library internal: the device, its queue, and what the window contexts draw with.
Definition metal_graphics_context.h:121
void PrepareFrame(StyleManager &styleManager, GradientManager &gradientManager, float elapsedTimeSecs) override
The gradient pages into the image set, and the styles uploaded where they changed.
void Cleanup() override
Waits for the GPU and destroys what the backend made, the renderer included.
TextAtlasManager * CreateTextAtlasManager() override
A new text atlas manager for the backend. The caller owns it and keeps it past Cleanup.
void DestroyWindowContext(IWindowContext *context) override
Waits for the context's GPU work and destroys it now; its native window must still exist.
void RePrepareFrame()
PrepareFrame again with its last arguments: a live resize's redraw changes styles.
void UpdateExternalImage(ImageIndex index, void *texture, Sampler sampler)
Points an existing index at another texture, for example after a resize.
ImageIndex RenderScene(ID key, ID window, uint2 size, color4f clear, std::function< void(const ScenePayload &scene)> record) override
The scene's color texture (MTLPixelFormatRGBA8Unorm, sampled with Sampler::LinearClampToEdge) and dep...
GraphicsAPI GetAPI() const override
The API it presents with; window backends make their windows for it.
Definition metal_graphics_context.h:57
void WaitIdle()
Waits until the GPU has done all work committed so far.
Sampler
How an image is filtered and addressed when sampled.
Definition gui_image.h:89
ImageFormat
Pixel formats for GraphicsContext::CreateImage, 8 bits per channel.
Definition gui_image.h:75
ImageIndex
Index of an image in the graphics context's image set, as the shaders sample it.
Definition gui_image.h:99
DeviceScope
When a deferred GPU resource destruction runs: Frame once the GPU has finished the frames that may us...
Definition gui_graphics_context.h:44
std::function< void()> OnGuiFunc
Definition gui_base_types.h:13
WindowFlags
How an OS window is made and behaves (IWindowBackend::CreateWindow); flags combine with |.
Definition gui_window_flags.h:14
void * OSWindowHandle
An OS window, opaque; what it points to is up to the window backend.
Definition gui_window_backend.h:37
GraphicsAPI
The graphics API a backend presents with; window backends create their windows to match (SDL: SDL_WIN...
Definition gui_graphics_api.h:14
@ Metal
Metal, on macOS.
Definition gui_graphics_api.h:19
A 64-bit element ID whose bit layout depends on its IDMode.
Definition gui_id.h:23
Definition gui_base_types.h:394
Integer 2D vector.
Definition gui_base_types.h:18
Definition metal_device.h:134
Definition gui_base_types.h:74