{-# language CPP #-}
module Vulkan.Extensions.VK_EXT_sample_locations  ( cmdSetSampleLocationsEXT
                                                  , getPhysicalDeviceMultisamplePropertiesEXT
                                                  , SampleLocationEXT(..)
                                                  , SampleLocationsInfoEXT(..)
                                                  , AttachmentSampleLocationsEXT(..)
                                                  , SubpassSampleLocationsEXT(..)
                                                  , RenderPassSampleLocationsBeginInfoEXT(..)
                                                  , PipelineSampleLocationsStateCreateInfoEXT(..)
                                                  , PhysicalDeviceSampleLocationsPropertiesEXT(..)
                                                  , MultisamplePropertiesEXT(..)
                                                  , EXT_SAMPLE_LOCATIONS_SPEC_VERSION
                                                  , pattern EXT_SAMPLE_LOCATIONS_SPEC_VERSION
                                                  , EXT_SAMPLE_LOCATIONS_EXTENSION_NAME
                                                  , pattern EXT_SAMPLE_LOCATIONS_EXTENSION_NAME
                                                  ) where

import Vulkan.CStruct.Utils (FixedArray)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
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 Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.C.Types (CFloat)
import Foreign.C.Types (CFloat(CFloat))
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.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import Vulkan.CStruct.Utils (advancePtrBytes)
import Vulkan.Core10.BaseType (bool32ToBool)
import Vulkan.Core10.BaseType (boolToBool32)
import Vulkan.CStruct.Utils (lowerArrayPtr)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.BaseType (Bool32)
import Vulkan.Core10.Handles (CommandBuffer)
import Vulkan.Core10.Handles (CommandBuffer(..))
import Vulkan.Core10.Handles (CommandBuffer_T)
import Vulkan.Dynamic (DeviceCmds(pVkCmdSetSampleLocationsEXT))
import Vulkan.Core10.SharedTypes (Extent2D)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Dynamic (InstanceCmds(pVkGetPhysicalDeviceMultisamplePropertiesEXT))
import Vulkan.Core10.Handles (PhysicalDevice)
import Vulkan.Core10.Handles (PhysicalDevice(..))
import Vulkan.Core10.Handles (PhysicalDevice_T)
import Vulkan.Core10.Enums.SampleCountFlagBits (SampleCountFlagBits)
import Vulkan.Core10.Enums.SampleCountFlagBits (SampleCountFlagBits(..))
import Vulkan.Core10.Enums.SampleCountFlagBits (SampleCountFlags)
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_MULTISAMPLE_PROPERTIES_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCmdSetSampleLocationsEXT
  :: FunPtr (Ptr CommandBuffer_T -> Ptr SampleLocationsInfoEXT -> IO ()) -> Ptr CommandBuffer_T -> Ptr SampleLocationsInfoEXT -> IO ()

-- | vkCmdSetSampleLocationsEXT - Set the dynamic sample locations state
--
-- == Valid Usage
--
-- -   The @sampleLocationsPerPixel@ member of @pSampleLocationsInfo@
--     /must/ equal the @rasterizationSamples@ member of the
--     'Vulkan.Core10.Pipeline.PipelineMultisampleStateCreateInfo'
--     structure the bound graphics pipeline has been created with
--
-- -   If
--     'PhysicalDeviceSampleLocationsPropertiesEXT'::@variableSampleLocations@
--     is 'Vulkan.Core10.BaseType.FALSE' then the current render pass
--     /must/ have been begun by specifying a
--     'RenderPassSampleLocationsBeginInfoEXT' structure whose
--     @pPostSubpassSampleLocations@ member contains an element with a
--     @subpassIndex@ matching the current subpass index and the
--     @sampleLocationsInfo@ member of that element /must/ match the sample
--     locations state pointed to by @pSampleLocationsInfo@
--
-- == Valid Usage (Implicit)
--
-- -   @commandBuffer@ /must/ be a valid
--     'Vulkan.Core10.Handles.CommandBuffer' handle
--
-- -   @pSampleLocationsInfo@ /must/ be a valid pointer to a valid
--     'SampleLocationsInfoEXT' structure
--
-- -   @commandBuffer@ /must/ be in the
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#commandbuffers-lifecycle recording state>
--
-- -   The 'Vulkan.Core10.Handles.CommandPool' that @commandBuffer@ was
--     allocated from /must/ support graphics operations
--
-- == Host Synchronization
--
-- -   Host access to @commandBuffer@ /must/ be externally synchronized
--
-- -   Host access to the 'Vulkan.Core10.Handles.CommandPool' that
--     @commandBuffer@ was allocated from /must/ be externally synchronized
--
-- == Command Properties
--
-- \'
--
-- +----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
-- | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkCommandBufferLevel Command Buffer Levels> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#vkCmdBeginRenderPass Render Pass Scope> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkQueueFlagBits Supported Queue Types> | <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#synchronization-pipeline-stages-types Pipeline Type> |
-- +============================================================================================================================+========================================================================================================================+=======================================================================================================================+=====================================================================================================================================+
-- | Primary                                                                                                                    | Both                                                                                                                   | Graphics                                                                                                              |                                                                                                                                     |
-- | Secondary                                                                                                                  |                                                                                                                        |                                                                                                                       |                                                                                                                                     |
-- +----------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+
--
-- = See Also
--
-- 'Vulkan.Core10.Handles.CommandBuffer', 'SampleLocationsInfoEXT'
cmdSetSampleLocationsEXT :: forall io
                          . (MonadIO io)
                         => -- | @commandBuffer@ is the command buffer into which the command will be
                            -- recorded.
                            CommandBuffer
                         -> -- | @pSampleLocationsInfo@ is the sample locations state to set.
                            SampleLocationsInfoEXT
                         -> io ()
cmdSetSampleLocationsEXT :: CommandBuffer -> SampleLocationsInfoEXT -> io ()
cmdSetSampleLocationsEXT commandBuffer :: CommandBuffer
commandBuffer sampleLocationsInfo :: SampleLocationsInfoEXT
sampleLocationsInfo = IO () -> io ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> io ())
-> (ContT () IO () -> IO ()) -> ContT () IO () -> io ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT () IO () -> IO ()
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT () IO () -> io ()) -> ContT () IO () -> io ()
forall a b. (a -> b) -> a -> b
$ do
  let vkCmdSetSampleLocationsEXTPtr :: FunPtr
  (Ptr CommandBuffer_T
   -> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
   -> IO ())
vkCmdSetSampleLocationsEXTPtr = DeviceCmds
-> FunPtr
     (Ptr CommandBuffer_T
      -> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
      -> IO ())
pVkCmdSetSampleLocationsEXT (CommandBuffer -> DeviceCmds
deviceCmds (CommandBuffer
commandBuffer :: CommandBuffer))
  IO () -> ContT () IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr CommandBuffer_T
   -> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
   -> IO ())
vkCmdSetSampleLocationsEXTPtr FunPtr
  (Ptr CommandBuffer_T
   -> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
   -> IO ())
-> FunPtr
     (Ptr CommandBuffer_T
      -> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr CommandBuffer_T
   -> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
   -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkCmdSetSampleLocationsEXT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkCmdSetSampleLocationsEXT' :: Ptr CommandBuffer_T
-> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT) -> IO ()
vkCmdSetSampleLocationsEXT' = FunPtr
  (Ptr CommandBuffer_T
   -> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
   -> IO ())
-> Ptr CommandBuffer_T
-> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> IO ()
mkVkCmdSetSampleLocationsEXT FunPtr
  (Ptr CommandBuffer_T
   -> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
   -> IO ())
vkCmdSetSampleLocationsEXTPtr
  "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
pSampleLocationsInfo <- ((("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT) -> IO ())
 -> IO ())
-> ContT
     () IO ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
   -> IO ())
  -> IO ())
 -> ContT
      () IO ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT))
-> ((("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
     -> IO ())
    -> IO ())
-> ContT
     () IO ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
forall a b. (a -> b) -> a -> b
$ SampleLocationsInfoEXT
-> (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
    -> IO ())
-> IO ()
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (SampleLocationsInfoEXT
sampleLocationsInfo)
  IO () -> ContT () IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT () IO ()) -> IO () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ Ptr CommandBuffer_T
-> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT) -> IO ()
vkCmdSetSampleLocationsEXT' (CommandBuffer -> Ptr CommandBuffer_T
commandBufferHandle (CommandBuffer
commandBuffer)) "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
pSampleLocationsInfo
  () -> ContT () IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure (() -> ContT () IO ()) -> () -> ContT () IO ()
forall a b. (a -> b) -> a -> b
$ ()


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkGetPhysicalDeviceMultisamplePropertiesEXT
  :: FunPtr (Ptr PhysicalDevice_T -> SampleCountFlagBits -> Ptr MultisamplePropertiesEXT -> IO ()) -> Ptr PhysicalDevice_T -> SampleCountFlagBits -> Ptr MultisamplePropertiesEXT -> IO ()

-- | vkGetPhysicalDeviceMultisamplePropertiesEXT - Report sample count
-- specific multisampling capabilities of a physical device
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'MultisamplePropertiesEXT', 'Vulkan.Core10.Handles.PhysicalDevice',
-- 'Vulkan.Core10.Enums.SampleCountFlagBits.SampleCountFlagBits'
getPhysicalDeviceMultisamplePropertiesEXT :: forall io
                                           . (MonadIO io)
                                          => -- | @physicalDevice@ is the physical device from which to query the
                                             -- additional multisampling capabilities.
                                             --
                                             -- @physicalDevice@ /must/ be a valid
                                             -- 'Vulkan.Core10.Handles.PhysicalDevice' handle
                                             PhysicalDevice
                                          -> -- | @samples@ is the sample count to query the capabilities for.
                                             --
                                             -- @samples@ /must/ be a valid
                                             -- 'Vulkan.Core10.Enums.SampleCountFlagBits.SampleCountFlagBits' value
                                             ("samples" ::: SampleCountFlagBits)
                                          -> io (MultisamplePropertiesEXT)
