TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::vulkan::VulkanDeviceContext Class Reference

The Vulkan device the GUI renders with: its own, or a host's (SetExternalDevice). More...

#include <gui_core/graphics/vulkan/vk_device_context.h>

Classes

struct  InstanceDebugConfig
 Diagnostic hook for the GPU test harness: the instance is built with this debug callback instead of the default printing messenger, and optionally with synchronization validation, so tests can fail on validation errors. More...
struct  ExternalDevice
 A host's Vulkan handles for SetExternalDevice, so the GUI renders on the host's device (an engine hosting it as its editor, say) and can share resources with it. More...
struct  DeviceRequirements
 What a device must provide for the GUI to run on it. More...

Public Types

using SurfaceFactory = std::function<VkSurfaceKHR(VkInstance, const VkAllocationCallbacks*, tachyon::OSWindowHandle)>
 Makes a VkSurfaceKHR for one of the window backend's windows with the given instance and allocation callbacks; VK_NULL_HANDLE on failure.

Public Member Functions

void SetSurfaceFactory (SurfaceFactory factory)
 How surfaces are made; set before initialization. SDLWindowBackend installs its own.
void SetAllocationHooks (const tachyon::AllocationHooks &hooks)
 Host memory functions for every Vulkan object, vk-bootstrap and VMA.
const VkAllocationCallbacks * AllocationCallbacks () const
 What the vkCreate*‍/vkDestroy* calls pass; null when no hooks are set.
void SetInstanceDebugConfig (const InstanceDebugConfig &cfg)
 Sets the instance debug config; call before initialization (no effect after).
void SetExternalDevice (const ExternalDevice &external)
 Renders on the host's device instead of making one; call before initialization.
bool UsesExternalDevice () const noexcept
 Whether SetExternalDevice was called; a lost host device isn't recreated.
std::unique_lock< std::mutex > LockQueue () const
 Locks the queue for the duration of a submit or present.
void WaitIdle () const
 Waits until the device is idle, holding the queue lock (vkDeviceWaitIdle needs every queue externally synchronized).
tachyon::Image * CreateImage (tachyon::uint2 size, tachyon::ImageFormat format, tachyon::Sampler sampler, bool mipmapped=false) const
 An image nothing is uploaded to (undefined contents), for sampling only.
tachyon::Image * CreateImage (const void *data, tachyon::uint2 size, tachyon::ImageFormat format, tachyon::Sampler sampler, bool mipmapped=false)
 An image from data pixels (null: cleared).
bool UpdateImageRows (tachyon::Image *image, uint32_t firstRow, uint32_t rowCount, const void *data)
 GraphicsContext::UpdateImageRows: the rows go up with the next frame's uploads, and into the pixels kept for a device loss.
void RecordPendingUploads (VkCommandBuffer cmd)
 Records the queued uploads into cmd, outside any rendering scope.
tachyon::RHI::ResidentBufferId CreateResidentBuffer (std::span< const tachyon::RHI::UploadRequest > requests, std::span< tachyon::DeviceAddress > addresses)
 Library internal: GPU-only storage for the packed requests, copied in from a staging buffer by the next RecordPendingUploads (see RHI::RenderCommandList::UploadResidentBuffers).
tachyon::RHI::ResidentState GetResidentBufferState (tachyon::RHI::ResidentBufferId id) const
 Library internal: whether the buffer exists and has been copied to the GPU.
void ReleaseResidentBuffer (tachyon::RHI::ResidentBufferId id)
 Library internal: frees the buffer now if its copy was never recorded, else when the frame deletion queue flushes.
size_t ResidentBufferCount () const
 Library internal: the resident buffers not released.
UploadWorker & Uploads () const
 Library internal: copies into mapped memory, off the main thread.
void WaitForUploads () const
void DestroyImage (tachyon::Image *img)
 Destroys the image's Vulkan objects now; doesn't delete the object.
void ReleaseLiveImages ()
 After a device loss: frees the live images' Vulkan objects; the image objects stay.
void RebuildLiveImages ()
 Makes the released images again on the new device, uploading the pixels they were made from.
