{-# language CPP #-}
-- | = Name
--
-- VK_ARM_format_pack - device extension
--
-- = VK_ARM_format_pack
--
-- [__Name String__]
--     @VK_ARM_format_pack@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     610
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__]
--     <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>
--     or
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#versions-1.1 Vulkan Version 1.1>
--
-- [__Contact__]
--
--     -   Jan-Harald Fredriksen
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_ARM_format_pack] @janharaldfredriksen-arm%0A*Here describe the issue or question you have about the VK_ARM_format_pack extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2025-03-24
--
-- [__Interactions and External Dependencies__; __Contributors__]
--
--     -   Jan-Harald Fredriksen, Arm
--
--     -   Lisa Wu, Arm
--
--     -   Oivind Boge, Arm
--
-- == Description
--
-- This extension adds support for additional 1-, 2- and 4-component
-- formats with 10, 12, or 14 bits of components in 16-bit containers.
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceFormatPackFeaturesARM'
--
-- == New Enum Constants
--
-- -   'ARM_FORMAT_PACK_EXTENSION_NAME'
--
-- -   'ARM_FORMAT_PACK_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.Format.Format':
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_G14X2_B14X2R14X2_2PLANE_420_UNORM_3PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_G14X2_B14X2R14X2_2PLANE_422_UNORM_3PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R10X6G10X6B10X6A10X6_UINT_4PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R10X6G10X6_UINT_2PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R10X6_UINT_PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R12X4G12X4B12X4A12X4_UINT_4PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R12X4G12X4_UINT_2PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R12X4_UINT_PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R14X2G14X2B14X2A14X2_UINT_4PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R14X2G14X2B14X2A14X2_UNORM_4PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R14X2G14X2_UINT_2PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R14X2G14X2_UNORM_2PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R14X2_UINT_PACK16_ARM'
--
--     -   'Vulkan.Core10.Enums.Format.FORMAT_R14X2_UNORM_PACK16_ARM'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_FORMAT_PACK_FEATURES_ARM'
--
-- === What do we call this extension?
--
-- __RESOLVED__
--
-- Many existing extension have the format in the name, but in this case we
-- want to expose multiple formats.
--
-- We will describe this set of formats as a “pack”.
--
-- === Compatibility classes
--
-- [__RESOLVED__]
--     Should these additional formats be in the same compatibility class
--     as any other formats? For single-plane formats, we put formats with
--     the same number of bits (but different types) in the same class.
--     Each multi-plane or subsampled format gets its own compatibility
--     class. This is consistent with how existing formats are handled.
--
-- === Format feature requirements
--
-- [__RESOLVED__]
--     The format feature queries could be used to determine what is
--     supported on any given implementation, but it may be useful to
--     establish a baseline requirement in the specification. For that
--     purpose, we require a set of format features - sufficient to enable
--     texture operations - to be supported for the added unsigned integer
--     single-plane formats. Other formats and format features are
--     optional.
--
-- == Version History
--
-- -   Revision 1, 2025-03-24
--
--     -   Initial revision
--
-- == See Also
--
-- No cross-references are available
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#VK_ARM_format_pack Vulkan Specification>.
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_ARM_format_pack  ( PhysicalDeviceFormatPackFeaturesARM(..)
                                             , ARM_FORMAT_PACK_SPEC_VERSION
                                             , pattern ARM_FORMAT_PACK_SPEC_VERSION
                                             , ARM_FORMAT_PACK_EXTENSION_NAME
                                             , pattern ARM_FORMAT_PACK_EXTENSION_NAME
                                             ) where

import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
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 Foreign.Ptr (Ptr)
import Data.Kind (Type)
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_FORMAT_PACK_FEATURES_ARM))
-- | VkPhysicalDeviceFormatPackFeaturesARM - Structure describing whether the
-- additional formats feature is supported by an implementation
--
-- = Members
--
-- This structure describes the following feature:
--
-- = Description
--
-- If the 'PhysicalDeviceFormatPackFeaturesARM' structure is included in
-- the @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceFeatures2',
-- it is filled in to indicate whether each corresponding feature is
-- supported. If the application wishes to use a
-- 'Vulkan.Core10.Handles.Device' with any features described by
-- 'PhysicalDeviceFormatPackFeaturesARM', it /must/ add an instance of the
-- structure, with the desired feature members set to
-- 'Vulkan.Core10.FundamentalTypes.TRUE', to the @pNext@ chain of
-- 'Vulkan.Core10.Device.DeviceCreateInfo' when creating the
-- 'Vulkan.Core10.Handles.Device'.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_ARM_format_pack VK_ARM_format_pack>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceFormatPackFeaturesARM = PhysicalDeviceFormatPackFeaturesARM
  { -- | #features-formatPack# @formatPack@ indicates that the implementation
    -- /must/ support using a 'Vulkan.Core10.Enums.Format.Format' of
    -- 'Vulkan.Core10.Enums.Format.FORMAT_R10X6_UINT_PACK16_ARM',
    -- 'Vulkan.Core10.Enums.Format.FORMAT_R10X6G10X6_UINT_2PACK16_ARM',
    -- 'Vulkan.Core10.Enums.Format.FORMAT_R10X6G10X6B10X6A10X6_UINT_4PACK16_ARM',
    -- 'Vulkan.Core10.Enums.Format.FORMAT_R12X4_UINT_PACK16_ARM',
    -- 'Vulkan.Core10.Enums.Format.FORMAT_R12X4G12X4_UINT_2PACK16_ARM',
    -- 'Vulkan.Core10.Enums.Format.FORMAT_R12X4G12X4B12X4A12X4_UINT_4PACK16_ARM',
    -- 'Vulkan.Core10.Enums.Format.FORMAT_R14X2_UINT_PACK16_ARM',
    -- 'Vulkan.Core10.Enums.Format.FORMAT_R14X2G14X2_UINT_2PACK16_ARM', and
    -- 'Vulkan.Core10.Enums.Format.FORMAT_R14X2G14X2B14X2A14X2_UINT_4PACK16_ARM',
    -- with at least the following
    -- 'Vulkan.Core10.Enums.FormatFeatureFlagBits.FormatFeatureFlagBits':
    --
    -- -   'Vulkan.Core10.Enums.FormatFeatureFlagBits.FORMAT_FEATURE_SAMPLED_IMAGE_BIT'
    --
    -- -   'Vulkan.Core10.Enums.FormatFeatureFlagBits.FORMAT_FEATURE_TRANSFER_SRC_BIT'
    --
    -- -   'Vulkan.Core10.Enums.FormatFeatureFlagBits.FORMAT_FEATURE_TRANSFER_DST_BIT'
    PhysicalDeviceFormatPackFeaturesARM -> Bool
formatPack :: Bool }
  deriving (Typeable, PhysicalDeviceFormatPackFeaturesARM
-> PhysicalDeviceFormatPackFeaturesARM -> Bool
(PhysicalDeviceFormatPackFeaturesARM
 -> PhysicalDeviceFormatPackFeaturesARM -> Bool)
-> (PhysicalDeviceFormatPackFeaturesARM
    -> PhysicalDeviceFormatPackFeaturesARM -> Bool)
-> Eq PhysicalDeviceFormatPackFeaturesARM
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PhysicalDeviceFormatPackFeaturesARM
-> PhysicalDeviceFormatPackFeaturesARM -> Bool
== :: PhysicalDeviceFormatPackFeaturesARM
-> PhysicalDeviceFormatPackFeaturesARM -> Bool
$c/= :: PhysicalDeviceFormatPackFeaturesARM
-> PhysicalDeviceFormatPackFeaturesARM -> Bool
/= :: PhysicalDeviceFormatPackFeaturesARM
-> PhysicalDeviceFormatPackFeaturesARM -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceFormatPackFeaturesARM)
#endif
deriving instance Show PhysicalDeviceFormatPackFeaturesARM

instance ToCStruct PhysicalDeviceFormatPackFeaturesARM where
  withCStruct :: forall b.