getPhysicalDeviceMultisamplePropertiesEXT :: PhysicalDevice
-> ("samples" ::: SampleCountFlagBits)
-> io MultisamplePropertiesEXT
getPhysicalDeviceMultisamplePropertiesEXT physicalDevice :: PhysicalDevice
physicalDevice samples :: "samples" ::: SampleCountFlagBits
samples = IO MultisamplePropertiesEXT -> io MultisamplePropertiesEXT
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MultisamplePropertiesEXT -> io MultisamplePropertiesEXT)
-> (ContT MultisamplePropertiesEXT IO MultisamplePropertiesEXT
    -> IO MultisamplePropertiesEXT)
-> ContT MultisamplePropertiesEXT IO MultisamplePropertiesEXT
-> io MultisamplePropertiesEXT
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT MultisamplePropertiesEXT IO MultisamplePropertiesEXT
-> IO MultisamplePropertiesEXT
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT MultisamplePropertiesEXT IO MultisamplePropertiesEXT
 -> io MultisamplePropertiesEXT)
-> ContT MultisamplePropertiesEXT IO MultisamplePropertiesEXT
-> io MultisamplePropertiesEXT
forall a b. (a -> b) -> a -> b
$ do
  let vkGetPhysicalDeviceMultisamplePropertiesEXTPtr :: FunPtr
  (Ptr PhysicalDevice_T
   -> ("samples" ::: SampleCountFlagBits)
   -> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
   -> IO ())
vkGetPhysicalDeviceMultisamplePropertiesEXTPtr = InstanceCmds
-> FunPtr
     (Ptr PhysicalDevice_T
      -> ("samples" ::: SampleCountFlagBits)
      -> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
      -> IO ())
pVkGetPhysicalDeviceMultisamplePropertiesEXT (PhysicalDevice -> InstanceCmds
instanceCmds (PhysicalDevice
physicalDevice :: PhysicalDevice))
  IO () -> ContT MultisamplePropertiesEXT IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT MultisamplePropertiesEXT IO ())
-> IO () -> ContT MultisamplePropertiesEXT IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr PhysicalDevice_T
   -> ("samples" ::: SampleCountFlagBits)
   -> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
   -> IO ())
vkGetPhysicalDeviceMultisamplePropertiesEXTPtr FunPtr
  (Ptr PhysicalDevice_T
   -> ("samples" ::: SampleCountFlagBits)
   -> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
   -> IO ())
-> FunPtr
     (Ptr PhysicalDevice_T
      -> ("samples" ::: SampleCountFlagBits)
      -> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
      -> IO ())
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr PhysicalDevice_T
   -> ("samples" ::: SampleCountFlagBits)
   -> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
   -> IO ())
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for vkGetPhysicalDeviceMultisamplePropertiesEXT is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let vkGetPhysicalDeviceMultisamplePropertiesEXT' :: Ptr PhysicalDevice_T
-> ("samples" ::: SampleCountFlagBits)
-> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> IO ()
vkGetPhysicalDeviceMultisamplePropertiesEXT' = FunPtr
  (Ptr PhysicalDevice_T
   -> ("samples" ::: SampleCountFlagBits)
   -> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
   -> IO ())
-> Ptr PhysicalDevice_T
-> ("samples" ::: SampleCountFlagBits)
-> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> IO ()
mkVkGetPhysicalDeviceMultisamplePropertiesEXT FunPtr
  (Ptr PhysicalDevice_T
   -> ("samples" ::: SampleCountFlagBits)
   -> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
   -> IO ())
vkGetPhysicalDeviceMultisamplePropertiesEXTPtr
  "pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
pPMultisampleProperties <- ((("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
  -> IO MultisamplePropertiesEXT)
 -> IO MultisamplePropertiesEXT)
-> ContT
     MultisamplePropertiesEXT
     IO
     ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct MultisamplePropertiesEXT =>
(("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
 -> IO b)
-> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @MultisamplePropertiesEXT)
  IO () -> ContT MultisamplePropertiesEXT IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT MultisamplePropertiesEXT IO ())
-> IO () -> ContT MultisamplePropertiesEXT IO ()
forall a b. (a -> b) -> a -> b
$ Ptr PhysicalDevice_T
-> ("samples" ::: SampleCountFlagBits)
-> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> IO ()
vkGetPhysicalDeviceMultisamplePropertiesEXT' (PhysicalDevice -> Ptr PhysicalDevice_T
physicalDeviceHandle (PhysicalDevice
physicalDevice)) ("samples" ::: SampleCountFlagBits
samples) ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
pPMultisampleProperties)
  MultisamplePropertiesEXT
pMultisampleProperties <- IO MultisamplePropertiesEXT
-> ContT MultisamplePropertiesEXT IO MultisamplePropertiesEXT
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO MultisamplePropertiesEXT
 -> ContT MultisamplePropertiesEXT IO MultisamplePropertiesEXT)
-> IO MultisamplePropertiesEXT
-> ContT MultisamplePropertiesEXT IO MultisamplePropertiesEXT
forall a b. (a -> b) -> a -> b
$ ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> IO MultisamplePropertiesEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @MultisamplePropertiesEXT "pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
pPMultisampleProperties
  MultisamplePropertiesEXT
-> ContT MultisamplePropertiesEXT IO MultisamplePropertiesEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MultisamplePropertiesEXT
 -> ContT MultisamplePropertiesEXT IO MultisamplePropertiesEXT)
-> MultisamplePropertiesEXT
-> ContT MultisamplePropertiesEXT IO MultisamplePropertiesEXT
forall a b. (a -> b) -> a -> b
$ (MultisamplePropertiesEXT
pMultisampleProperties)


-- | VkSampleLocationEXT - Structure specifying the coordinates of a sample
-- location
--
-- = Description
--
-- The domain space of the sample location coordinates has an upper-left
-- origin within the pixel in framebuffer space.
--
-- The values specified in a 'SampleLocationEXT' structure are always
-- clamped to the implementation-dependent sample location coordinate range
-- [@sampleLocationCoordinateRange@[0],@sampleLocationCoordinateRange@[1]]
-- that /can/ be queried by adding a
-- 'PhysicalDeviceSampleLocationsPropertiesEXT' structure to the @pNext@
-- chain of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2'.
--
-- = See Also
--
-- 'SampleLocationsInfoEXT'
data SampleLocationEXT = SampleLocationEXT
  { -- | @x@ is the horizontal coordinate of the sample’s location.
    SampleLocationEXT -> Float
x :: Float
  , -- | @y@ is the vertical coordinate of the sample’s location.
    SampleLocationEXT -> Float
y :: Float
  }
  deriving (Typeable, SampleLocationEXT -> SampleLocationEXT -> Bool
(SampleLocationEXT -> SampleLocationEXT -> Bool)
-> (SampleLocationEXT -> SampleLocationEXT -> Bool)
-> Eq SampleLocationEXT
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SampleLocationEXT -> SampleLocationEXT -> Bool
$c/= :: SampleLocationEXT -> SampleLocationEXT -> Bool
== :: SampleLocationEXT -> SampleLocationEXT -> Bool
$c== :: SampleLocationEXT -> SampleLocationEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SampleLocationEXT)
#endif
deriving instance Show SampleLocationEXT

instance ToCStruct SampleLocationEXT where
  withCStruct :: SampleLocationEXT -> (Ptr SampleLocationEXT -> IO b) -> IO b
withCStruct x :: SampleLocationEXT
x f :: Ptr SampleLocationEXT -> IO b
f = Int -> Int -> (Ptr SampleLocationEXT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 8 4 ((Ptr SampleLocationEXT -> IO b) -> IO b)
-> (Ptr SampleLocationEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr SampleLocationEXT
p -> Ptr SampleLocationEXT -> SampleLocationEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SampleLocationEXT
p SampleLocationEXT
x (Ptr SampleLocationEXT -> IO b
f Ptr SampleLocationEXT
p)
  pokeCStruct :: Ptr SampleLocationEXT -> SampleLocationEXT -> IO b -> IO b
pokeCStruct p :: Ptr SampleLocationEXT
p SampleLocationEXT{..} f :: IO b
f = do
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SampleLocationEXT
p Ptr SampleLocationEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
x))
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SampleLocationEXT
p Ptr SampleLocationEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
y))
    IO b
f
  cStructSize :: Int
cStructSize = 8
  cStructAlignment :: Int
cStructAlignment = 4
  pokeZeroCStruct :: Ptr SampleLocationEXT -> IO b -> IO b
pokeZeroCStruct p :: Ptr SampleLocationEXT
p f :: IO b
f = do
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SampleLocationEXT
p Ptr SampleLocationEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SampleLocationEXT
p Ptr SampleLocationEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct SampleLocationEXT where
  peekCStruct :: Ptr SampleLocationEXT -> IO SampleLocationEXT
peekCStruct p :: Ptr SampleLocationEXT
p = do
    CFloat
x <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr SampleLocationEXT
p Ptr SampleLocationEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr CFloat))
    CFloat
y <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr SampleLocationEXT
p Ptr SampleLocationEXT -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr CFloat))
    SampleLocationEXT -> IO SampleLocationEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SampleLocationEXT -> IO SampleLocationEXT)