void DestroyHandedOverImages ()
 At shutdown, the GPU idle: destroys the images handed over with an Application-scope DestroyImageAtEnd and deletes their objects.
void DestroyImageAtEnd (tachyon::Image *img, tachyon::DeviceScope scope, const std::source_location &loc=std::source_location::current())
 Destroys the image and deletes the object: a Frame-scope image once the frames that may use it are done; an Application-scope one (handed over, to be drawn by its index) at DestroyHandedOverImages, staying live till then, so a device loss makes it again with its pixels.
tachyon::Buffer * UploadVisualColorStyles (::std::span< const tachyon::VisualColorStyle > colorStyles) const
 Library internal: the color styles in a GPU buffer for the shaders.
void DestroyVisualColorStyles (tachyon::Buffer *buffer)
 Library internal: destroys the buffer's GPU objects now, when no submitted frame can use it.
void DestroyVisualColorStylesAtEnd (tachyon::Buffer *buffer, tachyon::DeviceScope scope, const std::source_location &loc=std::source_location::current())
 Library internal: destroys and deletes the buffer when the scope's queue flushes.
tachyon::Buffer * UploadVisualBoxStyles (::std::span< const tachyon::VisualBoxStyle > styles) const
 Library internal: the box styles in a GPU buffer for the shaders.
void DestroyVisualBoxStyles (tachyon::Buffer *buffer)
 Library internal: destroys the buffer's GPU objects now, when no submitted frame can use it.
void DestroyVisualBoxStylesAtEnd (tachyon::Buffer *buffer, tachyon::DeviceScope scope, const std::source_location &loc=std::source_location::current())
 Library internal: destroys and deletes the buffer when the scope's queue flushes.
DeletionQueue & GetDeletionQueue (tachyon::DeviceScope scope)
 Library internal: the deletion queue flushed at Destroy (DeviceScope::Application).
void DestroyAfterGpu (std::function< void()> destroy)
 The one way to free, while frames run, anything a frame may use (a buffer, an image, a staging copy the upload worker fills): destroy runs once the GPU has finished every frame submitted until the end of the frame it's dropped in, every window's.
void Defer (tachyon::DeviceScope scope, std::function< void()> destroy)
 For DeviceScope::Frame, DestroyAfterGpu; for Application, at Destroy.
void AdvanceFrameAndFlushDeletions ()
 Library internal, once a frame before it's built (all of the last frame's windows submitted): what was dropped since the last call waits for the last submission, and what the GPU has passed is destroyed.
VkSemaphoreSubmitInfo NextSubmitSignal ()
 Library internal: the signal every frame submission adds, the submit timeline at its next value.
bool FramesDone () const
 True when the GPU has finished every frame submitted: a resource can go now.
const std::source_location * WasDropped (VkImageView view) const
 Debug builds: where an image dropped (DestroyImageAtEnd) and not destroyed yet was dropped, which no frame may record with; null for any other, and in release builds.
bool Initialize ()
 Library internal: finishes the bring-up that the first CreateSurface does; false when that failed (see initError).
void Flush ()
 Waits for the GPU and flushes the frame deletion queues.
void Destroy ()
 Waits for the GPU, flushes every deletion queue and destroys what the GUI made.
VkSurfaceKHR CreateSurface (tachyon::OSWindowHandle windowHandle)
 A surface for the window, through the surface factory.
Buffer CreateBuffer (size_t allocSize, VkBufferUsageFlags usage, VmaMemoryUsage memoryUsage) const
 Library internal: a VMA buffer.
void DestroyBuffer (const Buffer &buffer) const
 Library internal: destroys a CreateBuffer buffer now.
void DestroyUnsubmittedBuffer (const Buffer &buffer) const
 Library internal: destroys a buffer no command buffer was recorded with, now.
Buffer CreateMappedStorageBuffer (const void *data, size_t size, VkDeviceAddress &outAddress) const
 Library internal: a host-visible, persistently mapped storage buffer with a device address, filled by memcpy (no staging, no blocking submit).
VulkanImage CreateImage (VkExtent3D size, VkFormat format, VkImageUsageFlags usage, VkSampler sampler, bool mipmapped=false) const
 Library internal: a VMA image with its view.
