Header menu logo Nu

Hl Module

High-level vulkan operations.

Functions and values

Function or value Description

Hl.allocateCommandBuffer commandBufferLevel commandPool

Full Usage: Hl.allocateCommandBuffer commandBufferLevel commandPool

Parameters:
Returns: VkCommandBuffer

Allocate a command buffer.

commandBufferLevel : VkCommandBufferLevel
commandPool : VkCommandPool
Returns: VkCommandBuffer

Hl.allocateCommandBuffers count commandBufferLevel commandPool

Full Usage: Hl.allocateCommandBuffers count commandBufferLevel commandPool

Parameters:
Returns: VkCommandBuffer array

Allocate an array of command buffers.

count : int
commandBufferLevel : VkCommandBufferLevel
commandPool : VkCommandPool
Returns: VkCommandBuffer array

Hl.check result

Full Usage: Hl.check result

Parameters:

Check the given Vulkan operation result, logging on non-Success.

result : VkResult

Hl.checkAttachmentFormat vkPhysicalDevice format

Full Usage: Hl.checkAttachmentFormat vkPhysicalDevice format

Parameters:
Returns: ImageFormat

Check if an image format is supported for attachments, falling back to a standard format where possible.

vkPhysicalDevice : VkPhysicalDevice
format : ImageFormat
Returns: ImageFormat

Hl.clipRect bounds rect

Full Usage: Hl.clipRect bounds rect

Parameters:
Returns: VkRect2D

Clip a VkRect2D within the bounds of another.

bounds : VkRect2D
rect : VkRect2D
Returns: VkRect2D

Hl.createFence createSignaled

Full Usage: Hl.createFence createSignaled

Parameters:
    createSignaled : bool

Returns: VkFence

Create a fence. TODO: create matching destroy fn and use that?

createSignaled : bool
Returns: VkFence

Hl.createImageView pixelFormat vkFormat mipLevel mipCount layer layerCount viewType imageAspect image

Full Usage: Hl.createImageView pixelFormat vkFormat mipLevel mipCount layer layerCount viewType imageAspect image

Parameters:
Returns: VkImageView

Create an image view.

pixelFormat : PixelFormat
vkFormat : VkFormat
mipLevel : int
mipCount : int
layer : int
layerCount : int
viewType : VkImageViewType
imageAspect : VkImageAspectFlags
image : VkImage
Returns: VkImageView

Hl.createSemaphore ()

Full Usage: Hl.createSemaphore ()

Parameters:
    () : unit

Returns: VkSemaphore

Create a semaphore. TODO: create matching destroy fn and use that?

() : unit
Returns: VkSemaphore

Hl.createSurface tryCreateVulkanSurface window instance

Full Usage: Hl.createSurface tryCreateVulkanSurface window instance

Parameters:
    tryCreateVulkanSurface : 'a -> 'b -> VkSurfaceKHR option
    window : 'a
    instance : 'b

Create a vulkan surface, waiting for app to enter foreground when necessary.

tryCreateVulkanSurface : 'a -> 'b -> VkSurfaceKHR option
window : 'a
instance : 'b

Hl.createTransientCommandBuffer commandPool

Full Usage: Hl.createTransientCommandBuffer commandPool

Parameters:
Returns: VkCommandBuffer

Create a transient command buffer. TODO: create matching destroy fn and use that?

commandPool : VkCommandPool
Returns: VkCommandBuffer

Hl.destroySurface ()

Full Usage: Hl.destroySurface ()

Parameters:
    () : unit

Destroy any existing Vulkan surface, and upon success, inform the backgrounding callback that the required teardown of presentation is complete.

() : unit

Hl.detectTextureCompressionDds dds

Full Usage: Hl.detectTextureCompressionDds dds

Parameters:
Returns: bool

Detect that a dds file uses a compressed representation.

dds : DdsFile
Returns: bool

Hl.detectTextureCompressionKtx ktx

Full Usage: Hl.detectTextureCompressionKtx ktx