-> SampleLocationEXT -> IO SampleLocationEXT
forall a b. (a -> b) -> a -> b
$ Float -> Float -> SampleLocationEXT
SampleLocationEXT
             ((\(CFloat a :: Float
a) -> Float
a) CFloat
x) ((\(CFloat a :: Float
a) -> Float
a) CFloat
y)

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

instance Zero SampleLocationEXT where
  zero :: SampleLocationEXT
zero = Float -> Float -> SampleLocationEXT
SampleLocationEXT
           Float
forall a. Zero a => a
zero
           Float
forall a. Zero a => a
zero


-- | VkSampleLocationsInfoEXT - Structure specifying a set of sample
-- locations
--
-- = Description
--
-- This structure /can/ be used either to specify the sample locations to
-- be used for rendering or to specify the set of sample locations an image
-- subresource has been last rendered with for the purposes of layout
-- transitions of depth\/stencil images created with
-- 'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT'.
--
-- The sample locations in @pSampleLocations@ specify
-- @sampleLocationsPerPixel@ number of sample locations for each pixel in
-- the grid of the size specified in @sampleLocationGridSize@. The sample
-- location for sample i at the pixel grid location (x,y) is taken from
-- @pSampleLocations@[(x + y * @sampleLocationGridSize.width@) *
-- @sampleLocationsPerPixel@ + i].
--
-- If the render pass has a fragment density map, the implementation will
-- choose the sample locations for the fragment and the contents of
-- @pSampleLocations@ /may/ be ignored.
--
-- == Valid Usage
--
-- -   @sampleLocationsPerPixel@ /must/ be a bit value that is set in
--     'PhysicalDeviceSampleLocationsPropertiesEXT'::@sampleLocationSampleCounts@
--
-- -   @sampleLocationsCount@ /must/ equal @sampleLocationsPerPixel@ ×
--     @sampleLocationGridSize.width@ × @sampleLocationGridSize.height@
--
-- == Valid Usage (Implicit)
--
-- -   @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT'
--
-- -   If @sampleLocationsPerPixel@ is not @0@, @sampleLocationsPerPixel@
--     /must/ be a valid
--     'Vulkan.Core10.Enums.SampleCountFlagBits.SampleCountFlagBits' value
--
-- -   If @sampleLocationsCount@ is not @0@, @pSampleLocations@ /must/ be a
--     valid pointer to an array of @sampleLocationsCount@
--     'SampleLocationEXT' structures
--
-- = See Also
--
-- 'AttachmentSampleLocationsEXT', 'Vulkan.Core10.SharedTypes.Extent2D',
-- 'PipelineSampleLocationsStateCreateInfoEXT',
-- 'Vulkan.Core10.Enums.SampleCountFlagBits.SampleCountFlagBits',
-- 'SampleLocationEXT', 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'SubpassSampleLocationsEXT', 'cmdSetSampleLocationsEXT'
data SampleLocationsInfoEXT = SampleLocationsInfoEXT
  { -- | @sampleLocationsPerPixel@ is a
    -- 'Vulkan.Core10.Enums.SampleCountFlagBits.SampleCountFlagBits' specifying
    -- the number of sample locations per pixel.
    SampleLocationsInfoEXT -> "samples" ::: SampleCountFlagBits
sampleLocationsPerPixel :: SampleCountFlagBits
  , -- | @sampleLocationGridSize@ is the size of the sample location grid to
    -- select custom sample locations for.
    SampleLocationsInfoEXT -> Extent2D
sampleLocationGridSize :: Extent2D
  , -- | @pSampleLocations@ is a pointer to an array of @sampleLocationsCount@
    -- 'SampleLocationEXT' structures.
    SampleLocationsInfoEXT -> Vector SampleLocationEXT
sampleLocations :: Vector SampleLocationEXT
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SampleLocationsInfoEXT)
#endif
deriving instance Show SampleLocationsInfoEXT

instance ToCStruct SampleLocationsInfoEXT where
  withCStruct :: SampleLocationsInfoEXT
-> (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
    -> IO b)
-> IO b
withCStruct x :: SampleLocationsInfoEXT
x f :: ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT) -> IO b
f = Int
-> Int
-> (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
    -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 40 8 ((("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT) -> IO b)
 -> IO b)
-> (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p -> ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> SampleLocationsInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p SampleLocationsInfoEXT
x (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT) -> IO b
f "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p)
  pokeCStruct :: ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> SampleLocationsInfoEXT -> IO b -> IO b
pokeCStruct p :: "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p SampleLocationsInfoEXT{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr ("samples" ::: SampleCountFlagBits)
-> ("samples" ::: SampleCountFlagBits) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr ("samples" ::: SampleCountFlagBits)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SampleCountFlagBits)) ("samples" ::: SampleCountFlagBits
sampleLocationsPerPixel)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Extent2D -> Extent2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Extent2D)) (Extent2D
sampleLocationGridSize) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector SampleLocationEXT -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector SampleLocationEXT -> Int)
-> Vector SampleLocationEXT -> Int
forall a b. (a -> b) -> a -> b
$ (Vector SampleLocationEXT
sampleLocations)) :: Word32))
    Ptr SampleLocationEXT
pPSampleLocations' <- ((Ptr SampleLocationEXT -> IO b) -> IO b)
-> ContT b IO (Ptr SampleLocationEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr SampleLocationEXT -> IO b) -> IO b)
 -> ContT b IO (Ptr SampleLocationEXT))
-> ((Ptr SampleLocationEXT -> IO b) -> IO b)
-> ContT b IO (Ptr SampleLocationEXT)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr SampleLocationEXT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @SampleLocationEXT ((Vector SampleLocationEXT -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector SampleLocationEXT
sampleLocations)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 4
    (Int -> SampleLocationEXT -> ContT b IO ())
-> Vector SampleLocationEXT -> ContT b IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: SampleLocationEXT
e -> ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr SampleLocationEXT -> SampleLocationEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (Ptr SampleLocationEXT
pPSampleLocations' Ptr SampleLocationEXT -> Int -> Ptr SampleLocationEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SampleLocationEXT) (SampleLocationEXT
e) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())) (Vector SampleLocationEXT
sampleLocations)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr SampleLocationEXT) -> Ptr SampleLocationEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr (Ptr SampleLocationEXT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr (Ptr SampleLocationEXT))) (Ptr SampleLocationEXT
pPSampleLocations')
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 40
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> IO b -> IO b
pokeZeroCStruct p :: "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Extent2D -> Extent2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Extent2D)) (Extent2D
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    Ptr SampleLocationEXT
pPSampleLocations' <- ((Ptr SampleLocationEXT -> IO b) -> IO b)
-> ContT b IO (Ptr SampleLocationEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr SampleLocationEXT -> IO b) -> IO b)
 -> ContT b IO (Ptr SampleLocationEXT))
-> ((Ptr SampleLocationEXT -> IO b) -> IO b)
-> ContT b IO (Ptr SampleLocationEXT)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr SampleLocationEXT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @SampleLocationEXT ((Vector Any -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Any
forall a. Monoid a => a
mempty)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 8) 4
    (Int -> SampleLocationEXT -> ContT b IO ())
-> Vector SampleLocationEXT -> ContT b IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: SampleLocationEXT
e -> ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr SampleLocationEXT -> SampleLocationEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (Ptr SampleLocationEXT
pPSampleLocations' Ptr SampleLocationEXT -> Int -> Ptr SampleLocationEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SampleLocationEXT) (SampleLocationEXT
e) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())) (Vector SampleLocationEXT
forall a. Monoid a => a
mempty)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr SampleLocationEXT) -> Ptr SampleLocationEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr (Ptr SampleLocationEXT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr (Ptr SampleLocationEXT))) (Ptr SampleLocationEXT
pPSampleLocations')
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance FromCStruct SampleLocationsInfoEXT where
  peekCStruct :: ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> IO SampleLocationsInfoEXT
peekCStruct p :: "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p = do
    "samples" ::: SampleCountFlagBits
sampleLocationsPerPixel <- Ptr ("samples" ::: SampleCountFlagBits)
-> IO ("samples" ::: SampleCountFlagBits)
forall a. Storable a => Ptr a -> IO a
peek @SampleCountFlagBits (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr ("samples" ::: SampleCountFlagBits)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SampleCountFlagBits))
    Extent2D
sampleLocationGridSize <- Ptr Extent2D -> IO Extent2D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Extent2D (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Extent2D))
    Word32
sampleLocationsCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr Word32))
    Ptr SampleLocationEXT
pSampleLocations <- Ptr (Ptr SampleLocationEXT) -> IO (Ptr SampleLocationEXT)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr SampleLocationEXT) (("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
p ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> Int -> Ptr (Ptr SampleLocationEXT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr (Ptr SampleLocationEXT)))
    Vector SampleLocationEXT
pSampleLocations' <- Int
-> (Int -> IO SampleLocationEXT) -> IO (Vector SampleLocationEXT)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
sampleLocationsCount) (\i :: Int
i -> Ptr SampleLocationEXT -> IO SampleLocationEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SampleLocationEXT ((Ptr SampleLocationEXT
pSampleLocations Ptr SampleLocationEXT -> Int -> Ptr SampleLocationEXT
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (8 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SampleLocationEXT)))
    SampleLocationsInfoEXT -> IO SampleLocationsInfoEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SampleLocationsInfoEXT -> IO SampleLocationsInfoEXT)
