{-# language CPP #-}
module Vulkan.Core10.Sampler ( createSampler
, withSampler
, destroySampler
, SamplerCreateInfo(..)
, Sampler(..)
, BorderColor(..)
, Filter(..)
, SamplerMipmapMode(..)
, SamplerAddressMode(..)
, SamplerCreateFlagBits(..)
, SamplerCreateFlags
) where
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Data.Typeable (eqT)
import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (castPtr)
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 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.Type.Equality ((:~:)(Refl))
import Data.Typeable (Typeable)
import Foreign.C.Types (CFloat)
import Foreign.C.Types (CFloat(..))
import Foreign.C.Types (CFloat(CFloat))
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.Core10.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.CStruct.Extends (forgetExtensions)
import Vulkan.NamedType ((:::))
import Vulkan.Core10.AllocationCallbacks (AllocationCallbacks)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Enums.BorderColor (BorderColor)
import Vulkan.CStruct.Extends (Chain)
import Vulkan.Core10.Enums.CompareOp (CompareOp)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Core10.Handles (Device(Device))
import Vulkan.Dynamic (DeviceCmds(pVkCreateSampler))
import Vulkan.Dynamic (DeviceCmds(pVkDestroySampler))
import Vulkan.Core10.Handles (Device_T)
import Vulkan.CStruct.Extends (Extends)
import Vulkan.CStruct.Extends (Extendss)
import Vulkan.CStruct.Extends (Extensible(..))
import Vulkan.Core10.Enums.Filter (Filter)
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_descriptor_buffer (OpaqueCaptureDescriptorDataCreateInfoEXT)
import Vulkan.CStruct.Extends (PeekChain)
import Vulkan.CStruct.Extends (PeekChain(..))
import Vulkan.CStruct.Extends (PokeChain)
import Vulkan.CStruct.Extends (PokeChain(..))
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Handles (Sampler)
import Vulkan.Core10.Handles (Sampler(..))
import Vulkan.Core10.Enums.SamplerAddressMode (SamplerAddressMode)
import {-# SOURCE #-} Vulkan.Extensions.VK_QCOM_image_processing2 (SamplerBlockMatchWindowCreateInfoQCOM)
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_border_color_swizzle (SamplerBorderColorComponentMappingCreateInfoEXT)
import Vulkan.Core10.Enums.SamplerCreateFlagBits (SamplerCreateFlags)
import {-# SOURCE #-} Vulkan.Extensions.VK_QCOM_filter_cubic_weights (SamplerCubicWeightsCreateInfoQCOM)
import {-# SOURCE #-} Vulkan.Extensions.VK_EXT_custom_border_color (SamplerCustomBorderColorCreateInfoEXT)
import Vulkan.Core10.Enums.SamplerMipmapMode (SamplerMipmapMode)
import {-# SOURCE #-} Vulkan.Core12.Promoted_From_VK_EXT_sampler_filter_minmax (SamplerReductionModeCreateInfo)
import {-# SOURCE #-} Vulkan.Core11.Promoted_From_VK_KHR_sampler_ycbcr_conversion (SamplerYcbcrConversionInfo)
import Vulkan.CStruct.Extends (SomeStruct)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_SAMPLER_CREATE_INFO))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Core10.Enums.BorderColor (BorderColor(..))
import Vulkan.Core10.Enums.Filter (Filter(..))
import Vulkan.Core10.Handles (Sampler(..))
import Vulkan.Core10.Enums.SamplerAddressMode (SamplerAddressMode(..))
import Vulkan.Core10.Enums.SamplerCreateFlagBits (SamplerCreateFlagBits(..))
import Vulkan.Core10.Enums.SamplerCreateFlagBits (SamplerCreateFlags)
import Vulkan.Core10.Enums.SamplerMipmapMode (SamplerMipmapMode(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkCreateSampler
:: FunPtr (Ptr Device_T -> Ptr (SomeStruct SamplerCreateInfo) -> Ptr AllocationCallbacks -> Ptr Sampler -> IO Result) -> Ptr Device_T -> Ptr (SomeStruct SamplerCreateInfo) -> Ptr AllocationCallbacks -> Ptr Sampler -> IO Result
createSampler :: forall a io
. (Extendss SamplerCreateInfo a, PokeChain a, MonadIO io)
=>
Device
->
(SamplerCreateInfo a)
->
("allocator" ::: Maybe AllocationCallbacks)
-> io (Sampler)
createSampler :: forall (a :: [*]) (io :: * -> *).
(Extendss SamplerCreateInfo a, PokeChain a, MonadIO io) =>
Device
-> SamplerCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io Sampler
createSampler Device
device SamplerCreateInfo a
createInfo "allocator" ::: Maybe AllocationCallbacks
allocator = 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 vkCreateSamplerPtr :: FunPtr
(Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct SamplerCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSampler" ::: Ptr Sampler)
-> IO Result)
vkCreateSamplerPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct SamplerCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSampler" ::: Ptr Sampler)
-> IO Result)
pVkCreateSampler (case Device
device of Device{DeviceCmds
$sel:deviceCmds:Device :: Device -> 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 Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct SamplerCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSampler" ::: Ptr Sampler)
-> IO Result)
vkCreateSamplerPtr 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 vkCreateSampler is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
let vkCreateSampler' :: Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct SamplerCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSampler" ::: Ptr Sampler)
-> IO Result
vkCreateSampler' = FunPtr
(Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct SamplerCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSampler" ::: Ptr Sampler)
-> IO Result)
-> Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct SamplerCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSampler" ::: Ptr Sampler)
-> IO Result
mkVkCreateSampler FunPtr
(Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct SamplerCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSampler" ::: Ptr Sampler)
-> IO Result)
vkCreateSamplerPtr
Ptr (SamplerCreateInfo a)
pCreateInfo <- 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. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (SamplerCreateInfo a
createInfo)
"pAllocator" ::: Ptr AllocationCallbacks
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
"allocator" ::: Maybe AllocationCallbacks
Nothing -> forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Ptr a
nullPtr
Just AllocationCallbacks
j -> 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. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
"pSampler" ::: Ptr Sampler
pPSampler <- 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 c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (forall a. Int -> IO (Ptr a)
callocBytes @Sampler Int
8) forall a. Ptr a -> IO ()
free
Result
r <- 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
"vkCreateSampler" (Ptr Device_T
-> ("pCreateInfo" ::: Ptr (SomeStruct SamplerCreateInfo))
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSampler" ::: Ptr Sampler)
-> IO Result
vkCreateSampler'
(Device -> Ptr Device_T
deviceHandle (Device
device))
(forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions Ptr (SamplerCreateInfo a)
pCreateInfo)
"pAllocator" ::: Ptr AllocationCallbacks
pAllocator
("pSampler" ::: Ptr Sampler
pPSampler))
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 ()
when (Result
r forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
Sampler
pSampler <- 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 -> IO a
peek @Sampler "pSampler" ::: Ptr Sampler
pPSampler
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ (Sampler
pSampler)
withSampler :: forall a io r . (Extendss SamplerCreateInfo a, PokeChain a, MonadIO io) => Device -> SamplerCreateInfo a -> Maybe AllocationCallbacks -> (io Sampler -> (Sampler -> io ()) -> r) -> r
withSampler :: forall (a :: [*]) (io :: * -> *) r.
(Extendss SamplerCreateInfo a, PokeChain a, MonadIO io) =>
Device
-> SamplerCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> (io Sampler -> (Sampler -> io ()) -> r)
-> r
withSampler Device
device SamplerCreateInfo a
pCreateInfo "allocator" ::: Maybe AllocationCallbacks
pAllocator io Sampler -> (Sampler -> io ()) -> r
b =
io Sampler -> (Sampler -> io ()) -> r
b (forall (a :: [*]) (io :: * -> *).
(Extendss SamplerCreateInfo a, PokeChain a, MonadIO io) =>
Device
-> SamplerCreateInfo a
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io Sampler
createSampler Device
device SamplerCreateInfo a
pCreateInfo "allocator" ::: Maybe AllocationCallbacks
pAllocator)
(\(Sampler
o0) -> forall (io :: * -> *).
MonadIO io =>
Device
-> Sampler -> ("allocator" ::: Maybe AllocationCallbacks) -> io ()
destroySampler Device
device Sampler
o0 "allocator" ::: Maybe AllocationCallbacks
pAllocator)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkDestroySampler
:: FunPtr (Ptr Device_T -> Sampler -> Ptr AllocationCallbacks -> IO ()) -> Ptr Device_T -> Sampler -> Ptr AllocationCallbacks -> IO ()
destroySampler :: forall io
. (MonadIO io)
=>
Device
->
Sampler
->
("allocator" ::: Maybe AllocationCallbacks)
-> io ()
destroySampler :: forall (io :: * -> *).
MonadIO io =>
Device
-> Sampler -> ("allocator" ::: Maybe AllocationCallbacks) -> io ()
destroySampler Device
device Sampler
sampler "allocator" ::: Maybe AllocationCallbacks
allocator = 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 vkDestroySamplerPtr :: FunPtr
(Ptr Device_T
-> Sampler -> ("pAllocator" ::: Ptr AllocationCallbacks) -> IO ())
vkDestroySamplerPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> Sampler -> ("pAllocator" ::: Ptr AllocationCallbacks) -> IO ())
pVkDestroySampler (case Device
device of Device{DeviceCmds
deviceCmds :: DeviceCmds
$sel:deviceCmds:Device :: Device -> 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 Device_T
-> Sampler -> ("pAllocator" ::: Ptr AllocationCallbacks) -> IO ())
vkDestroySamplerPtr 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 vkDestroySampler is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
let vkDestroySampler' :: Ptr Device_T
-> Sampler -> ("pAllocator" ::: Ptr AllocationCallbacks) -> IO ()
vkDestroySampler' = FunPtr
(Ptr Device_T
-> Sampler -> ("pAllocator" ::: Ptr AllocationCallbacks) -> IO ())
-> Ptr Device_T
-> Sampler
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> IO ()
mkVkDestroySampler FunPtr
(Ptr Device_T
-> Sampler -> ("pAllocator" ::: Ptr AllocationCallbacks) -> IO ())
vkDestroySamplerPtr
"pAllocator" ::: Ptr AllocationCallbacks
pAllocator <- case ("allocator" ::: Maybe AllocationCallbacks
allocator) of
"allocator" ::: Maybe AllocationCallbacks
Nothing -> forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Ptr a
nullPtr
Just AllocationCallbacks
j -> 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. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (AllocationCallbacks
j)
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
"vkDestroySampler" (Ptr Device_T
-> Sampler -> ("pAllocator" ::: Ptr AllocationCallbacks) -> IO ()
vkDestroySampler'
(Device -> Ptr Device_T
deviceHandle (Device
device))
(Sampler
sampler)
"pAllocator" ::: Ptr AllocationCallbacks
pAllocator)
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ ()
data SamplerCreateInfo (es :: [Type]) = SamplerCreateInfo
{
forall (es :: [*]). SamplerCreateInfo es -> Chain es
next :: Chain es
,
forall (es :: [*]). SamplerCreateInfo es -> SamplerCreateFlags
flags :: SamplerCreateFlags
,
forall (es :: [*]). SamplerCreateInfo es -> Filter
magFilter :: Filter
,
forall (es :: [*]). SamplerCreateInfo es -> Filter
minFilter :: Filter
,
forall (es :: [*]). SamplerCreateInfo es -> SamplerMipmapMode
mipmapMode :: SamplerMipmapMode
,
forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
addressModeU :: SamplerAddressMode
,
forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
addressModeV :: SamplerAddressMode
,
forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
addressModeW :: SamplerAddressMode
,
forall (es :: [*]). SamplerCreateInfo es -> Float
mipLodBias :: Float
,
forall (es :: [*]). SamplerCreateInfo es -> Bool
anisotropyEnable :: Bool
,
forall (es :: [*]). SamplerCreateInfo es -> Float
maxAnisotropy :: Float
,
forall (es :: [*]). SamplerCreateInfo es -> Bool
compareEnable :: Bool
,
forall (es :: [*]). SamplerCreateInfo es -> CompareOp
compareOp :: CompareOp
,
forall (es :: [*]). SamplerCreateInfo es -> Float
minLod :: Float
,
forall (es :: [*]). SamplerCreateInfo es -> Float
maxLod :: Float
,
forall (es :: [*]). SamplerCreateInfo es -> BorderColor
borderColor :: BorderColor
,
forall (es :: [*]). SamplerCreateInfo es -> Bool
unnormalizedCoordinates :: Bool
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SamplerCreateInfo (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (SamplerCreateInfo es)
instance Extensible SamplerCreateInfo where
extensibleTypeName :: String
extensibleTypeName = String
"SamplerCreateInfo"
setNext :: forall (ds :: [*]) (es :: [*]).
SamplerCreateInfo ds -> Chain es -> SamplerCreateInfo es
setNext SamplerCreateInfo{Bool
Float
Chain ds
CompareOp
Filter
SamplerMipmapMode
SamplerAddressMode
SamplerCreateFlags
BorderColor
unnormalizedCoordinates :: Bool
borderColor :: BorderColor
maxLod :: Float
minLod :: Float
compareOp :: CompareOp
compareEnable :: Bool
maxAnisotropy :: Float
anisotropyEnable :: Bool
mipLodBias :: Float
addressModeW :: SamplerAddressMode
addressModeV :: SamplerAddressMode
addressModeU :: SamplerAddressMode
mipmapMode :: SamplerMipmapMode
minFilter :: Filter
magFilter :: Filter
flags :: SamplerCreateFlags
next :: Chain ds
$sel:unnormalizedCoordinates:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Bool
$sel:borderColor:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> BorderColor
$sel:maxLod:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:minLod:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:compareOp:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> CompareOp
$sel:compareEnable:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Bool
$sel:maxAnisotropy:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:anisotropyEnable:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Bool
$sel:mipLodBias:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:addressModeW:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
$sel:addressModeV:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
$sel:addressModeU:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
$sel:mipmapMode:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerMipmapMode
$sel:minFilter:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Filter
$sel:magFilter:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Filter
$sel:flags:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerCreateFlags
$sel:next:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Chain es
..} Chain es
next' = SamplerCreateInfo{$sel:next:SamplerCreateInfo :: Chain es
next = Chain es
next', Bool
Float
CompareOp
Filter
SamplerMipmapMode
SamplerAddressMode
SamplerCreateFlags
BorderColor
unnormalizedCoordinates :: Bool
borderColor :: BorderColor
maxLod :: Float
minLod :: Float
compareOp :: CompareOp
compareEnable :: Bool
maxAnisotropy :: Float
anisotropyEnable :: Bool
mipLodBias :: Float
addressModeW :: SamplerAddressMode
addressModeV :: SamplerAddressMode
addressModeU :: SamplerAddressMode
mipmapMode :: SamplerMipmapMode
minFilter :: Filter
magFilter :: Filter
flags :: SamplerCreateFlags
$sel:unnormalizedCoordinates:SamplerCreateInfo :: Bool
$sel:borderColor:SamplerCreateInfo :: BorderColor
$sel:maxLod:SamplerCreateInfo :: Float
$sel:minLod:SamplerCreateInfo :: Float
$sel:compareOp:SamplerCreateInfo :: CompareOp
$sel:compareEnable:SamplerCreateInfo :: Bool
$sel:maxAnisotropy:SamplerCreateInfo :: Float
$sel:anisotropyEnable:SamplerCreateInfo :: Bool
$sel:mipLodBias:SamplerCreateInfo :: Float
$sel:addressModeW:SamplerCreateInfo :: SamplerAddressMode
$sel:addressModeV:SamplerCreateInfo :: SamplerAddressMode
$sel:addressModeU:SamplerCreateInfo :: SamplerAddressMode
$sel:mipmapMode:SamplerCreateInfo :: SamplerMipmapMode
$sel:minFilter:SamplerCreateInfo :: Filter
$sel:magFilter:SamplerCreateInfo :: Filter
$sel:flags:SamplerCreateInfo :: SamplerCreateFlags
..}
getNext :: forall (es :: [*]). SamplerCreateInfo es -> Chain es
getNext SamplerCreateInfo{Bool
Float
Chain es
CompareOp
Filter
SamplerMipmapMode
SamplerAddressMode
SamplerCreateFlags
BorderColor
unnormalizedCoordinates :: Bool
borderColor :: BorderColor
maxLod :: Float
minLod :: Float
compareOp :: CompareOp
compareEnable :: Bool
maxAnisotropy :: Float
anisotropyEnable :: Bool
mipLodBias :: Float
addressModeW :: SamplerAddressMode
addressModeV :: SamplerAddressMode
addressModeU :: SamplerAddressMode
mipmapMode :: SamplerMipmapMode
minFilter :: Filter
magFilter :: Filter
flags :: SamplerCreateFlags
next :: Chain es
$sel:unnormalizedCoordinates:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Bool
$sel:borderColor:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> BorderColor
$sel:maxLod:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:minLod:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:compareOp:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> CompareOp
$sel:compareEnable:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Bool
$sel:maxAnisotropy:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:anisotropyEnable:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Bool
$sel:mipLodBias:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:addressModeW:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
$sel:addressModeV:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
$sel:addressModeU:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
$sel:mipmapMode:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerMipmapMode
$sel:minFilter:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Filter
$sel:magFilter:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Filter
$sel:flags:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerCreateFlags
$sel:next:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Chain es
..} = Chain es
next
extends :: forall e b proxy. Typeable e => proxy e -> (Extends SamplerCreateInfo e => b) -> Maybe b
extends :: forall e b (proxy :: * -> *).
Typeable e =>
proxy e -> (Extends SamplerCreateInfo e => b) -> Maybe b
extends proxy e
_ Extends SamplerCreateInfo e => b
f
| Just e :~: SamplerBlockMatchWindowCreateInfoQCOM
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @SamplerBlockMatchWindowCreateInfoQCOM = forall a. a -> Maybe a
Just Extends SamplerCreateInfo e => b
f
| Just e :~: SamplerCubicWeightsCreateInfoQCOM
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @SamplerCubicWeightsCreateInfoQCOM = forall a. a -> Maybe a
Just Extends SamplerCreateInfo e => b
f
| Just e :~: OpaqueCaptureDescriptorDataCreateInfoEXT
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @OpaqueCaptureDescriptorDataCreateInfoEXT = forall a. a -> Maybe a
Just Extends SamplerCreateInfo e => b
f
| Just e :~: SamplerBorderColorComponentMappingCreateInfoEXT
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @SamplerBorderColorComponentMappingCreateInfoEXT = forall a. a -> Maybe a
Just Extends SamplerCreateInfo e => b
f
| Just e :~: SamplerCustomBorderColorCreateInfoEXT
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @SamplerCustomBorderColorCreateInfoEXT = forall a. a -> Maybe a
Just Extends SamplerCreateInfo e => b
f
| Just e :~: SamplerReductionModeCreateInfo
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @SamplerReductionModeCreateInfo = forall a. a -> Maybe a
Just Extends SamplerCreateInfo e => b
f
| Just e :~: SamplerYcbcrConversionInfo
Refl <- forall {k} (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @SamplerYcbcrConversionInfo = forall a. a -> Maybe a
Just Extends SamplerCreateInfo e => b
f
| Bool
otherwise = forall a. Maybe a
Nothing
instance ( Extendss SamplerCreateInfo es
, PokeChain es ) => ToCStruct (SamplerCreateInfo es) where
withCStruct :: forall b.
SamplerCreateInfo es
-> (Ptr (SamplerCreateInfo es) -> IO b) -> IO b
withCStruct SamplerCreateInfo es
x Ptr (SamplerCreateInfo es) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
80 forall a b. (a -> b) -> a -> b
$ \Ptr (SamplerCreateInfo es)
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (SamplerCreateInfo es)
p SamplerCreateInfo es
x (Ptr (SamplerCreateInfo es) -> IO b
f Ptr (SamplerCreateInfo es)
p)
pokeCStruct :: forall b.
Ptr (SamplerCreateInfo es) -> SamplerCreateInfo es -> IO b -> IO b
pokeCStruct Ptr (SamplerCreateInfo es)
p SamplerCreateInfo{Bool
Float
Chain es
CompareOp
Filter
SamplerMipmapMode
SamplerAddressMode
SamplerCreateFlags
BorderColor
unnormalizedCoordinates :: Bool
borderColor :: BorderColor
maxLod :: Float
minLod :: Float
compareOp :: CompareOp
compareEnable :: Bool
maxAnisotropy :: Float
anisotropyEnable :: Bool
mipLodBias :: Float
addressModeW :: SamplerAddressMode
addressModeV :: SamplerAddressMode
addressModeU :: SamplerAddressMode
mipmapMode :: SamplerMipmapMode
minFilter :: Filter
magFilter :: Filter
flags :: SamplerCreateFlags
next :: Chain es
$sel:unnormalizedCoordinates:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Bool
$sel:borderColor:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> BorderColor
$sel:maxLod:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:minLod:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:compareOp:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> CompareOp
$sel:compareEnable:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Bool
$sel:maxAnisotropy:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:anisotropyEnable:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Bool
$sel:mipLodBias:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Float
$sel:addressModeW:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
$sel:addressModeV:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
$sel:addressModeU:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerAddressMode
$sel:mipmapMode:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerMipmapMode
$sel:minFilter:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Filter
$sel:magFilter:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Filter
$sel:flags:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> SamplerCreateFlags
$sel:next:SamplerCreateInfo :: forall (es :: [*]). SamplerCreateInfo es -> Chain es
..} 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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
Ptr ()
pNext'' <- forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. Ptr a -> Ptr b
castPtr forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext''
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr SamplerCreateFlags)) (SamplerCreateFlags
flags)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Filter)) (Filter
magFilter)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Filter)) (Filter
minFilter)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr SamplerMipmapMode)) (SamplerMipmapMode
mipmapMode)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr SamplerAddressMode)) (SamplerAddressMode
addressModeU)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
36 :: Ptr SamplerAddressMode)) (SamplerAddressMode
addressModeV)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr SamplerAddressMode)) (SamplerAddressMode
addressModeW)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
44 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
mipLodBias))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
anisotropyEnable))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
52 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
maxAnisotropy))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
56 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
compareEnable))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
60 :: Ptr CompareOp)) (CompareOp
compareOp)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
64 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
minLod))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
68 :: Ptr CFloat)) (Float -> CFloat
CFloat (Float
maxLod))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
72 :: Ptr BorderColor)) (BorderColor
borderColor)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
76 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
unnormalizedCoordinates))
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
80
cStructAlignment :: Int
cStructAlignment = Int
8
pokeZeroCStruct :: forall b. Ptr (SamplerCreateInfo es) -> IO b -> IO b
pokeZeroCStruct Ptr (SamplerCreateInfo es)
p 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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_SAMPLER_CREATE_INFO)
Ptr ()
pNext' <- forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. Ptr a -> Ptr b
castPtr forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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 (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) Ptr ()
pNext'
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Filter)) (forall a. Zero a => a
zero)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Filter)) (forall a. Zero a => a
zero)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr SamplerMipmapMode)) (forall a. Zero a => a
zero)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr SamplerAddressMode)) (forall a. Zero a => a
zero)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
36 :: Ptr SamplerAddressMode)) (forall a. Zero a => a
zero)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr SamplerAddressMode)) (forall a. Zero a => a
zero)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
44 :: Ptr CFloat)) (Float -> CFloat
CFloat (forall a. Zero a => a
zero))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
52 :: Ptr CFloat)) (Float -> CFloat
CFloat (forall a. Zero a => a
zero))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
56 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
60 :: Ptr CompareOp)) (forall a. Zero a => a
zero)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
64 :: Ptr CFloat)) (Float -> CFloat
CFloat (forall a. Zero a => a
zero))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
68 :: Ptr CFloat)) (Float -> CFloat
CFloat (forall a. Zero a => a
zero))
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
72 :: Ptr BorderColor)) (forall a. Zero a => a
zero)
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 (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
76 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ IO b
f
instance ( Extendss SamplerCreateInfo es
, PeekChain es ) => FromCStruct (SamplerCreateInfo es) where
peekCStruct :: Ptr (SamplerCreateInfo es) -> IO (SamplerCreateInfo es)
peekCStruct Ptr (SamplerCreateInfo es)
p = do
Ptr ()
pNext <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ())))
Chain es
next <- forall (es :: [*]). PeekChain es => Ptr (Chain es) -> IO (Chain es)
peekChain (forall a b. Ptr a -> Ptr b
castPtr Ptr ()
pNext)
SamplerCreateFlags
flags <- forall a. Storable a => Ptr a -> IO a
peek @SamplerCreateFlags ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr SamplerCreateFlags))
Filter
magFilter <- forall a. Storable a => Ptr a -> IO a
peek @Filter ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Filter))
Filter
minFilter <- forall a. Storable a => Ptr a -> IO a
peek @Filter ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Filter))
SamplerMipmapMode
mipmapMode <- forall a. Storable a => Ptr a -> IO a
peek @SamplerMipmapMode ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
28 :: Ptr SamplerMipmapMode))
SamplerAddressMode
addressModeU <- forall a. Storable a => Ptr a -> IO a
peek @SamplerAddressMode ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr SamplerAddressMode))
SamplerAddressMode
addressModeV <- forall a. Storable a => Ptr a -> IO a
peek @SamplerAddressMode ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
36 :: Ptr SamplerAddressMode))
SamplerAddressMode
addressModeW <- forall a. Storable a => Ptr a -> IO a
peek @SamplerAddressMode ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr SamplerAddressMode))
CFloat
mipLodBias <- forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
44 :: Ptr CFloat))
Bool32
anisotropyEnable <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Bool32))
CFloat
maxAnisotropy <- forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
52 :: Ptr CFloat))
Bool32
compareEnable <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
56 :: Ptr Bool32))
CompareOp
compareOp <- forall a. Storable a => Ptr a -> IO a
peek @CompareOp ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
60 :: Ptr CompareOp))
CFloat
minLod <- forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
64 :: Ptr CFloat))
CFloat
maxLod <- forall a. Storable a => Ptr a -> IO a
peek @CFloat ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
68 :: Ptr CFloat))
BorderColor
borderColor <- forall a. Storable a => Ptr a -> IO a
peek @BorderColor ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
72 :: Ptr BorderColor))
Bool32
unnormalizedCoordinates <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr (SamplerCreateInfo es)
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
76 :: Ptr Bool32))
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall (es :: [*]).
Chain es
-> SamplerCreateFlags
-> Filter
-> Filter
-> SamplerMipmapMode
-> SamplerAddressMode
-> SamplerAddressMode
-> SamplerAddressMode
-> Float
-> Bool
-> Float
-> Bool
-> CompareOp
-> Float
-> Float
-> BorderColor
-> Bool
-> SamplerCreateInfo es
SamplerCreateInfo
Chain es
next
SamplerCreateFlags
flags
Filter
magFilter
Filter
minFilter
SamplerMipmapMode
mipmapMode
SamplerAddressMode
addressModeU
SamplerAddressMode
addressModeV
SamplerAddressMode
addressModeW
(coerce :: forall a b. Coercible a b => a -> b
coerce @CFloat @Float CFloat
mipLodBias)
(Bool32 -> Bool
bool32ToBool Bool32
anisotropyEnable)
(coerce :: forall a b. Coercible a b => a -> b
coerce @CFloat @Float CFloat
maxAnisotropy)
(Bool32 -> Bool
bool32ToBool Bool32
compareEnable)
CompareOp
compareOp
(coerce :: forall a b. Coercible a b => a -> b
coerce @CFloat @Float CFloat
minLod)
(coerce :: forall a b. Coercible a b => a -> b
coerce @CFloat @Float CFloat
maxLod)
BorderColor
borderColor
(Bool32 -> Bool
bool32ToBool Bool32
unnormalizedCoordinates)
instance es ~ '[] => Zero (SamplerCreateInfo es) where
zero :: SamplerCreateInfo es
zero = forall (es :: [*]).
Chain es
-> SamplerCreateFlags
-> Filter
-> Filter
-> SamplerMipmapMode
-> SamplerAddressMode
-> SamplerAddressMode
-> SamplerAddressMode
-> Float
-> Bool
-> Float
-> Bool
-> CompareOp
-> Float
-> Float
-> BorderColor
-> Bool
-> SamplerCreateInfo es
SamplerCreateInfo
()
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero
forall a. Zero a => a
zero