Parameters:
Returns: bool

Detect that a ktx file uses a compressed representation.

ktx : KtxFile
Returns: bool

Hl.findMemoryType typeFilter properties physicalDevice

Full Usage: Hl.findMemoryType typeFilter properties physicalDevice

Parameters:
Returns: uint

Find a suitable memory type for a buffer or image.

typeFilter : uint32
properties : VkMemoryPropertyFlags
physicalDevice : VkPhysicalDevice
Returns: uint

Hl.formatCompressedPfdds minimal dds

Full Usage: Hl.formatCompressedPfdds minimal dds

Parameters:
    minimal : bool
    dds : Dds

Returns: Vector2i * byte[] * (Vector2i * byte[]) array

Format compressed pfim image data.

minimal : bool
dds : Dds
Returns: Vector2i * byte[] * (Vector2i * byte[]) array

Hl.formatUncompressedPfimageMipmap format mipmap data

Full Usage: Hl.formatUncompressedPfimageMipmap format mipmap data

Parameters:
Returns: Vector2i * byte[]

Format an uncompressed pfim image mipmap.

format : ImageFormat
mipmap : MipMapOffset
data : byte array
Returns: Vector2i * byte[]

Hl.getBufferMemoryCount ()

Full Usage: Hl.getBufferMemoryCount ()

Parameters:
    () : unit

Returns: int64

Get the buffer memory usage.

() : unit
Returns: int64

Hl.getDrawCallCount ()

Full Usage: Hl.getDrawCallCount ()

Parameters:
    () : unit

Returns: int

Get the running number of draw calls.

() : unit
Returns: int

Hl.getDrawInstanceCount ()

Full Usage: Hl.getDrawInstanceCount ()

Parameters:
    () : unit

Returns: int

Get the running number of draw calls.

() : unit
Returns: int

Hl.getDrawScopeCount ()

Full Usage: Hl.getDrawScopeCount ()

Parameters:
    () : unit

Returns: int

Get the running number of draw scopes.

() : unit
Returns: int

Hl.getExtensionName extensionProps

Full Usage: Hl.getExtensionName extensionProps

Parameters:
Returns: string

Convert VkExtensionProperties.extensionName to a string. TODO: see if we can inline functions like these once F# supports C#'s representation of this fixed buffer type.

extensionProps : VkExtensionProperties
Returns: string

Hl.getImageMemoryCount ()

Full Usage: Hl.getImageMemoryCount ()

Parameters:
    () : unit

Returns: int64

Get the image memory usage.

() : unit
Returns: int64

Hl.getLayerName layerProps

Full Usage: Hl.getLayerName layerProps

Parameters:
Returns: string

Convert VkLayerProperties.layerName to a string.

layerProps : VkLayerProperties
Returns: string

Hl.inferTextureCompressible filePath

Full Usage: Hl.inferTextureCompressible filePath

Parameters:
    filePath : string

Returns: bool

Infer whether the texture at the given file path may be compressed.

filePath : string
Returns: bool

Hl.inferTextureCompression filePath

Full Usage: Hl.inferTextureCompression filePath

Parameters:
    filePath : string

Returns: TextureCompression

Infer the type of block compression that an asset with the given file path should utilize.

filePath : string
Returns: TextureCompression

Hl.inferTextureFiltered2d filePath

Full Usage: Hl.inferTextureFiltered2d filePath

Parameters:
    filePath : string

Returns: bool

Infer that an asset with the given file path should be filtered in a 2D rendering context.

filePath : string
Returns: bool

Hl.loseSurface ()

Full Usage: Hl.loseSurface ()

Parameters:
    () : unit

Make the surface state reflect the loss of the surface.

() : unit

Hl.makeBlendAttachment blendDataOpt

Full Usage: Hl.makeBlendAttachment blendDataOpt

Parameters:
Returns: VkPipelineColorBlendAttachmentState

Make a VkPipelineColorBlendAttachmentState.

