vulkan
Safe HaskellNone
LanguageHaskell2010

Vulkan.Core10.Image

Synopsis

Documentation

createImage Source #

Arguments

:: forall (a :: [Type]) io. (Extendss ImageCreateInfo a, PokeChain a, MonadIO io) 
=> Device

device is the logical device that creates the image.

-> ImageCreateInfo a

pCreateInfo is a pointer to a ImageCreateInfo structure containing parameters to be used to create the image.

-> ("allocator" ::: Maybe AllocationCallbacks)

pAllocator controls host memory allocation as described in the Memory Allocation chapter.

-> io Image 

vkCreateImage - Create a new image object

Valid Usage

Valid Usage (Implicit)

  • device must be a valid Device handle
  • pCreateInfo must be a valid pointer to a valid ImageCreateInfo structure
  • If pAllocator is not NULL, pAllocator must be a valid pointer to a valid AllocationCallbacks structure
  • pImage must be a valid pointer to a Image handle
  • The device must have been created with at least 1 queue

Return Codes

Success
Failure

See Also

VK_VERSION_1_0, AllocationCallbacks, Device, Image, ImageCreateInfo

withImage :: forall (a :: [Type]) io r. (Extendss ImageCreateInfo a, PokeChain a, MonadIO io) => Device -> ImageCreateInfo a -> Maybe AllocationCallbacks -> (io Image -> (Image -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to createImage and destroyImage

To ensure that destroyImage is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

destroyImage Source #

Arguments

:: MonadIO io 
=> Device

device is the logical device that destroys the image.

-> Image

image is the image to destroy.

-> ("allocator" ::: Maybe AllocationCallbacks)

pAllocator controls host memory allocation as described in the Memory Allocation chapter.

-> io () 

vkDestroyImage - Destroy an image object

Valid Usage

  • All submitted commands that refer to image, either directly or via a ImageView, must have completed execution

Valid Usage (Implicit)

  • device must be a valid Device handle
  • If image is not NULL_HANDLE, image must be a valid Image handle
  • If pAllocator is not NULL, pAllocator must be a valid pointer to a valid AllocationCallbacks structure
  • If image is a valid handle, it must have been created, allocated, or retrieved from device

Host Synchronization

  • Host access to image must be externally synchronized

See Also

VK_VERSION_1_0, AllocationCallbacks, Device, Image

getImageSubresourceLayout Source #

Arguments

:: MonadIO io 
=> Device

device is the logical device that owns the image.

-> Image

image is the image whose layout is being queried.

-> ImageSubresource

pSubresource is a pointer to a ImageSubresource structure selecting a specific image subresource from the image.

-> io SubresourceLayout 

vkGetImageSubresourceLayout - Retrieve information about an image subresource

Description

If the image is linear, then the returned layout is valid for host access.

If the image’s tiling is IMAGE_TILING_LINEAR and its format is a multi-planar format, then getImageSubresourceLayout describes one format plane of the image. If the image’s tiling is IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, then getImageSubresourceLayout describes one memory plane of the image. If the image’s tiling is IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT and the image is non-linear, then the returned layout has an implementation-dependent meaning; the vendor of the image’s DRM format modifier may provide documentation that explains how to interpret the returned layout.

getImageSubresourceLayout is invariant for the lifetime of a single image. However, the subresource layout of images in Android hardware buffer or QNX Screen buffer external memory is not known until the image has been bound to memory, so applications must not call getImageSubresourceLayout for such an image before it has been bound.

Valid Usage

Valid Usage (Implicit)

  • device must be a valid Device handle
  • image must be a valid Image handle
  • pSubresource must be a valid pointer to a valid ImageSubresource structure
  • pLayout must be a valid pointer to a SubresourceLayout structure
  • image must have been created, allocated, or retrieved from device

See Also

VK_VERSION_1_0, Device, Image, ImageSubresource, SubresourceLayout

data ImageCreateInfo (es :: [Type]) Source #

VkImageCreateInfo - Structure specifying the parameters of a newly created image object

Description

Images created with tiling equal to IMAGE_TILING_LINEAR have further restrictions on their limits and capabilities compared to images created with tiling equal to IMAGE_TILING_OPTIMAL. Creation of images with tiling IMAGE_TILING_LINEAR may not be supported unless other parameters meet all of the constraints:

Images created with one of the formats that require a sampler Y′CBCR conversion, have further restrictions on their limits and capabilities compared to images created with other formats. Creation of images with a format requiring Y′CBCR conversion may not be supported unless other parameters meet all of the constraints:

Images created with the IMAGE_USAGE_TILE_MEMORY_BIT_QCOM usage flag set have further restrictions on their limits and capabilities compared to images created without this flag. Creation of images with usage including IMAGE_USAGE_TILE_MEMORY_BIT_QCOM may not be supported unless parameters meet all of the constraints:

Implementations may support additional limits and capabilities beyond those listed above.

To determine the set of valid usage bits for a given format, call getPhysicalDeviceFormatProperties.

If the size of the resultant image would exceed maxResourceSize, then createImage must fail and return ERROR_OUT_OF_DEVICE_MEMORY. This failure may occur even when all image creation parameters satisfy their valid usage requirements.

If the implementation reports TRUE in PromotedStreamingTransfers.PhysicalDeviceHostImageCopyProperties'::identicalMemoryTypeRequirements, usage of IMAGE_USAGE_HOST_TRANSFER_BIT must not affect the memory type requirements of the image as described in Sparse Resource Memory Requirements and Resource Memory Association.

For images created without the IMAGE_CREATE_EXTENDED_USAGE_BIT flag set, a usage bit is valid if it is supported for the format the image is created with.

For images created with IMAGE_CREATE_EXTENDED_USAGE_BIT a usage bit is valid if it is supported for at least one of the formats a ImageView created from the image can have (see Image Views for more detail).

Image Creation Limits

Valid values for some image creation parameters are limited by a numerical upper bound or by inclusion in a bitset. For example, ImageCreateInfo::arrayLayers is limited by imageCreateMaxArrayLayers, defined below; and ImageCreateInfo::samples is limited by imageCreateSampleCounts, also defined below.

Several limiting values are defined below, as well as assisting values from which the limiting values are derived. The limiting values are referenced by the relevant valid usage statements of ImageCreateInfo.

Valid Usage

  • Each of the following values (as described in Image Creation Limits) must not be undefined : imageCreateMaxMipLevels, imageCreateMaxArrayLayers, imageCreateMaxExtent, and imageCreateSampleCounts

Valid Usage (Implicit)

See Also

VK_VERSION_1_0, DeviceImageMemoryRequirements, DeviceImageSubresourceInfo, Extent3D, Format, ImageCreateFlags, ImageFormatConstraintsInfoFUCHSIA, ImageLayout, ImageTiling, ImageType, ImageUsageFlags, SampleCountFlagBits, SharingMode, StructureType, createImage

Constructors

ImageCreateInfo 

Fields

Instances

Instances details
Extensible ImageCreateInfo Source # 
Instance details

Defined in Vulkan.Core10.Image

Methods

extensibleTypeName :: String Source #

getNext :: forall (es :: [Type]). ImageCreateInfo es -> Chain es Source #

setNext :: forall (ds :: [Type]) (es :: [Type]). ImageCreateInfo ds -> Chain es -> ImageCreateInfo es Source #

extends :: forall e b proxy. Typeable e => proxy e -> (Extends ImageCreateInfo e => b) -> Maybe b Source #

Show (Chain es) => Show (ImageCreateInfo es) Source # 
Instance details

Defined in Vulkan.Core10.Image

(Extendss ImageCreateInfo es, PeekChain es) => FromCStruct (ImageCreateInfo es) Source # 
Instance details

Defined in Vulkan.Core10.Image

(Extendss ImageCreateInfo es, PokeChain es) => ToCStruct (ImageCreateInfo es) Source # 
Instance details

Defined in Vulkan.Core10.Image

es ~ ('[] :: [Type]) => Zero (ImageCreateInfo es) Source # 
Instance details

Defined in Vulkan.Core10.Image

data SubresourceLayout Source #

VkSubresourceLayout - Structure specifying subresource layout

Description

If the image is linear, then rowPitch, arrayPitch and depthPitch describe the layout of the image subresource in linear memory. For uncompressed formats, rowPitch is the number of bytes between texels with the same x coordinate in adjacent rows (y coordinates differ by one). arrayPitch is the number of bytes between texels with the same x and y coordinate in adjacent array layers of the image (array layer values differ by one). depthPitch is the number of bytes between texels with the same x and y coordinate in adjacent slices of a 3D image (z coordinates differ by one). Expressed as an addressing formula, the starting byte of a texel in the image subresource has address:

// (x,y,z,layer) are in texel coordinates
address(x,y,z,layer) = layer*arrayPitch + z*depthPitch + y*rowPitch + x*elementSize + offset

For compressed formats, the rowPitch is the number of bytes between compressed texel blocks in adjacent rows. arrayPitch is the number of bytes between compressed texel blocks in adjacent array layers. depthPitch is the number of bytes between compressed texel blocks in adjacent slices of a 3D image.

// (x,y,z,layer) are in compressed texel block coordinates
address(x,y,z,layer) = layer*arrayPitch + z*depthPitch + y*rowPitch + x*compressedTexelBlockByteSize + offset;

The value of arrayPitch is undefined for images that were not created as arrays. depthPitch is defined only for 3D images.

If the image has a single-plane color format and its tiling is IMAGE_TILING_LINEAR , then the aspectMask member of ImageSubresource must be IMAGE_ASPECT_COLOR_BIT.

If the image has a depth/stencil format and its tiling is IMAGE_TILING_LINEAR , then aspectMask must be either IMAGE_ASPECT_DEPTH_BIT or IMAGE_ASPECT_STENCIL_BIT. On implementations that store depth and stencil aspects separately, querying each of these image subresource layouts will return a different offset and size representing the region of memory used for that aspect. On implementations that store depth and stencil aspects interleaved, the same offset and size are returned and represent the interleaved memory allocation.

If the image has a multi-planar format and its tiling is IMAGE_TILING_LINEAR , then the aspectMask member of ImageSubresource must be IMAGE_ASPECT_PLANE_0_BIT, IMAGE_ASPECT_PLANE_1_BIT, or (for 3-plane formats only) IMAGE_ASPECT_PLANE_2_BIT. Querying each of these image subresource layouts will return a different offset and size representing the region of memory used for that plane. If the image is disjoint, then the offset is relative to the base address of the plane. If the image is non-disjoint, then the offset is relative to the base address of the image.

If the image’s tiling is IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, then the aspectMask member of ImageSubresource must be one of VK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXT, where the maximum allowed plane index i is defined by the DrmFormatModifierPropertiesEXT::drmFormatModifierPlaneCount associated with the image’s ImageCreateInfo::format and modifier. The memory range used by the subresource is described by offset and size. If the image is disjoint, then the offset is relative to the base address of the memory plane. If the image is non-disjoint, then the offset is relative to the base address of the image. If the image is non-linear, then rowPitch, arrayPitch, and depthPitch have an implementation-dependent meaning.

See Also

VK_VERSION_1_0, DeviceSize, ImageDrmFormatModifierExplicitCreateInfoEXT, SubresourceLayout2, getImageSubresourceLayout

Constructors

SubresourceLayout 

Fields

  • offset :: DeviceSize

    offset is the byte offset from the start of the image or the plane where the image subresource begins.

  • size :: DeviceSize

    size is the size in bytes of the image subresource. size includes any extra memory that is required based on rowPitch.

  • rowPitch :: DeviceSize

    rowPitch describes the number of bytes between each row of texels in an image.

  • arrayPitch :: DeviceSize

    arrayPitch describes the number of bytes between each array layer of an image.

  • depthPitch :: DeviceSize

    depthPitch describes the number of bytes between each slice of 3D image.

Instances

Instances details
Eq SubresourceLayout Source # 
Instance details

Defined in Vulkan.Core10.Image

Storable SubresourceLayout Source # 
Instance details

Defined in Vulkan.Core10.Image

Show SubresourceLayout Source # 
Instance details

Defined in Vulkan.Core10.Image

FromCStruct SubresourceLayout Source # 
Instance details

Defined in Vulkan.Core10.Image

ToCStruct SubresourceLayout Source # 
Instance details

Defined in Vulkan.Core10.Image

Zero SubresourceLayout Source # 
Instance details

Defined in Vulkan.Core10.Image

newtype Image Source #

Constructors

Image Word64 

Instances

Instances details
Eq Image Source # 
Instance details

Defined in Vulkan.Core10.Handles

Methods

(==) :: Image -> Image -> Bool #

(/=) :: Image -> Image -> Bool #

Ord Image Source # 
Instance details

Defined in Vulkan.Core10.Handles

Methods

compare :: Image -> Image -> Ordering #

(<) :: Image -> Image -> Bool #

(<=) :: Image -> Image -> Bool #

(>) :: Image -> Image -> Bool #

(>=) :: Image -> Image -> Bool #

max :: Image -> Image -> Image #

min :: Image -> Image -> Image #

Storable Image Source # 
Instance details

Defined in Vulkan.Core10.Handles

Methods

sizeOf :: Image -> Int #

alignment :: Image -> Int #

peekElemOff :: Ptr Image -> Int -> IO Image #

pokeElemOff :: Ptr Image -> Int -> Image -> IO () #

peekByteOff :: Ptr b -> Int -> IO Image #

pokeByteOff :: Ptr b -> Int -> Image -> IO () #

peek :: Ptr Image -> IO Image #

poke :: Ptr Image -> Image -> IO () #

Show Image Source # 
Instance details

Defined in Vulkan.Core10.Handles

Methods

showsPrec :: Int -> Image -> ShowS #

show :: Image -> String #

showList :: [Image] -> ShowS #

HasObjectType Image Source # 
Instance details

Defined in Vulkan.Core10.Handles

IsHandle Image Source # 
Instance details

Defined in Vulkan.Core10.Handles

Zero Image Source # 
Instance details

Defined in Vulkan.Core10.Handles

Methods

zero :: Image Source #

newtype ImageLayout Source #

VkImageLayout - Layout of image and image subresources

Description

The type(s) of device access supported by each layout are:

The layout of each image subresource is not a state of the image subresource itself, but is rather a property of how the data in memory is organized, and thus for each mechanism of accessing an image in the API the application must specify a parameter or structure member that indicates which image layout the image subresource(s) are considered to be in when the image will be accessed. For transfer commands, this is a parameter to the command (see https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#clears and https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#copies). For use as a framebuffer attachment, this is a member in the substructures of the RenderPassCreateInfo (see Render Pass). For use in a descriptor set, this is a member in the DescriptorImageInfo structure (see https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#descriptorsets-updates).

If the unifiedImageLayouts feature is enabled, the IMAGE_LAYOUT_GENERAL image layout may be used in place of the other layouts where allowed with no loss of performance.

IMAGE_LAYOUT_GENERAL can be a useful catch-all image layout, but there are situations where a dedicated image layout must be used instead. Some examples include:

While IMAGE_LAYOUT_GENERAL suggests that all types of device access is possible, it does not mean that all patterns of memory accesses are safe in all situations. Common Render Pass Data Races outlines some situations where data races are unavoidable. For example, when a subresource is used as both an attachment and a sampled image (i.e., not an input attachment), enabling feedback loop adds extra guarantees which IMAGE_LAYOUT_GENERAL alone does not.

See Also

VK_VERSION_1_0, AttachmentDescription, AttachmentDescription2, AttachmentDescriptionStencilLayout, AttachmentReference, AttachmentReference2, AttachmentReferenceStencilLayout, BlitImageInfo2, CopyBufferToImageInfo2, CopyImageInfo2, CopyImageToBufferInfo2, PromotedStreamingTransfers.CopyImageToImageInfo', PromotedStreamingTransfers.CopyImageToMemoryInfo', CopyMemoryToImageIndirectInfoKHR, PromotedStreamingTransfers.CopyMemoryToImageInfo', DescriptorImageInfo, PromotedStreamingTransfers.HostImageLayoutTransitionInfo', ImageCreateInfo, ImageDescriptorInfoEXT, ImageMemoryBarrier, ImageMemoryBarrier2, PromotedStreamingTransfers.PhysicalDeviceHostImageCopyProperties', PhysicalDeviceVulkan14Properties, RenderingAttachmentInfo, RenderingFragmentDensityMapAttachmentInfoEXT, RenderingFragmentShadingRateAttachmentInfoKHR, ResolveImageInfo2, bindOpticalFlowSessionImageNV, cmdBindInvocationMaskHUAWEI, cmdBindShadingRateImageNV, cmdBlitImage, cmdClearColorImage, cmdClearDepthStencilImage, cmdCopyBufferToImage, cmdCopyImage, cmdCopyImageToBuffer, cmdCopyMemoryToImageIndirectNV, cmdResolveImage

Constructors

ImageLayout Int32 

Bundled Patterns

pattern IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT :: ImageLayout 
pattern IMAGE_LAYOUT_ATTACHMENT_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT :: ImageLayout 
pattern IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR :: ImageLayout 
pattern IMAGE_LAYOUT_GENERAL :: ImageLayout 
pattern IMAGE_LAYOUT_PREINITIALIZED :: ImageLayout 
pattern IMAGE_LAYOUT_PRESENT_SRC_KHR :: ImageLayout 
pattern IMAGE_LAYOUT_READ_ONLY_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_RENDERING_LOCAL_READ :: ImageLayout 
pattern IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_SHARED_PRESENT_KHR :: ImageLayout 
pattern IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_TENSOR_ALIASING_ARM :: ImageLayout 
pattern IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL :: ImageLayout 
pattern IMAGE_LAYOUT_UNDEFINED :: ImageLayout 
pattern IMAGE_LAYOUT_ZERO_INITIALIZED_EXT :: ImageLayout 

Instances

Instances details
Eq ImageLayout Source # 
Instance details

Defined in Vulkan.Core10.Enums.ImageLayout

Ord ImageLayout Source # 
Instance details

Defined in Vulkan.Core10.Enums.ImageLayout

Storable ImageLayout Source # 
Instance details

Defined in Vulkan.Core10.Enums.ImageLayout

Read ImageLayout Source # 
Instance details

Defined in Vulkan.Core10.Enums.ImageLayout

Show ImageLayout Source # 
Instance details

Defined in Vulkan.Core10.Enums.ImageLayout

Zero ImageLayout Source # 
Instance details

Defined in Vulkan.Core10.Enums.ImageLayout