{-# language CPP #-}
-- | = Name
--
-- VK_EXT_image_drm_format_modifier - device extension
--
-- == VK_EXT_image_drm_format_modifier
--
-- [__Name String__]
--     @VK_EXT_image_drm_format_modifier@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     159
--
-- [__Revision__]
--     2
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__]
--             
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_bind_memory2 VK_KHR_bind_memory2>
--              and
--             
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_get_physical_device_properties2 VK_KHR_get_physical_device_properties2>
--              and
--             
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_sampler_ycbcr_conversion VK_KHR_sampler_ycbcr_conversion>
--          or
--         
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.1 Version 1.1>
--     and
--         
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_image_format_list VK_KHR_image_format_list>
--          or
--         
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.2 Version 1.2>
--
-- [__Contact__]
--
--     -   Lina Versace
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_image_drm_format_modifier] @versalinyaa%0A*Here describe the issue or question you have about the VK_EXT_image_drm_format_modifier extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2021-09-30
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Antoine Labour, Google
--
--     -   Bas Nieuwenhuizen, Google
--
--     -   Lina Versace, Google
--
--     -   James Jones, NVIDIA
--
--     -   Faith Ekstrand, Intel
--
--     -   Jőrg Wagner, ARM
--
--     -   Kristian Høgsberg Kristensen, Google
--
--     -   Ray Smith, ARM
--
-- == Description
--
-- This extension provides the ability to use /DRM format modifiers/ with
-- images, enabling Vulkan to better integrate with the Linux ecosystem of
-- graphics, video, and display APIs.
--
-- Its functionality closely overlaps with
-- @EGL_EXT_image_dma_buf_import_modifiers@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn2 2>^
-- and
-- @EGL_MESA_image_dma_buf_export@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn3 3>^.
-- Unlike the EGL extensions, this extension does not require the use of a
-- specific handle type (such as a dma_buf) for external memory and
-- provides more explicit control of image creation.
--
-- == Introduction to DRM Format Modifiers
--
-- A /DRM format modifier/ is a 64-bit, vendor-prefixed, semi-opaque
-- unsigned integer. Most /modifiers/ represent a concrete, vendor-specific
-- tiling format for images. Some exceptions are @DRM_FORMAT_MOD_LINEAR@
-- (which is not vendor-specific); @DRM_FORMAT_MOD_NONE@ (which is an alias
-- of @DRM_FORMAT_MOD_LINEAR@ due to historical accident); and
-- @DRM_FORMAT_MOD_INVALID@ (which does not represent a tiling format). The
-- /modifier’s/ vendor prefix consists of the 8 most significant bits. The
-- canonical list of /modifiers/ and vendor prefixes is found in
-- <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/drm/drm_fourcc.h drm_fourcc.h>
-- in the Linux kernel source. The other dominant source of /modifiers/ are
-- vendor kernel trees.
--
-- One goal of /modifiers/ in the Linux ecosystem is to enumerate for each
-- vendor a reasonably sized set of tiling formats that are appropriate for
-- images shared across processes, APIs, and\/or devices, where each
-- participating component may possibly be from different vendors. A
-- non-goal is to enumerate all tiling formats supported by all vendors.
-- Some tiling formats used internally by vendors are inappropriate for
-- sharing; no /modifiers/ should be assigned to such tiling formats.
--
-- Modifier values typically do not /describe/ memory layouts. More
-- precisely, a /modifier/\'s lower 56 bits usually have no structure.
-- Instead, modifiers /name/ memory layouts; they name a small set of
-- vendor-preferred layouts for image sharing. As a consequence, in each
-- vendor namespace the modifier values are often sequentially allocated
-- starting at 1.
--
-- Each /modifier/ is usually supported by a single vendor and its name
-- matches the pattern @{VENDOR}_FORMAT_MOD_*@ or
-- @DRM_FORMAT_MOD_{VENDOR}_*@. Examples are @I915_FORMAT_MOD_X_TILED@ and
-- @DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED@. An exception is
-- @DRM_FORMAT_MOD_LINEAR@, which is supported by most vendors.
--
-- Many APIs in Linux use /modifiers/ to negotiate and specify the memory
-- layout of shared images. For example, a Wayland compositor and Wayland
-- client may, by relaying /modifiers/ over the Wayland protocol
-- @zwp_linux_dmabuf_v1@, negotiate a vendor-specific tiling format for a
-- shared @wl_buffer@. The client may allocate the underlying memory for
-- the @wl_buffer@ with GBM, providing the chosen /modifier/ to
-- @gbm_bo_create_with_modifiers@. The client may then import the
-- @wl_buffer@ into Vulkan for producing image content, providing the
-- resource’s dma_buf to
-- 'Vulkan.Extensions.VK_KHR_external_memory_fd.ImportMemoryFdInfoKHR' and
-- its /modifier/ to 'ImageDrmFormatModifierExplicitCreateInfoEXT'. The
-- compositor may then import the @wl_buffer@ into OpenGL for sampling,
-- providing the resource’s dma_buf and /modifier/ to @eglCreateImage@. The
-- compositor may also bypass OpenGL and submit the @wl_buffer@ directly to
-- the kernel’s display API, providing the dma_buf and /modifier/ through
-- @drm_mode_fb_cmd2@.
--
-- == Format Translation
--
-- /Modifier/-capable APIs often pair /modifiers/ with DRM formats, which
-- are defined in
-- <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/drm/drm_fourcc.h drm_fourcc.h>.
-- However, @VK_EXT_image_drm_format_modifier@ uses
-- 'Vulkan.Core10.Enums.Format.Format' instead of DRM formats. The
-- application must convert between 'Vulkan.Core10.Enums.Format.Format' and
-- DRM format when it sends or receives a DRM format to or from an external
-- API.
--
-- The mapping from 'Vulkan.Core10.Enums.Format.Format' to DRM format is
-- lossy. Therefore, when receiving a DRM format from an external API,
-- often the application must use information from the external API to
-- accurately map the DRM format to a 'Vulkan.Core10.Enums.Format.Format'.
-- For example, DRM formats do not distinguish between RGB and sRGB (as of
-- 2018-03-28); external information is required to identify the image’s
-- color space.
--
-- The mapping between 'Vulkan.Core10.Enums.Format.Format' and DRM format
-- is also incomplete. For some DRM formats there exist no corresponding
-- Vulkan format, and for some Vulkan formats there exist no corresponding
-- DRM format.
--
-- == Usage Patterns
--
-- Three primary usage patterns are intended for this extension:
--
-- -   __Negotiation.__ The application negotiates with /modifier/-aware,
--     external components to determine sets of image creation parameters
--     supported among all components.
--
--     In the Linux ecosystem, the negotiation usually assumes the image is
--     a 2D, single-sampled, non-mipmapped, non-array image; this extension
--     permits that assumption but does not require it. The result of the
--     negotiation usually resembles a set of tuples such as /(drmFormat,
--     drmFormatModifier)/, where each participating component supports all
--     tuples in the set.
--
--     Many details of this negotiation - such as the protocol used during
--     negotiation, the set of image creation parameters expressible in the
--     protocol, and how the protocol chooses which process and which API
--     will create the image - are outside the scope of this specification.
--
--     In this extension,
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceFormatProperties2'
--     with 'DrmFormatModifierPropertiesListEXT' serves a primary role
--     during the negotiation, and
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceImageFormatProperties2'
--     with 'PhysicalDeviceImageDrmFormatModifierInfoEXT' serves a
--     secondary role.
--
-- -   __Import.__ The application imports an image with a /modifier/.
--
--     In this pattern, the application receives from an external source
--     the image’s memory and its creation parameters, which are often the
--     result of the negotiation described above. Some image creation
--     parameters are implicitly defined by the external source; for
--     example, 'Vulkan.Core10.Enums.ImageType.IMAGE_TYPE_2D' is often
--     assumed. Some image creation parameters are usually explicit, such
--     as the image’s @format@, @drmFormatModifier@, and @extent@; and each
--     plane’s @offset@ and @rowPitch@.
--
--     Before creating the image, the application first verifies that the
--     physical device supports the received creation parameters by
--     querying
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceFormatProperties2'
--     with 'DrmFormatModifierPropertiesListEXT' and
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceImageFormatProperties2'
--     with 'PhysicalDeviceImageDrmFormatModifierInfoEXT'. Then the
--     application creates the image by chaining
--     'ImageDrmFormatModifierExplicitCreateInfoEXT' and
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_memory.ExternalMemoryImageCreateInfo'
--     onto 'Vulkan.Core10.Image.ImageCreateInfo'.
--
-- -   __Export.__ The application creates an image and allocates its
--     memory. Then the application exports to /modifier/-aware consumers
--     the image’s memory handles; its creation parameters; its /modifier/;
--     and the <VkSubresourceLayout.html offset>,
--     <VkSubresourceLayout.html size>, and
--     <VkSubresourceLayout.html rowPitch> of each /memory plane/.
--
--     In this pattern, the Vulkan device is the authority for the image;
--     it is the allocator of the image’s memory and the decider of the
--     image’s creation parameters. When choosing the image’s creation
--     parameters, the application usually chooses a tuple /(format,
--     drmFormatModifier)/ from the result of the negotiation described
--     above. The negotiation’s result often contains multiple tuples that
--     share the same format but differ in their /modifier/. In this case,
--     the application should defer the choice of the image’s /modifier/ to
--     the Vulkan implementation by providing all such /modifiers/ to
--     'ImageDrmFormatModifierListCreateInfoEXT'::@pDrmFormatModifiers@;
--     and the implementation should choose from @pDrmFormatModifiers@ the
--     optimal /modifier/ in consideration with the other image parameters.
--
--     The application creates the image by chaining
--     'ImageDrmFormatModifierListCreateInfoEXT' and
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_memory.ExternalMemoryImageCreateInfo'
--     onto 'Vulkan.Core10.Image.ImageCreateInfo'. The protocol and APIs by
--     which the application will share the image with external consumers
--     will likely determine the value of
--     'Vulkan.Core11.Promoted_From_VK_KHR_external_memory.ExternalMemoryImageCreateInfo'::@handleTypes@.
--     The implementation chooses for the image an optimal /modifier/ from
--     'ImageDrmFormatModifierListCreateInfoEXT'::@pDrmFormatModifiers@.
--     The application then queries the implementation-chosen /modifier/
--     with 'getImageDrmFormatModifierPropertiesEXT', and queries the
--     memory layout of each plane with
--     'Vulkan.Core10.Image.getImageSubresourceLayout'.
--
--     The application then allocates the image’s memory with
--     'Vulkan.Core10.Memory.MemoryAllocateInfo', adding chained extending
--     structures for external memory; binds it to the image; and exports
--     the memory, for example, with
--     'Vulkan.Extensions.VK_KHR_external_memory_fd.getMemoryFdKHR'.
--
--     Finally, the application sends the image’s creation parameters, its
--     /modifier/, its per-plane memory layout, and the exported memory
--     handle to the external consumers. The details of how the application
--     transmits this information to external consumers is outside the
--     scope of this specification.
--
-- == Prior Art
--
-- Extension
-- @EGL_EXT_image_dma_buf_import@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn1 1>^
-- introduced the ability to create an @EGLImage@ by importing for each
-- plane a dma_buf, offset, and row pitch.
--
-- Later, extension
-- @EGL_EXT_image_dma_buf_import_modifiers@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn2 2>^
-- introduced the ability to query which combination of formats and
-- /modifiers/ the implementation supports and to specify /modifiers/
-- during creation of the @EGLImage@.
--
-- Extension
-- @EGL_MESA_image_dma_buf_export@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn3 3>^
-- is the inverse of @EGL_EXT_image_dma_buf_import_modifiers@.
--
-- The Linux kernel modesetting API (KMS), when configuring the display’s
-- framebuffer with
-- @struct drm_mode_fb_cmd2@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn4 4>^,
-- allows one to specify the framebuffer’s /modifier/ as well as a
-- per-plane memory handle, offset, and row pitch.
--
-- GBM, a graphics buffer manager for Linux, allows creation of a @gbm_bo@
-- (that is, a graphics /buffer object/) by importing data similar to that
-- in
-- @EGL_EXT_image_dma_buf_import_modifiers@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn1 1>^;
-- and symmetrically allows exporting the same data from the @gbm_bo@. See
-- the references to /modifier/ and /plane/ in
-- @gbm.h@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn5 5>^.
--
-- == New Commands
--
-- -   'getImageDrmFormatModifierPropertiesEXT'
--
-- == New Structures
--
-- -   'DrmFormatModifierPropertiesEXT'
--
-- -   'ImageDrmFormatModifierPropertiesEXT'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.FormatProperties2':
--
--     -   'DrmFormatModifierPropertiesListEXT'
--
-- -   Extending 'Vulkan.Core10.Image.ImageCreateInfo':
--
--     -   'ImageDrmFormatModifierExplicitCreateInfoEXT'
--
--     -   'ImageDrmFormatModifierListCreateInfoEXT'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceImageFormatInfo2':
--
--     -   'PhysicalDeviceImageDrmFormatModifierInfoEXT'
--
-- If
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_format_feature_flags2 VK_KHR_format_feature_flags2>
-- is supported:
--
-- -   'DrmFormatModifierProperties2EXT'
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.FormatProperties2':
--
--     -   'DrmFormatModifierPropertiesList2EXT'
--
-- == New Enum Constants
--
-- -   'EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME'
--
-- -   'EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION'
--
-- -   Extending
--     'Vulkan.Core10.Enums.ImageAspectFlagBits.ImageAspectFlagBits':
--
--     -   'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT'
--
--     -   'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_MEMORY_PLANE_1_BIT_EXT'
--
--     -   'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_MEMORY_PLANE_2_BIT_EXT'
--
--     -   'Vulkan.Core10.Enums.ImageAspectFlagBits.IMAGE_ASPECT_MEMORY_PLANE_3_BIT_EXT'
--
-- -   Extending 'Vulkan.Core10.Enums.ImageTiling.ImageTiling':
--
--     -   'Vulkan.Core10.Enums.ImageTiling.IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT'
--
-- -   Extending 'Vulkan.Core10.Enums.Result.Result':
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT'
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT'
--
-- If
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_format_feature_flags2 VK_KHR_format_feature_flags2>
-- is supported:
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_2_EXT'
--
-- == Issues
--
-- 1) Should this extension define a single DRM format modifier per
-- 'Vulkan.Core10.Handles.Image'? Or define one per plane?
--
-- +
--
-- __RESOLVED__: There exists a single DRM format modifier per
-- 'Vulkan.Core10.Handles.Image'.
--
-- __DISCUSSION__: Prior art, such as
-- @EGL_EXT_image_dma_buf_import_modifiers@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn2 2>^,
-- @struct drm_mode_fb_cmd2@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn4 4>^,
-- and
-- @struct gbm_import_fd_modifier_data@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn5 5>^,
-- allows defining one /modifier/ per plane. However, developers of the GBM
-- and kernel APIs concede it was a mistake. Beginning in Linux 4.10, the
-- kernel requires that the application provide the same DRM format
-- /modifier/ for each plane. (See Linux commit
-- <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bae781b259269590109e8a4a8227331362b88212 bae781b259269590109e8a4a8227331362b88212>).
-- And GBM provides an entry point, @gbm_bo_get_modifier@, for querying the
-- /modifier/ of the image but does not provide one to query the modifier
-- of individual planes.
--
-- 2) When creating an image with
-- 'ImageDrmFormatModifierExplicitCreateInfoEXT', which is typically used
-- when /importing/ an image, should the application explicitly provide the
-- size of each plane?
--
-- +
--
-- __RESOLVED__: No. The application /must/ not provide the size. To
-- enforce this, the API requires that
-- 'ImageDrmFormatModifierExplicitCreateInfoEXT'::@pPlaneLayouts->size@
-- /must/ be 0.
--
-- __DISCUSSION__: Prior art, such as
-- @EGL_EXT_image_dma_buf_import_modifiers@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn2 2>^,
-- @struct drm_mode_fb_cmd2@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn4 4>^,
-- and
-- @struct gbm_import_fd_modifier_data@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier-fn5 5>^,
-- omits from the API the size of each plane. Instead, the APIs infer each
-- plane’s size from the import parameters, which include the image’s pixel
-- format and a dma_buf, offset, and row pitch for each plane.
--
-- However, Vulkan differs from EGL and GBM with regards to image creation
-- in the following ways:
--
-- -   __Undedicated allocation by default.__ When importing or exporting a
--     set of dma_bufs as an @EGLImage@ or @gbm_bo@, common practice
--     mandates that each dma_buf’s memory be dedicated (in the sense of
--     @VK_KHR_dedicated_allocation@) to the image (though not necessarily
--     dedicated to a single plane). In particular, neither the GBM
--     documentation nor the EGL extension specifications explicitly state
--     this requirement, but in light of common practice this is likely due
--     to under-specification rather than intentional omission. In
--     contrast, @VK_EXT_image_drm_format_modifier@ permits, but does not
--     require, the implementation to require dedicated allocations for
--     images created with
--     'Vulkan.Core10.Enums.ImageTiling.IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT'.
--
-- -   __Separation of image creation and memory allocation.__ When
--     importing a set of dma_bufs as an @EGLImage@ or @gbm_bo@, EGL and
--     GBM create the image resource and bind it to memory (the dma_bufs)
--     simultaneously. This allows EGL and GBM to query each dma_buf’s size
--     during image creation. In Vulkan, image creation and memory
--     allocation are independent unless a dedicated allocation is used (as
--     in @VK_KHR_dedicated_allocation@). Therefore, without requiring
--     dedicated allocation, Vulkan cannot query the size of each dma_buf
--     (or other external handle) when calculating the image’s memory
--     layout. Even if dedication allocation were required, Vulkan cannot
--     calculate the image’s memory layout until after the image is bound
--     to its dma_ufs.
--
-- The above differences complicate the potential inference of plane size
-- in Vulkan. Consider the following problematic cases:
--
-- -   __Padding.__ Some plane of the image may require
--     implementation-dependent padding.
--
-- -   __Metadata.__ For some /modifiers/, the image may have a metadata
--     plane which requires a non-trivial calculation to determine its
--     size.
--
-- -   __Mipmapped, array, and 3D images.__ The implementation may support
--     'Vulkan.Core10.Enums.ImageTiling.IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT'
--     for images whose @mipLevels@, @arrayLayers@, or @depth@ is greater
--     than 1. For such images with certain /modifiers/, the calculation of
--     each plane’s size may be non-trivial.
--
-- However, an application-provided plane size solves none of the above
-- problems.
--
-- For simplicity, consider an external image with a single memory plane.
-- The implementation is obviously capable calculating the image’s size
-- when its tiling is
-- 'Vulkan.Core10.Enums.ImageTiling.IMAGE_TILING_OPTIMAL'. Likewise, any
-- reasonable implementation is capable of calculating the image’s size
-- when its tiling uses a supported /modifier/.
--
-- Suppose that the external image’s size is smaller than the
-- implementation-calculated size. If the application provided the external
-- image’s size to 'Vulkan.Core10.Image.createImage', the implementation
-- would observe the mismatched size and recognize its inability to
-- comprehend the external image’s layout (unless the implementation used
-- the application-provided size to select a refinement of the tiling
-- layout indicated by the /modifier/, which is strongly discouraged). The
-- implementation would observe the conflict, and reject image creation
-- with
-- 'Vulkan.Core10.Enums.Result.ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT'.
-- On the other hand, if the application did not provide the external
-- image’s size to 'Vulkan.Core10.Image.createImage', then the application
-- would observe after calling
-- 'Vulkan.Core10.MemoryManagement.getImageMemoryRequirements' that the
-- external image’s size is less than the size required by the
-- implementation. The application would observe the conflict and refuse to
-- bind the 'Vulkan.Core10.Handles.Image' to the external memory. In both
-- cases, the result is explicit failure.
--
-- Suppose that the external image’s size is larger than the
-- implementation-calculated size. If the application provided the external
-- image’s size to 'Vulkan.Core10.Image.createImage', for reasons similar
-- to above the implementation would observe the mismatched size and
-- recognize its inability to comprehend the image data residing in the
-- extra size. The implementation, however, must assume that image data
-- resides in the entire size provided by the application. The
-- implementation would observe the conflict and reject image creation with
-- 'Vulkan.Core10.Enums.Result.ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT'.
-- On the other hand, if the application did not provide the external
-- image’s size to 'Vulkan.Core10.Image.createImage', then the application
-- would observe after calling
-- 'Vulkan.Core10.MemoryManagement.getImageMemoryRequirements' that the
-- external image’s size is larger than the implementation-usable size. The
-- application would observe the conflict and refuse to bind the
-- 'Vulkan.Core10.Handles.Image' to the external memory. In both cases, the
-- result is explicit failure.
--
-- Therefore, an application-provided size provides no benefit, and this
-- extension should not require it. This decision renders
-- 'Vulkan.Core10.Image.SubresourceLayout'::@size@ an unused field during
-- image creation, and thus introduces a risk that implementations may
-- require applications to submit sideband creation parameters in the
-- unused field. To prevent implementations from relying on sideband data,
-- this extension /requires/ the application to set @size@ to 0.
--
-- === References
--
-- 1.  #VK_EXT_image_drm_format_modifier-fn1#
--     <https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import.txt EGL_EXT_image_dma_buf_import>
--
-- 2.  #VK_EXT_image_drm_format_modifier-fn2#
--     <https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt EGL_EXT_image_dma_buf_import_modifiers>
--
-- 3.  #VK_EXT_image_drm_format_modifier-fn3#
--     <https://registry.khronos.org/EGL/extensions/MESA/EGL_MESA_image_dma_buf_export.txt EGL_MESA_image_dma_buf_export>
--
-- 4.  #VK_EXT_image_drm_format_modifier-fn4#
--     <https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/drm/drm_mode.h?id=refs/tags/v4.10#n392 struct drm_mode_fb_cmd2>
--
-- 5.  #VK_EXT_image_drm_format_modifier-fn5#
--     <https://cgit.freedesktop.org/mesa/mesa/tree/src/gbm/main/gbm.h?id=refs/tags/mesa-18.0.0-rc1 gbm.h>
--
-- === Version History
--
-- -   Revision 1, 2018-08-29 (Lina Versace)
--
--     -   First stable revision
--
-- -   Revision 2, 2021-09-30 (Jon Leech)
--
--     -   Add interaction with @VK_KHR_format_feature_flags2@ to @vk.xml@
--
-- == See Also
--
-- 'DrmFormatModifierPropertiesEXT', 'DrmFormatModifierPropertiesListEXT',
-- 'ImageDrmFormatModifierExplicitCreateInfoEXT',
-- 'ImageDrmFormatModifierListCreateInfoEXT',
-- 'ImageDrmFormatModifierPropertiesEXT',
-- 'PhysicalDeviceImageDrmFormatModifierInfoEXT',
-- 'getImageDrmFormatModifierPropertiesEXT'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_EXT_image_drm_format_modifier  ( getImageDrmFormatModifierPropertiesEXT
                                                           , DrmFormatModifierPropertiesListEXT(..)
                                                           , DrmFormatModifierPropertiesEXT(..)
                                                           , PhysicalDeviceImageDrmFormatModifierInfoEXT(..)
                                                           , ImageDrmFormatModifierListCreateInfoEXT(..)
                                                           , ImageDrmFormatModifierExplicitCreateInfoEXT(..)
                                                           , ImageDrmFormatModifierPropertiesEXT(..)
                                                           , DrmFormatModifierPropertiesList2EXT(..)
                                                           , DrmFormatModifierProperties2EXT(..)
                                                           , EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION
                                                           , pattern EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION
                                                           , EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME
                                                           , pattern EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME
                                                           ) where