-> SampleLocationsInfoEXT -> IO SampleLocationsInfoEXT
forall a b. (a -> b) -> a -> b
$ ("samples" ::: SampleCountFlagBits)
-> Extent2D -> Vector SampleLocationEXT -> SampleLocationsInfoEXT
SampleLocationsInfoEXT
             "samples" ::: SampleCountFlagBits
sampleLocationsPerPixel Extent2D
sampleLocationGridSize Vector SampleLocationEXT
pSampleLocations'

instance Zero SampleLocationsInfoEXT where
  zero :: SampleLocationsInfoEXT
zero = ("samples" ::: SampleCountFlagBits)
-> Extent2D -> Vector SampleLocationEXT -> SampleLocationsInfoEXT
SampleLocationsInfoEXT
           "samples" ::: SampleCountFlagBits
forall a. Zero a => a
zero
           Extent2D
forall a. Zero a => a
zero
           Vector SampleLocationEXT
forall a. Monoid a => a
mempty


-- | VkAttachmentSampleLocationsEXT - Structure specifying the sample
-- locations state to use in the initial layout transition of attachments
--
-- = Description
--
-- If the image referenced by the framebuffer attachment at index
-- @attachmentIndex@ was not created with
-- 'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT'
-- then the values specified in @sampleLocationsInfo@ are ignored.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'RenderPassSampleLocationsBeginInfoEXT', 'SampleLocationsInfoEXT'
data AttachmentSampleLocationsEXT = AttachmentSampleLocationsEXT
  { -- | @attachmentIndex@ is the index of the attachment for which the sample
    -- locations state is provided.
    --
    -- @attachmentIndex@ /must/ be less than the @attachmentCount@ specified in
    -- 'Vulkan.Core10.Pass.RenderPassCreateInfo' the render pass specified by
    -- 'Vulkan.Core10.CommandBufferBuilding.RenderPassBeginInfo'::@renderPass@
    -- was created with
    AttachmentSampleLocationsEXT -> Word32
attachmentIndex :: Word32
  , -- | @sampleLocationsInfo@ is the sample locations state to use for the
    -- layout transition of the given attachment from the initial layout of the
    -- attachment to the image layout specified for the attachment in the first
    -- subpass using it.
    --
    -- @sampleLocationsInfo@ /must/ be a valid 'SampleLocationsInfoEXT'
    -- structure
    AttachmentSampleLocationsEXT -> SampleLocationsInfoEXT
sampleLocationsInfo :: SampleLocationsInfoEXT
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (AttachmentSampleLocationsEXT)
#endif
deriving instance Show AttachmentSampleLocationsEXT

instance ToCStruct AttachmentSampleLocationsEXT where
  withCStruct :: AttachmentSampleLocationsEXT
-> (Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b
withCStruct x :: AttachmentSampleLocationsEXT
x f :: Ptr AttachmentSampleLocationsEXT -> IO b
f = Int -> Int -> (Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 48 8 ((Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b)
-> (Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr AttachmentSampleLocationsEXT
p -> Ptr AttachmentSampleLocationsEXT
-> AttachmentSampleLocationsEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr AttachmentSampleLocationsEXT
p AttachmentSampleLocationsEXT
x (Ptr AttachmentSampleLocationsEXT -> IO b
f Ptr AttachmentSampleLocationsEXT
p)
  pokeCStruct :: Ptr AttachmentSampleLocationsEXT
-> AttachmentSampleLocationsEXT -> IO b -> IO b
pokeCStruct p :: Ptr AttachmentSampleLocationsEXT
p AttachmentSampleLocationsEXT{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AttachmentSampleLocationsEXT
p Ptr AttachmentSampleLocationsEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
attachmentIndex)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> SampleLocationsInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr AttachmentSampleLocationsEXT
p Ptr AttachmentSampleLocationsEXT
-> Int -> "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr SampleLocationsInfoEXT)) (SampleLocationsInfoEXT
sampleLocationsInfo) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 48
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr AttachmentSampleLocationsEXT -> IO b -> IO b
pokeZeroCStruct p :: Ptr AttachmentSampleLocationsEXT
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AttachmentSampleLocationsEXT
p Ptr AttachmentSampleLocationsEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> SampleLocationsInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr AttachmentSampleLocationsEXT
p Ptr AttachmentSampleLocationsEXT
-> Int -> "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr SampleLocationsInfoEXT)) (SampleLocationsInfoEXT
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance FromCStruct AttachmentSampleLocationsEXT where
  peekCStruct :: Ptr AttachmentSampleLocationsEXT -> IO AttachmentSampleLocationsEXT
peekCStruct p :: Ptr AttachmentSampleLocationsEXT
p = do
    Word32
attachmentIndex <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr AttachmentSampleLocationsEXT
p Ptr AttachmentSampleLocationsEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32))
    SampleLocationsInfoEXT
sampleLocationsInfo <- ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> IO SampleLocationsInfoEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SampleLocationsInfoEXT ((Ptr AttachmentSampleLocationsEXT
p Ptr AttachmentSampleLocationsEXT
-> Int -> "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr SampleLocationsInfoEXT))
    AttachmentSampleLocationsEXT -> IO AttachmentSampleLocationsEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AttachmentSampleLocationsEXT -> IO AttachmentSampleLocationsEXT)
-> AttachmentSampleLocationsEXT -> IO AttachmentSampleLocationsEXT
forall a b. (a -> b) -> a -> b
$ Word32 -> SampleLocationsInfoEXT -> AttachmentSampleLocationsEXT
AttachmentSampleLocationsEXT
             Word32
attachmentIndex SampleLocationsInfoEXT
sampleLocationsInfo

instance Zero AttachmentSampleLocationsEXT where
  zero :: AttachmentSampleLocationsEXT
zero = Word32 -> SampleLocationsInfoEXT -> AttachmentSampleLocationsEXT
AttachmentSampleLocationsEXT
           Word32
forall a. Zero a => a
zero
           SampleLocationsInfoEXT
forall a. Zero a => a
zero


-- | VkSubpassSampleLocationsEXT - Structure specifying the sample locations
-- state to use for layout transitions of attachments performed after a
-- given subpass
--
-- = Description
--
-- If the image referenced by the depth\/stencil attachment used in the
-- subpass identified by @subpassIndex@ was not created with
-- 'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT'
-- or if the subpass does not use a depth\/stencil attachment, and
-- 'PhysicalDeviceSampleLocationsPropertiesEXT'::@variableSampleLocations@
-- is 'Vulkan.Core10.BaseType.TRUE' then the values specified in
-- @sampleLocationsInfo@ are ignored.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'RenderPassSampleLocationsBeginInfoEXT', 'SampleLocationsInfoEXT'
data SubpassSampleLocationsEXT = SubpassSampleLocationsEXT
  { -- | @subpassIndex@ is the index of the subpass for which the sample
    -- locations state is provided.
    --
    -- @subpassIndex@ /must/ be less than the @subpassCount@ specified in
    -- 'Vulkan.Core10.Pass.RenderPassCreateInfo' the render pass specified by
    -- 'Vulkan.Core10.CommandBufferBuilding.RenderPassBeginInfo'::@renderPass@
    -- was created with
    SubpassSampleLocationsEXT -> Word32
subpassIndex :: Word32
  , -- | @sampleLocationsInfo@ is the sample locations state to use for the
    -- layout transition of the depth\/stencil attachment away from the image
    -- layout the attachment is used with in the subpass specified in
    -- @subpassIndex@.
    --
    -- @sampleLocationsInfo@ /must/ be a valid 'SampleLocationsInfoEXT'
    -- structure
    SubpassSampleLocationsEXT -> SampleLocationsInfoEXT
sampleLocationsInfo :: SampleLocationsInfoEXT
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SubpassSampleLocationsEXT)
#endif
deriving instance Show SubpassSampleLocationsEXT

instance ToCStruct SubpassSampleLocationsEXT where
  withCStruct :: SubpassSampleLocationsEXT
-> (Ptr SubpassSampleLocationsEXT -> IO b) -> IO b
withCStruct x :: SubpassSampleLocationsEXT
x f :: Ptr SubpassSampleLocationsEXT -> IO b
f = Int -> Int -> (Ptr SubpassSampleLocationsEXT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 48 8 ((Ptr SubpassSampleLocationsEXT -> IO b) -> IO b)
-> (Ptr SubpassSampleLocationsEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr SubpassSampleLocationsEXT
p -> Ptr SubpassSampleLocationsEXT
-> SubpassSampleLocationsEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr SubpassSampleLocationsEXT
p SubpassSampleLocationsEXT
x (Ptr SubpassSampleLocationsEXT -> IO b
f Ptr SubpassSampleLocationsEXT
p)
  pokeCStruct :: Ptr SubpassSampleLocationsEXT
-> SubpassSampleLocationsEXT -> IO b -> IO b
pokeCStruct p :: Ptr SubpassSampleLocationsEXT
p SubpassSampleLocationsEXT{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SubpassSampleLocationsEXT
p Ptr SubpassSampleLocationsEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
subpassIndex)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> SampleLocationsInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr SubpassSampleLocationsEXT
p Ptr SubpassSampleLocationsEXT
-> Int -> "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr SampleLocationsInfoEXT)) (SampleLocationsInfoEXT
sampleLocationsInfo) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 48
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr SubpassSampleLocationsEXT -> IO b -> IO b
pokeZeroCStruct p :: Ptr SubpassSampleLocationsEXT
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr SubpassSampleLocationsEXT
p Ptr SubpassSampleLocationsEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> SampleLocationsInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr SubpassSampleLocationsEXT
p Ptr SubpassSampleLocationsEXT
-> Int -> "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr SampleLocationsInfoEXT)) (SampleLocationsInfoEXT
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance FromCStruct SubpassSampleLocationsEXT where
  peekCStruct :: Ptr SubpassSampleLocationsEXT -> IO SubpassSampleLocationsEXT
peekCStruct p :: Ptr SubpassSampleLocationsEXT
p = do
    Word32
subpassIndex <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr SubpassSampleLocationsEXT
p Ptr SubpassSampleLocationsEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr Word32))
    SampleLocationsInfoEXT
sampleLocationsInfo <- ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> IO SampleLocationsInfoEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SampleLocationsInfoEXT ((Ptr SubpassSampleLocationsEXT
p Ptr SubpassSampleLocationsEXT
-> Int -> "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr SampleLocationsInfoEXT))
    SubpassSampleLocationsEXT -> IO SubpassSampleLocationsEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SubpassSampleLocationsEXT -> IO SubpassSampleLocationsEXT)
-> SubpassSampleLocationsEXT -> IO SubpassSampleLocationsEXT
forall a b. (a -> b) -> a -> b
$ Word32 -> SampleLocationsInfoEXT -> SubpassSampleLocationsEXT
SubpassSampleLocationsEXT
             Word32
subpassIndex SampleLocationsInfoEXT
sampleLocationsInfo

instance Zero SubpassSampleLocationsEXT where
  zero :: SubpassSampleLocationsEXT
zero = Word32 -> SampleLocationsInfoEXT -> SubpassSampleLocationsEXT
SubpassSampleLocationsEXT
           Word32
forall a. Zero a => a
zero
           SampleLocationsInfoEXT
forall a. Zero a => a
zero


-- | VkRenderPassSampleLocationsBeginInfoEXT - Structure specifying sample
-- locations to use for the layout transition of custom sample locations
-- compatible depth\/stencil attachments
--
-- == Valid Usage (Implicit)
--
-- -   @sType@ /must/ be
--     'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT'
--
-- -   If @attachmentInitialSampleLocationsCount@ is not @0@,
--     @pAttachmentInitialSampleLocations@ /must/ be a valid pointer to an
--     array of @attachmentInitialSampleLocationsCount@ valid
--     'AttachmentSampleLocationsEXT' structures
--
-- -   If @postSubpassSampleLocationsCount@ is not @0@,
--     @pPostSubpassSampleLocations@ /must/ be a valid pointer to an array
--     of @postSubpassSampleLocationsCount@ valid
--     'SubpassSampleLocationsEXT' structures
--
-- = See Also
--
-- 'AttachmentSampleLocationsEXT',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'SubpassSampleLocationsEXT'
data RenderPassSampleLocationsBeginInfoEXT = RenderPassSampleLocationsBeginInfoEXT
  { -- | @pAttachmentInitialSampleLocations@ is a pointer to an array of
    -- @attachmentInitialSampleLocationsCount@ 'AttachmentSampleLocationsEXT'
    -- structures specifying the attachment indices and their corresponding
    -- sample location state. Each element of
    -- @pAttachmentInitialSampleLocations@ /can/ specify the sample location
    -- state to use in the automatic layout transition performed to transition
    -- a depth\/stencil attachment from the initial layout of the attachment to
    -- the image layout specified for the attachment in the first subpass using
    -- it.
    RenderPassSampleLocationsBeginInfoEXT
-> Vector AttachmentSampleLocationsEXT
attachmentInitialSampleLocations :: Vector AttachmentSampleLocationsEXT
  , -- | @pPostSubpassSampleLocations@ is a pointer to an array of
    -- @postSubpassSampleLocationsCount@ 'SubpassSampleLocationsEXT' structures
    -- specifying the subpass indices and their corresponding sample location
    -- state. Each element of @pPostSubpassSampleLocations@ /can/ specify the
    -- sample location state to use in the automatic layout transition
    -- performed to transition the depth\/stencil attachment used by the
    -- specified subpass to the image layout specified in a dependent subpass
    -- or to the final layout of the attachment in case the specified subpass
    -- is the last subpass using that attachment. In addition, if
    -- 'PhysicalDeviceSampleLocationsPropertiesEXT'::@variableSampleLocations@
    -- is 'Vulkan.Core10.BaseType.FALSE', each element of
    -- @pPostSubpassSampleLocations@ /must/ specify the sample location state
    -- that matches the sample locations used by all pipelines that will be
    -- bound to a command buffer during the specified subpass. If
    -- @variableSampleLocations@ is 'Vulkan.Core10.BaseType.TRUE', the sample
    -- locations used for rasterization do not depend on
    -- @pPostSubpassSampleLocations@.
    RenderPassSampleLocationsBeginInfoEXT
-> Vector SubpassSampleLocationsEXT
postSubpassSampleLocations :: Vector SubpassSampleLocationsEXT
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (RenderPassSampleLocationsBeginInfoEXT)
#endif
deriving instance Show RenderPassSampleLocationsBeginInfoEXT

instance ToCStruct RenderPassSampleLocationsBeginInfoEXT where
  withCStruct :: RenderPassSampleLocationsBeginInfoEXT
-> (Ptr RenderPassSampleLocationsBeginInfoEXT -> IO b) -> IO b
withCStruct x :: RenderPassSampleLocationsBeginInfoEXT
x f :: Ptr RenderPassSampleLocationsBeginInfoEXT -> IO b
f = Int
-> Int
-> (Ptr RenderPassSampleLocationsBeginInfoEXT -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 48 8 ((Ptr RenderPassSampleLocationsBeginInfoEXT -> IO b) -> IO b)
-> (Ptr RenderPassSampleLocationsBeginInfoEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr RenderPassSampleLocationsBeginInfoEXT
p -> Ptr RenderPassSampleLocationsBeginInfoEXT
-> RenderPassSampleLocationsBeginInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr RenderPassSampleLocationsBeginInfoEXT
p RenderPassSampleLocationsBeginInfoEXT
x (Ptr RenderPassSampleLocationsBeginInfoEXT -> IO b
f Ptr RenderPassSampleLocationsBeginInfoEXT
p)
  pokeCStruct :: Ptr RenderPassSampleLocationsBeginInfoEXT
-> RenderPassSampleLocationsBeginInfoEXT -> IO b -> IO b
pokeCStruct p :: Ptr RenderPassSampleLocationsBeginInfoEXT
p RenderPassSampleLocationsBeginInfoEXT{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector AttachmentSampleLocationsEXT -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector AttachmentSampleLocationsEXT -> Int)
-> Vector AttachmentSampleLocationsEXT -> Int
forall a b. (a -> b) -> a -> b
$ (Vector AttachmentSampleLocationsEXT
attachmentInitialSampleLocations)) :: Word32))
    Ptr AttachmentSampleLocationsEXT
pPAttachmentInitialSampleLocations' <- ((Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b)
-> ContT b IO (Ptr AttachmentSampleLocationsEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b)
 -> ContT b IO (Ptr AttachmentSampleLocationsEXT))
-> ((Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b)
-> ContT b IO (Ptr AttachmentSampleLocationsEXT)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @AttachmentSampleLocationsEXT ((Vector AttachmentSampleLocationsEXT -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector AttachmentSampleLocationsEXT
attachmentInitialSampleLocations)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 48) 8
    (Int -> AttachmentSampleLocationsEXT -> ContT b IO ())
-> Vector AttachmentSampleLocationsEXT -> ContT b IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: AttachmentSampleLocationsEXT
e -> ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr AttachmentSampleLocationsEXT
-> AttachmentSampleLocationsEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (Ptr AttachmentSampleLocationsEXT
pPAttachmentInitialSampleLocations' Ptr AttachmentSampleLocationsEXT
-> Int -> Ptr AttachmentSampleLocationsEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (48 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr AttachmentSampleLocationsEXT) (AttachmentSampleLocationsEXT
e) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())) (Vector AttachmentSampleLocationsEXT
attachmentInitialSampleLocations)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr AttachmentSampleLocationsEXT)
-> Ptr AttachmentSampleLocationsEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT
-> Int -> Ptr (Ptr AttachmentSampleLocationsEXT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr AttachmentSampleLocationsEXT))) (Ptr AttachmentSampleLocationsEXT
pPAttachmentInitialSampleLocations')
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Word32)) ((Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Vector SubpassSampleLocationsEXT -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector SubpassSampleLocationsEXT -> Int)
-> Vector SubpassSampleLocationsEXT -> Int
forall a b. (a -> b) -> a -> b
$ (Vector SubpassSampleLocationsEXT
postSubpassSampleLocations)) :: Word32))
    Ptr SubpassSampleLocationsEXT
pPPostSubpassSampleLocations' <- ((Ptr SubpassSampleLocationsEXT -> IO b) -> IO b)
-> ContT b IO (Ptr SubpassSampleLocationsEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr SubpassSampleLocationsEXT -> IO b) -> IO b)
 -> ContT b IO (Ptr SubpassSampleLocationsEXT))
-> ((Ptr SubpassSampleLocationsEXT -> IO b) -> IO b)
-> ContT b IO (Ptr SubpassSampleLocationsEXT)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr SubpassSampleLocationsEXT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @SubpassSampleLocationsEXT ((Vector SubpassSampleLocationsEXT -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector SubpassSampleLocationsEXT
postSubpassSampleLocations)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 48) 8
    (Int -> SubpassSampleLocationsEXT -> ContT b IO ())
-> Vector SubpassSampleLocationsEXT -> ContT b IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: SubpassSampleLocationsEXT
e -> ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr SubpassSampleLocationsEXT
-> SubpassSampleLocationsEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (Ptr SubpassSampleLocationsEXT
pPPostSubpassSampleLocations' Ptr SubpassSampleLocationsEXT
-> Int -> Ptr SubpassSampleLocationsEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (48 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SubpassSampleLocationsEXT) (SubpassSampleLocationsEXT
e) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())) (Vector SubpassSampleLocationsEXT
postSubpassSampleLocations)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr SubpassSampleLocationsEXT)
-> Ptr SubpassSampleLocationsEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT
-> Int -> Ptr (Ptr SubpassSampleLocationsEXT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr (Ptr SubpassSampleLocationsEXT))) (Ptr SubpassSampleLocationsEXT
pPPostSubpassSampleLocations')
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 48
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr RenderPassSampleLocationsBeginInfoEXT -> IO b -> IO b
pokeZeroCStruct p :: Ptr RenderPassSampleLocationsBeginInfoEXT
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr AttachmentSampleLocationsEXT
pPAttachmentInitialSampleLocations' <- ((Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b)
-> ContT b IO (Ptr AttachmentSampleLocationsEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b)
 -> ContT b IO (Ptr AttachmentSampleLocationsEXT))
