ngscopeclient 0.1-dev+51fbda87c
Files | Classes | Functions | Variables
Collaboration diagram for Vulkan acceleration:

Files

file  ComputePipeline.cpp
 Implementation of ComputePipeline.
 
file  ComputePipeline.h
 Declaration of ComputePipeline.
 
file  VulkanInit.cpp
 Vulkan initialization.
 

Classes

class  ComputePipeline
 Encapsulates a Vulkan compute pipeline and all necessary resources to use it. More...
 

Functions

bool VulkanInit (bool skipGLFW)
 Initialize a Vulkan context for compute. More...
 
bool IsDevicePreferred (const vk::PhysicalDeviceProperties &a, const vk::PhysicalDeviceProperties &b)
 Checks if a given Vulkan device is "better" than another. More...
 
void VulkanCleanup ()
 Free all global Vulkan resources in the correct order.
 

Variables

vk::raii::Context g_vkContext
 Global Vulkan context.
 
unique_ptr< vk::raii::Instance > g_vkInstance
 Global Vulkan instance.
 
shared_ptr< vk::raii::Deviceg_vkComputeDevice
 The Vulkan device selected for compute operations (may or may not be same device as rendering)
 
unique_ptr< vk::raii::CommandPool > g_vkTransferCommandPool
 Command pool for AcceleratorBuffer transfers. More...
 
unique_ptr< vk::raii::CommandBuffer > g_vkTransferCommandBuffer
 Command buffer for AcceleratorBuffer transfers. More...
 
shared_ptr< QueueHandleg_vkTransferQueue
 Queue for AcceleratorBuffer transfers. More...
 
std::unique_ptr< QueueManagerg_vkQueueManager
 Allocates QueueHandle objects. More...
 
mutex g_vkTransferMutex
 Mutex for interlocking access to g_vkTransferCommandBuffer and g_vkTransferCommandPool.
 
uint32_t g_vkPinnedMemoryType
 Vulkan memory type for CPU-based memory that is also GPU-readable.
 
uint32_t g_vkLocalMemoryType
 Vulkan memory type for GPU-based memory (generally not CPU-readable, except on unified memory systems)
 
uint8_t g_vkComputeDeviceUuid [16]
 UUID of g_vkComputeDevice.
 
uint32_t g_vkComputeDeviceDriverVer
 Driver version of g_vkComputeDevice.
 
vk::raii::PhysicalDevice * g_vkComputePhysicalDevice
 Physical device for g_vkComputeDevice.
 
uint32_t g_vkPinnedMemoryHeap = 0
 Heap from which g_vkPinnedMemoryType is allocated.
 
uint32_t g_vkLocalMemoryHeap = 0
 Heap from which g_vkLocalMemoryType is allocated.
 
bool g_hasShaderFloat64 = false
 Indicates whether the float64 type is available for use in shaders and SSBOs.
 
bool g_hasShaderInt64 = false
 Indicates whether the int64 type is available for use in shaders and SSBOs.
 
bool g_hasShaderInt16 = false
 Indicates whether the int16 type is available for use in shaders and SSBOs.
 
bool g_hasShaderInt8 = false
 Indicates whether the int8 type is available for use in shaders and SSBOs.
 
bool g_hasShaderAtomicFloat = false
 Indicates whether atomic operations on the float type are available in shaders.
 
bool g_hasDebugUtils = false
 Indicates whether the VK_EXT_debug_utils extension is available.
 
bool g_hasMemoryBudget = false
 Indicates whether the VK_EXT_memory_budget extension is available.
 
bool g_hasPushDescriptor = false
 Indicates whether the VK_KHR_push_descriptor extension is available.
 
bool g_vulkanDeviceHasUnifiedMemory = false
 Indicates whether the Vulkan device is unified memory. More...
 
size_t g_maxComputeGroupCount [3] = {0}
 Maximum size of a Vulkan dispatch group for compute shaders, in each axis.
 
bool g_vulkanDeviceIsIntelMesa = false
 Indicates that the Vulkan driver is Mesa on an Intel GPU.
 
bool g_vulkanDeviceIsAnyMesa = false
 Indicates that the Vulkan driver is Mesa on any GPU.
 
bool g_vulkanDeviceIsMoltenVK = false
 Indicates that the Vulkan driver is MoltenVK.
 

Detailed Description

Function Documentation

◆ IsDevicePreferred()

bool IsDevicePreferred ( const vk::PhysicalDeviceProperties &  a,
const vk::PhysicalDeviceProperties &  b 
)

Checks if a given Vulkan device is "better" than another.

Parameters
aOne of two devices being considered
bThe second device being considered
Returns
True if we should use device B over A

◆ VulkanInit()

bool VulkanInit ( bool  skipGLFW)

Initialize a Vulkan context for compute.

Parameters
skipGLFWDo not initalize GLFW (workaround for what looks like gtk or video driver bug). This was a workaround used by glscopeclient and should probably be removed as it's not used now.

Variable Documentation

◆ g_vkQueueManager

std::unique_ptr<QueueManager> g_vkQueueManager

Allocates QueueHandle objects.

This is a single global resource, all QueueHandles must be obtained through this object.

◆ g_vkTransferCommandBuffer

unique_ptr<vk::raii::CommandBuffer> g_vkTransferCommandBuffer

Command buffer for AcceleratorBuffer transfers.

This is a single global resource interlocked by g_vkTransferMutex and is used for convenience and code simplicity when parallelism isn't that important.

◆ g_vkTransferCommandPool

unique_ptr<vk::raii::CommandPool> g_vkTransferCommandPool

Command pool for AcceleratorBuffer transfers.

This is a single global resource interlocked by g_vkTransferMutex and is used for convenience and code simplicity when parallelism isn't that important.

◆ g_vkTransferQueue

shared_ptr<QueueHandle> g_vkTransferQueue

Queue for AcceleratorBuffer transfers.

This is a single global resource interlocked by g_vkTransferMutex and is used for convenience and code simplicity when parallelism isn't that important.

◆ g_vulkanDeviceHasUnifiedMemory

bool g_vulkanDeviceHasUnifiedMemory = false

Indicates whether the Vulkan device is unified memory.

Unified memory means that all memory allocations for compute shaders are from a single heap which is accessible to both the CPU and GPU with roughly equal performance, and there is no device-local memory with higher performance.

For example, AMD APUs, Intel integrated GPUs, and Apple Silicon platforms are unified memory.

Discrete PCIe GPUs typically are not.