import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Data.Vector (generateM)
import qualified Data.Vector (imapM_)
import qualified Data.Vector (length)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Word (Word64)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkGetImageDrmFormatModifierPropertiesEXT))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.Core10.Enums.FormatFeatureFlagBits (FormatFeatureFlags)
import Vulkan.Core13.Enums.FormatFeatureFlags2 (FormatFeatureFlags2)
import Vulkan.Core10.Handles (Image)
import Vulkan.Core10.Handles (Image(..))
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.SharingMode (SharingMode)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Image (SubresourceLayout)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_2_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetImageDrmFormatModifierPropertiesEXT
  :: FunPtr (Ptr Device_T -> Image -> Ptr ImageDrmFormatModifierPropertiesEXT -> IO Result) -> Ptr Device_T -> Image -> Ptr ImageDrmFormatModifierPropertiesEXT -> IO Result

-- | vkGetImageDrmFormatModifierPropertiesEXT - Returns an image’s DRM format
-- modifier
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier VK_EXT_image_drm_format_modifier>,
-- 'Vulkan.Core10.Handles.Device', 'Vulkan.Core10.Handles.Image',
-- 'ImageDrmFormatModifierPropertiesEXT'
getImageDrmFormatModifierPropertiesEXT :: forall io
                                        . (MonadIO io)
                                       => -- | @device@ is the logical device that owns the image.
                                          --
                                          -- #VUID-vkGetImageDrmFormatModifierPropertiesEXT-device-parameter#
                                          -- @device@ /must/ be a valid 'Vulkan.Core10.Handles.Device' handle
                                          Device
                                       -> -- | @image@ is the queried image.
                                          --
                                          -- #VUID-vkGetImageDrmFormatModifierPropertiesEXT-image-02272# @image@
                                          -- /must/ have been created with <VkImageCreateInfo.html tiling> equal to
                                          -- 'Vulkan.Core10.Enums.ImageTiling.IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT'
                                          --
                                          -- #VUID-vkGetImageDrmFormatModifierPropertiesEXT-image-parameter# @image@
                                          -- /must/ be a valid 'Vulkan.Core10.Handles.Image' handle
                                          --
                                          -- #VUID-vkGetImageDrmFormatModifierPropertiesEXT-image-parent# @image@
                                          -- /must/ have been created, allocated, or retrieved from @device@
                                          Image
                                       -> io (ImageDrmFormatModifierPropertiesEXT)