blendDataOpt : (VkBlendFactor * VkBlendFactor * VkBlendFactor * VkBlendFactor) option
Returns: VkPipelineColorBlendAttachmentState

Hl.makeBlit srcMipLevel dstMipLevel srcLayer dstLayer srcRect dstRect

Full Usage: Hl.makeBlit srcMipLevel dstMipLevel srcLayer dstLayer srcRect dstRect

Parameters:
    srcMipLevel : int
    dstMipLevel : int
    srcLayer : int
    dstLayer : int
    srcRect : VkRect2D
    dstRect : VkRect2D

Returns: VkImageBlit

Make a VkImageBlit.

srcMipLevel : int
dstMipLevel : int
srcLayer : int
dstLayer : int
srcRect : VkRect2D
dstRect : VkRect2D
Returns: VkImageBlit

Hl.makeComponentMapping pixelFormat

Full Usage: Hl.makeComponentMapping pixelFormat

Parameters:
Returns: VkComponentMapping

Make a VkComponentMapping.

pixelFormat : PixelFormat
Returns: VkComponentMapping

Hl.makeDescriptorBinding binding descriptorType descriptorCount shaderStage

Full Usage: Hl.makeDescriptorBinding binding descriptorType descriptorCount shaderStage

Parameters:
Returns: VkDescriptorSetLayoutBinding

Make a VkDescriptorSetLayoutBinding.

binding : int
descriptorType : DescriptorType
descriptorCount : int
shaderStage : ShaderStage
Returns: VkDescriptorSetLayoutBinding

Hl.makePushConstantRange offset size shaderStage

Full Usage: Hl.makePushConstantRange offset size shaderStage

Parameters:
Returns: VkPushConstantRange

Make a VkPushConstantRange.

offset : int
size : int
shaderStage : ShaderStage
Returns: VkPushConstantRange

Hl.makeSubresourceLayers mipLevel layer imageAspect

Full Usage: Hl.makeSubresourceLayers mipLevel layer imageAspect

Parameters:
Returns: VkImageSubresourceLayers

Make a VkImageSubresourceLayers representing a color image.

mipLevel : int
layer : int
imageAspect : VkImageAspectFlags
Returns: VkImageSubresourceLayers

Hl.makeSubresourceRange mipLevel mipCount layer layerCount imageAspect

Full Usage: Hl.makeSubresourceRange mipLevel mipCount layer layerCount imageAspect

Parameters:
    mipLevel : int
    mipCount : int
    layer : int
    layerCount : int
    imageAspect : VkImageAspectFlags

Returns: VkImageSubresourceRange

Make a VkImageSubresourceRange representing a color image.

mipLevel : int
mipCount : int
layer : int
layerCount : int
imageAspect : VkImageAspectFlags
Returns: VkImageSubresourceRange

Hl.makeVertexAttribute location binding format offset

Full Usage: Hl.makeVertexAttribute location binding format offset

Parameters:
Returns: VkVertexInputAttributeDescription

Make a VkVertexInputAttributeDescription.

location : int
binding : int
format : VertexAttribFormat
offset : int
Returns: VkVertexInputAttributeDescription

Hl.makeVertexBinding binding stride inputRate

Full Usage: Hl.makeVertexBinding binding stride inputRate

Parameters:
Returns: VkVertexInputBindingDescription

Make a VkVertexInputBindingDescription.

binding : int
stride : int
inputRate : VkVertexInputRate
Returns: VkVertexInputBindingDescription

Hl.makeViewport invertY rect

Full Usage: Hl.makeViewport invertY rect

Parameters:
Returns: VkViewport

Make a VkViewport.

invertY : bool
rect : VkRect2D
Returns: VkViewport

Hl.recordCopyBufferToImage commandBuffer width height mipLevel layer vkBuffer vkImage

Full Usage: Hl.recordCopyBufferToImage commandBuffer width height mipLevel layer vkBuffer vkImage

Parameters:

Record command to copy buffer to image.

