Device
- Namespace: Turian.Engine.Core
- Source File: Device.Creation.cs, Device.cs, Device.Queries.cs
Properties
Instance
(Instance): Gets the Vulkan instance associated with this device.
VkDevice
(Silk.NET.Vulkan.Device): Gets the Vulkan device.
Surface
(SurfaceKHR): Gets the surface associated with this device.
VkPhysicalDevice
(PhysicalDevice): Gets the physical device associated with this device.
DeviceName
(string): Gets the name of the Vulkan device.
MaxSamplerAnisotropy
(float): Gets the largest anisotropy value the device accepts on a sampler. Anisotropic filtering is always enabled — IsDeviceSuitable rejects devices that do not support it.
DeviceLocalMemoryBytes
(ulong): Gets the total size of the device-local memory heaps, in bytes — the VRAM a discrete GPU reports, or the share of system memory an integrated one exposes.
MsaaSamples
(SampleCountFlags): Gets the MSAA (Multi-Sample Anti-Aliasing) sample count.
GraphicsFamilyIndex
(uint): Gets the index of the graphics family queue.
GraphicsQueue
(Queue): Gets the graphics queue associated with this device.
PresentQueue
(Queue): Gets the present queue associated with this device.
CommandPool
(CommandPool): Gets the command pool associated with this device.
FindQueueFamilies
(QueueFamilyIndices): Gets the queue families found for this device.
QuerySwapChainSupport
(SwapChainSupportDetails): Gets the swap chain support details for this device.
Public Methods
GetProperties
public PhysicalDeviceProperties GetProperties()
Gets the properties of the physical device.
Returns: PhysicalDeviceProperties
- The properties of the physical device.
CopyBuffer
public void CopyBuffer(Silk.NET.Vulkan.Buffer srcBuffer, Silk.NET.Vulkan.Buffer dstBuffer, ulong size)
Copies data from one buffer to another.
Parameters:
srcBuffer(Silk.NET.Vulkan.Buffer): The source buffer.dstBuffer(Silk.NET.Vulkan.Buffer): The destination buffer.size(ulong): The size of the data to copy.
CreateBuffer
public void CreateBuffer(ulong size, BufferUsageFlags usage, MemoryPropertyFlags properties, Silk.NET.Vulkan.Buffer buffer, DeviceMemory bufferMemory)
Creates a buffer with the specified size, usage, and memory properties.
Parameters:
size(ulong): The size of the buffer.usage(BufferUsageFlags): The buffer usage flags.properties(MemoryPropertyFlags): The memory properties.buffer(Silk.NET.Vulkan.Buffer): The created buffer.bufferMemory(DeviceMemory): The memory for the buffer.
FindDepthFormat
public Format FindDepthFormat()
Finds the depth format supported by the device.
Returns: Format
- The supported depth format.
CreateImage2D
public void CreateImage2D(uint width, uint height, uint mipLevels, Format format, ImageTiling tiling, ImageUsageFlags usage, MemoryPropertyFlags properties, Image image, DeviceMemory memory)
Creates a 2D Vulkan image with backing device memory bound. Used by the texture pipeline; samplers and image views are created separately by Texture.
Parameters:
width(uint)height(uint)mipLevels(uint)format(Format)tiling(ImageTiling)usage(ImageUsageFlags)properties(MemoryPropertyFlags)image(Image)memory(DeviceMemory)
TransitionImageLayout
public void TransitionImageLayout(Image image, ImageLayout oldLayout, ImageLayout newLayout, uint mipLevels)
Issues a layout transition pipeline barrier for the entire image (all mip levels). Supports Undefined→TransferDstOptimal and TransferDstOptimal→ShaderReadOnlyOptimal — the two transitions a staged texture upload needs.
Parameters:
image(Image)oldLayout(ImageLayout)newLayout(ImageLayout)mipLevels(uint)
CopyBufferToImage
public void CopyBufferToImage(Silk.NET.Vulkan.Buffer src, Image dst, uint width, uint height)
Copies a tightly-packed buffer into mip 0 of a 2D image. The image must already be in TransferDstOptimal.
Parameters:
src(Silk.NET.Vulkan.Buffer)dst(Image)width(uint)height(uint)
GenerateMipmaps
public void GenerateMipmaps(Image image, uint width, uint height, uint mipLevels)
Fills mip levels 1..mipLevels-1 by successively halving the level above with vkCmdBlitImage, and leaves the whole image in ShaderReadOnlyOptimal. The image must be in TransferDstOptimal with level 0 already uploaded, and its format must support linear blitting — check with SupportsFormat first, as block-compressed formats do not.
Parameters:
image(Image): The image to fill.width(uint): Width of mip level 0.height(uint): Height of mip level 0.mipLevels(uint): Total level count, including level 0.
SupportsFormat
public bool SupportsFormat(Format format, FormatFeatureFlags features, ImageTiling tiling)
Reports whether the physical device offers features for format at the given tiling. Used to check block-compressed sampling support before creating a BC texture, and linear-blit support before generating mips.
Parameters:
format(Format): The format to query.features(FormatFeatureFlags): The required format features.tiling(ImageTiling): The image tiling the format will be used with.
Returns: bool
FindMemoryType
public uint FindMemoryType(uint typeFilter, MemoryPropertyFlags properties)
Finds a suitable memory type for the specified type filter and memory properties.
Parameters:
typeFilter(uint): The type filter.properties(MemoryPropertyFlags): The memory properties.
Returns: uint
- The memory type index.
Dispose
public void Dispose()