13struct ID3D12CommandQueue;
16struct ID3D12GraphicsCommandList;
63 ID3D12CommandQueue*
queue =
nullptr;
129 std::function<
void(
const ScenePayload& scene)> record)
override;
175 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
std::string_view GetDeviceName() const override
The GPU it renders with, as the driver names it ("NVIDIA GeForce RTX 4070"); empty before Initialize ...
void SetWindowImageTarget(ID window, ID3D12Resource *texture)
The host texture a render-to-image window (WindowFlags::RenderToImage) is copied into each frame; nul...
Result< void > Initialize(IWindowBackend *windowBackend) override
Picks a GPU that runs Shader Model 6.6 with resource binding tier 3 (the shaders' descriptor heap ind...
GraphicsAPI GetAPI() const override
The API it presents with; window backends make their windows for it.
Definition d3d12_graphics_context.h:80
void DestroyWindowContext(IWindowContext *context) override
Waits for the context's GPU work and destroys it now; its native window must still exist.
~D3D12GraphicsContext() override
ImageIndex RenderScene(ID key, ID window, uint2 size, color4f clear, std::function< void(const ScenePayload &scene)> record) override
The scene's color texture (R8G8B8A8_UNORM, sampled with Sampler::LinearClampToEdge) and depth (D32_FL...
uint32_t GetImageSlotCount() const override
How many images can be registered at once; 0 when the backend doesn't say.
ImageSet * GetImageSet() const override
The images the shaders sample, by ImageIndex.
ImageIndex RegisterExternalImage(ID3D12Resource *texture, Sampler sampler)
A texture the host renders (a 3D viewport) in the image set, for the Image control or a primitive to ...
void Cleanup() override
Waits for the GPU and destroys what the backend made, the renderer included.
uint64_t ImageViewWrites() const
How many image views the image set has written: a slot set to the image it holds writes none.
bool DeviceLost() const override
The device was removed.
void WaitIdle()
Waits until the GPU has done all work submitted so far.
ImageIndex RegisterImage(Image *image) override
Adds the image to the image set; elements draw it by the returned index.
void UpdateExternalImage(ImageIndex index, ID3D12Resource *texture, Sampler sampler)
Points an existing index at another texture, for example after a resize, under the same rules.
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...
IWindowContext * CreateWindowContext(void *nativeWindowHandle, OSWindowHandle osHandle, ID id, int2 size, WindowFlags windowFlags, OnGuiFunc onGui) override
An OS window gets a swapchain, a layered (transparent) one none: its frames are read back and shown w...
void SetGpuPreference(std::string_view preference) override
Which GPU to render with, when there's more than one: a kind ("integrated", "discrete"),...
void SetExternalDevice(const ExternalDevice &external)
Render on the host's device and queue instead of making them.
void UnregisterImage(ImageIndex index) override
Frees the index for reuse; the image stays (DestroyImageAtEnd destroys it).
Impl & Internal()
Library internal: the device, its queue, and what the window contexts draw with.
Definition d3d12_graphics_context.h:169
Image * CreateImage(void *data, uint2 size, ImageFormat format, Sampler sampler, bool mipmapped=false) override
R8G8B8 is widened to R8G8B8A8 (Direct3D 12 has no 3-byte format), and R8 and R8G8 in sRGB too (it has...
static bool CheckDeviceSupport(ID3D12Device *device, std::string *problems=nullptr)
Whether device runs the GUI's shaders; what it lacks, one line each, in problems.
void SetImageSlotCount(uint32_t slots) override
4096 by default, 1,000,000 at most (a shader-visible descriptor heap's size).
TextAtlasManager * CreateTextAtlasManager() override
A new text atlas manager for the backend. The caller owns it and keeps it past Cleanup.
void PrepareFrame(StyleManager &styleManager, GradientManager &gradientManager, float elapsedTimeSecs) override
The gradient pages into the image set, and the styles uploaded where they changed.
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 BeginFrame() override
Frees what the GPU is done with, and resets the renderer.
void RePrepareFrame()
PrepareFrame again with its last arguments: a live resize's redraw changes styles.
void AddFrameWait(ID3D12Fence *fence, uint64_t value)
The GUI's next frame waits on the queue for fence to reach value: for work the host submits to anothe...
void SetDebugConfig(const DebugConfig &config)
Call before Initialize.
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
DebugSeverity
How serious a debug-layer message is.
Definition d3d12_graphics_context.h:45
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 d3d12_common.h:22
GraphicsAPI
The graphics API a backend presents with; window backends create their windows to match (SDL: SDL_WIN...
Definition gui_graphics_api.h:14
@ D3D12
Direct3D 12, on Windows.
Definition gui_graphics_api.h:17
A failure: its category and a human-readable message.
Definition gui_result.h:26
A 64-bit element ID whose bit layout depends on its IDMode.
Definition gui_id.h:23
Definition gui_base_types.h:394
Definition d3d12_device.h:107
What GraphicsContext::RenderScene's record gets on Direct3D 12 (ScenePayload::As): the window frame's...
Definition d3d12_graphics_context.h:31
uint2 extent
Definition d3d12_graphics_context.h:37
DXGI_FORMAT depthFormat
Definition d3d12_graphics_context.h:36
static constexpr GraphicsAPI kAPI
Definition d3d12_graphics_context.h:32
ID3D12GraphicsCommandList * commandList
Definition d3d12_graphics_context.h:34
size_t depthStencilView
Definition d3d12_graphics_context.h:41
size_t renderTargetView
The views the targets are set with, as D3D12_CPU_DESCRIPTOR_HANDLE::ptr: to clear part of them,...
Definition d3d12_graphics_context.h:40
DXGI_FORMAT colorFormat
Definition d3d12_graphics_context.h:35
Where the debug layer's messages go.
Definition d3d12_graphics_context.h:50
void * userData
Definition d3d12_graphics_context.h:52
void(*) callback(DebugSeverity severity, const char *message, void *userData)
Definition d3d12_graphics_context.h:51
A host's device and queue, for the GUI to render on (SetExternalDevice) instead of making its own.
Definition d3d12_graphics_context.h:58
ID3D12Device * device
Runs Shader Model 6.6 with resource binding tier 3 (CheckDeviceSupport).
Definition d3d12_graphics_context.h:60
ID3D12CommandQueue * queue
A direct queue of device: every GUI submit, wait and present goes here.
Definition d3d12_graphics_context.h:63
Integer 2D vector.
Definition gui_base_types.h:18
Definition gui_base_types.h:74