commandBuffer : VkCommandBuffer
width : int
height : int
mipLevel : int
layer : int
vkBuffer : VkBuffer
vkImage : VkImage

Hl.recordGenerateMipmaps commandBuffer width height mipLevels layer vkImage

Full Usage: Hl.recordGenerateMipmaps commandBuffer width height mipLevels layer vkImage

Parameters:

Record commands to generate mipmaps.

commandBuffer : VkCommandBuffer
width : int
height : int
mipLevels : int
layer : int
vkImage : VkImage

Hl.recordTransitionLayout allLevels mipNumber layer layerCount imageAspect oldLayout newLayout vkImage commandBuffer

Full Usage: Hl.recordTransitionLayout allLevels mipNumber layer layerCount imageAspect oldLayout newLayout vkImage commandBuffer

Parameters:

Record command to transition image layout.

allLevels : bool
mipNumber : int
layer : int
layerCount : int
imageAspect : VkImageAspectFlags
oldLayout : ImageLayout
newLayout : ImageLayout
vkImage : VkImage
commandBuffer : VkCommandBuffer

Hl.reportBufferMemoryChange bytes

Full Usage: Hl.reportBufferMemoryChange bytes

Parameters:
    bytes : int64

Report the fact that buffer memory usage has been changed.

bytes : int64

Hl.reportDrawCall drawInstances drawScope

Full Usage: Hl.reportDrawCall drawInstances drawScope

Parameters:
    drawInstances : int
    drawScope : bool

Report the fact that a draw call has just been made with the given number of instances.

drawInstances : int
drawScope : bool

Hl.reportDrawScope ()

Full Usage: Hl.reportDrawScope ()

Parameters:
    () : unit

Report the fact that a draw call has just been made with the given number of instances.

() : unit

Hl.reportImageMemoryChange bytes

Full Usage: Hl.reportImageMemoryChange bytes

Parameters:
    bytes : int64

Report the fact that image memory usage has been changed.

bytes : int64

Hl.resetDrawCounters ()

Full Usage: Hl.resetDrawCounters ()

Parameters:
    () : unit

Reset the running counts of draw events.

() : unit

Hl.supportsAttachment vkPhysicalDevice format

Full Usage: Hl.supportsAttachment vkPhysicalDevice format

Parameters:
Returns: bool

Determine whether format is supported for use as an attachment.

vkPhysicalDevice : VkPhysicalDevice
format : ImageFormat
Returns: bool

Hl.tryCompileShader shaderPath shaderKind

Full Usage: Hl.tryCompileShader shaderPath shaderKind

Parameters:
Returns: Either<string, byte[]>

Try to compile GLSL file to SPIR-V code.

shaderPath : string
shaderKind : Nullable<ShaderKind>
Returns: Either<string, byte[]>

Hl.tryCompressImage image

Full Usage: Hl.tryCompressImage image

Parameters:
Returns: (Vector2i * byte array) option

Attempt to compress a MagickImage to astc bytes.

image : MagickImage
Returns: (Vector2i * byte array) option

Hl.tryCompressMipmaps image

Full Usage: Hl.tryCompressMipmaps image

Parameters:
Returns: (Vector2i * byte array) list option

Attempt to compress astc mipmap bytes from a MagickImage.

image : MagickImage
Returns: (Vector2i * byte array) list option

Hl.tryCreateShaderModuleFromGlsl shaderPath shaderKind

Full Usage: Hl.tryCreateShaderModuleFromGlsl shaderPath shaderKind

Parameters:
Returns: Either<string, VkShaderModule>

Try to create a shader module from a GLSL file. TODO: create matching destroy fn and use that?

shaderPath : string
shaderKind : Nullable<ShaderKind>
Returns: Either<string, VkShaderModule>

Hl.tryCreateVkSwapchain surfaceFormat graphicsQueueFamily presentQueueFamily vkPhysicalDevice

Full Usage: Hl.tryCreateVkSwapchain surfaceFormat graphicsQueueFamily presentQueueFamily vkPhysicalDevice