void DestroyImage (const VulkanImage &img)
 Library internal: destroys the image and its view now; as DestroyBuffer, only when no submitted frame can use it.
VisualBoxStyleBuffers UploadMesh (::std::span< const tachyon::VisualBoxStyle > visualBoxStyles) const
 Library internal: the box styles in GPU buffers. Per-primitive uploads go through the RHI.
VisualColorStyleBuffers UploadMesh (::std::span< const tachyon::VisualColorStyle > colorStyles) const
 Library internal: the color styles in GPU buffers.
void DestroyMesh (const VisualBoxStyleBuffers &mesh) const
 Library internal: destroys the style buffers now.
void DestroyMesh (const VisualColorStyleBuffers &mesh) const
 Library internal: destroys the style buffers now.
VkShaderModule CreateShader (::std::span< uint32_t > spirvBuffer) const
 Library internal: a shader module from SPIR-V words.
void DestroyShader (const VkShaderModule &shader) const
 Library internal.

Static Public Member Functions

static DeviceRequirements GetDeviceRequirements ()
 What a host's device must enable for the GUI.
static bool CheckPhysicalDeviceSupport (VkPhysicalDevice physicalDevice, std::string *problems)
 Checks that a physical device can support GetDeviceRequirements().

Public Attributes

FrameWaits frameWaits
 Library internal: the timeline semaphores the frame's submissions wait on.
std::string shaderDirectory
 Where to load the compiled shaders from; empty uses the built-in ones.
GUIRenderContext renderContext
 Library internal: the GUI's pipelines.
VkInstance instance = VK_NULL_HANDLE
 The instance; the host's with SetExternalDevice.
VkDevice device = VK_NULL_HANDLE
 The device; the host's with SetExternalDevice.
VmaAllocator allocator = VK_NULL_HANDLE
 The allocator; the host's when it passed one.
VkPhysicalDevice chosenGPU = VK_NULL_HANDLE
 The GPU the device runs on.
std::string deviceName
 chosenGPU's name, as its driver reports it.
VkFence immFence
 Library internal: the immediate-submit fence.
VkCommandBuffer immCommandBuffer
 Library internal.
VkCommandPool immCommandPool
 Library internal.
VkQueue graphicsQueue
 The queue every GUI submit and present goes to; the host's with SetExternalDevice.
uint32_t graphicsQueueFamily
 graphicsQueue's family.
VkDescriptorSetLayout singleImageDescriptorLayout
 Library internal: the layout of the descriptor set the shaders sample images from.
uint32_t requestedImageSlots = 4096
 Image slots asked for (VulkanGraphicsContext::SetImageSlotCount); set before Initialize.
std::string gpuPreference
 The GPU asked for (GraphicsContext::SetGpuPreference); set before Initialize.
uint32_t imageSlots = 0
 The image slots there are: the ones asked for, or fewer when the device holds fewer sampled images per shader stage.
VkSampler defaultSamplerLinear
 For Sampler::LinearRepeat.
VkSampler defaultSamplerNearest
 For Sampler::NearestRepeat.
VkSampler defaultSamplerLinearClampToEdge
 For Sampler::LinearClampToEdge.
DeletionQueue mainDeletionQueue
 Flushed at Destroy (DeviceScope::Application).