getImageDrmFormatModifierPropertiesEXT :: forall (io :: * -> *).
MonadIO io =>
Device -> Image -> io ImageDrmFormatModifierPropertiesEXT
getImageDrmFormatModifierPropertiesEXT Device
device Image
image = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
  let vkGetImageDrmFormatModifierPropertiesEXTPtr :: FunPtr
  (Ptr Device_T
   -> Image
   -> ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
   -> IO Result)
vkGetImageDrmFormatModifierPropertiesEXTPtr = DeviceCmds
-> FunPtr
     (Ptr Device_T
      -> Image
      -> ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
      -> IO Result)
pVkGetImageDrmFormatModifierPropertiesEXT (case Device
device of Device{DeviceCmds
$sel:deviceCmds:Device :: Device -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Device_T
   -> Image
   -> ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
   -> IO Result)
vkGetImageDrmFormatModifierPropertiesEXTPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
    forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkGetImageDrmFormatModifierPropertiesEXT is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
  let vkGetImageDrmFormatModifierPropertiesEXT' :: Ptr Device_T
-> Image
-> ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
-> IO Result
vkGetImageDrmFormatModifierPropertiesEXT' = FunPtr
  (Ptr Device_T
   -> Image
   -> ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
   -> IO Result)
-> Ptr Device_T
-> Image
-> ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
-> IO Result
mkVkGetImageDrmFormatModifierPropertiesEXT FunPtr
  (Ptr Device_T
   -> Image
   -> ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
   -> IO Result)
vkGetImageDrmFormatModifierPropertiesEXTPtr
  "pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
pPProperties <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @ImageDrmFormatModifierPropertiesEXT)
  Result
r <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkGetImageDrmFormatModifierPropertiesEXT" (Ptr Device_T
-> Image
-> ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
-> IO Result
vkGetImageDrmFormatModifierPropertiesEXT'
                                                                             (Device -> Ptr Device_T
deviceHandle (Device
device))
                                                                             (Image
image)
                                                                             ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
pPProperties))
  forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
  ImageDrmFormatModifierPropertiesEXT
pProperties <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ImageDrmFormatModifierPropertiesEXT "pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
pPProperties
  forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ (ImageDrmFormatModifierPropertiesEXT
pProperties)


-- | VkDrmFormatModifierPropertiesListEXT - Structure specifying the list of
-- DRM format modifiers supported for a format
--
-- = Description
--
-- If @pDrmFormatModifierProperties@ is @NULL@, then the function returns
-- in @drmFormatModifierCount@ the number of modifiers compatible with the
-- queried @format@. Otherwise, the application /must/ set
-- @drmFormatModifierCount@ to the length of the array
-- @pDrmFormatModifierProperties@; the function will write at most
-- @drmFormatModifierCount@ elements to the array, and will return in
-- @drmFormatModifierCount@ the number of elements written.
--
-- Among the elements in array @pDrmFormatModifierProperties@, each
-- returned @drmFormatModifier@ /must/ be unique.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier VK_EXT_image_drm_format_modifier>,
-- 'DrmFormatModifierPropertiesEXT',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data DrmFormatModifierPropertiesListEXT = DrmFormatModifierPropertiesListEXT
  { -- | @drmFormatModifierCount@ is an inout parameter related to the number of
    -- modifiers compatible with the @format@, as described below.
    DrmFormatModifierPropertiesListEXT -> Word32
drmFormatModifierCount :: Word32
  , -- | @pDrmFormatModifierProperties@ is either @NULL@ or a pointer to an array
    -- of 'DrmFormatModifierPropertiesEXT' structures.
    DrmFormatModifierPropertiesListEXT
-> Ptr DrmFormatModifierPropertiesEXT
drmFormatModifierProperties :: Ptr DrmFormatModifierPropertiesEXT
  }
  deriving (Typeable, DrmFormatModifierPropertiesListEXT
-> DrmFormatModifierPropertiesListEXT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DrmFormatModifierPropertiesListEXT
-> DrmFormatModifierPropertiesListEXT -> Bool
$c/= :: DrmFormatModifierPropertiesListEXT
-> DrmFormatModifierPropertiesListEXT -> Bool
== :: DrmFormatModifierPropertiesListEXT
-> DrmFormatModifierPropertiesListEXT -> Bool
$c== :: DrmFormatModifierPropertiesListEXT
-> DrmFormatModifierPropertiesListEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DrmFormatModifierPropertiesListEXT)
#endif
deriving instance Show DrmFormatModifierPropertiesListEXT

instance ToCStruct DrmFormatModifierPropertiesListEXT where
  withCStruct :: forall b.
