TachyonUI 1.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
5#include <unordered_map>
6
7namespace tachyon
8{
11
16 {
17 public:
20
21 GraphicsAPI GetAPI() const override { return GraphicsAPI::None; }
22
23 void SetAllocationHooks(const AllocationHooks&) override {}
24 Result<void> Initialize(IWindowBackend* windowBackend) override;
25 void Cleanup() override;
26 void BeginFrame() override;
27 void EndFrame() override {}
28
29 Image* CreateImage(void* data, uint2 size, ImageFormat format, Sampler sampler, bool mipmapped = false) override;
30 void DestroyImageAtEnd(Image* img, DeviceScope scope, const std::source_location& loc = std::source_location::current()) override;
31
33
34 IWindowContext* CreateWindowContext(void* nativeWindowHandle, OSWindowHandle osHandle, ID id, int2 size, WindowFlags windowFlags, OnGuiFunc onGui) override;
35 void DestroyWindowContext(IWindowContext* context) override;
36
37 ImageSet* GetImageSet() const override;
38 ImageIndex RegisterImage(Image* image) override;
39 void UnregisterImage(ImageIndex index) override;
40
42 void PrepareFrame(StyleManager& styleManager, GradientManager& gradientManager, float) override;
43
45 uint64_t RecordedFrames(ID window) const;
46
47 private:
48 ImageSet* m_imageSet = nullptr;
49 std::unordered_map<ID, uint64_t> m_recorded;
50 };
51
52}
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
void EndFrame() override
Ends the UI build, before the uploads and the window contexts' recording.
Definition gui_null_graphics_context.h:27
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.
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:21
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).
uint64_t RecordedFrames(ID window) const
How many frames the window was recorded in (RecordWindowFrame), for tests.
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:23
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: for DeviceScope::Frame once i...
void PrepareFrame(StyleManager &styleManager, GradientManager &gradientManager, float) override
Nothing to upload: takes the style and gradient changes, as a GPU backend's upload does.
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: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
Definition gui_logging.h:24
GraphicsAPI
The graphics API a backend presents with; window backends create their windows to match (SDL: SDL_WIN...
Definition gui_graphics_api.h:14
@ None
nothing is presented (NullGraphicsContext)
Definition gui_graphics_api.h:15
Memory functions a host gives the library, for the allocations that can be routed: Vulkan objects,...
Definition gui_allocation_hooks.h:17
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:18
Definition gui_base_types.h:74