|
TachyonUI 1.1.0
High-performance UI for building tools.
|
#include <gui_core/graphics/d3d12/d3d12_device.h>
Classes | |
| struct | Garbage |
| struct | ImageUpload |
| A whole image's pixels, or with partial a band of rows from firstRow written into an image already up (UpdateImageRows): its other rows are kept. More... | |
| struct | UploadScratch |
| RecordPendingUploads' working lists, kept between frames for their storage. More... | |
| struct | Resident |
| struct | Scene |
| What RenderScene keeps for a key: its color texture (in the image set) and depth, both in liveImages, and a view of each. More... | |
| struct | SceneRequest |
Public Member Functions | |
| void | NoteFailure (HRESULT hr, const char *what) |
| Notes a failed call: logged, and when it says the device is gone, removed is set. | |
| UINT64 | Submit (ID3D12CommandList *list) |
| Runs list, after the frame waits, and signals the fence's next value, which it returns. | |
| void | Wait (UINT64 value) |
| Waits on the CPU until the fence reaches value. | |
| void | WaitIdle () |
| Waits until everything submitted so far is done, presents included. | |
| UINT64 | Completed () const |
| Buffer | CreateUploadBuffer (UINT64 size) |
| A buffer the CPU writes and the GPU reads, mapped. Empty on failure. | |
| Buffer | CreateGpuBuffer (UINT64 size) |
| A buffer in GPU memory, made ready for a copy into it. | |
| void | DestroyAfterGpu (ComPtr< D3D12MA::Allocation > allocation, UINT64 afterValue) |
| What's let go is freed once the GPU is past afterValue: the next submit (submitted + 1) for anything a window frame being recorded may use, which is everything let go while frames are built; 0 for what no command list refers to. | |
| void | DestroyAfterGpu (std::unique_ptr< D3D12Image > image, UINT64 afterValue) |
| void | DestroyAfterGpu (ComPtr< ID3D12Resource > resource, UINT64 afterValue) |
| void | FlushDeletions () |
| Frees what the GPU is done with. | |
| void | RecordPendingUploads (ID3D12GraphicsCommandList *list) |
| Records the queued image and resident-buffer copies into list. | |
| RHI::ResidentBufferId | CreateResidentBuffer (std::span< const RHI::UploadRequest > requests, std::span< DeviceAddress > addresses) |
| RHI::ResidentState | ResidentState (RHI::ResidentBufferId id) const |
| void | ReleaseResident (RHI::ResidentBufferId id) |
| bool | EnsureQuadIndices (ID3D12GraphicsCommandList *list, uint32_t quads) |
| Grows the quads' index buffer to hold quads, its copy recorded into list before the draw that needs it; false when it can't. | |
| void | RecordScenes (ID3D12GraphicsCommandList *list, ID window) |
| Records the scenes asked for in window this frame, before its UI. | |
| D3D12Image * | CreateTargetImage (uint2 size, DXGI_FORMAT format, D3D12_RESOURCE_FLAGS flags, D3D12_RESOURCE_STATES state, const D3D12_CLEAR_VALUE *clear, Sampler sampler) |
| A texture the GPU draws into (a scene's), in liveImages so DestroyImageAtEnd frees it; null on failure. | |
Public Attributes | |
| DebugConfig | debug |
| ExternalDevice | external |
| the host's device and queue, when it gave them | |
| std::string | gpuPreference |
| std::string | deviceName |
| bool | debugLayer = false |
| the debug layer is on: its messages go to debug | |
| uint32_t | imageSlots = 4096 |
| asked for with SetImageSlotCount | |
| ComPtr< IDXGIFactory6 > | factory |
| ComPtr< IDXGIAdapter1 > | adapter |
| ComPtr< ID3D12Device > | device |
| ComPtr< ID3D12CommandQueue > | queue |
| ComPtr< D3D12MA::Allocator > | allocator |
| GPU memory: buffers and textures in its heaps. | |
| ComPtr< ID3D12InfoQueue1 > | infoQueue |
| DWORD | messageCallback = 0 |
| ComPtr< ID3D12Fence > | submitFence |
| Every submit signals the next value: submitted is the last one signalled. | |
| std::atomic< UINT64 > | submitted = 0 |
| Atomic: DestroyImageAtEnd, on any thread, reads it. | |
| std::atomic< bool > | removed = false |
| The device was removed (a Present, a resize or the debug layer said so): told once, with the reason, and the GUI is told through DeviceLost. | |
| HANDLE | waitEvent = nullptr |
| std::vector< std::pair< ComPtr< ID3D12Fence >, UINT64 > > | frameWaits |
| What the next submit waits for on the queue (AddFrameWait), a fence once each. | |
| std::mutex | garbageMutex |
| images are let go on any thread | |
| std::vector< Garbage > | garbage |
| std::mutex | uploadMutex |
| images are made on any thread | |
| std::vector< ImageUpload > | imageUploads |
| struct tachyon::d3d12::D3D12GraphicsContext::Impl::UploadScratch | uploadScratch |
| std::unordered_map< RHI::ResidentBufferId, Resident > | residents |
| std::vector< RHI::ResidentBufferId > | pendingResidents |
| Made and not copied yet, oldest first; one let go of meanwhile is no longer in residents and is passed over. | |
| RHI::ResidentBufferId | nextResident = 1 |
| std::unordered_set< D3D12Image * > | liveImages |
| Every image made and not let go for a frame (DeviceScope::Frame): those handed over for the application's lifetime too. | |
| D3D12ImageSet | imageSet |
| RHI::ResidentBufferId | boxStyles = 0 |
| The box styles in GPU memory (a resident buffer), made again when they change; 0: none. | |
| RHI::ResidentBufferId | colorStyles = 0 |
| The color styles, with their gradient pages' slots, likewise. | |
| std::vector< ImageIndex > | gradientPages |
| each gradient page's index in the image set | |
| StyleManager * | lastStyles = nullptr |
| PrepareFrame's, for a live resize's redraw. | |
| GradientManager * | lastGradients = nullptr |
| float | lastTime = 0.0f |
| ComPtr< ID3D12RootSignature > | rootSignature |
| std::vector< ComPtr< ID3D12PipelineState > > | pipelineStates |
| by PrimitiveKind | |
| std::array< RHI::GpuPipeline, kPrimitiveKindCount > | pipelines {} |
| Buffer | quadIndices |
| p * 4 + { 0, 1, 3, 0, 3, 2 } for each quad p, in GPU memory. | |
| uint32_t | quadCapacity = 0 |
| GPUDrawPushConstants | pushConstants {} |
| the styles' addresses and the time, from PrepareFrame | |
| std::unordered_map< ID, Scene > | scenes |
| std::unordered_map< uint32_t, std::unique_ptr< D3D12Image > > | externalImages |
| By image index: what the image set points at for a host's texture. | |
| std::unordered_map< ID, ID3D12Resource * > | imageTargets |
| The texture a render-to-image window is copied into, by window. | |
| std::vector< SceneRequest > | sceneRequests |
| uint64_t | sceneFrame = 0 |
Static Public Attributes | |
| static constexpr DXGI_FORMAT | kSceneColorFormat = DXGI_FORMAT_R8G8B8A8_UNORM |
| static constexpr uint64_t | kSceneKeepFrames = 4 |
| a scene not asked for this long goes | |
| void tachyon::d3d12::D3D12GraphicsContext::Impl::NoteFailure | ( | HRESULT | hr, |
| const char * | what ) |
Notes a failed call: logged, and when it says the device is gone, removed is set.
| UINT64 tachyon::d3d12::D3D12GraphicsContext::Impl::Submit | ( | ID3D12CommandList * | list | ) |
Runs list, after the frame waits, and signals the fence's next value, which it returns.
| void tachyon::d3d12::D3D12GraphicsContext::Impl::Wait | ( | UINT64 | value | ) |
Waits on the CPU until the fence reaches value.
| void tachyon::d3d12::D3D12GraphicsContext::Impl::WaitIdle | ( | ) |
Waits until everything submitted so far is done, presents included.
|
inline |
| Buffer tachyon::d3d12::D3D12GraphicsContext::Impl::CreateUploadBuffer | ( | UINT64 | size | ) |
A buffer the CPU writes and the GPU reads, mapped. Empty on failure.
| Buffer tachyon::d3d12::D3D12GraphicsContext::Impl::CreateGpuBuffer | ( | UINT64 | size | ) |
A buffer in GPU memory, made ready for a copy into it.
| void tachyon::d3d12::D3D12GraphicsContext::Impl::DestroyAfterGpu | ( | ComPtr< D3D12MA::Allocation > | allocation, |
| UINT64 | afterValue ) |
What's let go is freed once the GPU is past afterValue: the next submit (submitted + 1) for anything a window frame being recorded may use, which is everything let go while frames are built; 0 for what no command list refers to.
| void tachyon::d3d12::D3D12GraphicsContext::Impl::DestroyAfterGpu | ( | std::unique_ptr< D3D12Image > | image, |
| UINT64 | afterValue ) |
| void tachyon::d3d12::D3D12GraphicsContext::Impl::DestroyAfterGpu | ( | ComPtr< ID3D12Resource > | resource, |
| UINT64 | afterValue ) |
| void tachyon::d3d12::D3D12GraphicsContext::Impl::FlushDeletions | ( | ) |
Frees what the GPU is done with.
| void tachyon::d3d12::D3D12GraphicsContext::Impl::RecordPendingUploads | ( | ID3D12GraphicsCommandList * | list | ) |
Records the queued image and resident-buffer copies into list.
| RHI::ResidentBufferId tachyon::d3d12::D3D12GraphicsContext::Impl::CreateResidentBuffer | ( | std::span< const RHI::UploadRequest > | requests, |
| std::span< DeviceAddress > | addresses ) |
| RHI::ResidentState tachyon::d3d12::D3D12GraphicsContext::Impl::ResidentState | ( | RHI::ResidentBufferId | id | ) | const |
| void tachyon::d3d12::D3D12GraphicsContext::Impl::ReleaseResident | ( | RHI::ResidentBufferId | id | ) |
| bool tachyon::d3d12::D3D12GraphicsContext::Impl::EnsureQuadIndices | ( | ID3D12GraphicsCommandList * | list, |
| uint32_t | quads ) |
Grows the quads' index buffer to hold quads, its copy recorded into list before the draw that needs it; false when it can't.
| void tachyon::d3d12::D3D12GraphicsContext::Impl::RecordScenes | ( | ID3D12GraphicsCommandList * | list, |
| ID | window ) |
Records the scenes asked for in window this frame, before its UI.
| D3D12Image * tachyon::d3d12::D3D12GraphicsContext::Impl::CreateTargetImage | ( | uint2 | size, |
| DXGI_FORMAT | format, | ||
| D3D12_RESOURCE_FLAGS | flags, | ||
| D3D12_RESOURCE_STATES | state, | ||
| const D3D12_CLEAR_VALUE * | clear, | ||
| Sampler | sampler ) |
A texture the GPU draws into (a scene's), in liveImages so DestroyImageAtEnd frees it; null on failure.
clear: its optimized clear value, or null when it's cleared to values not known in advance.
| DebugConfig tachyon::d3d12::D3D12GraphicsContext::Impl::debug |
| ExternalDevice tachyon::d3d12::D3D12GraphicsContext::Impl::external |
the host's device and queue, when it gave them
| std::string tachyon::d3d12::D3D12GraphicsContext::Impl::gpuPreference |
| std::string tachyon::d3d12::D3D12GraphicsContext::Impl::deviceName |
| bool tachyon::d3d12::D3D12GraphicsContext::Impl::debugLayer = false |
the debug layer is on: its messages go to debug
| uint32_t tachyon::d3d12::D3D12GraphicsContext::Impl::imageSlots = 4096 |
asked for with SetImageSlotCount
| ComPtr<IDXGIFactory6> tachyon::d3d12::D3D12GraphicsContext::Impl::factory |
| ComPtr<IDXGIAdapter1> tachyon::d3d12::D3D12GraphicsContext::Impl::adapter |
| ComPtr<ID3D12Device> tachyon::d3d12::D3D12GraphicsContext::Impl::device |
| ComPtr<ID3D12CommandQueue> tachyon::d3d12::D3D12GraphicsContext::Impl::queue |
| ComPtr<D3D12MA::Allocator> tachyon::d3d12::D3D12GraphicsContext::Impl::allocator |
GPU memory: buffers and textures in its heaps.
| ComPtr<ID3D12InfoQueue1> tachyon::d3d12::D3D12GraphicsContext::Impl::infoQueue |
| DWORD tachyon::d3d12::D3D12GraphicsContext::Impl::messageCallback = 0 |
| ComPtr<ID3D12Fence> tachyon::d3d12::D3D12GraphicsContext::Impl::submitFence |
Every submit signals the next value: submitted is the last one signalled.
| std::atomic<UINT64> tachyon::d3d12::D3D12GraphicsContext::Impl::submitted = 0 |
Atomic: DestroyImageAtEnd, on any thread, reads it.
| std::atomic<bool> tachyon::d3d12::D3D12GraphicsContext::Impl::removed = false |
The device was removed (a Present, a resize or the debug layer said so): told once, with the reason, and the GUI is told through DeviceLost.
| HANDLE tachyon::d3d12::D3D12GraphicsContext::Impl::waitEvent = nullptr |
| std::vector<std::pair<ComPtr<ID3D12Fence>, UINT64> > tachyon::d3d12::D3D12GraphicsContext::Impl::frameWaits |
What the next submit waits for on the queue (AddFrameWait), a fence once each.
| std::mutex tachyon::d3d12::D3D12GraphicsContext::Impl::garbageMutex |
images are let go on any thread
| std::vector<Garbage> tachyon::d3d12::D3D12GraphicsContext::Impl::garbage |
| std::mutex tachyon::d3d12::D3D12GraphicsContext::Impl::uploadMutex |
images are made on any thread
| std::vector<ImageUpload> tachyon::d3d12::D3D12GraphicsContext::Impl::imageUploads |
| struct tachyon::d3d12::D3D12GraphicsContext::Impl::UploadScratch tachyon::d3d12::D3D12GraphicsContext::Impl::uploadScratch |
| std::unordered_map<RHI::ResidentBufferId, Resident> tachyon::d3d12::D3D12GraphicsContext::Impl::residents |
| std::vector<RHI::ResidentBufferId> tachyon::d3d12::D3D12GraphicsContext::Impl::pendingResidents |
Made and not copied yet, oldest first; one let go of meanwhile is no longer in residents and is passed over.
Ids are never handed out twice.
| RHI::ResidentBufferId tachyon::d3d12::D3D12GraphicsContext::Impl::nextResident = 1 |
| std::unordered_set<D3D12Image*> tachyon::d3d12::D3D12GraphicsContext::Impl::liveImages |
Every image made and not let go for a frame (DeviceScope::Frame): those handed over for the application's lifetime too.
Cleanup frees what's left.
| D3D12ImageSet tachyon::d3d12::D3D12GraphicsContext::Impl::imageSet |
| RHI::ResidentBufferId tachyon::d3d12::D3D12GraphicsContext::Impl::boxStyles = 0 |
The box styles in GPU memory (a resident buffer), made again when they change; 0: none.
| RHI::ResidentBufferId tachyon::d3d12::D3D12GraphicsContext::Impl::colorStyles = 0 |
The color styles, with their gradient pages' slots, likewise.
| std::vector<ImageIndex> tachyon::d3d12::D3D12GraphicsContext::Impl::gradientPages |
each gradient page's index in the image set
| StyleManager* tachyon::d3d12::D3D12GraphicsContext::Impl::lastStyles = nullptr |
PrepareFrame's, for a live resize's redraw.
| GradientManager* tachyon::d3d12::D3D12GraphicsContext::Impl::lastGradients = nullptr |
| float tachyon::d3d12::D3D12GraphicsContext::Impl::lastTime = 0.0f |
| ComPtr<ID3D12RootSignature> tachyon::d3d12::D3D12GraphicsContext::Impl::rootSignature |
| std::vector<ComPtr<ID3D12PipelineState> > tachyon::d3d12::D3D12GraphicsContext::Impl::pipelineStates |
| std::array<RHI::GpuPipeline, kPrimitiveKindCount> tachyon::d3d12::D3D12GraphicsContext::Impl::pipelines {} |
| Buffer tachyon::d3d12::D3D12GraphicsContext::Impl::quadIndices |
p * 4 + { 0, 1, 3, 0, 3, 2 } for each quad p, in GPU memory.
| uint32_t tachyon::d3d12::D3D12GraphicsContext::Impl::quadCapacity = 0 |
| GPUDrawPushConstants tachyon::d3d12::D3D12GraphicsContext::Impl::pushConstants {} |
the styles' addresses and the time, from PrepareFrame
|
staticconstexpr |
|
staticconstexpr |
a scene not asked for this long goes
| std::unordered_map<uint32_t, std::unique_ptr<D3D12Image> > tachyon::d3d12::D3D12GraphicsContext::Impl::externalImages |
By image index: what the image set points at for a host's texture.
| std::unordered_map<ID, ID3D12Resource*> tachyon::d3d12::D3D12GraphicsContext::Impl::imageTargets |
The texture a render-to-image window is copied into, by window.
| std::vector<SceneRequest> tachyon::d3d12::D3D12GraphicsContext::Impl::sceneRequests |
| uint64_t tachyon::d3d12::D3D12GraphicsContext::Impl::sceneFrame = 0 |