DeletionQueue shutdownQueue
 Flushed only when the context shuts down (Cleanup), not when a lost device is remade: for objects that outlive a device, made again on the new one (the glyph atlas's pages).
VkSemaphore submitTimeline = VK_NULL_HANDLE
 A timeline every frame submission signals, one value further each.
uint64_t frameNumber { 0 }
 Frames advanced so far.
VkDebugUtilsMessengerEXT debug_messenger
 The default debug messenger, when the GUI made the instance with one.
VkCommandPoolCreateInfo commandPoolInfo
 Library internal: reused for the window contexts' command pools.
VkFenceCreateInfo fenceCreateInfo
 Library internal: reused for the window contexts' fences.
bool initialized { false }
 Whether the device is up (made or adopted).
tachyon::Error initError {}
 why the bring-up failed, when it did

Detailed Description

The Vulkan device the GUI renders with: its own, or a host's (SetExternalDevice).

It lives in VulkanGraphicsContext::deviceContext; set it up before GUIApplication::Initialize.

Member Typedef Documentation

◆ SurfaceFactory

using tachyon::vulkan::VulkanDeviceContext::SurfaceFactory = std::function<VkSurfaceKHR(VkInstance, const VkAllocationCallbacks*, tachyon::OSWindowHandle)>

Makes a VkSurfaceKHR for one of the window backend's windows with the given instance and allocation callbacks; VK_NULL_HANDLE on failure.

The GUI destroys the surfaces.

Member Function Documentation

◆ SetSurfaceFactory()

void tachyon::vulkan::VulkanDeviceContext::SetSurfaceFactory ( SurfaceFactory factory)
inline

How surfaces are made; set before initialization. SDLWindowBackend installs its own.

◆ SetAllocationHooks()

void tachyon::vulkan::VulkanDeviceContext::SetAllocationHooks ( const tachyon::AllocationHooks & hooks)

Host memory functions for every Vulkan object, vk-bootstrap and VMA.

Call before initialization.

◆ AllocationCallbacks()

const VkAllocationCallbacks * tachyon::vulkan::VulkanDeviceContext::AllocationCallbacks ( ) const
inline

What the vkCreate*‍/vkDestroy* calls pass; null when no hooks are set.

◆ SetInstanceDebugConfig()

void tachyon::vulkan::VulkanDeviceContext::SetInstanceDebugConfig ( const InstanceDebugConfig & cfg)
inline

Sets the instance debug config; call before initialization (no effect after).

◆ SetExternalDevice()

void tachyon::vulkan::VulkanDeviceContext::SetExternalDevice ( const ExternalDevice & external)
inline

Renders on the host's device instead of making one; call before initialization.

◆ UsesExternalDevice()

bool tachyon::vulkan::VulkanDeviceContext::UsesExternalDevice ( ) const
inlinenodiscardnoexcept

Whether SetExternalDevice was called; a lost host device isn't recreated.

◆ GetDeviceRequirements()

DeviceRequirements tachyon::vulkan::VulkanDeviceContext::GetDeviceRequirements ( )
staticnodiscard

What a host's device must enable for the GUI.

The feature structs have no pNext chain; a host chains them itself.

Examples
host_device/host_device.cpp.

◆ CheckPhysicalDeviceSupport()

bool tachyon::vulkan::VulkanDeviceContext::CheckPhysicalDeviceSupport ( VkPhysicalDevice physicalDevice,
std::string * problems )
staticnodiscard

Checks that a physical device can support GetDeviceRequirements().

Appends a line per missing capability to problems when non-null. This cannot verify what the host actually enabled at device creation.

◆ LockQueue()

std::unique_lock< std::mutex > tachyon::vulkan::VulkanDeviceContext::LockQueue ( ) const
inlinenodiscard

Locks the queue for the duration of a submit or present.

Every vkQueueSubmit/vkQueuePresentKHR on graphicsQueue must hold this.

◆ WaitIdle()

void tachyon::vulkan::VulkanDeviceContext::WaitIdle ( ) const

Waits until the device is idle, holding the queue lock (vkDeviceWaitIdle needs every queue externally synchronized).

◆ CreateImage() [1/3]

tachyon::Image * tachyon::vulkan::VulkanDeviceContext::CreateImage ( tachyon::uint2 size,
tachyon::ImageFormat format,
tachyon::Sampler sampler,
bool mipmapped = false ) const

An image nothing is uploaded to (undefined contents), for sampling only.

◆ CreateImage() [2/3]

tachyon::Image * tachyon::vulkan::VulkanDeviceContext::CreateImage ( const void * data,
tachyon::uint2 size,
tachyon::ImageFormat format,
tachyon::Sampler sampler,
bool mipmapped = false )

An image from data pixels (null: cleared).

Doesn't wait for the GPU: the upload and mip generation are recorded at the start of the next window frame (RecordPendingUploads).

◆ UpdateImageRows()

bool tachyon::vulkan::VulkanDeviceContext::UpdateImageRows ( tachyon::Image * image,
uint32_t firstRow,
uint32_t rowCount,
const void * data )

GraphicsContext::UpdateImageRows: the rows go up with the next frame's uploads, and into the pixels kept for a device loss.

◆ RecordPendingUploads()

void tachyon::vulkan::VulkanDeviceContext::RecordPendingUploads ( VkCommandBuffer cmd)

Records the queued uploads into cmd, outside any rendering scope.

◆ CreateResidentBuffer()

tachyon::RHI::ResidentBufferId tachyon::vulkan::VulkanDeviceContext::CreateResidentBuffer ( std::span< const tachyon::RHI::UploadRequest > requests,
std::span< tachyon::DeviceAddress > addresses )

Library internal: GPU-only storage for the packed requests, copied in from a staging buffer by the next RecordPendingUploads (see RHI::RenderCommandList::UploadResidentBuffers).

◆ GetResidentBufferState()

tachyon::RHI::ResidentState tachyon::vulkan::VulkanDeviceContext::GetResidentBufferState ( tachyon::RHI::ResidentBufferId id) const

Library internal: whether the buffer exists and has been copied to the GPU.

◆ ReleaseResidentBuffer()

void tachyon::vulkan::VulkanDeviceContext::ReleaseResidentBuffer ( tachyon::RHI::ResidentBufferId id)

Library internal: frees the buffer now if its copy was never recorded, else when the frame deletion queue flushes.

◆ ResidentBufferCount()

size_t tachyon::vulkan::VulkanDeviceContext::ResidentBufferCount ( ) const
inline

Library internal: the resident buffers not released.

◆ Uploads()

UploadWorker & tachyon::vulkan::VulkanDeviceContext::Uploads ( ) const
inline

Library internal: copies into mapped memory, off the main thread.

Everything a submit reads must be copied first: WaitForUploads before vkQueueSubmit.

◆ WaitForUploads()

void tachyon::vulkan::VulkanDeviceContext::WaitForUploads ( ) const
inline

◆ DestroyImage() [1/2]

void tachyon::vulkan::VulkanDeviceContext::DestroyImage ( tachyon::Image * img)

Destroys the image's Vulkan objects now; doesn't delete the object.

Only when no submitted frame can use it (debug builds check); DestroyImageAtEnd otherwise.

◆ ReleaseLiveImages()

void tachyon::vulkan::VulkanDeviceContext::ReleaseLiveImages ( )

After a device loss: frees the live images' Vulkan objects; the image objects stay.

◆ RebuildLiveImages()

void tachyon::vulkan::VulkanDeviceContext::RebuildLiveImages ( )

Makes the released images again on the new device, uploading the pixels they were made from.

◆ DestroyHandedOverImages()

void tachyon::vulkan::VulkanDeviceContext::DestroyHandedOverImages ( )

At shutdown, the GPU idle: destroys the images handed over with an Application-scope DestroyImageAtEnd and deletes their objects.

Not on a device loss, which keeps them.

◆ DestroyImageAtEnd()

void tachyon::vulkan::VulkanDeviceContext::DestroyImageAtEnd ( tachyon::Image * img,
tachyon::DeviceScope scope,
const std::source_location & loc = std::source_location::current() )

Destroys the image and deletes the object: a Frame-scope image once the frames that may use it are done; an Application-scope one (handed over, to be drawn by its index) at DestroyHandedOverImages, staying live till then, so a device loss makes it again with its pixels.

◆ UploadVisualColorStyles()

tachyon::Buffer * tachyon::vulkan::VulkanDeviceContext::UploadVisualColorStyles ( ::std::span< const tachyon::VisualColorStyle > colorStyles) const

Library internal: the color styles in a GPU buffer for the shaders.

◆ DestroyVisualColorStyles()

void tachyon::vulkan::VulkanDeviceContext::DestroyVisualColorStyles ( tachyon::Buffer * buffer)

Library internal: destroys the buffer's GPU objects now, when no submitted frame can use it.

◆ DestroyVisualColorStylesAtEnd()

void tachyon::vulkan::VulkanDeviceContext::DestroyVisualColorStylesAtEnd ( tachyon::Buffer * buffer,
tachyon::DeviceScope scope,
const std::source_location & loc = std::source_location::current() )

Library internal: destroys and deletes the buffer when the scope's queue flushes.

◆ UploadVisualBoxStyles()

tachyon::Buffer * tachyon::vulkan::VulkanDeviceContext::UploadVisualBoxStyles ( ::std::span< const tachyon::VisualBoxStyle > styles) const

Library internal: the box styles in a GPU buffer for the shaders.

◆ DestroyVisualBoxStyles()

void tachyon::vulkan::VulkanDeviceContext::DestroyVisualBoxStyles ( tachyon::Buffer * buffer)

Library internal: destroys the buffer's GPU objects now, when no submitted frame can use it.

◆ DestroyVisualBoxStylesAtEnd()

void tachyon::vulkan::VulkanDeviceContext::DestroyVisualBoxStylesAtEnd ( tachyon::Buffer * buffer,
tachyon::DeviceScope scope,
const std::source_location & loc = std::source_location::current() )

Library internal: destroys and deletes the buffer when the scope's queue flushes.

◆ GetDeletionQueue()

DeletionQueue & tachyon::vulkan::VulkanDeviceContext::GetDeletionQueue ( tachyon::DeviceScope scope)
inline

Library internal: the deletion queue flushed at Destroy (DeviceScope::Application).

What a frame may draw with goes through DestroyAfterGpu instead.

◆ DestroyAfterGpu()

void tachyon::vulkan::VulkanDeviceContext::DestroyAfterGpu ( std::function< void()> destroy)

The one way to free, while frames run, anything a frame may use (a buffer, an image, a staging copy the upload worker fills): destroy runs once the GPU has finished every frame submitted until the end of the frame it's dropped in, every window's.

However many frames go by without a window drawn: the GPU's progress decides, not a count of frames. Any thread.

◆ Defer()

void tachyon::vulkan::VulkanDeviceContext::Defer ( tachyon::DeviceScope scope,
std::function< void()> destroy )

For DeviceScope::Frame, DestroyAfterGpu; for Application, at Destroy.

◆ AdvanceFrameAndFlushDeletions()

void tachyon::vulkan::VulkanDeviceContext::AdvanceFrameAndFlushDeletions ( )

Library internal, once a frame before it's built (all of the last frame's windows submitted): what was dropped since the last call waits for the last submission, and what the GPU has passed is destroyed.