DrmFormatModifierPropertiesListEXT
-> (Ptr DrmFormatModifierPropertiesListEXT -> IO b) -> IO b
withCStruct DrmFormatModifierPropertiesListEXT
x Ptr DrmFormatModifierPropertiesListEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr DrmFormatModifierPropertiesListEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierPropertiesListEXT
p DrmFormatModifierPropertiesListEXT
x (Ptr DrmFormatModifierPropertiesListEXT -> IO b
f Ptr DrmFormatModifierPropertiesListEXT
p)
  pokeCStruct :: forall b.
Ptr DrmFormatModifierPropertiesListEXT
-> DrmFormatModifierPropertiesListEXT -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierPropertiesListEXT
p DrmFormatModifierPropertiesListEXT{Word32
Ptr DrmFormatModifierPropertiesEXT
drmFormatModifierProperties :: Ptr DrmFormatModifierPropertiesEXT
drmFormatModifierCount :: Word32
$sel:drmFormatModifierProperties:DrmFormatModifierPropertiesListEXT :: DrmFormatModifierPropertiesListEXT
-> Ptr DrmFormatModifierPropertiesEXT
$sel:drmFormatModifierCount:DrmFormatModifierPropertiesListEXT :: DrmFormatModifierPropertiesListEXT -> Word32
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesListEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesListEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesListEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
drmFormatModifierCount)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesListEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr DrmFormatModifierPropertiesEXT))) (Ptr DrmFormatModifierPropertiesEXT
drmFormatModifierProperties)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr DrmFormatModifierPropertiesListEXT -> IO b -> IO b
pokeZeroCStruct Ptr DrmFormatModifierPropertiesListEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesListEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesListEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    IO b
f

instance FromCStruct DrmFormatModifierPropertiesListEXT where
  peekCStruct :: Ptr DrmFormatModifierPropertiesListEXT
-> IO DrmFormatModifierPropertiesListEXT
peekCStruct Ptr DrmFormatModifierPropertiesListEXT
p = do
    Word32
drmFormatModifierCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DrmFormatModifierPropertiesListEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
    Ptr DrmFormatModifierPropertiesEXT
pDrmFormatModifierProperties <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr DrmFormatModifierPropertiesEXT) ((Ptr DrmFormatModifierPropertiesListEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr DrmFormatModifierPropertiesEXT)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Word32
-> Ptr DrmFormatModifierPropertiesEXT
-> DrmFormatModifierPropertiesListEXT
DrmFormatModifierPropertiesListEXT
             Word32
drmFormatModifierCount Ptr DrmFormatModifierPropertiesEXT
pDrmFormatModifierProperties

instance Storable DrmFormatModifierPropertiesListEXT where
  sizeOf :: DrmFormatModifierPropertiesListEXT -> Int
sizeOf ~DrmFormatModifierPropertiesListEXT
_ = Int
32
  alignment :: DrmFormatModifierPropertiesListEXT -> Int
alignment ~DrmFormatModifierPropertiesListEXT
_ = Int
8
  peek :: Ptr DrmFormatModifierPropertiesListEXT
-> IO DrmFormatModifierPropertiesListEXT
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr DrmFormatModifierPropertiesListEXT
-> DrmFormatModifierPropertiesListEXT -> IO ()
poke Ptr DrmFormatModifierPropertiesListEXT
ptr DrmFormatModifierPropertiesListEXT
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierPropertiesListEXT
ptr DrmFormatModifierPropertiesListEXT
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero DrmFormatModifierPropertiesListEXT where
  zero :: DrmFormatModifierPropertiesListEXT
zero = Word32
-> Ptr DrmFormatModifierPropertiesEXT
-> DrmFormatModifierPropertiesListEXT
DrmFormatModifierPropertiesListEXT
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


-- | VkDrmFormatModifierPropertiesEXT - Structure specifying properties of a
-- format when combined with a DRM format modifier
--
-- = Description
--
-- The returned @drmFormatModifierTilingFeatures@ /must/ contain at least
-- one bit.
--
-- The implementation /must/ not return @DRM_FORMAT_MOD_INVALID@ in
-- @drmFormatModifier@.
--
-- An image’s /memory planecount/ (as returned by
-- @drmFormatModifierPlaneCount@) is distinct from its /format planecount/
-- (in the sense of
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#formats-requiring-sampler-ycbcr-conversion multi-planar>
-- Y′CBCR formats). In
-- 'Vulkan.Core10.Enums.ImageAspectFlagBits.ImageAspectFlags', each
-- @VK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXT@ represents a /memory plane/ and
-- each @VK_IMAGE_ASPECT_PLANE_i_BIT@ a /format plane/.
--
-- An image’s set of /format planes/ is an ordered partition of the image’s
-- __content__ into separable groups of format components. The ordered
-- partition is encoded in the name of each
-- 'Vulkan.Core10.Enums.Format.Format'. For example,
-- 'Vulkan.Core10.Enums.Format.FORMAT_G8_B8R8_2PLANE_420_UNORM' contains
-- two /format planes/; the first plane contains the green component and
-- the second plane contains the blue component and red component. If the
-- format name does not contain @PLANE@, then the format contains a single
-- plane; for example, 'Vulkan.Core10.Enums.Format.FORMAT_R8G8B8A8_UNORM'.
-- Some commands, such as
-- 'Vulkan.Core10.CommandBufferBuilding.cmdCopyBufferToImage', do not
-- operate on all format components in the image, but instead operate only
-- on the /format planes/ explicitly chosen by the application and operate
-- on each /format plane/ independently.
--
-- An image’s set of /memory planes/ is an ordered partition of the image’s
-- __memory__ rather than the image’s __content__. Each /memory plane/ is a
-- contiguous range of memory. The union of an image’s /memory planes/ is
-- not necessarily contiguous.
--
-- If an image is
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#glossary-linear-resource linear>,
-- then the partition is the same for /memory planes/ and for /format
-- planes/. Therefore, if the returned @drmFormatModifier@ is
-- @DRM_FORMAT_MOD_LINEAR@, then @drmFormatModifierPlaneCount@ /must/ equal
-- the /format planecount/, and @drmFormatModifierTilingFeatures@ /must/ be
-- identical to the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.FormatProperties2'::@linearTilingFeatures@
-- returned in the same @pNext@ chain.
--
-- If an image is
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#glossary-linear-resource non-linear>,
-- then the partition of the image’s __memory__ into /memory planes/ is
-- implementation-specific and /may/ be unrelated to the partition of the
-- image’s __content__ into /format planes/. For example, consider an image
-- whose @format@ is
-- 'Vulkan.Core10.Enums.Format.FORMAT_G8_B8_R8_3PLANE_420_UNORM', @tiling@
-- is
-- 'Vulkan.Core10.Enums.ImageTiling.IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT',
-- whose @drmFormatModifier@ is not @DRM_FORMAT_MOD_LINEAR@, and @flags@
-- lacks
-- 'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_DISJOINT_BIT'. The
-- image has 3 /format planes/, and commands such
-- 'Vulkan.Core10.CommandBufferBuilding.cmdCopyBufferToImage' act on each
-- /format plane/ independently as if the data of each /format plane/ were
-- separable from the data of the other planes. In a straightforward
-- implementation, the implementation /may/ store the image’s content in 3
-- adjacent /memory planes/ where each /memory plane/ corresponds exactly
-- to a /format plane/. However, the implementation /may/ also store the
-- image’s content in a single /memory plane/ where all format components
-- are combined using an implementation-private block-compressed format; or
-- the implementation /may/ store the image’s content in a collection of 7
-- adjacent /memory planes/ using an implementation-private sharding
-- technique. Because the image is non-linear and non-disjoint, the
-- implementation has much freedom when choosing the image’s placement in
-- memory.
--
-- The /memory planecount/ applies to function parameters and structures
-- only when the API specifies an explicit requirement on
-- @drmFormatModifierPlaneCount@. In all other cases, the /memory
-- planecount/ is ignored.
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier VK_EXT_image_drm_format_modifier>,
-- 'DrmFormatModifierPropertiesListEXT',
-- 'Vulkan.Core10.Enums.FormatFeatureFlagBits.FormatFeatureFlags'
data DrmFormatModifierPropertiesEXT = DrmFormatModifierPropertiesEXT
  { -- | @drmFormatModifier@ is a /Linux DRM format modifier/.
    DrmFormatModifierPropertiesEXT -> Word64
drmFormatModifier :: Word64
  , -- | @drmFormatModifierPlaneCount@ is the number of /memory planes/ in any
    -- image created with @format@ and @drmFormatModifier@. An image’s /memory
    -- planecount/ is distinct from its /format planecount/, as explained
    -- below.
    DrmFormatModifierPropertiesEXT -> Word32
drmFormatModifierPlaneCount :: Word32
  , -- | @drmFormatModifierTilingFeatures@ is a bitmask of
    -- 'Vulkan.Core10.Enums.FormatFeatureFlagBits.FormatFeatureFlagBits' that
    -- are supported by any image created with @format@ and
    -- @drmFormatModifier@.
    DrmFormatModifierPropertiesEXT -> FormatFeatureFlags
drmFormatModifierTilingFeatures :: FormatFeatureFlags
  }
  deriving (Typeable, DrmFormatModifierPropertiesEXT
-> DrmFormatModifierPropertiesEXT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DrmFormatModifierPropertiesEXT
-> DrmFormatModifierPropertiesEXT -> Bool
$c/= :: DrmFormatModifierPropertiesEXT
-> DrmFormatModifierPropertiesEXT -> Bool
== :: DrmFormatModifierPropertiesEXT
-> DrmFormatModifierPropertiesEXT -> Bool
$c== :: DrmFormatModifierPropertiesEXT
-> DrmFormatModifierPropertiesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DrmFormatModifierPropertiesEXT)
#endif
deriving instance Show DrmFormatModifierPropertiesEXT

instance ToCStruct DrmFormatModifierPropertiesEXT where
  withCStruct :: forall b.
DrmFormatModifierPropertiesEXT
-> (Ptr DrmFormatModifierPropertiesEXT -> IO b) -> IO b
withCStruct DrmFormatModifierPropertiesEXT
x Ptr DrmFormatModifierPropertiesEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
16 forall a b. (a -> b) -> a -> b
$ \Ptr DrmFormatModifierPropertiesEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierPropertiesEXT
p DrmFormatModifierPropertiesEXT
x (Ptr DrmFormatModifierPropertiesEXT -> IO b
f Ptr DrmFormatModifierPropertiesEXT
p)
  pokeCStruct :: forall b.
Ptr DrmFormatModifierPropertiesEXT
-> DrmFormatModifierPropertiesEXT -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierPropertiesEXT
p DrmFormatModifierPropertiesEXT{Word32
Word64
FormatFeatureFlags
drmFormatModifierTilingFeatures :: FormatFeatureFlags
drmFormatModifierPlaneCount :: Word32
drmFormatModifier :: Word64
$sel:drmFormatModifierTilingFeatures:DrmFormatModifierPropertiesEXT :: DrmFormatModifierPropertiesEXT -> FormatFeatureFlags
$sel:drmFormatModifierPlaneCount:DrmFormatModifierPropertiesEXT :: DrmFormatModifierPropertiesEXT -> Word32
$sel:drmFormatModifier:DrmFormatModifierPropertiesEXT :: DrmFormatModifierPropertiesEXT -> Word64
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word64)) (Word64
drmFormatModifier)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32)) (Word32
drmFormatModifierPlaneCount)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12 :: Ptr FormatFeatureFlags)) (FormatFeatureFlags
drmFormatModifierTilingFeatures)
    IO b
