{-# language CPP #-}
-- | = Name
--
-- VK_EXT_index_type_uint8 - device extension
--
-- == VK_EXT_index_type_uint8
--
-- [__Name String__]
--     @VK_EXT_index_type_uint8@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     266
--
-- [__Revision__]
--     1
--
-- [__Extension and Version Dependencies__]
--
--     -   Requires Vulkan 1.0
--
-- [__Contact__]
--
--     -   Piers Daniell
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?title=VK_EXT_index_type_uint8:%20&body=@pdaniell-nv%20 >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2019-05-02
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Jeff Bolz, NVIDIA
--
-- == Description
--
-- This extension allows @uint8_t@ indices to be used with
-- 'Vulkan.Core10.CommandBufferBuilding.cmdBindIndexBuffer'.
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceIndexTypeUint8FeaturesEXT'
--
-- == New Enum Constants
--
-- -   'EXT_INDEX_TYPE_UINT8_EXTENSION_NAME'
--
-- -   'EXT_INDEX_TYPE_UINT8_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.IndexType.IndexType':
--
--     -   'Vulkan.Core10.Enums.IndexType.INDEX_TYPE_UINT8_EXT'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT'
--
-- == Version History
--
-- -   Revision 1, 2019-05-02 (Piers Daniell)
--
--     -   Internal revisions
--
-- = See Also
--
-- 'PhysicalDeviceIndexTypeUint8FeaturesEXT'
--
-- = Document Notes
--
-- For more information, see the
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_index_type_uint8 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_index_type_uint8  ( PhysicalDeviceIndexTypeUint8FeaturesEXT(..)
                                                  , EXT_INDEX_TYPE_UINT8_SPEC_VERSION
                                                  , pattern EXT_INDEX_TYPE_UINT8_SPEC_VERSION
                                                  , EXT_INDEX_TYPE_UINT8_EXTENSION_NAME
                                                  , pattern EXT_INDEX_TYPE_UINT8_EXTENSION_NAME
                                                  ) where

import Foreign.Marshal.Alloc (allocaBytesAligned)
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_INDEX_TYPE_UINT8_FEATURES_EXT))
-- | VkPhysicalDeviceIndexTypeUint8FeaturesEXT - Structure describing whether
-- uint8 index type can be used
--
-- = Members
--
-- The members of the 'PhysicalDeviceIndexTypeUint8FeaturesEXT' structure
-- describe the following features:
--
-- = Description
--
-- If the 'PhysicalDeviceIndexTypeUint8FeaturesEXT' structure is included
-- in the @pNext@ chain of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
-- it is filled with values indicating whether the feature is supported.
-- 'PhysicalDeviceIndexTypeUint8FeaturesEXT' /can/ also be included in the
-- @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo' to enable
-- features.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceIndexTypeUint8FeaturesEXT = PhysicalDeviceIndexTypeUint8FeaturesEXT
  { -- | #features-indexTypeUint8# @indexTypeUint8@ indicates that
    -- 'Vulkan.Core10.Enums.IndexType.INDEX_TYPE_UINT8_EXT' can be used with
    -- 'Vulkan.Core10.CommandBufferBuilding.cmdBindIndexBuffer'.
    PhysicalDeviceIndexTypeUint8FeaturesEXT -> Bool
indexTypeUint8 :: Bool }
  deriving (Typeable, PhysicalDeviceIndexTypeUint8FeaturesEXT
-> PhysicalDeviceIndexTypeUint8FeaturesEXT -> Bool
(PhysicalDeviceIndexTypeUint8FeaturesEXT
 -> PhysicalDeviceIndexTypeUint8FeaturesEXT -> Bool)
-> (PhysicalDeviceIndexTypeUint8FeaturesEXT
    -> PhysicalDeviceIndexTypeUint8FeaturesEXT -> Bool)
-> Eq PhysicalDeviceIndexTypeUint8FeaturesEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceIndexTypeUint8FeaturesEXT
-> PhysicalDeviceIndexTypeUint8FeaturesEXT -> Bool
$c/= :: PhysicalDeviceIndexTypeUint8FeaturesEXT
-> PhysicalDeviceIndexTypeUint8FeaturesEXT -> Bool
== :: PhysicalDeviceIndexTypeUint8FeaturesEXT
-> PhysicalDeviceIndexTypeUint8FeaturesEXT -> Bool
$c== :: PhysicalDeviceIndexTypeUint8FeaturesEXT
-> PhysicalDeviceIndexTypeUint8FeaturesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceIndexTypeUint8FeaturesEXT)
#endif
deriving instance Show PhysicalDeviceIndexTypeUint8FeaturesEXT

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

instance FromCStruct PhysicalDeviceIndexTypeUint8FeaturesEXT where
  peekCStruct :: Ptr PhysicalDeviceIndexTypeUint8FeaturesEXT
-> IO PhysicalDeviceIndexTypeUint8FeaturesEXT
peekCStruct p :: Ptr PhysicalDeviceIndexTypeUint8FeaturesEXT
p = do
    Bool32
indexTypeUint8 <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceIndexTypeUint8FeaturesEXT
p Ptr PhysicalDeviceIndexTypeUint8FeaturesEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32))
    PhysicalDeviceIndexTypeUint8FeaturesEXT
-> IO PhysicalDeviceIndexTypeUint8FeaturesEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceIndexTypeUint8FeaturesEXT
 -> IO PhysicalDeviceIndexTypeUint8FeaturesEXT)
-> PhysicalDeviceIndexTypeUint8FeaturesEXT
-> IO PhysicalDeviceIndexTypeUint8FeaturesEXT
forall a b. (a -> b) -> a -> b
$ Bool -> PhysicalDeviceIndexTypeUint8FeaturesEXT
PhysicalDeviceIndexTypeUint8FeaturesEXT
             (Bool32 -> Bool
bool32ToBool Bool32
indexTypeUint8)

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

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


type EXT_INDEX_TYPE_UINT8_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_INDEX_TYPE_UINT8_SPEC_VERSION"
pattern EXT_INDEX_TYPE_UINT8_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_INDEX_TYPE_UINT8_SPEC_VERSION :: a
$mEXT_INDEX_TYPE_UINT8_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
EXT_INDEX_TYPE_UINT8_SPEC_VERSION = 1


type EXT_INDEX_TYPE_UINT8_EXTENSION_NAME = "VK_EXT_index_type_uint8"

-- No documentation found for TopLevel "VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME"
pattern EXT_INDEX_TYPE_UINT8_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_INDEX_TYPE_UINT8_EXTENSION_NAME :: a
$mEXT_INDEX_TYPE_UINT8_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
EXT_INDEX_TYPE_UINT8_EXTENSION_NAME = "VK_EXT_index_type_uint8"