|
TachyonUI 0.1.0
High-performance UI for building tools.
|
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...
#include <gui_core/graphics/null/gui_null_graphics_context.h>
Public Member Functions | |
| NullGraphicsContext () | |
| ~NullGraphicsContext () override | |
| GraphicsAPI | GetAPI () const override |
| The API it presents with; window backends make their windows for it. | |
| void | SetAllocationHooks (const AllocationHooks &) override |
| Host memory functions for the graphics API's allocations. Call before Initialize. | |
| Result< void > | Initialize (IWindowBackend *windowBackend) override |
| Brings the device up; GUIApplication::Initialize calls it once, before any window context. | |
| void | Cleanup () override |
| Waits for the GPU and destroys what the backend made, the renderer included. | |
| void | BeginFrame () override |
| Starts a frame's UI build: resets the renderer for new primitives (Vulkan: also frees what frame-scoped deletions held long enough). | |
| void | EndFrame () override |
| Ends the UI build, before the uploads and the window contexts' recording. | |
| Image * | CreateImage (void *data, uint2 size, ImageFormat format, Sampler sampler, bool mipmapped=false) override |
| Makes an image from size.x x size.y tightly packed pixels of format (Vulkan: data null for a cleared image); mipmapped generates its mip levels. | |
| 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: a few frames on for DeviceScope::Frame, at Cleanup for DeviceScope::Application. | |
| TextAtlasManager * | CreateTextAtlasManager () override |
| A new text atlas manager for the backend. The caller owns it and keeps it past Cleanup. | |
| IWindowContext * | CreateWindowContext (void *nativeWindowHandle, OSWindowHandle osHandle, ID id, int2 size, WindowFlags windowFlags, OnGuiFunc onGui) override |
| Makes the context that renders an OS window: nativeWindowHandle comes from IWindowBackend::GetNativeHandle, size is in pixels and onGui builds the window's UI. | |
| void | DestroyWindowContext (IWindowContext *context) override |
| Waits for the context's GPU work and destroys it now; its native window must still exist. | |
| ImageSet * | GetImageSet () const override |
| The images the shaders sample, by ImageIndex. | |
| 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 | PrepareFrame (StyleManager &, GradientManager &, float) override |
| Uploads the styles and gradient pages for this frame's draws, after the UI build and before the window contexts record. | |
| Public Member Functions inherited from tachyon::GraphicsContext | |
| GraphicsContext ()=default | |
| virtual | ~GraphicsContext () |
| virtual bool | DeviceLost () const |
| True once the GPU device is lost; RecreateDevice then makes a new one. | |
| virtual Result< void > | RecreateDevice (IWindowBackend *) |
| Makes a new device after DeviceLost, and everything the backend owns on it (the window contexts are the caller's to make again). | |
| virtual float | GetLastFrameBuildSeconds () const |
| Wall-clock seconds of CPU work in the last frame: from just after one present returns to just before the next, so without the vsync wait. | |
Additional Inherited Members | |
| Public Attributes inherited from tachyon::GraphicsContext | |
| GUIRenderer * | guiRenderer = nullptr |
| Where the UI records its draw primitives. | |
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.
For headless runs and tests, and as the minimal example of a backend.
| tachyon::NullGraphicsContext::NullGraphicsContext | ( | ) |
|
override |
|
inlineoverridevirtual |
The API it presents with; window backends make their windows for it.
Implements tachyon::GraphicsContext.
|
inlineoverridevirtual |
Host memory functions for the graphics API's allocations. Call before Initialize.
Implements tachyon::GraphicsContext.
|
overridevirtual |
Brings the device up; GUIApplication::Initialize calls it once, before any window context.
It may make windows with the backend (Vulkan: a hidden one, to pick a GPU that can present to it).
Implements tachyon::GraphicsContext.
|
overridevirtual |
Waits for the GPU and destroys what the backend made, the renderer included.
The window contexts are destroyed before it.
Implements tachyon::GraphicsContext.
|
overridevirtual |
Starts a frame's UI build: resets the renderer for new primitives (Vulkan: also frees what frame-scoped deletions held long enough).
Implements tachyon::GraphicsContext.
|
inlineoverridevirtual |
Ends the UI build, before the uploads and the window contexts' recording.
Implements tachyon::GraphicsContext.
|
overridevirtual |
Makes an image from size.x x size.y tightly packed pixels of format (Vulkan: data null for a cleared image); mipmapped generates its mip levels.
Doesn't wait for the GPU: the upload goes with the next frame. RegisterImage makes it drawable.
Implements tachyon::GraphicsContext.
|
overridevirtual |
Destroys the image and deletes the object once the GPU is done with it: a few frames on for DeviceScope::Frame, at Cleanup for DeviceScope::Application.
loc is for diagnostics.
Implements tachyon::GraphicsContext.
|
overridevirtual |
A new text atlas manager for the backend. The caller owns it and keeps it past Cleanup.
Implements tachyon::GraphicsContext.
|
overridevirtual |
Makes the context that renders an OS window: nativeWindowHandle comes from IWindowBackend::GetNativeHandle, size is in pixels and onGui builds the window's UI.
nullptr on failure. Destroy it with DestroyWindowContext.
Implements tachyon::GraphicsContext.
|
overridevirtual |
Waits for the context's GPU work and destroys it now; its native window must still exist.
Implements tachyon::GraphicsContext.
|
overridevirtual |
The images the shaders sample, by ImageIndex.
Implements tachyon::GraphicsContext.
|
overridevirtual |
Adds the image to the image set; elements draw it by the returned index.
Implements tachyon::GraphicsContext.
|
overridevirtual |
Frees the index for reuse; the image stays (DestroyImageAtEnd destroys it).
Implements tachyon::GraphicsContext.
|
inlineoverridevirtual |
Uploads the styles and gradient pages for this frame's draws, after the UI build and before the window contexts record.
elapsedTimeSecs: the frame clock's time, for shader animation.
Implements tachyon::GraphicsContext.