Class VulkanDevice¶
Namespace: Apogee.Graphics.Vulkan
Assembly: Apogee.Graphics.dll
The Vulkan implementation of
public sealed class VulkanDevice : GraphicsDevice, IDisposable
Inheritance¶
object ← GraphicsDevice ← VulkanDevice
Implements¶
Inherited Members¶
GraphicsDevice.Backend, GraphicsDevice.ShaderBackend, GraphicsDevice.Name, GraphicsDevice.Kind, GraphicsDevice.Immediate, GraphicsDevice.Bindless, GraphicsDevice.TimestampPeriod, GraphicsDevice.SupportsTimestamps, GraphicsDevice.MinUniformBufferOffsetAlignment, GraphicsDevice.MaxSamplerAnisotropy, GraphicsDevice.SupportsBc, GraphicsDevice.SupportsAstc, GraphicsDevice.SupportsAnisotropy, GraphicsDevice.SupportsDrawIndirectCount, GraphicsDevice.SupportsSamplerFilterMinMax, GraphicsDevice.ValidationErrorCount, GraphicsDevice.TakeValidationErrors(), GraphicsDevice.DefaultBackend, GraphicsDevice.RequiredWindowOptions(GraphicsBackend?), GraphicsDevice.Create(GraphicsDeviceOptions?), GraphicsDevice.TryCreate(GraphicsDeviceOptions?, out GraphicsDevice?, out string?), GraphicsDevice.EnumerateDevices(GraphicsDeviceOptions?), GraphicsDevice.CreateBuffer(ulong, BufferUsage, MemoryKind, string?), GraphicsDevice.CreateImage(in ImageDescription, string?), GraphicsDevice.CreateSampler(in SamplerDescription, string?), GraphicsDevice.CreateComputePipeline(in ShaderCode, string?), GraphicsDevice.CreateGraphicsPipeline(GraphicsPipelineDescription, string?), GraphicsDevice.CreateSwapchain(bool), GraphicsDevice.CreateFrameLoop(Swapchain?, int, int), GraphicsDevice.WaitIdle(), GraphicsDevice.Dispose(), GraphicsDevice.CreateBuffer(ReadOnlySpan<byte>, BufferUsage, string?), GraphicsDevice.UploadBuffer(GpuBuffer, ReadOnlySpan<byte>, ulong), GraphicsDevice.UploadImage(GpuImage, ReadOnlySpan<byte>, ReadOnlySpan<ImageRegion>, ImageState), GraphicsDevice.ReadBuffer(GpuBuffer, ulong, int), GraphicsDevice.ReadImage(GpuImage, ImageState, uint, uint), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Properties¶
Allocator¶
public Allocator* Allocator { get; }
Property Value¶
Allocator*
Backend¶
public override GraphicsBackend Backend { get; }
Property Value¶
Commands¶
public VkDeviceCommands Commands { get; }
Property Value¶
VkDeviceCommands
Handle¶
public VkDevice Handle { get; }
Property Value¶
VkDevice
Instance¶
public VulkanInstance Instance { get; }
Property Value¶
Kind¶
public override GpuKind Kind { get; }
Property Value¶
MaxPushConstantsSize¶
public uint MaxPushConstantsSize { get; }
Property Value¶
MaxSamplerAnisotropy¶
public override float MaxSamplerAnisotropy { get; }
Property Value¶
MinUniformBufferOffsetAlignment¶
public override ulong MinUniformBufferOffsetAlignment { get; }
Property Value¶
Name¶
public override string Name { get; }
Property Value¶
Physical¶
public PhysicalDeviceInfo Physical { get; }
Property Value¶
Queue¶
The one queue the engine submits to: graphics, compute and transfer, and presentation when a surface was given.
public VkQueue Queue { get; }
Property Value¶
VkQueue
QueueFamily¶
public uint QueueFamily { get; }
Property Value¶
QueueLock¶
Held while submitting to
public object QueueLock { get; }
Property Value¶
ShaderBackend¶
The kind of shader code this device runs: pass it to
public override ShaderBackend ShaderBackend { get; }
Property Value¶
SupportsAnisotropy¶
public override bool SupportsAnisotropy { get; }
Property Value¶
SupportsAstc¶
ASTC LDR textures can be sampled (mobile and Apple GPUs).
public override bool SupportsAstc { get; }
Property Value¶
SupportsBc¶
BC1-7 textures can be sampled (desktop GPUs); otherwise transcode Basis textures to ASTC or RGBA8.
public override bool SupportsBc { get; }
Property Value¶
SupportsDrawIndirectCount¶
drawIndirectCount). Metal has no such draw; use
public override bool SupportsDrawIndirectCount { get; }
Property Value¶
SupportsMultiDrawIndirect¶
One indirect draw command can make several draws (multiDrawIndirect); without it the recorder issues one command at a time.
public bool SupportsMultiDrawIndirect { get; }
Property Value¶
SupportsSamplerFilterMinMax¶
Samplers can return the minimum or maximum of their footprint (
public override bool SupportsSamplerFilterMinMax { get; }
Property Value¶
SupportsSwapchain¶
public bool SupportsSwapchain { get; }
Property Value¶
SupportsTimestamps¶
The queue writes timestamps (all of graphics and compute can).
public override bool SupportsTimestamps { get; }
Property Value¶
TimestampPeriod¶
Nanoseconds per timestamp tick, for GPU timings.
public override float TimestampPeriod { get; }
Property Value¶
ValidationErrorCount¶
How many warnings and errors the API's validation layer has reported; tests fail on any.
public override int ValidationErrorCount { get; }
Property Value¶
VulkanBindless¶
The bindless heap as a Vulkan one: the descriptor set and the pipeline layout.
public VulkanBindlessHeap VulkanBindless { get; }
Property Value¶
Methods¶
Create(VulkanInstance, GraphicsDeviceOptions?)¶
Creates the device on an instance the caller keeps (the caller disposes the instance after the device). A surface is made for the window, if there is one.
public static VulkanDevice Create(VulkanInstance instance, GraphicsDeviceOptions? options = null)
Parameters¶
instance VulkanInstance
options GraphicsDeviceOptions?
Returns¶
CreateBuffer(ulong, BufferUsage, MemoryKind, string?)¶
public override GpuBuffer CreateBuffer(ulong size, BufferUsage usage, MemoryKind kind = MemoryKind.DeviceLocal, string? name = null)
Parameters¶
size ulong
usage BufferUsage
kind MemoryKind
name string?
Returns¶
CreateComputePipeline(in ShaderCode, string?)¶
public override Pipeline CreateComputePipeline(in ShaderCode shader, string? name = null)
Parameters¶
shader ShaderCode
name string?
Returns¶
CreateFrameLoop(Swapchain?, int, int)¶
The loop that records and submits frames, to swapchain or headless.
public override FrameLoop CreateFrameLoop(Swapchain? swapchain = null, int framesInFlight = 2, int arenaBytes = 4194304)
Parameters¶
swapchain Swapchain?
framesInFlight int
arenaBytes int
Returns¶
CreateGraphicsPipeline(GraphicsPipelineDescription, string?)¶
public override Pipeline CreateGraphicsPipeline(GraphicsPipelineDescription description, string? name = null)
Parameters¶
description GraphicsPipelineDescription
name string?
Returns¶
CreateImage(in ImageDescription, string?)¶
public override GpuImage CreateImage(in ImageDescription description, string? name = null)
Parameters¶
description ImageDescription
name string?
Returns¶
CreateSampler(in SamplerDescription, string?)¶
public override GpuSampler CreateSampler(in SamplerDescription description, string? name = null)
Parameters¶
description SamplerDescription
name string?
Returns¶
CreateSwapchain(bool)¶
A swapchain for the window the device was created for.
public override Swapchain CreateSwapchain(bool vsync = true)
Parameters¶
vsync bool
Returns¶
Dispose()¶
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public override void Dispose()
EnumeratePhysicalDevices(VulkanInstance, VkSurfaceKHR)¶
Lists the GPUs the loader reports, with whether each meets the baseline.
public static PhysicalDeviceInfo[] EnumeratePhysicalDevices(VulkanInstance instance, VkSurfaceKHR surface = default)
Parameters¶
instance VulkanInstance
surface VkSurfaceKHR
Returns¶
SetDebugName(VkObjectType, ulong, string)¶
Names an object for the validation layer and capture tools (RenderDoc, Nsight). Does nothing without VK_EXT_debug_utils.
public void SetDebugName(VkObjectType type, ulong handle, string name)
Parameters¶
type VkObjectType
handle ulong
name string
TakeValidationErrors()¶
Takes the validation messages reported so far.
public override string[] TakeValidationErrors()
Returns¶
string[]
WaitIdle()¶
public override void WaitIdle()