◆ NextSubmitSignal()

VkSemaphoreSubmitInfo tachyon::vulkan::VulkanDeviceContext::NextSubmitSignal ( )

Library internal: the signal every frame submission adds, the submit timeline at its next value.

Call with the queue locked (LockQueue), right before the submit, so the values reach the queue in order.

◆ FramesDone()

bool tachyon::vulkan::VulkanDeviceContext::FramesDone ( ) const

True when the GPU has finished every frame submitted: a resource can go now.

◆ WasDropped()

const std::source_location * tachyon::vulkan::VulkanDeviceContext::WasDropped ( VkImageView view) const

Debug builds: where an image dropped (DestroyImageAtEnd) and not destroyed yet was dropped, which no frame may record with; null for any other, and in release builds.

◆ Initialize()

bool tachyon::vulkan::VulkanDeviceContext::Initialize ( )

Library internal: finishes the bring-up that the first CreateSurface does; false when that failed (see initError).

◆ Flush()

void tachyon::vulkan::VulkanDeviceContext::Flush ( )

Waits for the GPU and flushes the frame deletion queues.

◆ Destroy()

void tachyon::vulkan::VulkanDeviceContext::Destroy ( )

Waits for the GPU, flushes every deletion queue and destroys what the GUI made.

◆ CreateSurface()

