{-# language CPP #-}
module Vulkan.Core12.Promoted_From_VK_KHR_shader_atomic_int64  ( PhysicalDeviceShaderAtomicInt64Features(..)
                                                               , StructureType(..)
                                                               ) where

import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
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.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES))
import Vulkan.Core10.Enums.StructureType (StructureType(..))
-- | VkPhysicalDeviceShaderAtomicInt64Features - Structure describing
-- features supported by VK_KHR_shader_atomic_int64
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceShaderAtomicInt64Features = PhysicalDeviceShaderAtomicInt64Features
  { -- | @shaderBufferInt64Atomics@ indicates whether shaders /can/ perform
    -- 64-bit unsigned and signed integer atomic operations on buffers.
    PhysicalDeviceShaderAtomicInt64Features -> Bool
shaderBufferInt64Atomics :: Bool
  , -- | @shaderSharedInt64Atomics@ indicates whether shaders /can/ perform
    -- 64-bit unsigned and signed integer atomic operations on shared memory.
    PhysicalDeviceShaderAtomicInt64Features -> Bool
shaderSharedInt64Atomics :: Bool
  }
  deriving (Typeable, PhysicalDeviceShaderAtomicInt64Features
-> PhysicalDeviceShaderAtomicInt64Features -> Bool
(PhysicalDeviceShaderAtomicInt64Features
 -> PhysicalDeviceShaderAtomicInt64Features -> Bool)
-> (PhysicalDeviceShaderAtomicInt64Features
    -> PhysicalDeviceShaderAtomicInt64Features -> Bool)
-> Eq PhysicalDeviceShaderAtomicInt64Features
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceShaderAtomicInt64Features
-> PhysicalDeviceShaderAtomicInt64Features -> Bool
$c/= :: PhysicalDeviceShaderAtomicInt64Features
-> PhysicalDeviceShaderAtomicInt64Features -> Bool
== :: PhysicalDeviceShaderAtomicInt64Features
-> PhysicalDeviceShaderAtomicInt64Features -> Bool
$c== :: PhysicalDeviceShaderAtomicInt64Features
-> PhysicalDeviceShaderAtomicInt64Features -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceShaderAtomicInt64Features)
#endif
deriving instance Show PhysicalDeviceShaderAtomicInt64Features

instance ToCStruct PhysicalDeviceShaderAtomicInt64Features where
  withCStruct :: PhysicalDeviceShaderAtomicInt64Features
-> (Ptr PhysicalDeviceShaderAtomicInt64Features -> IO b) -> IO b
withCStruct x :: PhysicalDeviceShaderAtomicInt64Features
x f :: Ptr PhysicalDeviceShaderAtomicInt64Features -> IO b
f = Int
-> Int
-> (Ptr PhysicalDeviceShaderAtomicInt64Features -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr PhysicalDeviceShaderAtomicInt64Features -> IO b) -> IO b)
-> (Ptr PhysicalDeviceShaderAtomicInt64Features -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PhysicalDeviceShaderAtomicInt64Features
p -> Ptr PhysicalDeviceShaderAtomicInt64Features
-> PhysicalDeviceShaderAtomicInt64Features -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceShaderAtomicInt64Features
p PhysicalDeviceShaderAtomicInt64Features
x (Ptr PhysicalDeviceShaderAtomicInt64Features -> IO b
f Ptr PhysicalDeviceShaderAtomicInt64Features
p)
  pokeCStruct :: Ptr PhysicalDeviceShaderAtomicInt64Features
-> PhysicalDeviceShaderAtomicInt64Features -> IO b -> IO b
pokeCStruct p :: Ptr PhysicalDeviceShaderAtomicInt64Features
p PhysicalDeviceShaderAtomicInt64Features{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderAtomicInt64Features
p Ptr PhysicalDeviceShaderAtomicInt64Features
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderAtomicInt64Features
p Ptr PhysicalDeviceShaderAtomicInt64Features -> 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 PhysicalDeviceShaderAtomicInt64Features
p Ptr PhysicalDeviceShaderAtomicInt64Features -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
shaderBufferInt64Atomics))
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderAtomicInt64Features
p Ptr PhysicalDeviceShaderAtomicInt64Features -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
shaderSharedInt64Atomics))
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr PhysicalDeviceShaderAtomicInt64Features -> IO b -> IO b
pokeZeroCStruct p :: Ptr PhysicalDeviceShaderAtomicInt64Features
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderAtomicInt64Features
p Ptr PhysicalDeviceShaderAtomicInt64Features
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderAtomicInt64Features
p Ptr PhysicalDeviceShaderAtomicInt64Features -> 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 PhysicalDeviceShaderAtomicInt64Features
p Ptr PhysicalDeviceShaderAtomicInt64Features -> 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))
    Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceShaderAtomicInt64Features
p Ptr PhysicalDeviceShaderAtomicInt64Features -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    IO b
f

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

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

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