-> ((Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b)
-> ContT b IO (Ptr AttachmentSampleLocationsEXT)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr AttachmentSampleLocationsEXT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @AttachmentSampleLocationsEXT ((Vector Any -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Any
forall a. Monoid a => a
mempty)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 48) 8
    (Int -> AttachmentSampleLocationsEXT -> ContT b IO ())
-> Vector AttachmentSampleLocationsEXT -> ContT b IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: AttachmentSampleLocationsEXT
e -> ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr AttachmentSampleLocationsEXT
-> AttachmentSampleLocationsEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (Ptr AttachmentSampleLocationsEXT
pPAttachmentInitialSampleLocations' Ptr AttachmentSampleLocationsEXT
-> Int -> Ptr AttachmentSampleLocationsEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (48 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr AttachmentSampleLocationsEXT) (AttachmentSampleLocationsEXT
e) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())) (Vector AttachmentSampleLocationsEXT
forall a. Monoid a => a
mempty)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr AttachmentSampleLocationsEXT)
-> Ptr AttachmentSampleLocationsEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT
-> Int -> Ptr (Ptr AttachmentSampleLocationsEXT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr AttachmentSampleLocationsEXT))) (Ptr AttachmentSampleLocationsEXT
pPAttachmentInitialSampleLocations')
    Ptr SubpassSampleLocationsEXT
pPPostSubpassSampleLocations' <- ((Ptr SubpassSampleLocationsEXT -> IO b) -> IO b)
-> ContT b IO (Ptr SubpassSampleLocationsEXT)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr SubpassSampleLocationsEXT -> IO b) -> IO b)
 -> ContT b IO (Ptr SubpassSampleLocationsEXT))
-> ((Ptr SubpassSampleLocationsEXT -> IO b) -> IO b)
-> ContT b IO (Ptr SubpassSampleLocationsEXT)
forall a b. (a -> b) -> a -> b
$ Int -> Int -> (Ptr SubpassSampleLocationsEXT -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned @SubpassSampleLocationsEXT ((Vector Any -> Int
forall a. Vector a -> Int
Data.Vector.length (Vector Any
forall a. Monoid a => a
mempty)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 48) 8
    (Int -> SubpassSampleLocationsEXT -> ContT b IO ())
-> Vector SubpassSampleLocationsEXT -> ContT b IO ()
forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\i :: Int
i e :: SubpassSampleLocationsEXT
e -> ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr SubpassSampleLocationsEXT
-> SubpassSampleLocationsEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (Ptr SubpassSampleLocationsEXT
pPPostSubpassSampleLocations' Ptr SubpassSampleLocationsEXT
-> Int -> Ptr SubpassSampleLocationsEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (48 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SubpassSampleLocationsEXT) (SubpassSampleLocationsEXT
e) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())) (Vector SubpassSampleLocationsEXT
forall a. Monoid a => a
mempty)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr SubpassSampleLocationsEXT)
-> Ptr SubpassSampleLocationsEXT -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT
-> Int -> Ptr (Ptr SubpassSampleLocationsEXT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr (Ptr SubpassSampleLocationsEXT))) (Ptr SubpassSampleLocationsEXT
pPPostSubpassSampleLocations')
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance FromCStruct RenderPassSampleLocationsBeginInfoEXT where
  peekCStruct :: Ptr RenderPassSampleLocationsBeginInfoEXT
-> IO RenderPassSampleLocationsBeginInfoEXT
peekCStruct p :: Ptr RenderPassSampleLocationsBeginInfoEXT
p = do
    Word32
attachmentInitialSampleLocationsCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word32))
    Ptr AttachmentSampleLocationsEXT
pAttachmentInitialSampleLocations <- Ptr (Ptr AttachmentSampleLocationsEXT)
-> IO (Ptr AttachmentSampleLocationsEXT)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr AttachmentSampleLocationsEXT) ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT
-> Int -> Ptr (Ptr AttachmentSampleLocationsEXT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr (Ptr AttachmentSampleLocationsEXT)))
    Vector AttachmentSampleLocationsEXT
pAttachmentInitialSampleLocations' <- Int
-> (Int -> IO AttachmentSampleLocationsEXT)
-> IO (Vector AttachmentSampleLocationsEXT)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
attachmentInitialSampleLocationsCount) (\i :: Int
i -> Ptr AttachmentSampleLocationsEXT -> IO AttachmentSampleLocationsEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @AttachmentSampleLocationsEXT ((Ptr AttachmentSampleLocationsEXT
pAttachmentInitialSampleLocations Ptr AttachmentSampleLocationsEXT
-> Int -> Ptr AttachmentSampleLocationsEXT
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (48 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr AttachmentSampleLocationsEXT)))
    Word32
postSubpassSampleLocationsCount <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr Word32))
    Ptr SubpassSampleLocationsEXT
pPostSubpassSampleLocations <- Ptr (Ptr SubpassSampleLocationsEXT)
-> IO (Ptr SubpassSampleLocationsEXT)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr SubpassSampleLocationsEXT) ((Ptr RenderPassSampleLocationsBeginInfoEXT
p Ptr RenderPassSampleLocationsBeginInfoEXT
-> Int -> Ptr (Ptr SubpassSampleLocationsEXT)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr (Ptr SubpassSampleLocationsEXT)))
    Vector SubpassSampleLocationsEXT