VkSurfaceKHR tachyon::vulkan::VulkanDeviceContext::CreateSurface ( tachyon::OSWindowHandle windowHandle)

A surface for the window, through the surface factory.

The first call also makes the device (or adopts the host's) on a GPU that can present to it. VK_NULL_HANDLE on failure.

◆ CreateBuffer()

Buffer tachyon::vulkan::VulkanDeviceContext::CreateBuffer ( size_t allocSize,
VkBufferUsageFlags usage,
VmaMemoryUsage memoryUsage ) const

Library internal: a VMA buffer.

◆ DestroyBuffer()

void tachyon::vulkan::VulkanDeviceContext::DestroyBuffer ( const Buffer & buffer) const

Library internal: destroys a CreateBuffer buffer now.

Only when no submitted frame can use it: from DestroyAfterGpu, with the GPU idle, or one never recorded (DestroyUnsubmittedBuffer). Debug builds check it.

◆ DestroyUnsubmittedBuffer()

void tachyon::vulkan::VulkanDeviceContext::DestroyUnsubmittedBuffer ( const Buffer & buffer) const

Library internal: destroys a buffer no command buffer was recorded with, now.

◆ CreateMappedStorageBuffer()

Buffer tachyon::vulkan::VulkanDeviceContext::CreateMappedStorageBuffer ( const void * data,
size_t size,
VkDeviceAddress & outAddress ) const

Library internal: a host-visible, persistently mapped storage buffer with a device address, filled by memcpy (no staging, no blocking submit).

Empty, with outAddress 0, for size 0.

◆ CreateImage() [3/3]

VulkanImage tachyon::vulkan::VulkanDeviceContext::CreateImage ( VkExtent3D size,
VkFormat format,
VkImageUsageFlags usage,
VkSampler sampler,
bool mipmapped = false ) const

Library internal: a VMA image with its view.

◆ DestroyImage() [2/2]

void tachyon::vulkan::VulkanDeviceContext::DestroyImage ( const VulkanImage & img)

Library internal: destroys the image and its view now; as DestroyBuffer, only when no submitted frame can use it.

◆ UploadMesh() [1/2]

VisualBoxStyleBuffers tachyon::vulkan::VulkanDeviceContext::UploadMesh ( ::std::span< const tachyon::VisualBoxStyle > visualBoxStyles) const

Library internal: the box styles in GPU buffers. Per-primitive uploads go through the RHI.

◆ UploadMesh() [2/2]

VisualColorStyleBuffers tachyon::vulkan::VulkanDeviceContext::UploadMesh ( ::std::span< const tachyon::VisualColorStyle > colorStyles) const

Library internal: the color styles in GPU buffers.

◆ DestroyMesh() [1/2]

void tachyon::vulkan::VulkanDeviceContext::DestroyMesh ( const VisualBoxStyleBuffers & mesh) const

Library internal: destroys the style buffers now.

◆ DestroyMesh() [2/2]

void tachyon::vulkan::VulkanDeviceContext::DestroyMesh ( const VisualColorStyleBuffers & mesh) const

Library internal: destroys the style buffers now.

◆ CreateShader()

VkShaderModule tachyon::vulkan::VulkanDeviceContext::CreateShader ( ::std::span< uint32_t > spirvBuffer) const

Library internal: a shader module from SPIR-V words.

◆ DestroyShader()

void tachyon::vulkan::VulkanDeviceContext::DestroyShader ( const VkShaderModule & shader) const

Library internal.

Member Data Documentation

◆ frameWaits

FrameWaits tachyon::vulkan::VulkanDeviceContext::frameWaits

Library internal: the timeline semaphores the frame's submissions wait on.

◆ shaderDirectory

std::string tachyon::vulkan::VulkanDeviceContext::shaderDirectory

Where to load the compiled shaders from; empty uses the built-in ones.

◆ renderContext

GUIRenderContext tachyon::vulkan::VulkanDeviceContext::renderContext

Library internal: the GUI's pipelines.

◆ instance

VkInstance tachyon::vulkan::VulkanDeviceContext::instance = VK_NULL_HANDLE

The instance; the host's with SetExternalDevice.

◆ device

VkDevice tachyon::vulkan::VulkanDeviceContext::device = VK_NULL_HANDLE

The device; the host's with SetExternalDevice.

◆ allocator

VmaAllocator tachyon::vulkan::VulkanDeviceContext::allocator = VK_NULL_HANDLE

The allocator; the host's when it passed one.

◆ chosenGPU

VkPhysicalDevice tachyon::vulkan::VulkanDeviceContext::chosenGPU = VK_NULL_HANDLE

The GPU the device runs on.

◆ deviceName

std::string tachyon::vulkan::VulkanDeviceContext::deviceName

chosenGPU's name, as its driver reports it.

◆ immFence

VkFence tachyon::vulkan::VulkanDeviceContext::immFence

Library internal: the immediate-submit fence.

◆ immCommandBuffer

VkCommandBuffer tachyon::vulkan::VulkanDeviceContext::immCommandBuffer

Library internal.

◆ immCommandPool

VkCommandPool tachyon::vulkan::VulkanDeviceContext::immCommandPool

Library internal.

◆ graphicsQueue

VkQueue tachyon::vulkan::VulkanDeviceContext::graphicsQueue

The queue every GUI submit and present goes to; the host's with SetExternalDevice.

◆ graphicsQueueFamily

uint32_t tachyon::vulkan::VulkanDeviceContext::graphicsQueueFamily

graphicsQueue's family.

◆ singleImageDescriptorLayout

VkDescriptorSetLayout tachyon::vulkan::VulkanDeviceContext::singleImageDescriptorLayout

Library internal: the layout of the descriptor set the shaders sample images from.

◆ requestedImageSlots

uint32_t tachyon::vulkan::VulkanDeviceContext::requestedImageSlots = 4096

Image slots asked for (VulkanGraphicsContext::SetImageSlotCount); set before Initialize.

◆ gpuPreference

std::string tachyon::vulkan::VulkanDeviceContext::gpuPreference

The GPU asked for (GraphicsContext::SetGpuPreference); set before Initialize.

◆ imageSlots

uint32_t tachyon::vulkan::VulkanDeviceContext::imageSlots = 0

The image slots there are: the ones asked for, or fewer when the device holds fewer sampled images per shader stage.

Set by Initialize.

◆ defaultSamplerLinear

VkSampler tachyon::vulkan::VulkanDeviceContext::defaultSamplerLinear

◆ defaultSamplerNearest

VkSampler tachyon::vulkan::VulkanDeviceContext::defaultSamplerNearest

◆ defaultSamplerLinearClampToEdge

VkSampler tachyon::vulkan::VulkanDeviceContext::defaultSamplerLinearClampToEdge

◆ mainDeletionQueue

DeletionQueue tachyon::vulkan::VulkanDeviceContext::mainDeletionQueue

Flushed at Destroy (DeviceScope::Application).

◆ shutdownQueue

DeletionQueue tachyon::vulkan::VulkanDeviceContext::shutdownQueue

Flushed only when the context shuts down (Cleanup), not when a lost device is remade: for objects that outlive a device, made again on the new one (the glyph atlas's pages).

◆ submitTimeline

VkSemaphore tachyon::vulkan::VulkanDeviceContext::submitTimeline = VK_NULL_HANDLE

A timeline every frame submission signals, one value further each.

◆ frameNumber

uint64_t tachyon::vulkan::VulkanDeviceContext::frameNumber { 0 }

Frames advanced so far.

◆ debug_messenger

VkDebugUtilsMessengerEXT tachyon::vulkan::VulkanDeviceContext::debug_messenger

The default debug messenger, when the GUI made the instance with one.

◆ commandPoolInfo

VkCommandPoolCreateInfo tachyon::vulkan::VulkanDeviceContext::commandPoolInfo

Library internal: reused for the window contexts' command pools.

◆ fenceCreateInfo

VkFenceCreateInfo tachyon::vulkan::VulkanDeviceContext::fenceCreateInfo

Library internal: reused for the window contexts' fences.

◆ initialized

bool tachyon::vulkan::VulkanDeviceContext::initialized { false }

Whether the device is up (made or adopted).

◆ initError

tachyon::Error tachyon::vulkan::VulkanDeviceContext::initError {}

why the bring-up failed, when it did


The documentation for this class was generated from the following file: