TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_null_graphics_context.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace tachyon
6{
9
14 {
15 public:
18
19 GraphicsAPI GetAPI() const override { return GraphicsAPI::None; }
20
21 void SetAllocationHooks(const AllocationHooks&) override {}
22 Result<void> Initialize(IWindowBackend* windowBackend) override;
23 void Cleanup() override;
24 void BeginFrame() override;
25 void EndFrame() override {}
26
27 Image* CreateImage(void* data, uint2 size, ImageFormat format, Sampler sampler, bool mipmapped = false) override;
28 void DestroyImageAtEnd(Image* img, DeviceScope scope, const std::source_location& loc = std::source_location::current()) override;
29
31
32 IWindowContext* CreateWindowContext(void* nativeWindowHandle, OSWindowHandle osHandle, ID id, int2 size, WindowFlags windowFlags, OnGuiFunc onGui) override;
33 void DestroyWindowContext(IWindowContext* context) override;
34
35 ImageSet* GetImageSet() const override;
36 ImageIndex RegisterImage(Image* image) override;
37 void UnregisterImage(ImageIndex index) override;
38
39 void PrepareFrame(StyleManager&, GradientManager&, float) override {}
40
41 private:
42 ImageSet* m_imageSet = nullptr;
43 };
44
45}
The atlas that the colors of color styles are baked into: pages of 2D textures, one row per gradient,...
Definition gui_gradient_manager.h:64
Makes and manages the OS windows and delivers their input; GUIApplication::SetWindowBackend sets one,...
Definition gui_window_backend.h:105
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:44
An image made by GraphicsContext::CreateImage; the backend defines its contents.
Definition gui_image.h:40
void EndFrame() override
Ends the UI build, before the uploads and the window contexts' recording.
Definition gui_null_graphics_context.h:25
void DestroyWindowContext(IWindowContext *context) override
Waits for the context's GPU work and destroys it now; its native window must still exist.
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::GetNativeH...
TextAtlasManager * CreateTextAtlasManager() override
A new text atlas manager for the backend. The caller owns it and keeps it past Cleanup.
void PrepareFrame(StyleManager &, GradientManager &, float) override
Uploads the styles and gradient pages for this frame's draws, after the UI build and before the windo...
Definition gui_null_graphics_context.h:39
ImageIndex RegisterImage(Image *image) override
Adds the image to the image set; elements draw it by the returned index.
GraphicsAPI GetAPI() const override
The API it presents with; window backends make their windows for it.
Definition gui_null_graphics_context.h:19
ImageSet * GetImageSet() const override
The images the shaders sample, by ImageIndex.
void Cleanup() override
Waits for the GPU and destroys what the backend made, the renderer included.
Result< void > Initialize(IWindowBackend *windowBackend) override
Brings the device up; GUIApplication::Initialize calls it once, before any window context.
void UnregisterImage(ImageIndex index) override
Frees the index for reuse; the image stays (DestroyImageAtEnd destroys it).
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 ...
void SetAllocationHooks(const AllocationHooks &) override
Host memory functions for the graphics API's allocations. Call before Initialize.
Definition gui_null_graphics_context.h:21
void BeginFrame() override
Starts a frame's UI build: resets the renderer for new primitives (Vulkan: also frees what frame-scop...
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 DeviceSco...
A value, or the Error saying why there is none.
Definition gui_result.h:36
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
Sampler
How an image is filtered and addressed when sampled.
Definition gui_image.h:27
ImageFormat
Pixel formats for GraphicsContext::CreateImage, 8 bits per channel.
Definition gui_image.h:13
ImageIndex
Index of an image in the graphics context's image set, as the shaders sample it.
Definition gui_image.h:37
DeviceScope
When a deferred GPU resource destruction runs: Frame once the frames that may use it are done,...
Definition gui_graphics_context.h:43
GraphicsAPI
The graphics API a backend presents with; window backends create their windows to match (SDL: SDL_WIN...
Definition gui_graphics_context.h:51
@ None
nothing is presented (NullGraphicsContext)
Definition gui_graphics_context.h:52
std::function< void()> OnGuiFunc
Definition gui_base_types.h:14
WindowFlags
How an OS window is made and behaves (IWindowBackend::CreateWindow); flags combine with |.
Definition gui_window_flags.h:12
void * OSWindowHandle
An OS window, opaque; what it points to is up to the window backend.
Definition gui_window_backend.h:37
Definition gui_logging.h:24
Memory functions a host gives the library, for the allocations that can be routed: Vulkan objects,...
Definition gui_allocation_hooks.h:15
A 64-bit element ID whose bit layout depends on its IDMode.
Definition gui_id.h:23
Integer 2D vector.
Definition gui_base_types.h:19
Definition gui_base_types.h:75