Parameters:
Returns: (VkSwapchainKHR * VkExtent2D) option

Attempt to create a vulkan swapchain.

surfaceFormat : VkSurfaceFormatKHR
graphicsQueueFamily : uint32
presentQueueFamily : uint32
vkPhysicalDevice : VkPhysicalDevice
Returns: (VkSwapchainKHR * VkExtent2D) option

Hl.tryFormatUncompressedPfimage minimal image

Full Usage: Hl.tryFormatUncompressedPfimage minimal image

Parameters:
    minimal : bool
    image : IImage

Returns: (Vector2i * byte[] * (Vector2i * byte[]) array) option

Attempt to format an uncompressed pfim image.

minimal : bool
image : IImage
Returns: (Vector2i * byte[] * (Vector2i * byte[]) array) option

Hl.tryFormatUncompressedPfimageTexture format height stride data

Full Usage: Hl.tryFormatUncompressedPfimageTexture format height stride data

Parameters:
    format : ImageFormat
    height : int
    stride : int
    data : byte array

Returns: byte[] option

Attempt to format an uncompressed pfim image texture (non-mipmap).

format : ImageFormat
height : int
stride : int
data : byte array
Returns: byte[] option

Hl.tryGenerateUncompressedImage image

Full Usage: Hl.tryGenerateUncompressedImage image

Parameters:
Returns: (Vector2i * byte[]) option

Attempt to generate uncompressed astc bytes from a MagickImage.

image : MagickImage
Returns: (Vector2i * byte[]) option

Hl.tryGenerateUncompressedMipmaps image

Full Usage: Hl.tryGenerateUncompressedMipmaps image

Parameters:
Returns: (Vector2i * byte[]) list option

Attempt to generate uncompressed astc mipmap bytes from a MagickImage.

image : MagickImage
Returns: (Vector2i * byte[]) list option

Hl.tryGetPresentModes device

Full Usage: Hl.tryGetPresentModes device

Parameters:
Returns: VkPresentModeKHR array option

Attempt to get the available vulkan present modes.

device : VkPhysicalDevice
Returns: VkPresentModeKHR array option

Hl.tryGetSurfaceCapabilities vkPhysicalDevice

Full Usage: Hl.tryGetSurfaceCapabilities vkPhysicalDevice

Parameters:
Returns: VkSurfaceCapabilitiesKHR option

Attempt to get surface capabilities.

vkPhysicalDevice : VkPhysicalDevice
Returns: VkSurfaceCapabilitiesKHR option

Hl.tryRecreateSurface window instance

Full Usage: Hl.tryRecreateSurface window instance

Parameters:
Returns: 'b -> unit

Attempt to recreate the vulkan surface.

window : 'a -> 'b -> VkSurfaceKHR option
instance : 'a
Returns: 'b -> unit

Hl.validateRect rect

Full Usage: Hl.validateRect rect

Parameters:
Returns: bool

Check that VkRect2D has non-zero area.

rect : VkRect2D
Returns: bool

Hl.withRenderingInfo colorAttachments depthAttachmentOpt renderArea loadOperation action

Full Usage: Hl.withRenderingInfo colorAttachments depthAttachmentOpt renderArea loadOperation action

Parameters:
Returns: 'a

Make a VkRenderingInfo and utilize within the given scope for memory safety.

colorAttachments : VkImageView array
depthAttachmentOpt : VkImageView option
renderArea : VkRect2D
loadOperation : LoadOperation
action : VkRenderingInfo -> 'a
Returns: 'a

Hl.writeKtxHeader resolution mipmapLevels compressed writer

Full Usage: Hl.writeKtxHeader resolution mipmapLevels compressed writer

Parameters:

Write the binary header of a ktx file. Implementation based on https://registry.khronos.org/KTX/specs/1.0/ktxspec.v1.html

resolution : Vector2i
mipmapLevels : int
compressed : bool
writer : BinaryWriter

Type something to start searching.