f
  cStructSize :: Int
cStructSize = Int
16
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr DrmFormatModifierPropertiesEXT -> IO b -> IO b
pokeZeroCStruct Ptr DrmFormatModifierPropertiesEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word64)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12 :: Ptr FormatFeatureFlags)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct DrmFormatModifierPropertiesEXT where
  peekCStruct :: Ptr DrmFormatModifierPropertiesEXT
-> IO DrmFormatModifierPropertiesEXT
peekCStruct Ptr DrmFormatModifierPropertiesEXT
p = do
    Word64
drmFormatModifier <- forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr DrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word64))
    Word32
drmFormatModifierPlaneCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32))
    FormatFeatureFlags
drmFormatModifierTilingFeatures <- forall a. Storable a => Ptr a -> IO a
peek @FormatFeatureFlags ((Ptr DrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12 :: Ptr FormatFeatureFlags))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Word64
-> Word32 -> FormatFeatureFlags -> DrmFormatModifierPropertiesEXT
DrmFormatModifierPropertiesEXT
             Word64
drmFormatModifier
             Word32
drmFormatModifierPlaneCount
             FormatFeatureFlags
drmFormatModifierTilingFeatures

instance Storable DrmFormatModifierPropertiesEXT where
  sizeOf :: DrmFormatModifierPropertiesEXT -> Int
sizeOf ~DrmFormatModifierPropertiesEXT
_ = Int
16
  alignment :: DrmFormatModifierPropertiesEXT -> Int
alignment ~DrmFormatModifierPropertiesEXT
_ = Int
8
  peek :: Ptr DrmFormatModifierPropertiesEXT
-> IO DrmFormatModifierPropertiesEXT
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr DrmFormatModifierPropertiesEXT
-> DrmFormatModifierPropertiesEXT -> IO ()
poke Ptr DrmFormatModifierPropertiesEXT
ptr DrmFormatModifierPropertiesEXT
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierPropertiesEXT
ptr DrmFormatModifierPropertiesEXT
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero DrmFormatModifierPropertiesEXT where
  zero :: DrmFormatModifierPropertiesEXT
zero = Word64
-> Word32 -> FormatFeatureFlags -> DrmFormatModifierPropertiesEXT
DrmFormatModifierPropertiesEXT
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


-- | VkPhysicalDeviceImageDrmFormatModifierInfoEXT - Structure specifying a
-- DRM format modifier as image creation parameter
--
-- = Description
--
-- If the @drmFormatModifier@ is incompatible with the parameters specified
-- in
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceImageFormatInfo2'
-- and its @pNext@ chain, then
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceImageFormatProperties2'
-- returns 'Vulkan.Core10.Enums.Result.ERROR_FORMAT_NOT_SUPPORTED'. The
-- implementation /must/ support the query of any @drmFormatModifier@,
-- including unknown and invalid modifier values.
--
-- == Valid Usage
--
-- -   #VUID-VkPhysicalDeviceImageDrmFormatModifierInfoEXT-sharingMode-02314#
--     If @sharingMode@ is
--     'Vulkan.Core10.Enums.SharingMode.SHARING_MODE_CONCURRENT', then
--     @pQueueFamilyIndices@ /must/ be a valid pointer to an array of
--     @queueFamilyIndexCount@ @uint32_t@ values
--
-- -   #VUID-VkPhysicalDeviceImageDrmFormatModifierInfoEXT-sharingMode-02315#
--     If @sharingMode@ is
--     'Vulkan.Core10.Enums.SharingMode.SHARING_MODE_CONCURRENT', then
--     @queueFamilyIndexCount@ /must/ be greater than @1@
--
-- -   #VUID-VkPhysicalDeviceImageDrmFormatModifierInfoEXT-sharingMode-02316#
--     If @sharingMode@ is
--     'Vulkan.Core10.Enums.SharingMode.SHARING_MODE_CONCURRENT', each
--     element of @pQueueFamilyIndices@ /must/ be unique and /must/ be less
--     than the @pQueueFamilyPropertyCount@ returned by
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceQueueFamilyProperties2'
--     for the @physicalDevice@ that was used to create @device@
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkPhysicalDeviceImageDrmFormatModifierInfoEXT-sType-sType#
--     @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT'
--
-- -   #VUID-VkPhysicalDeviceImageDrmFormatModifierInfoEXT-sharingMode-parameter#
--     @sharingMode@ /must/ be a valid
--     'Vulkan.Core10.Enums.SharingMode.SharingMode' value
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier VK_EXT_image_drm_format_modifier>,
-- 'Vulkan.Core10.Enums.SharingMode.SharingMode',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceImageDrmFormatModifierInfoEXT = PhysicalDeviceImageDrmFormatModifierInfoEXT
  { -- | @drmFormatModifier@ is the image’s /Linux DRM format modifier/,
    -- corresponding to
    -- 'ImageDrmFormatModifierExplicitCreateInfoEXT'::@modifier@ or to
    -- 'ImageDrmFormatModifierListCreateInfoEXT'::@pModifiers@.
    PhysicalDeviceImageDrmFormatModifierInfoEXT -> Word64
drmFormatModifier :: Word64
  , -- | @sharingMode@ specifies how the image will be accessed by multiple queue
    -- families.
    PhysicalDeviceImageDrmFormatModifierInfoEXT -> SharingMode
sharingMode :: SharingMode
  , -- | @pQueueFamilyIndices@ is a pointer to an array of queue families that
    -- will access the image. It is ignored if @sharingMode@ is not
    -- 'Vulkan.Core10.Enums.SharingMode.SHARING_MODE_CONCURRENT'.
    PhysicalDeviceImageDrmFormatModifierInfoEXT -> Vector Word32
queueFamilyIndices :: Vector Word32
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceImageDrmFormatModifierInfoEXT)
#endif
deriving instance Show PhysicalDeviceImageDrmFormatModifierInfoEXT

instance ToCStruct PhysicalDeviceImageDrmFormatModifierInfoEXT where
  withCStruct :: forall b.
PhysicalDeviceImageDrmFormatModifierInfoEXT
-> (Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT -> IO b)
-> IO b
withCStruct PhysicalDeviceImageDrmFormatModifierInfoEXT
x Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p PhysicalDeviceImageDrmFormatModifierInfoEXT
x (Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT -> IO b
f Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
-> PhysicalDeviceImageDrmFormatModifierInfoEXT -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p PhysicalDeviceImageDrmFormatModifierInfoEXT{Word64
Vector Word32
SharingMode
queueFamilyIndices :: Vector Word32
sharingMode :: SharingMode
drmFormatModifier :: Word64
$sel:queueFamilyIndices:PhysicalDeviceImageDrmFormatModifierInfoEXT :: PhysicalDeviceImageDrmFormatModifierInfoEXT -> Vector Word32
$sel:sharingMode:PhysicalDeviceImageDrmFormatModifierInfoEXT :: PhysicalDeviceImageDrmFormatModifierInfoEXT -> SharingMode
$sel:drmFormatModifier:PhysicalDeviceImageDrmFormatModifierInfoEXT :: PhysicalDeviceImageDrmFormatModifierInfoEXT -> Word64
..} IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word64)) (Word64
drmFormatModifier)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr SharingMode)) (SharingMode
sharingMode)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32)) ((forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Vector a -> Int
Data.Vector.length forall a b. (a -> b) -> a -> b
$ (Vector Word32
queueFamilyIndices)) :: Word32))
    Ptr Word32
pPQueueFamilyIndices' <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @Word32 ((forall a. Vector a -> Int
Data.Vector.length (Vector Word32
queueFamilyIndices)) forall a. Num a => a -> a -> a
* Int
4)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i Word32
e -> forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word32
pPQueueFamilyIndices' forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
4 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word32) (Word32
e)) (Vector Word32
queueFamilyIndices)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr Word32))) (Ptr Word32
pPQueueFamilyIndices')
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = Int
40
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word64)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr SharingMode)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PhysicalDeviceImageDrmFormatModifierInfoEXT where
  peekCStruct :: Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
-> IO PhysicalDeviceImageDrmFormatModifierInfoEXT
peekCStruct Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p = do
    Word64
drmFormatModifier <- forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word64))
    SharingMode
sharingMode <- forall a. Storable a => Ptr a -> IO a
peek @SharingMode ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr SharingMode))
    Word32
queueFamilyIndexCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr Word32))
    Ptr Word32
pQueueFamilyIndices <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr Word32) ((Ptr PhysicalDeviceImageDrmFormatModifierInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr Word32)))
    Vector Word32
pQueueFamilyIndices' <- forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
queueFamilyIndexCount) (\Int
i -> forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr Word32
pQueueFamilyIndices forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
4 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word32)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Word64
-> SharingMode
-> Vector Word32
-> PhysicalDeviceImageDrmFormatModifierInfoEXT
PhysicalDeviceImageDrmFormatModifierInfoEXT
             Word64
drmFormatModifier SharingMode
sharingMode Vector Word32
pQueueFamilyIndices'

instance Zero PhysicalDeviceImageDrmFormatModifierInfoEXT where
  zero :: PhysicalDeviceImageDrmFormatModifierInfoEXT
zero = Word64
-> SharingMode
-> Vector Word32
-> PhysicalDeviceImageDrmFormatModifierInfoEXT
PhysicalDeviceImageDrmFormatModifierInfoEXT
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Monoid a => a
mempty