pPostSubpassSampleLocations' <- Int
-> (Int -> IO SubpassSampleLocationsEXT)
-> IO (Vector SubpassSampleLocationsEXT)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (Word32 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
postSubpassSampleLocationsCount) (\i :: Int
i -> Ptr SubpassSampleLocationsEXT -> IO SubpassSampleLocationsEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SubpassSampleLocationsEXT ((Ptr SubpassSampleLocationsEXT
pPostSubpassSampleLocations Ptr SubpassSampleLocationsEXT
-> Int -> Ptr SubpassSampleLocationsEXT
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (48 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr SubpassSampleLocationsEXT)))
    RenderPassSampleLocationsBeginInfoEXT
-> IO RenderPassSampleLocationsBeginInfoEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (RenderPassSampleLocationsBeginInfoEXT
 -> IO RenderPassSampleLocationsBeginInfoEXT)
-> RenderPassSampleLocationsBeginInfoEXT
-> IO RenderPassSampleLocationsBeginInfoEXT
forall a b. (a -> b) -> a -> b
$ Vector AttachmentSampleLocationsEXT
-> Vector SubpassSampleLocationsEXT
-> RenderPassSampleLocationsBeginInfoEXT
RenderPassSampleLocationsBeginInfoEXT
             Vector AttachmentSampleLocationsEXT
pAttachmentInitialSampleLocations' Vector SubpassSampleLocationsEXT
pPostSubpassSampleLocations'

instance Zero RenderPassSampleLocationsBeginInfoEXT where
  zero :: RenderPassSampleLocationsBeginInfoEXT
zero = Vector AttachmentSampleLocationsEXT
-> Vector SubpassSampleLocationsEXT
-> RenderPassSampleLocationsBeginInfoEXT
RenderPassSampleLocationsBeginInfoEXT
           Vector AttachmentSampleLocationsEXT
forall a. Monoid a => a
mempty
           Vector SubpassSampleLocationsEXT
forall a. Monoid a => a
mempty


-- | VkPipelineSampleLocationsStateCreateInfoEXT - Structure specifying
-- sample locations for a pipeline
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.BaseType.Bool32', 'SampleLocationsInfoEXT',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PipelineSampleLocationsStateCreateInfoEXT = PipelineSampleLocationsStateCreateInfoEXT
  { -- | @sampleLocationsEnable@ controls whether custom sample locations are
    -- used. If @sampleLocationsEnable@ is 'Vulkan.Core10.BaseType.FALSE', the
    -- default sample locations are used and the values specified in
    -- @sampleLocationsInfo@ are ignored.
    PipelineSampleLocationsStateCreateInfoEXT -> Bool
sampleLocationsEnable :: Bool
  , -- | @sampleLocationsInfo@ is the sample locations to use during
    -- rasterization if @sampleLocationsEnable@ is
    -- 'Vulkan.Core10.BaseType.TRUE' and the graphics pipeline is not created
    -- with
    -- 'Vulkan.Core10.Enums.DynamicState.DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT'.
    --
    -- @sampleLocationsInfo@ /must/ be a valid 'SampleLocationsInfoEXT'
    -- structure
    PipelineSampleLocationsStateCreateInfoEXT -> SampleLocationsInfoEXT
sampleLocationsInfo :: SampleLocationsInfoEXT
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PipelineSampleLocationsStateCreateInfoEXT)
#endif
deriving instance Show PipelineSampleLocationsStateCreateInfoEXT

instance ToCStruct PipelineSampleLocationsStateCreateInfoEXT where
  withCStruct :: PipelineSampleLocationsStateCreateInfoEXT
-> (Ptr PipelineSampleLocationsStateCreateInfoEXT -> IO b) -> IO b
withCStruct x :: PipelineSampleLocationsStateCreateInfoEXT
x f :: Ptr PipelineSampleLocationsStateCreateInfoEXT -> IO b
f = Int
-> Int
-> (Ptr PipelineSampleLocationsStateCreateInfoEXT -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 64 8 ((Ptr PipelineSampleLocationsStateCreateInfoEXT -> IO b) -> IO b)
-> (Ptr PipelineSampleLocationsStateCreateInfoEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PipelineSampleLocationsStateCreateInfoEXT
p -> Ptr PipelineSampleLocationsStateCreateInfoEXT
-> PipelineSampleLocationsStateCreateInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PipelineSampleLocationsStateCreateInfoEXT
p PipelineSampleLocationsStateCreateInfoEXT
x (Ptr PipelineSampleLocationsStateCreateInfoEXT -> IO b
f Ptr PipelineSampleLocationsStateCreateInfoEXT
p)
  pokeCStruct :: Ptr PipelineSampleLocationsStateCreateInfoEXT
-> PipelineSampleLocationsStateCreateInfoEXT -> IO b -> IO b
pokeCStruct p :: Ptr PipelineSampleLocationsStateCreateInfoEXT
p PipelineSampleLocationsStateCreateInfoEXT{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineSampleLocationsStateCreateInfoEXT
p Ptr PipelineSampleLocationsStateCreateInfoEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineSampleLocationsStateCreateInfoEXT
p Ptr PipelineSampleLocationsStateCreateInfoEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineSampleLocationsStateCreateInfoEXT
p Ptr PipelineSampleLocationsStateCreateInfoEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
sampleLocationsEnable))
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> SampleLocationsInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr PipelineSampleLocationsStateCreateInfoEXT
p Ptr PipelineSampleLocationsStateCreateInfoEXT
-> Int -> "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr SampleLocationsInfoEXT)) (SampleLocationsInfoEXT
sampleLocationsInfo) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 64
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr PipelineSampleLocationsStateCreateInfoEXT -> IO b -> IO b
pokeZeroCStruct p :: Ptr PipelineSampleLocationsStateCreateInfoEXT
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineSampleLocationsStateCreateInfoEXT
p Ptr PipelineSampleLocationsStateCreateInfoEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineSampleLocationsStateCreateInfoEXT
p Ptr PipelineSampleLocationsStateCreateInfoEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineSampleLocationsStateCreateInfoEXT
p Ptr PipelineSampleLocationsStateCreateInfoEXT -> 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) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> SampleLocationsInfoEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr PipelineSampleLocationsStateCreateInfoEXT
p Ptr PipelineSampleLocationsStateCreateInfoEXT
-> Int -> "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr SampleLocationsInfoEXT)) (SampleLocationsInfoEXT
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance FromCStruct PipelineSampleLocationsStateCreateInfoEXT where
  peekCStruct :: Ptr PipelineSampleLocationsStateCreateInfoEXT
-> IO PipelineSampleLocationsStateCreateInfoEXT
peekCStruct p :: Ptr PipelineSampleLocationsStateCreateInfoEXT
p = do
    Bool32
sampleLocationsEnable <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PipelineSampleLocationsStateCreateInfoEXT
p Ptr PipelineSampleLocationsStateCreateInfoEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Bool32))
    SampleLocationsInfoEXT
sampleLocationsInfo <- ("pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT)
-> IO SampleLocationsInfoEXT
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @SampleLocationsInfoEXT ((Ptr PipelineSampleLocationsStateCreateInfoEXT
p Ptr PipelineSampleLocationsStateCreateInfoEXT
-> Int -> "pSampleLocationsInfo" ::: Ptr SampleLocationsInfoEXT
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr SampleLocationsInfoEXT))
    PipelineSampleLocationsStateCreateInfoEXT
-> IO PipelineSampleLocationsStateCreateInfoEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PipelineSampleLocationsStateCreateInfoEXT
 -> IO PipelineSampleLocationsStateCreateInfoEXT)
-> PipelineSampleLocationsStateCreateInfoEXT
-> IO PipelineSampleLocationsStateCreateInfoEXT
forall a b. (a -> b) -> a -> b
$ Bool
-> SampleLocationsInfoEXT
-> PipelineSampleLocationsStateCreateInfoEXT
PipelineSampleLocationsStateCreateInfoEXT
             (Bool32 -> Bool
bool32ToBool Bool32
sampleLocationsEnable) SampleLocationsInfoEXT
sampleLocationsInfo

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


-- | VkPhysicalDeviceSampleLocationsPropertiesEXT - Structure describing
-- sample location limits that can be supported by an implementation
--
-- = Members
--
-- The members of the 'PhysicalDeviceSampleLocationsPropertiesEXT'
-- structure describe the following implementation-dependent limits:
--
-- = Description
--
-- If the 'PhysicalDeviceSampleLocationsPropertiesEXT' structure is
-- included in the @pNext@ chain of
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2',
-- it is filled with the implementation-dependent limits.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.BaseType.Bool32', 'Vulkan.Core10.SharedTypes.Extent2D',
-- 'Vulkan.Core10.Enums.SampleCountFlagBits.SampleCountFlags',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceSampleLocationsPropertiesEXT = PhysicalDeviceSampleLocationsPropertiesEXT
  { -- | @sampleLocationSampleCounts@ is a bitmask of
    -- 'Vulkan.Core10.Enums.SampleCountFlagBits.SampleCountFlagBits' indicating
    -- the sample counts supporting custom sample locations.
    PhysicalDeviceSampleLocationsPropertiesEXT
-> "samples" ::: SampleCountFlagBits
sampleLocationSampleCounts :: SampleCountFlags
  , -- | @maxSampleLocationGridSize@ is the maximum size of the pixel grid in
    -- which sample locations /can/ vary that is supported for all sample
    -- counts in @sampleLocationSampleCounts@.
    PhysicalDeviceSampleLocationsPropertiesEXT -> Extent2D
maxSampleLocationGridSize :: Extent2D
  , -- | @sampleLocationCoordinateRange@[2] is the range of supported sample
    -- location coordinates.
    PhysicalDeviceSampleLocationsPropertiesEXT -> (Float, Float)
sampleLocationCoordinateRange :: (Float, Float)
  , -- | @sampleLocationSubPixelBits@ is the number of bits of subpixel precision
    -- for sample locations.
    PhysicalDeviceSampleLocationsPropertiesEXT -> Word32
sampleLocationSubPixelBits :: Word32
  , -- | @variableSampleLocations@ specifies whether the sample locations used by
    -- all pipelines that will be bound to a command buffer during a subpass
    -- /must/ match. If set to 'Vulkan.Core10.BaseType.TRUE', the
    -- implementation supports variable sample locations in a subpass. If set
    -- to 'Vulkan.Core10.BaseType.FALSE', then the sample locations /must/ stay
    -- constant in each subpass.
    PhysicalDeviceSampleLocationsPropertiesEXT -> Bool
variableSampleLocations :: Bool
  }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceSampleLocationsPropertiesEXT)
#endif
deriving instance Show PhysicalDeviceSampleLocationsPropertiesEXT

instance ToCStruct PhysicalDeviceSampleLocationsPropertiesEXT where
  withCStruct :: PhysicalDeviceSampleLocationsPropertiesEXT
-> (Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> IO b) -> IO b
withCStruct x :: PhysicalDeviceSampleLocationsPropertiesEXT
x f :: Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> IO b
f = Int
-> Int
-> (Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 48 8 ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> IO b) -> IO b)
-> (Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p -> Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> PhysicalDeviceSampleLocationsPropertiesEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p PhysicalDeviceSampleLocationsPropertiesEXT
x (Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> IO b
f Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p)
  pokeCStruct :: Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> PhysicalDeviceSampleLocationsPropertiesEXT -> IO b -> IO b
pokeCStruct p :: Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p PhysicalDeviceSampleLocationsPropertiesEXT{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr ("samples" ::: SampleCountFlagBits)
-> ("samples" ::: SampleCountFlagBits) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr ("samples" ::: SampleCountFlagBits)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SampleCountFlags)) ("samples" ::: SampleCountFlagBits
sampleLocationSampleCounts)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Extent2D -> Extent2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Extent2D)) (Extent2D
maxSampleLocationGridSize) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    let pSampleLocationCoordinateRange' :: Ptr CFloat
pSampleLocationCoordinateRange' = Ptr (FixedArray 2 CFloat) -> Ptr CFloat
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr (FixedArray 2 CFloat)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr (FixedArray 2 CFloat)))
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ case ((Float, Float)
sampleLocationCoordinateRange) of
      (e0 :: Float
e0, e1 :: Float
e1) -> do
        Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CFloat
pSampleLocationCoordinateRange' :: Ptr CFloat) (Float -> CFloat
CFloat (Float
e0))
        Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CFloat
