HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulevulkan-3.27GHC2021

Vulkan.Core11.Promoted_From_VK_KHR_maintenance1

  • 6 types
  • 1 value
  • Packagevulkan-3.27
  • Exports99
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourcePromoted_From_VK_KHR_maintenance1.hs
valuetrimCommandPool
  1. :: MonadIO io
  2. => Device

    device is the logical device that owns the command pool.

  3. -> CommandPool

    commandPool is the command pool to trim.

  4. -> CommandPoolTrimFlags

    flags is reserved for future use.

  5. -> io ()
#

vkTrimCommandPool - Trim a command pool

Description

Trimming a command pool recycles unused memory from the command pool back to the system. Command buffers allocated from the pool are not affected by the command.

This command provides applications with some control over the internal memory allocations used by command pools.

Unused memory normally arises from command buffers that have been recorded and later reset, such that they are no longer using the memory. On reset, a command buffer can return memory to its command pool, but the only way to release memory from a command pool to the system requires calling resetCommandPool, which cannot be executed while any command buffers from that pool are still in use. Subsequent recording operations into command buffers will reuse this memory but since total memory requirements fluctuate over time, unused memory can accumulate.

In this situation, trimming a command pool may be useful to return unused memory back to the system, returning the total outstanding memory allocated by the pool back to a more “average” value.

Implementations utilize many internal allocation strategies that make it impossible to guarantee that all unused memory is released back to the system. For instance, an implementation of a command pool may involve allocating memory in bulk from the system and sub-allocating from that memory. In such an implementation any live command buffer that holds a reference to a bulk allocation would prevent that allocation from being freed, even if only a small proportion of the bulk allocation is in use.

In most cases trimming will result in a reduction in allocated but unused memory, but it does not guarantee the “ideal” behavior.

Trimming may be an expensive operation, and should not be called frequently. Trimming should be treated as a way to relieve memory pressure after application-known points when there exists enough unused memory that the cost of trimming is “worth” it.

Valid Usage (Implicit)

  • device must be a valid Device handle

  • commandPool must be a valid CommandPool handle

  • flags must be 0

  • commandPool must have been created, allocated, or retrieved from device

Host Synchronization

  • Host access to commandPool must be externally synchronized

See Also

VK_KHR_maintenance1, VK_VERSION_1_1, CommandPool, CommandPoolTrimFlags, Device

newtypenewtype CommandPoolTrimFlags
#

VkCommandPoolTrimFlags - Reserved for future use

Description

CommandPoolTrimFlags is a bitmask type for setting a mask, but is currently reserved for future use.

See Also

VK_KHR_maintenance1, VK_VERSION_1_1, Flags, trimCommandPool, trimCommandPool

Instances8Eq, Ord, Read, Show, Bits, FiniteBits, …
newtypenewtype Result
#

VkResult - Vulkan command return codes

Description

  • SUCCESS Command successfully completed

If a command returns a runtime error, unless otherwise specified any output parameters will have undefined contents, except that if the output parameter is a structure with sType and pNext fields, those fields will be unmodified. Any structures chained from pNext will also have undefined contents, except that sType and pNext will be unmodified.

VK_ERROR_OUT_OF_*_MEMORY errors do not modify any currently existing Vulkan objects. Objects that have already been successfully created can still be used by the application.

As a general rule, Free, Release, and Reset commands do not return ERROR_OUT_OF_HOST_MEMORY, while any other command with a return code may return it. Any exceptions from this rule are described for those commands.

ERROR_UNKNOWN will be returned by an implementation when an unexpected error occurs that cannot be attributed to valid behavior of the application and implementation. Under these conditions, it may be returned from any command returning a Result.

ERROR_UNKNOWN is not expected to ever be returned if the application behavior is valid, and if the implementation is bug-free. If ERROR_UNKNOWN is returned, the application should be checked against the latest validation layers to verify correct behavior as much as possible. If no issues are identified it could be an implementation issue, and the implementor should be contacted for support.

Any command returning a Result may return ERROR_VALIDATION_FAILED if a violation of valid usage is detected.

Performance-critical commands generally do not have return codes. If a runtime error occurs in such commands, the implementation will defer reporting the error until a specified point. For commands that record into command buffers (vkCmd*) runtime errors are reported by endCommandBuffer.

See Also

VK_VERSION_1_0, BindMemoryStatus, PresentInfoKHR

Constructors

Instances6Eq, Ord, Read, Show, Storable, Zero
  • Eq ResultDefined in vulkan-3.27 · Vulkan.Core10.Enums.Result
  • Ord ResultDefined in vulkan-3.27 · Vulkan.Core10.Enums.Result
  • Read ResultDefined in vulkan-3.27 · Vulkan.Core10.Enums.Result
  • Show ResultDefined in vulkan-3.27 · Vulkan.Core10.Enums.Result
  • Storable ResultDefined in vulkan-3.27 · Vulkan.Core10.Enums.Result
  • Zero ResultDefined in vulkan-3.27 · Vulkan.Core10.Enums.Result
newtypenewtype ImageCreateFlagBits
#

VkImageCreateFlagBits - Bitmask specifying additional parameters of an image

Description

See Sparse Resource Features and Sparse Physical Device Features for more details.

See Also

VK_VERSION_1_0, ImageCreateFlags

Instances8Eq, Ord, Read, Show, Bits, FiniteBits, …
newtypenewtype FormatFeatureFlagBits
#

VkFormatFeatureFlagBits - Bitmask specifying features supported by a buffer

Description

These values all have the same meaning as the equivalently named values for FormatFeatureFlags2 and may be set in linearTilingFeatures, optimalTilingFeatures, and DrmFormatModifierPropertiesEXT::drmFormatModifierTilingFeatures, specifying that the features are supported by images or image views or sampler Y′CBCR conversion objects created with the queried getPhysicalDeviceFormatProperties::format:

The following bits may be set in bufferFeatures, specifying that the features are supported by buffers or buffer views created with the queried getPhysicalDeviceFormatProperties::format:

FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT and FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT are only intended to be advertised for single-component formats, since SPIR-V atomic operations require a scalar type.

See Also

VK_VERSION_1_0, FormatFeatureFlags

Instances8Eq, Ord, Read, Show, Bits, FiniteBits, …