-- | VkImageDrmFormatModifierListCreateInfoEXT - Specify that an image must
-- be created with a DRM format modifier from the provided list
--
-- == Valid Usage
--
-- -   #VUID-VkImageDrmFormatModifierListCreateInfoEXT-pDrmFormatModifiers-02263#
--     Each /modifier/ in @pDrmFormatModifiers@ /must/ be compatible with
--     the parameters in 'Vulkan.Core10.Image.ImageCreateInfo' and its
--     @pNext@ chain, as determined by querying
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceImageFormatInfo2'
--     extended with 'PhysicalDeviceImageDrmFormatModifierInfoEXT'
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkImageDrmFormatModifierListCreateInfoEXT-sType-sType# @sType@
--     /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT'
--
-- -   #VUID-VkImageDrmFormatModifierListCreateInfoEXT-pDrmFormatModifiers-parameter#
--     @pDrmFormatModifiers@ /must/ be a valid pointer to an array of
--     @drmFormatModifierCount@ @uint64_t@ values
--
-- -   #VUID-VkImageDrmFormatModifierListCreateInfoEXT-drmFormatModifierCount-arraylength#
--     @drmFormatModifierCount@ /must/ be greater than @0@
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier VK_EXT_image_drm_format_modifier>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data ImageDrmFormatModifierListCreateInfoEXT = ImageDrmFormatModifierListCreateInfoEXT
  { -- | @pDrmFormatModifiers@ is a pointer to an array of /Linux DRM format
    -- modifiers/.
    ImageDrmFormatModifierListCreateInfoEXT -> Vector Word64
drmFormatModifiers :: Vector Word64 }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImageDrmFormatModifierListCreateInfoEXT)
#endif
deriving instance Show ImageDrmFormatModifierListCreateInfoEXT

instance ToCStruct ImageDrmFormatModifierListCreateInfoEXT where
  withCStruct :: forall b.
ImageDrmFormatModifierListCreateInfoEXT
-> (Ptr ImageDrmFormatModifierListCreateInfoEXT -> IO b) -> IO b
withCStruct ImageDrmFormatModifierListCreateInfoEXT
x Ptr ImageDrmFormatModifierListCreateInfoEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr ImageDrmFormatModifierListCreateInfoEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ImageDrmFormatModifierListCreateInfoEXT
p ImageDrmFormatModifierListCreateInfoEXT
x (Ptr ImageDrmFormatModifierListCreateInfoEXT -> IO b
f Ptr ImageDrmFormatModifierListCreateInfoEXT
p)
  pokeCStruct :: forall b.
Ptr ImageDrmFormatModifierListCreateInfoEXT
-> ImageDrmFormatModifierListCreateInfoEXT -> IO b -> IO b
pokeCStruct Ptr ImageDrmFormatModifierListCreateInfoEXT
p ImageDrmFormatModifierListCreateInfoEXT{Vector Word64
drmFormatModifiers :: Vector Word64
$sel:drmFormatModifiers:ImageDrmFormatModifierListCreateInfoEXT :: ImageDrmFormatModifierListCreateInfoEXT -> Vector Word64
..} IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierListCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierListCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierListCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) ((forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Vector a -> Int
Data.Vector.length forall a b. (a -> b) -> a -> b
$ (Vector Word64
drmFormatModifiers)) :: Word32))
    Ptr Word64
pPDrmFormatModifiers' <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @Word64 ((forall a. Vector a -> Int
Data.Vector.length (Vector Word64
drmFormatModifiers)) forall a. Num a => a -> a -> a
* Int
8)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i Word64
e -> forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Word64
pPDrmFormatModifiers' forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64) (Word64
e)) (Vector Word64
drmFormatModifiers)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierListCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Word64))) (Ptr Word64
pPDrmFormatModifiers')
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr ImageDrmFormatModifierListCreateInfoEXT -> IO b -> IO b
pokeZeroCStruct Ptr ImageDrmFormatModifierListCreateInfoEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierListCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierListCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    IO b
f

instance FromCStruct ImageDrmFormatModifierListCreateInfoEXT where
  peekCStruct :: Ptr ImageDrmFormatModifierListCreateInfoEXT
-> IO ImageDrmFormatModifierListCreateInfoEXT
peekCStruct Ptr ImageDrmFormatModifierListCreateInfoEXT
p = do
    Word32
drmFormatModifierCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ImageDrmFormatModifierListCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
    Ptr Word64
pDrmFormatModifiers <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr Word64) ((Ptr ImageDrmFormatModifierListCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr Word64)))
    Vector Word64
pDrmFormatModifiers' <- forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
drmFormatModifierCount) (\Int
i -> forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr Word64
pDrmFormatModifiers forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr Word64)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Vector Word64 -> ImageDrmFormatModifierListCreateInfoEXT
ImageDrmFormatModifierListCreateInfoEXT
             Vector Word64
pDrmFormatModifiers'

instance Zero ImageDrmFormatModifierListCreateInfoEXT where
  zero :: ImageDrmFormatModifierListCreateInfoEXT
zero = Vector Word64 -> ImageDrmFormatModifierListCreateInfoEXT
ImageDrmFormatModifierListCreateInfoEXT
           forall a. Monoid a => a
mempty


-- | VkImageDrmFormatModifierExplicitCreateInfoEXT - Specify that an image be
-- created with the provided DRM format modifier and explicit memory layout
--
-- = Description
--
-- The @i@th member of @pPlaneLayouts@ describes the layout of the image’s
-- @i@th /memory plane/ (that is,
-- @VK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXT@). In each element of
-- @pPlaneLayouts@, the implementation /must/ ignore @size@. The
-- implementation calculates the size of each plane, which the application
-- /can/ query with 'Vulkan.Core10.Image.getImageSubresourceLayout'.
--
-- When creating an image with
-- 'ImageDrmFormatModifierExplicitCreateInfoEXT', it is the application’s
-- responsibility to satisfy all valid usage requirements. However, the
-- implementation /must/ validate that the provided @pPlaneLayouts@, when
-- combined with the provided @drmFormatModifier@ and other creation
-- parameters in 'Vulkan.Core10.Image.ImageCreateInfo' and its @pNext@
-- chain, produce a valid image. (This validation is necessarily
-- implementation-dependent and outside the scope of Vulkan, and therefore
-- not described by valid usage requirements). If this validation fails,
-- then 'Vulkan.Core10.Image.createImage' returns
-- 'Vulkan.Core10.Enums.Result.ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT'.
--
-- == Valid Usage
--
-- -   #VUID-VkImageDrmFormatModifierExplicitCreateInfoEXT-drmFormatModifier-02264#
--     @drmFormatModifier@ /must/ be compatible with the parameters in
--     'Vulkan.Core10.Image.ImageCreateInfo' and its @pNext@ chain, as
--     determined by querying
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceImageFormatInfo2'
--     extended with 'PhysicalDeviceImageDrmFormatModifierInfoEXT'
--
-- -   #VUID-VkImageDrmFormatModifierExplicitCreateInfoEXT-drmFormatModifierPlaneCount-02265#
--     @drmFormatModifierPlaneCount@ /must/ be equal to the
--     'DrmFormatModifierPropertiesEXT'::@drmFormatModifierPlaneCount@
--     associated with 'Vulkan.Core10.Image.ImageCreateInfo'::@format@ and
--     @drmFormatModifier@, as found by querying
--     'DrmFormatModifierPropertiesListEXT'
--
-- -   #VUID-VkImageDrmFormatModifierExplicitCreateInfoEXT-size-02267# For
--     each element of @pPlaneLayouts@, @size@ /must/ be 0
--
-- -   #VUID-VkImageDrmFormatModifierExplicitCreateInfoEXT-arrayPitch-02268#
--     For each element of @pPlaneLayouts@, @arrayPitch@ /must/ be 0 if
--     'Vulkan.Core10.Image.ImageCreateInfo'::@arrayLayers@ is 1
--
-- -   #VUID-VkImageDrmFormatModifierExplicitCreateInfoEXT-depthPitch-02269#
--     For each element of @pPlaneLayouts@, @depthPitch@ /must/ be 0 if
--     'Vulkan.Core10.Image.ImageCreateInfo'::@extent.depth@ is 1
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-VkImageDrmFormatModifierExplicitCreateInfoEXT-sType-sType#
--     @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT'
--
-- -   #VUID-VkImageDrmFormatModifierExplicitCreateInfoEXT-pPlaneLayouts-parameter#
--     @pPlaneLayouts@ /must/ be a valid pointer to an array of
--     @drmFormatModifierPlaneCount@
--     'Vulkan.Core10.Image.SubresourceLayout' structures
--
-- -   #VUID-VkImageDrmFormatModifierExplicitCreateInfoEXT-drmFormatModifierPlaneCount-arraylength#
--     @drmFormatModifierPlaneCount@ /must/ be greater than @0@
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier VK_EXT_image_drm_format_modifier>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'Vulkan.Core10.Image.SubresourceLayout'
data ImageDrmFormatModifierExplicitCreateInfoEXT = ImageDrmFormatModifierExplicitCreateInfoEXT
  { -- | @drmFormatModifier@ is the /Linux DRM format modifier/ with which the
    -- image will be created.
    ImageDrmFormatModifierExplicitCreateInfoEXT -> Word64
drmFormatModifier :: Word64
  , -- | @pPlaneLayouts@ is a pointer to an array of
    -- 'Vulkan.Core10.Image.SubresourceLayout' structures describing the
    -- image’s /memory planes/.
    ImageDrmFormatModifierExplicitCreateInfoEXT
-> Vector SubresourceLayout
planeLayouts :: Vector SubresourceLayout
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImageDrmFormatModifierExplicitCreateInfoEXT)
#endif
deriving instance Show ImageDrmFormatModifierExplicitCreateInfoEXT

instance ToCStruct ImageDrmFormatModifierExplicitCreateInfoEXT where
  withCStruct :: forall b.