pSampleLocationCoordinateRange' Ptr CFloat -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr CFloat) (Float -> CFloat
CFloat (Float
e1))
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 36 :: Ptr Word32)) (Word32
sampleLocationSubPixelBits)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
variableSampleLocations))
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 48
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> IO b -> IO b
pokeZeroCStruct p :: Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr ("samples" ::: SampleCountFlagBits)
-> ("samples" ::: SampleCountFlagBits) -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr ("samples" ::: SampleCountFlagBits)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SampleCountFlags)) ("samples" ::: SampleCountFlagBits
forall a. Zero a => a
zero)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Extent2D -> Extent2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Extent2D)) (Extent2D
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    let pSampleLocationCoordinateRange' :: Ptr CFloat
pSampleLocationCoordinateRange' = Ptr (FixedArray 2 CFloat) -> Ptr CFloat
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr (FixedArray 2 CFloat)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr (FixedArray 2 CFloat)))
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ case ((Float
forall a. Zero a => a
zero, Float
forall a. Zero a => a
zero)) of
      (e0 :: Float
e0, e1 :: Float
e1) -> do
        Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CFloat
pSampleLocationCoordinateRange' :: Ptr CFloat) (Float -> CFloat
CFloat (Float
e0))
        Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr CFloat
pSampleLocationCoordinateRange' Ptr CFloat -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4 :: Ptr CFloat) (Float -> CFloat
CFloat (Float
e1))
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 36 :: Ptr Word32)) (Word32
forall a. Zero a => a
zero)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Bool32 -> Bool32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
forall a. Zero a => a
zero))
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance FromCStruct PhysicalDeviceSampleLocationsPropertiesEXT where
  peekCStruct :: Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> IO PhysicalDeviceSampleLocationsPropertiesEXT
peekCStruct p :: Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p = do
    "samples" ::: SampleCountFlagBits
sampleLocationSampleCounts <- Ptr ("samples" ::: SampleCountFlagBits)
-> IO ("samples" ::: SampleCountFlagBits)
forall a. Storable a => Ptr a -> IO a
peek @SampleCountFlags ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr ("samples" ::: SampleCountFlagBits)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SampleCountFlags))
    Extent2D
maxSampleLocationGridSize <- Ptr Extent2D -> IO Extent2D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Extent2D ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 20 :: Ptr Extent2D))
    let psampleLocationCoordinateRange :: Ptr CFloat
psampleLocationCoordinateRange = Ptr (FixedArray 2 CFloat) -> Ptr CFloat
forall a (n :: Nat). Ptr (FixedArray n a) -> Ptr a
lowerArrayPtr @CFloat ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT
-> Int -> Ptr (FixedArray 2 CFloat)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 28 :: Ptr (FixedArray 2 CFloat)))
    CFloat
sampleLocationCoordinateRange0 <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr CFloat
psampleLocationCoordinateRange Ptr CFloat -> Int -> Ptr CFloat
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` 0 :: Ptr CFloat))
    CFloat
sampleLocationCoordinateRange1 <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr CFloat
psampleLocationCoordinateRange Ptr CFloat -> Int -> Ptr CFloat
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` 4 :: Ptr CFloat))
    Word32
sampleLocationSubPixelBits <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 36 :: Ptr Word32))
    Bool32
variableSampleLocations <- Ptr Bool32 -> IO Bool32
forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceSampleLocationsPropertiesEXT
p Ptr PhysicalDeviceSampleLocationsPropertiesEXT -> Int -> Ptr Bool32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 40 :: Ptr Bool32))
    PhysicalDeviceSampleLocationsPropertiesEXT
-> IO PhysicalDeviceSampleLocationsPropertiesEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PhysicalDeviceSampleLocationsPropertiesEXT
 -> IO PhysicalDeviceSampleLocationsPropertiesEXT)
-> PhysicalDeviceSampleLocationsPropertiesEXT
-> IO PhysicalDeviceSampleLocationsPropertiesEXT
forall a b. (a -> b) -> a -> b
$ ("samples" ::: SampleCountFlagBits)
-> Extent2D
-> (Float, Float)
-> Word32
-> Bool
-> PhysicalDeviceSampleLocationsPropertiesEXT
PhysicalDeviceSampleLocationsPropertiesEXT
             "samples" ::: SampleCountFlagBits
sampleLocationSampleCounts Extent2D
maxSampleLocationGridSize ((((\(CFloat a :: Float
a) -> Float
a) CFloat
sampleLocationCoordinateRange0), ((\(CFloat a :: Float
a) -> Float
a) CFloat
sampleLocationCoordinateRange1))) Word32
sampleLocationSubPixelBits (Bool32 -> Bool
bool32ToBool Bool32
variableSampleLocations)

instance Zero PhysicalDeviceSampleLocationsPropertiesEXT where
  zero :: PhysicalDeviceSampleLocationsPropertiesEXT
zero = ("samples" ::: SampleCountFlagBits)
-> Extent2D
-> (Float, Float)
-> Word32
-> Bool
-> PhysicalDeviceSampleLocationsPropertiesEXT
PhysicalDeviceSampleLocationsPropertiesEXT
           "samples" ::: SampleCountFlagBits
forall a. Zero a => a
zero
           Extent2D
forall a. Zero a => a
zero
           (Float
forall a. Zero a => a
zero, Float
forall a. Zero a => a
zero)
           Word32
forall a. Zero a => a
zero
           Bool
forall a. Zero a => a
zero


-- | VkMultisamplePropertiesEXT - Structure returning information about
-- sample count specific additional multisampling capabilities
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.SharedTypes.Extent2D',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'getPhysicalDeviceMultisamplePropertiesEXT'
data MultisamplePropertiesEXT = MultisamplePropertiesEXT
  { -- | @maxSampleLocationGridSize@ is the maximum size of the pixel grid in
    -- which sample locations /can/ vary.
    MultisamplePropertiesEXT -> Extent2D
maxSampleLocationGridSize :: Extent2D }
  deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MultisamplePropertiesEXT)
#endif
deriving instance Show MultisamplePropertiesEXT

instance ToCStruct MultisamplePropertiesEXT where
  withCStruct :: MultisamplePropertiesEXT
-> (("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
    -> IO b)
-> IO b
withCStruct x :: MultisamplePropertiesEXT
x f :: ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT) -> IO b
f = Int
-> Int
-> (("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
    -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
  -> IO b)
 -> IO b)
-> (("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
    -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p -> ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> MultisamplePropertiesEXT -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p MultisamplePropertiesEXT
x (("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT) -> IO b
f "pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p)
  pokeCStruct :: ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> MultisamplePropertiesEXT -> IO b -> IO b
pokeCStruct p :: "pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p MultisamplePropertiesEXT{..} f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Extent2D -> Extent2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Extent2D)) (Extent2D
maxSampleLocationGridSize) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> IO b -> IO b
pokeZeroCStruct p :: "pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p f :: IO b
f = ContT b IO b -> IO b
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT b IO b -> IO b) -> ContT b IO b -> IO b
forall a b. (a -> b) -> a -> b
$ do
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT)
    IO () -> ContT b IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT b IO ()) -> IO () -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    ((() -> IO b) -> IO b) -> ContT b IO ()
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((() -> IO b) -> IO b) -> ContT b IO ())
-> ((() -> IO b) -> IO b) -> ContT b IO ()
forall a b. (a -> b) -> a -> b
$ Ptr Extent2D -> Extent2D -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct (("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Extent2D)) (Extent2D
forall a. Zero a => a
zero) (IO b -> IO b) -> ((() -> IO b) -> IO b) -> (() -> IO b) -> IO b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((() -> IO b) -> () -> IO b
forall a b. (a -> b) -> a -> b
$ ())
    IO b -> ContT b IO b
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO b -> ContT b IO b) -> IO b -> ContT b IO b
forall a b. (a -> b) -> a -> b
$ IO b
f

instance FromCStruct MultisamplePropertiesEXT where
  peekCStruct :: ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> IO MultisamplePropertiesEXT
peekCStruct p :: "pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p = do
    Extent2D
maxSampleLocationGridSize <- Ptr Extent2D -> IO Extent2D
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @Extent2D (("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT
p ("pMultisampleProperties" ::: Ptr MultisamplePropertiesEXT)
-> Int -> Ptr Extent2D
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Extent2D))
    MultisamplePropertiesEXT -> IO MultisamplePropertiesEXT
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MultisamplePropertiesEXT -> IO MultisamplePropertiesEXT)
-> MultisamplePropertiesEXT -> IO MultisamplePropertiesEXT
forall a b. (a -> b) -> a -> b
$ Extent2D -> MultisamplePropertiesEXT
MultisamplePropertiesEXT
             Extent2D
maxSampleLocationGridSize

instance Zero MultisamplePropertiesEXT where
  zero :: MultisamplePropertiesEXT
zero = Extent2D -> MultisamplePropertiesEXT
MultisamplePropertiesEXT
           Extent2D
forall a. Zero a => a
zero


type EXT_SAMPLE_LOCATIONS_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_SAMPLE_LOCATIONS_SPEC_VERSION"
pattern EXT_SAMPLE_LOCATIONS_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_SAMPLE_LOCATIONS_SPEC_VERSION :: a
$mEXT_SAMPLE_LOCATIONS_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
EXT_SAMPLE_LOCATIONS_SPEC_VERSION = 1


type EXT_SAMPLE_LOCATIONS_EXTENSION_NAME = "VK_EXT_sample_locations"

-- No documentation found for TopLevel "VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME"
pattern EXT_SAMPLE_LOCATIONS_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_SAMPLE_LOCATIONS_EXTENSION_NAME :: a
$mEXT_SAMPLE_LOCATIONS_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
EXT_SAMPLE_LOCATIONS_EXTENSION_NAME = "VK_EXT_sample_locations"