PhysicalDeviceFormatPackFeaturesARM
-> (Ptr PhysicalDeviceFormatPackFeaturesARM -> IO b) -> IO b
withCStruct PhysicalDeviceFormatPackFeaturesARM
x Ptr PhysicalDeviceFormatPackFeaturesARM -> IO b
f = Int -> (Ptr PhysicalDeviceFormatPackFeaturesARM -> IO b) -> IO b
forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 ((Ptr PhysicalDeviceFormatPackFeaturesARM -> IO b) -> IO b)
-> (Ptr PhysicalDeviceFormatPackFeaturesARM -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceFormatPackFeaturesARM
p -> Ptr PhysicalDeviceFormatPackFeaturesARM
-> PhysicalDeviceFormatPackFeaturesARM -> IO b -> IO b
forall b.
Ptr PhysicalDeviceFormatPackFeaturesARM
-> PhysicalDeviceFormatPackFeaturesARM -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceFormatPackFeaturesARM
p PhysicalDeviceFormatPackFeaturesARM
x (Ptr PhysicalDeviceFormatPackFeaturesARM -> IO b
f Ptr PhysicalDeviceFormatPackFeaturesARM
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceFormatPackFeaturesARM
-> PhysicalDeviceFormatPackFeaturesARM -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceFormatPackFeaturesARM
p PhysicalDeviceFormatPackFeaturesARM{Bool
formatPack :: PhysicalDeviceFormatPackFeaturesARM -> Bool
formatPack :: Bool
..} IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFormatPackFeaturesARM
p Ptr PhysicalDeviceFormatPackFeaturesARM -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_FORMAT_PACK_FEATURES_ARM)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFormatPackFeaturesARM
p Ptr PhysicalDeviceFormatPackFeaturesARM -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFormatPackFeaturesARM
p Ptr PhysicalDeviceFormatPackFeaturesARM -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
formatPack))
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr PhysicalDeviceFormatPackFeaturesARM -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceFormatPackFeaturesARM
p IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFormatPackFeaturesARM
p Ptr PhysicalDeviceFormatPackFeaturesARM -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_FORMAT_PACK_FEATURES_ARM)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFormatPackFeaturesARM
p Ptr PhysicalDeviceFormatPackFeaturesARM -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceFormatPackFeaturesARM
p Ptr PhysicalDeviceFormatPackFeaturesARM -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct PhysicalDeviceFormatPackFeaturesARM where
  peekCStruct :: Ptr PhysicalDeviceFormatPackFeaturesARM
-> IO PhysicalDeviceFormatPackFeaturesARM
peekCStruct Ptr PhysicalDeviceFormatPackFeaturesARM
p = do
    formatPack <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceFormatPackFeaturesARM
p Ptr PhysicalDeviceFormatPackFeaturesARM -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    pure $ PhysicalDeviceFormatPackFeaturesARM
             (bool32ToBool formatPack)

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

instance Zero PhysicalDeviceFormatPackFeaturesARM where
  zero :: PhysicalDeviceFormatPackFeaturesARM
zero = Bool -> PhysicalDeviceFormatPackFeaturesARM
PhysicalDeviceFormatPackFeaturesARM
           Bool
forall a. Zero a => a
zero


type ARM_FORMAT_PACK_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_ARM_FORMAT_PACK_SPEC_VERSION"
pattern ARM_FORMAT_PACK_SPEC_VERSION :: forall a . Integral a => a
pattern $mARM_FORMAT_PACK_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bARM_FORMAT_PACK_SPEC_VERSION :: forall a. Integral a => a
ARM_FORMAT_PACK_SPEC_VERSION = 1


type ARM_FORMAT_PACK_EXTENSION_NAME = "VK_ARM_format_pack"

-- No documentation found for TopLevel "VK_ARM_FORMAT_PACK_EXTENSION_NAME"
pattern ARM_FORMAT_PACK_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $mARM_FORMAT_PACK_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
$bARM_FORMAT_PACK_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
ARM_FORMAT_PACK_EXTENSION_NAME = "VK_ARM_format_pack"