ImageDrmFormatModifierExplicitCreateInfoEXT
-> (Ptr ImageDrmFormatModifierExplicitCreateInfoEXT -> IO b)
-> IO b
withCStruct ImageDrmFormatModifierExplicitCreateInfoEXT
x Ptr ImageDrmFormatModifierExplicitCreateInfoEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
40 forall a b. (a -> b) -> a -> b
$ \Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p ImageDrmFormatModifierExplicitCreateInfoEXT
x (Ptr ImageDrmFormatModifierExplicitCreateInfoEXT -> IO b
f Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p)
  pokeCStruct :: forall b.
Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
-> ImageDrmFormatModifierExplicitCreateInfoEXT -> IO b -> IO b
pokeCStruct Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p ImageDrmFormatModifierExplicitCreateInfoEXT{Word64
Vector SubresourceLayout
planeLayouts :: Vector SubresourceLayout
drmFormatModifier :: Word64
$sel:planeLayouts:ImageDrmFormatModifierExplicitCreateInfoEXT :: ImageDrmFormatModifierExplicitCreateInfoEXT
-> Vector SubresourceLayout
$sel:drmFormatModifier:ImageDrmFormatModifierExplicitCreateInfoEXT :: ImageDrmFormatModifierExplicitCreateInfoEXT -> Word64
..} IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word64)) (Word64
drmFormatModifier)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32)) ((forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Vector a -> Int
Data.Vector.length forall a b. (a -> b) -> a -> b
$ (Vector SubresourceLayout
planeLayouts)) :: Word32))
    Ptr SubresourceLayout
pPPlaneLayouts' <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @SubresourceLayout ((forall a. Vector a -> Int
Data.Vector.length (Vector SubresourceLayout
planeLayouts)) forall a. Num a => a -> a -> a
* Int
40)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i SubresourceLayout
e -> forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr SubresourceLayout
pPPlaneLayouts' forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
40 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SubresourceLayout) (SubresourceLayout
e)) (Vector SubresourceLayout
planeLayouts)
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr SubresourceLayout))) (Ptr SubresourceLayout
pPPlaneLayouts')
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = Int
40
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr ImageDrmFormatModifierExplicitCreateInfoEXT -> IO b -> IO b
pokeZeroCStruct Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word64)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ImageDrmFormatModifierExplicitCreateInfoEXT where
  peekCStruct :: Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
-> IO ImageDrmFormatModifierExplicitCreateInfoEXT
peekCStruct Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p = do
    Word64
drmFormatModifier <- forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word64))
    Word32
drmFormatModifierPlaneCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Word32))
    Ptr SubresourceLayout
pPlaneLayouts <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr SubresourceLayout) ((Ptr ImageDrmFormatModifierExplicitCreateInfoEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr (Ptr SubresourceLayout)))
    Vector SubresourceLayout
