{-# language CPP #-}
module Vulkan.Extensions.VK_NV_clip_space_w_scaling ( cmdSetViewportWScalingNV
, ViewportWScalingNV(..)
, PipelineViewportWScalingStateCreateInfoNV(..)
, NV_CLIP_SPACE_W_SCALING_SPEC_VERSION
, pattern NV_CLIP_SPACE_W_SCALING_SPEC_VERSION
, NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME
, pattern NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME
) where
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytes)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Data.Coerce (coerce)
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 qualified Data.Vector (null)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Typeable (Typeable)
import Foreign.C.Types (CFloat)
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.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Handles (CommandBuffer)
import Vulkan.Core10.Handles (CommandBuffer(..))
import Vulkan.Core10.Handles (CommandBuffer(CommandBuffer))
import Vulkan.Core10.Handles (CommandBuffer_T)
import Vulkan.Dynamic (DeviceCmds(pVkCmdSetViewportWScalingNV))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkCmdSetViewportWScalingNV
:: FunPtr (Ptr CommandBuffer_T -> Word32 -> Word32 -> Ptr ViewportWScalingNV -> IO ()) -> Ptr CommandBuffer_T -> Word32 -> Word32 -> Ptr ViewportWScalingNV -> IO ()
cmdSetViewportWScalingNV :: forall io
. (MonadIO io)
=>
CommandBuffer
->
("firstViewport" ::: Word32)
->
("viewportWScalings" ::: Vector ViewportWScalingNV)
-> io ()
cmdSetViewportWScalingNV :: forall (io :: * -> *).
MonadIO io =>
CommandBuffer
-> ("firstViewport" ::: Word32)
-> ("viewportWScalings" ::: Vector ViewportWScalingNV)
-> io ()
cmdSetViewportWScalingNV CommandBuffer
commandBuffer
"firstViewport" ::: Word32
firstViewport
"viewportWScalings" ::: Vector ViewportWScalingNV
viewportWScalings = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
let vkCmdSetViewportWScalingNVPtr :: FunPtr
(Ptr CommandBuffer_T
-> ("firstViewport" ::: Word32)
-> ("firstViewport" ::: Word32)
-> ("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> IO ())
vkCmdSetViewportWScalingNVPtr = DeviceCmds
-> FunPtr
(Ptr CommandBuffer_T
-> ("firstViewport" ::: Word32)
-> ("firstViewport" ::: Word32)
-> ("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> IO ())
pVkCmdSetViewportWScalingNV (case CommandBuffer
commandBuffer of CommandBuffer{DeviceCmds
$sel:deviceCmds:CommandBuffer :: CommandBuffer -> DeviceCmds
deviceCmds :: DeviceCmds
deviceCmds} -> DeviceCmds
deviceCmds)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr CommandBuffer_T
-> ("firstViewport" ::: Word32)
-> ("firstViewport" ::: Word32)
-> ("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> IO ())
vkCmdSetViewportWScalingNVPtr forall a. Eq a => a -> a -> Bool
/= forall a. FunPtr a
nullFunPtr) forall a b. (a -> b) -> a -> b
$
forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"The function pointer for vkCmdSetViewportWScalingNV is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
let vkCmdSetViewportWScalingNV' :: Ptr CommandBuffer_T
-> ("firstViewport" ::: Word32)
-> ("firstViewport" ::: Word32)
-> ("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> IO ()
vkCmdSetViewportWScalingNV' = FunPtr
(Ptr CommandBuffer_T
-> ("firstViewport" ::: Word32)
-> ("firstViewport" ::: Word32)
-> ("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> IO ())
-> Ptr CommandBuffer_T
-> ("firstViewport" ::: Word32)
-> ("firstViewport" ::: Word32)
-> ("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> IO ()
mkVkCmdSetViewportWScalingNV FunPtr
(Ptr CommandBuffer_T
-> ("firstViewport" ::: Word32)
-> ("firstViewport" ::: Word32)
-> ("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> IO ())
vkCmdSetViewportWScalingNVPtr
"pViewportWScalings" ::: Ptr ViewportWScalingNV
pPViewportWScalings <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @ViewportWScalingNV ((forall a. Vector a -> Int
Data.Vector.length ("viewportWScalings" ::: Vector ViewportWScalingNV
viewportWScalings)) forall a. Num a => a -> a -> a
* Int
8)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i ViewportWScalingNV
e -> forall a. Storable a => Ptr a -> a -> IO ()
poke ("pViewportWScalings" ::: Ptr ViewportWScalingNV
pPViewportWScalings forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ViewportWScalingNV) (ViewportWScalingNV
e)) ("viewportWScalings" ::: Vector ViewportWScalingNV
viewportWScalings)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. String -> IO a -> IO a
traceAroundEvent String
"vkCmdSetViewportWScalingNV" (Ptr CommandBuffer_T
-> ("firstViewport" ::: Word32)
-> ("firstViewport" ::: Word32)
-> ("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> IO ()
vkCmdSetViewportWScalingNV'
(CommandBuffer -> Ptr CommandBuffer_T
commandBufferHandle (CommandBuffer
commandBuffer))
("firstViewport" ::: Word32
firstViewport)
((forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall a. Vector a -> Int
Data.Vector.length forall a b. (a -> b) -> a -> b
$ ("viewportWScalings" ::: Vector ViewportWScalingNV
viewportWScalings)) :: Word32))
("pViewportWScalings" ::: Ptr ViewportWScalingNV
pPViewportWScalings))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ()
data ViewportWScalingNV = ViewportWScalingNV
{
ViewportWScalingNV -> Float
xcoeff :: Float
,
ViewportWScalingNV -> Float
ycoeff :: Float
}
deriving (Typeable, ViewportWScalingNV -> ViewportWScalingNV -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ViewportWScalingNV -> ViewportWScalingNV -> Bool
$c/= :: ViewportWScalingNV -> ViewportWScalingNV -> Bool
== :: ViewportWScalingNV -> ViewportWScalingNV -> Bool
$c== :: ViewportWScalingNV -> ViewportWScalingNV -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ViewportWScalingNV)
#endif
deriving instance Show ViewportWScalingNV
instance ToCStruct ViewportWScalingNV where
withCStruct :: forall b.
ViewportWScalingNV
-> (("pViewportWScalings" ::: Ptr ViewportWScalingNV) -> IO b)
-> IO b
withCStruct ViewportWScalingNV
x ("pViewportWScalings" ::: Ptr ViewportWScalingNV) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
8 forall a b. (a -> b) -> a -> b
$ \"pViewportWScalings" ::: Ptr ViewportWScalingNV
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pViewportWScalings" ::: Ptr ViewportWScalingNV
p ViewportWScalingNV
x (("pViewportWScalings" ::: Ptr ViewportWScalingNV) -> IO b
f "pViewportWScalings" ::: Ptr ViewportWScalingNV
p)
pokeCStruct :: forall b.
("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> ViewportWScalingNV -> IO b -> IO b
pokeCStruct "pViewportWScalings" ::: Ptr ViewportWScalingNV
p ViewportWScalingNV{Float
ycoeff :: Float
xcoeff :: Float
$sel:ycoeff:ViewportWScalingNV :: ViewportWScalingNV -> Float
$sel:xcoeff:ViewportWScalingNV :: ViewportWScalingNV -> Float
..} IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pViewportWScalings" ::: Ptr ViewportWScalingNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
xcoeff))
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pViewportWScalings" ::: Ptr ViewportWScalingNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
ycoeff))
IO b
f
cStructSize :: Int
cStructSize = Int
8
cStructAlignment :: Int
cStructAlignment = Int
4
pokeZeroCStruct :: forall b.
("pViewportWScalings" ::: Ptr ViewportWScalingNV) -> IO b -> IO b
pokeZeroCStruct "pViewportWScalings" ::: Ptr ViewportWScalingNV
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pViewportWScalings" ::: Ptr ViewportWScalingNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr CFloat)) (Float -> CFloat
CFloat (forall a. Zero a => a
zero))
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pViewportWScalings" ::: Ptr ViewportWScalingNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr CFloat)) (Float -> CFloat
CFloat (forall a. Zero a => a
zero))
IO b
f
instance FromCStruct ViewportWScalingNV where
peekCStruct :: ("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> IO ViewportWScalingNV
peekCStruct "pViewportWScalings" ::: Ptr ViewportWScalingNV
p = do
CFloat
xcoeff <- forall a. Storable a => Ptr a -> IO a
peek @CFloat (("pViewportWScalings" ::: Ptr ViewportWScalingNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr CFloat))
CFloat
ycoeff <- forall a. Storable a => Ptr a -> IO a
peek @CFloat (("pViewportWScalings" ::: Ptr ViewportWScalingNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4 :: Ptr CFloat))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Float -> Float -> ViewportWScalingNV
ViewportWScalingNV
(coerce :: forall a b. Coercible a b => a -> b
coerce @CFloat @Float CFloat
xcoeff) (coerce :: forall a b. Coercible a b => a -> b
coerce @CFloat @Float CFloat
ycoeff)
instance Storable ViewportWScalingNV where
sizeOf :: ViewportWScalingNV -> Int
sizeOf ~ViewportWScalingNV
_ = Int
8
alignment :: ViewportWScalingNV -> Int
alignment ~ViewportWScalingNV
_ = Int
4
peek :: ("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> IO ViewportWScalingNV
peek = forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pViewportWScalings" ::: Ptr ViewportWScalingNV)
-> ViewportWScalingNV -> IO ()
poke "pViewportWScalings" ::: Ptr ViewportWScalingNV
ptr ViewportWScalingNV
poked = forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pViewportWScalings" ::: Ptr ViewportWScalingNV
ptr ViewportWScalingNV
poked (forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ViewportWScalingNV where
zero :: ViewportWScalingNV
zero = Float -> Float -> ViewportWScalingNV
ViewportWScalingNV
forall a. Zero a => a
zero
forall a. Zero a => a
zero
data PipelineViewportWScalingStateCreateInfoNV = PipelineViewportWScalingStateCreateInfoNV
{
PipelineViewportWScalingStateCreateInfoNV -> Bool
viewportWScalingEnable :: Bool
,
PipelineViewportWScalingStateCreateInfoNV
-> "firstViewport" ::: Word32
viewportCount :: Word32
,
PipelineViewportWScalingStateCreateInfoNV
-> "viewportWScalings" ::: Vector ViewportWScalingNV
viewportWScalings :: Vector ViewportWScalingNV
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PipelineViewportWScalingStateCreateInfoNV)
#endif
deriving instance Show PipelineViewportWScalingStateCreateInfoNV
instance ToCStruct PipelineViewportWScalingStateCreateInfoNV where
withCStruct :: forall b.
PipelineViewportWScalingStateCreateInfoNV
-> (Ptr PipelineViewportWScalingStateCreateInfoNV -> IO b) -> IO b
withCStruct PipelineViewportWScalingStateCreateInfoNV
x Ptr PipelineViewportWScalingStateCreateInfoNV -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \Ptr PipelineViewportWScalingStateCreateInfoNV
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PipelineViewportWScalingStateCreateInfoNV
p PipelineViewportWScalingStateCreateInfoNV
x (Ptr PipelineViewportWScalingStateCreateInfoNV -> IO b
f Ptr PipelineViewportWScalingStateCreateInfoNV
p)
pokeCStruct :: forall b.
Ptr PipelineViewportWScalingStateCreateInfoNV
-> PipelineViewportWScalingStateCreateInfoNV -> IO b -> IO b
pokeCStruct Ptr PipelineViewportWScalingStateCreateInfoNV
p PipelineViewportWScalingStateCreateInfoNV{Bool
"firstViewport" ::: Word32
"viewportWScalings" ::: Vector ViewportWScalingNV
viewportWScalings :: "viewportWScalings" ::: Vector ViewportWScalingNV
viewportCount :: "firstViewport" ::: Word32
viewportWScalingEnable :: Bool
$sel:viewportWScalings:PipelineViewportWScalingStateCreateInfoNV :: PipelineViewportWScalingStateCreateInfoNV
-> "viewportWScalings" ::: Vector ViewportWScalingNV
$sel:viewportCount:PipelineViewportWScalingStateCreateInfoNV :: PipelineViewportWScalingStateCreateInfoNV
-> "firstViewport" ::: Word32
$sel:viewportWScalingEnable:PipelineViewportWScalingStateCreateInfoNV :: PipelineViewportWScalingStateCreateInfoNV -> Bool
..} IO b
f = forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT forall a b. (a -> b) -> a -> b
$ do
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportWScalingStateCreateInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportWScalingStateCreateInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportWScalingStateCreateInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
viewportWScalingEnable))
let pViewportWScalingsLength :: Int
pViewportWScalingsLength = forall a. Vector a -> Int
Data.Vector.length forall a b. (a -> b) -> a -> b
$ ("viewportWScalings" ::: Vector ViewportWScalingNV
viewportWScalings)
"firstViewport" ::: Word32
viewportCount'' <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ if ("firstViewport" ::: Word32
viewportCount) forall a. Eq a => a -> a -> Bool
== "firstViewport" ::: Word32
0
then forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pViewportWScalingsLength
else do
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pViewportWScalingsLength forall a. Eq a => a -> a -> Bool
== ("firstViewport" ::: Word32
viewportCount) Bool -> Bool -> Bool
|| Int
pViewportWScalingsLength forall a. Eq a => a -> a -> Bool
== Int
0) forall a b. (a -> b) -> a -> b
$
forall e a. Exception e => e -> IO a
throwIO forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError forall a. Maybe a
Nothing IOErrorType
InvalidArgument String
"" String
"pViewportWScalings must be empty or have 'viewportCount' elements" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
forall (f :: * -> *) a. Applicative f => a -> f a
pure ("firstViewport" ::: Word32
viewportCount)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportWScalingStateCreateInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32)) ("firstViewport" ::: Word32
viewportCount'')
"pViewportWScalings" ::: Ptr ViewportWScalingNV
pViewportWScalings'' <- if forall a. Vector a -> Bool
Data.Vector.null ("viewportWScalings" ::: Vector ViewportWScalingNV
viewportWScalings)
then forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Ptr a
nullPtr
else do
"pViewportWScalings" ::: Ptr ViewportWScalingNV
pPViewportWScalings <- forall {k} (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT forall a b. (a -> b) -> a -> b
$ forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes @ViewportWScalingNV (((forall a. Vector a -> Int
Data.Vector.length ("viewportWScalings" ::: Vector ViewportWScalingNV
viewportWScalings))) forall a. Num a => a -> a -> a
* Int
8)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a b.
Monad m =>
(Int -> a -> m b) -> Vector a -> m ()
Data.Vector.imapM_ (\Int
i ViewportWScalingNV
e -> forall a. Storable a => Ptr a -> a -> IO ()
poke ("pViewportWScalings" ::: Ptr ViewportWScalingNV
pPViewportWScalings forall a b. Ptr a -> Int -> Ptr b
`plusPtr` (Int
8 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ViewportWScalingNV) (ViewportWScalingNV
e)) (("viewportWScalings" ::: Vector ViewportWScalingNV
viewportWScalings))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ "pViewportWScalings" ::: Ptr ViewportWScalingNV
pPViewportWScalings
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportWScalingStateCreateInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ViewportWScalingNV))) "pViewportWScalings" ::: Ptr ViewportWScalingNV
pViewportWScalings''
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
cStructSize :: Int
cStructSize = Int
32
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b.
Ptr PipelineViewportWScalingStateCreateInfoNV -> IO b -> IO b
pokeZeroCStruct Ptr PipelineViewportWScalingStateCreateInfoNV
p IO b
f = do
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportWScalingStateCreateInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportWScalingStateCreateInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PipelineViewportWScalingStateCreateInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
IO b
f
instance FromCStruct PipelineViewportWScalingStateCreateInfoNV where
peekCStruct :: Ptr PipelineViewportWScalingStateCreateInfoNV
-> IO PipelineViewportWScalingStateCreateInfoNV
peekCStruct Ptr PipelineViewportWScalingStateCreateInfoNV
p = do
Bool32
viewportWScalingEnable <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PipelineViewportWScalingStateCreateInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
"firstViewport" ::: Word32
viewportCount <- forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr PipelineViewportWScalingStateCreateInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Word32))
"pViewportWScalings" ::: Ptr ViewportWScalingNV
pViewportWScalings <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr ViewportWScalingNV) ((Ptr PipelineViewportWScalingStateCreateInfoNV
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ViewportWScalingNV)))
let pViewportWScalingsLength :: Int
pViewportWScalingsLength = if "pViewportWScalings" ::: Ptr ViewportWScalingNV
pViewportWScalings forall a. Eq a => a -> a -> Bool
== forall a. Ptr a
nullPtr then Int
0 else (forall a b. (Integral a, Num b) => a -> b
fromIntegral "firstViewport" ::: Word32
viewportCount)
"viewportWScalings" ::: Vector ViewportWScalingNV
pViewportWScalings' <- forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM Int
pViewportWScalingsLength (\Int
i -> forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ViewportWScalingNV (("pViewportWScalings" ::: Ptr ViewportWScalingNV
pViewportWScalings forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (Int
8 forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ViewportWScalingNV)))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Bool
-> ("firstViewport" ::: Word32)
-> ("viewportWScalings" ::: Vector ViewportWScalingNV)
-> PipelineViewportWScalingStateCreateInfoNV
PipelineViewportWScalingStateCreateInfoNV
(Bool32 -> Bool
bool32ToBool Bool32
viewportWScalingEnable)
"firstViewport" ::: Word32
viewportCount
"viewportWScalings" ::: Vector ViewportWScalingNV
pViewportWScalings'
instance Zero PipelineViewportWScalingStateCreateInfoNV where
zero :: PipelineViewportWScalingStateCreateInfoNV
zero = Bool
-> ("firstViewport" ::: Word32)
-> ("viewportWScalings" ::: Vector ViewportWScalingNV)
-> PipelineViewportWScalingStateCreateInfoNV
PipelineViewportWScalingStateCreateInfoNV
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Monoid a => a
mempty
type NV_CLIP_SPACE_W_SCALING_SPEC_VERSION = 1
pattern NV_CLIP_SPACE_W_SCALING_SPEC_VERSION :: forall a . Integral a => a
pattern $bNV_CLIP_SPACE_W_SCALING_SPEC_VERSION :: forall a. Integral a => a
$mNV_CLIP_SPACE_W_SCALING_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
NV_CLIP_SPACE_W_SCALING_SPEC_VERSION = 1
type NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME = "VK_NV_clip_space_w_scaling"
pattern NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bNV_CLIP_SPACE_W_SCALING_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mNV_CLIP_SPACE_W_SCALING_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME = "VK_NV_clip_space_w_scaling"