pPlaneLayouts' <- forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
drmFormatModifierPlaneCount) (\Int
i -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SubresourceLayout ((Ptr SubresourceLayout
pPlaneLayouts forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
40 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SubresourceLayout)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Word64
-> Vector SubresourceLayout
-> ImageDrmFormatModifierExplicitCreateInfoEXT
ImageDrmFormatModifierExplicitCreateInfoEXT
             Word64
drmFormatModifier Vector SubresourceLayout
pPlaneLayouts'

instance Zero ImageDrmFormatModifierExplicitCreateInfoEXT where
  zero :: ImageDrmFormatModifierExplicitCreateInfoEXT
zero = Word64
-> Vector SubresourceLayout
-> ImageDrmFormatModifierExplicitCreateInfoEXT
ImageDrmFormatModifierExplicitCreateInfoEXT
           forall a. Zero a => a
zero
           forall a. Monoid a => a
mempty


-- | VkImageDrmFormatModifierPropertiesEXT - Properties of an image’s Linux
-- DRM format modifier
--
-- = Description
--
-- If the @image@ was created with
-- 'ImageDrmFormatModifierListCreateInfoEXT', then the returned
-- @drmFormatModifier@ /must/ belong to the list of modifiers provided at
-- time of image creation in
-- 'ImageDrmFormatModifierListCreateInfoEXT'::@pDrmFormatModifiers@. If the
-- @image@ was created with 'ImageDrmFormatModifierExplicitCreateInfoEXT',
-- then the returned @drmFormatModifier@ /must/ be the modifier provided at
-- time of image creation in
-- 'ImageDrmFormatModifierExplicitCreateInfoEXT'::@drmFormatModifier@.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier VK_EXT_image_drm_format_modifier>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getImageDrmFormatModifierPropertiesEXT'
data ImageDrmFormatModifierPropertiesEXT = ImageDrmFormatModifierPropertiesEXT
  { -- | @drmFormatModifier@ returns the image’s
    -- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#glossary-drm-format-modifier Linux DRM format modifier>.
    ImageDrmFormatModifierPropertiesEXT -> Word64
drmFormatModifier :: Word64 }
  deriving (Typeable, ImageDrmFormatModifierPropertiesEXT
-> ImageDrmFormatModifierPropertiesEXT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageDrmFormatModifierPropertiesEXT
-> ImageDrmFormatModifierPropertiesEXT -> Bool
$c/= :: ImageDrmFormatModifierPropertiesEXT
-> ImageDrmFormatModifierPropertiesEXT -> Bool
== :: ImageDrmFormatModifierPropertiesEXT
-> ImageDrmFormatModifierPropertiesEXT -> Bool
$c== :: ImageDrmFormatModifierPropertiesEXT
-> ImageDrmFormatModifierPropertiesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImageDrmFormatModifierPropertiesEXT)
#endif
deriving instance Show ImageDrmFormatModifierPropertiesEXT

instance ToCStruct ImageDrmFormatModifierPropertiesEXT where
  withCStruct :: forall b.
ImageDrmFormatModifierPropertiesEXT
-> (("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
    -> IO b)
-> IO b
withCStruct ImageDrmFormatModifierPropertiesEXT
x ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \"pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p ImageDrmFormatModifierPropertiesEXT
x (("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT) -> IO b
f "pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p)
  pokeCStruct :: forall b.
("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
-> ImageDrmFormatModifierPropertiesEXT -> IO b -> IO b
pokeCStruct "pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p ImageDrmFormatModifierPropertiesEXT{Word64
drmFormatModifier :: Word64
$sel:drmFormatModifier:ImageDrmFormatModifierPropertiesEXT :: ImageDrmFormatModifierPropertiesEXT -> Word64
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word64)) (Word64
drmFormatModifier)
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
-> IO b -> IO b
pokeZeroCStruct "pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word64)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct ImageDrmFormatModifierPropertiesEXT where
  peekCStruct :: ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
-> IO ImageDrmFormatModifierPropertiesEXT
peekCStruct "pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p = do
    Word64
drmFormatModifier <- forall a. Storable a => Ptr a -> IO a
peek @Word64 (("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word64))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Word64 -> ImageDrmFormatModifierPropertiesEXT
ImageDrmFormatModifierPropertiesEXT
             Word64
drmFormatModifier

instance Storable ImageDrmFormatModifierPropertiesEXT where
  sizeOf :: ImageDrmFormatModifierPropertiesEXT -> Int
sizeOf ~ImageDrmFormatModifierPropertiesEXT
_ = Int
24
  alignment :: ImageDrmFormatModifierPropertiesEXT -> Int
alignment ~ImageDrmFormatModifierPropertiesEXT
_ = Int
8
  peek :: ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
-> IO ImageDrmFormatModifierPropertiesEXT
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: ("pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT)
-> ImageDrmFormatModifierPropertiesEXT -> IO ()
poke "pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
ptr ImageDrmFormatModifierPropertiesEXT
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pProperties" ::: Ptr ImageDrmFormatModifierPropertiesEXT
ptr ImageDrmFormatModifierPropertiesEXT
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero ImageDrmFormatModifierPropertiesEXT where
  zero :: ImageDrmFormatModifierPropertiesEXT
zero = Word64 -> ImageDrmFormatModifierPropertiesEXT
ImageDrmFormatModifierPropertiesEXT
           forall a. Zero a => a
zero


-- | VkDrmFormatModifierPropertiesList2EXT - Structure specifying the list of
-- DRM format modifiers supported for a format
--
-- = Description
--
-- If @pDrmFormatModifierProperties@ is @NULL@, the number of modifiers
-- compatible with the queried @format@ is returned in
-- @drmFormatModifierCount@. Otherwise, the application /must/ set
-- @drmFormatModifierCount@ to the length of the array
-- @pDrmFormatModifierProperties@; the function will write at most
-- @drmFormatModifierCount@ elements to the array, and will return in
-- @drmFormatModifierCount@ the number of elements written.
--
-- Among the elements in array @pDrmFormatModifierProperties@, each
-- returned @drmFormatModifier@ /must/ be unique.
--
-- Among the elements in array @pDrmFormatModifierProperties@, the bits
-- reported in @drmFormatModifierTilingFeatures@ /must/ include the bits
-- reported in the corresponding element of
-- 'DrmFormatModifierPropertiesListEXT'::@pDrmFormatModifierProperties@.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier VK_EXT_image_drm_format_modifier>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_format_feature_flags2 VK_KHR_format_feature_flags2>,
-- 'DrmFormatModifierProperties2EXT',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data DrmFormatModifierPropertiesList2EXT = DrmFormatModifierPropertiesList2EXT
  { -- | @drmFormatModifierCount@ is an inout parameter related to the number of
    -- modifiers compatible with the @format@, as described below.
    DrmFormatModifierPropertiesList2EXT -> Word32
drmFormatModifierCount :: Word32
  , -- | @pDrmFormatModifierProperties@ is either @NULL@ or a pointer to an array
    -- of 'DrmFormatModifierProperties2EXT' structures.
    DrmFormatModifierPropertiesList2EXT
-> Ptr DrmFormatModifierProperties2EXT
drmFormatModifierProperties :: Ptr DrmFormatModifierProperties2EXT
  }
  deriving (Typeable, DrmFormatModifierPropertiesList2EXT
-> DrmFormatModifierPropertiesList2EXT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DrmFormatModifierPropertiesList2EXT
-> DrmFormatModifierPropertiesList2EXT -> Bool
$c/= :: DrmFormatModifierPropertiesList2EXT
-> DrmFormatModifierPropertiesList2EXT -> Bool
== :: DrmFormatModifierPropertiesList2EXT
-> DrmFormatModifierPropertiesList2EXT -> Bool
$c== :: DrmFormatModifierPropertiesList2EXT
-> DrmFormatModifierPropertiesList2EXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DrmFormatModifierPropertiesList2EXT)
#endif
deriving instance Show DrmFormatModifierPropertiesList2EXT

instance ToCStruct DrmFormatModifierPropertiesList2EXT where
  withCStruct :: forall b.
DrmFormatModifierPropertiesList2EXT
-> (Ptr DrmFormatModifierPropertiesList2EXT -> IO b) -> IO b
withCStruct DrmFormatModifierPropertiesList2EXT
x Ptr DrmFormatModifierPropertiesList2EXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr DrmFormatModifierPropertiesList2EXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierPropertiesList2EXT
p DrmFormatModifierPropertiesList2EXT
x (Ptr DrmFormatModifierPropertiesList2EXT -> IO b
f Ptr DrmFormatModifierPropertiesList2EXT
p)
  pokeCStruct :: forall b.
Ptr DrmFormatModifierPropertiesList2EXT
-> DrmFormatModifierPropertiesList2EXT -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierPropertiesList2EXT
p DrmFormatModifierPropertiesList2EXT{Word32
Ptr DrmFormatModifierProperties2EXT
drmFormatModifierProperties :: Ptr DrmFormatModifierProperties2EXT
drmFormatModifierCount :: Word32
$sel:drmFormatModifierProperties:DrmFormatModifierPropertiesList2EXT :: DrmFormatModifierPropertiesList2EXT
-> Ptr DrmFormatModifierProperties2EXT
$sel:drmFormatModifierCount:DrmFormatModifierPropertiesList2EXT :: DrmFormatModifierPropertiesList2EXT -> Word32
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesList2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_2_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesList2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesList2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32)) (Word32
drmFormatModifierCount)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesList2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr DrmFormatModifierProperties2EXT))) (Ptr DrmFormatModifierProperties2EXT
drmFormatModifierProperties)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr DrmFormatModifierPropertiesList2EXT -> IO b -> IO b
pokeZeroCStruct Ptr DrmFormatModifierPropertiesList2EXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesList2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_2_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierPropertiesList2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    IO b
f

instance FromCStruct DrmFormatModifierPropertiesList2EXT where
  peekCStruct :: Ptr DrmFormatModifierPropertiesList2EXT
-> IO DrmFormatModifierPropertiesList2EXT
peekCStruct Ptr DrmFormatModifierPropertiesList2EXT
p = do
    Word32
drmFormatModifierCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DrmFormatModifierPropertiesList2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Word32))
    Ptr DrmFormatModifierProperties2EXT
pDrmFormatModifierProperties <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr DrmFormatModifierProperties2EXT) ((Ptr DrmFormatModifierPropertiesList2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr DrmFormatModifierProperties2EXT)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Word32
-> Ptr DrmFormatModifierProperties2EXT
-> DrmFormatModifierPropertiesList2EXT
DrmFormatModifierPropertiesList2EXT
             Word32
drmFormatModifierCount Ptr DrmFormatModifierProperties2EXT
pDrmFormatModifierProperties

instance Storable DrmFormatModifierPropertiesList2EXT where
  sizeOf :: DrmFormatModifierPropertiesList2EXT -> Int
sizeOf ~DrmFormatModifierPropertiesList2EXT
_ = Int
32
  alignment :: DrmFormatModifierPropertiesList2EXT -> Int
alignment ~DrmFormatModifierPropertiesList2EXT
_ = Int
8
  peek :: Ptr DrmFormatModifierPropertiesList2EXT
-> IO DrmFormatModifierPropertiesList2EXT
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr DrmFormatModifierPropertiesList2EXT
-> DrmFormatModifierPropertiesList2EXT -> IO ()
poke Ptr DrmFormatModifierPropertiesList2EXT
ptr DrmFormatModifierPropertiesList2EXT
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierPropertiesList2EXT
ptr DrmFormatModifierPropertiesList2EXT
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero DrmFormatModifierPropertiesList2EXT where
  zero :: DrmFormatModifierPropertiesList2EXT
zero = Word32
-> Ptr DrmFormatModifierProperties2EXT
-> DrmFormatModifierPropertiesList2EXT
DrmFormatModifierPropertiesList2EXT
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


-- | VkDrmFormatModifierProperties2EXT - Structure specifying properties of a
-- format when combined with a DRM format modifier
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_image_drm_format_modifier VK_EXT_image_drm_format_modifier>,
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_format_feature_flags2 VK_KHR_format_feature_flags2>,
-- 'DrmFormatModifierPropertiesList2EXT',
-- 'Vulkan.Core13.Enums.FormatFeatureFlags2.FormatFeatureFlags2'
data DrmFormatModifierProperties2EXT = DrmFormatModifierProperties2EXT
  { -- | @drmFormatModifier@ is a /Linux DRM format modifier/.
    DrmFormatModifierProperties2EXT -> Word64
drmFormatModifier :: Word64
  , -- | @drmFormatModifierPlaneCount@ is the number of /memory planes/ in any
    -- image created with @format@ and @drmFormatModifier@. An image’s /memory
    -- planecount/ is distinct from its /format planecount/, as explained
    -- below.
    DrmFormatModifierProperties2EXT -> Word32
drmFormatModifierPlaneCount :: Word32
  , -- | @drmFormatModifierTilingFeatures@ is a bitmask of
    -- 'Vulkan.Core13.Enums.FormatFeatureFlags2.FormatFeatureFlagBits2' that
    -- are supported by any image created with @format@ and
    -- @drmFormatModifier@.
    DrmFormatModifierProperties2EXT -> FormatFeatureFlags2
drmFormatModifierTilingFeatures :: FormatFeatureFlags2
  }
  deriving (Typeable, DrmFormatModifierProperties2EXT
-> DrmFormatModifierProperties2EXT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DrmFormatModifierProperties2EXT
-> DrmFormatModifierProperties2EXT -> Bool
$c/= :: DrmFormatModifierProperties2EXT
-> DrmFormatModifierProperties2EXT -> Bool
== :: DrmFormatModifierProperties2EXT
-> DrmFormatModifierProperties2EXT -> Bool
$c== :: DrmFormatModifierProperties2EXT
-> DrmFormatModifierProperties2EXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (DrmFormatModifierProperties2EXT)
#endif
deriving instance Show DrmFormatModifierProperties2EXT

instance ToCStruct DrmFormatModifierProperties2EXT where
  withCStruct :: forall b.
DrmFormatModifierProperties2EXT
-> (Ptr DrmFormatModifierProperties2EXT -> IO b) -> IO b
withCStruct DrmFormatModifierProperties2EXT
x Ptr DrmFormatModifierProperties2EXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr DrmFormatModifierProperties2EXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierProperties2EXT
p DrmFormatModifierProperties2EXT
x (Ptr DrmFormatModifierProperties2EXT -> IO b
f Ptr DrmFormatModifierProperties2EXT
p)
  pokeCStruct :: forall b.
Ptr DrmFormatModifierProperties2EXT
-> DrmFormatModifierProperties2EXT -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierProperties2EXT
p DrmFormatModifierProperties2EXT{Word32
Word64
FormatFeatureFlags2
drmFormatModifierTilingFeatures :: FormatFeatureFlags2
drmFormatModifierPlaneCount :: Word32
drmFormatModifier :: Word64
$sel:drmFormatModifierTilingFeatures:DrmFormatModifierProperties2EXT :: DrmFormatModifierProperties2EXT -> FormatFeatureFlags2
$sel:drmFormatModifierPlaneCount:DrmFormatModifierProperties2EXT :: DrmFormatModifierProperties2EXT -> Word32
$sel:drmFormatModifier:DrmFormatModifierProperties2EXT :: DrmFormatModifierProperties2EXT -> Word64
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierProperties2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word64)) (Word64
drmFormatModifier)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierProperties2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32)) (Word32
drmFormatModifierPlaneCount)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierProperties2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr FormatFeatureFlags2)) (FormatFeatureFlags2
drmFormatModifierTilingFeatures)
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr DrmFormatModifierProperties2EXT -> IO b -> IO b
pokeZeroCStruct Ptr DrmFormatModifierProperties2EXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierProperties2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word64)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierProperties2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr DrmFormatModifierProperties2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr FormatFeatureFlags2)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct DrmFormatModifierProperties2EXT where
  peekCStruct :: Ptr DrmFormatModifierProperties2EXT
-> IO DrmFormatModifierProperties2EXT
peekCStruct Ptr DrmFormatModifierProperties2EXT
p = do
    Word64
drmFormatModifier <- forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr DrmFormatModifierProperties2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr Word64))
    Word32
drmFormatModifierPlaneCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr DrmFormatModifierProperties2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr Word32))
    FormatFeatureFlags2
drmFormatModifierTilingFeatures <- forall a. Storable a => Ptr a -> IO a
peek @FormatFeatureFlags2 ((Ptr DrmFormatModifierProperties2EXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr FormatFeatureFlags2))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Word64
-> Word32 -> FormatFeatureFlags2 -> DrmFormatModifierProperties2EXT
DrmFormatModifierProperties2EXT
             Word64
drmFormatModifier
             Word32
drmFormatModifierPlaneCount
             FormatFeatureFlags2
drmFormatModifierTilingFeatures

instance Storable DrmFormatModifierProperties2EXT where
  sizeOf :: DrmFormatModifierProperties2EXT -> Int
sizeOf ~DrmFormatModifierProperties2EXT
_ = Int
24
  alignment :: DrmFormatModifierProperties2EXT -> Int
alignment ~DrmFormatModifierProperties2EXT
_ = Int
8
  peek :: Ptr DrmFormatModifierProperties2EXT
-> IO DrmFormatModifierProperties2EXT
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
  poke :: Ptr DrmFormatModifierProperties2EXT
-> DrmFormatModifierProperties2EXT -> IO ()
poke Ptr DrmFormatModifierProperties2EXT
ptr DrmFormatModifierProperties2EXT
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr DrmFormatModifierProperties2EXT
ptr DrmFormatModifierProperties2EXT
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())

instance Zero DrmFormatModifierProperties2EXT where
  zero :: DrmFormatModifierProperties2EXT
zero = Word64
-> Word32 -> FormatFeatureFlags2 -> DrmFormatModifierProperties2EXT
DrmFormatModifierProperties2EXT
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


type EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION = 2

-- No documentation found for TopLevel "VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION"
pattern EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION :: forall a. Integral a => a
$mEXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION = 2


type EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME = "VK_EXT_image_drm_format_modifier"

-- No documentation found for TopLevel "VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME"
pattern EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mEXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME = "VK_EXT_image_drm_format_modifier"