{-# language CPP #-}
module Vulkan.Extensions.VK_ANDROID_external_memory_android_hardware_buffer ( getAndroidHardwareBufferPropertiesANDROID
, getMemoryAndroidHardwareBufferANDROID
, ImportAndroidHardwareBufferInfoANDROID(..)
, AndroidHardwareBufferUsageANDROID(..)
, AndroidHardwareBufferPropertiesANDROID(..)
, MemoryGetAndroidHardwareBufferInfoANDROID(..)
, AndroidHardwareBufferFormatPropertiesANDROID(..)
, ExternalFormatANDROID(..)
, ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION
, pattern ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION
, ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME
, pattern ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME
, AHardwareBuffer
) where
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Data.Typeable (eqT)
import Foreign.Marshal.Alloc (allocaBytesAligned)
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 Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
import Data.Type.Equality ((:~:)(Refl))
import Data.Typeable (Typeable)
import Foreign.Storable (Storable)
import Foreign.Storable (Storable(peek))
import Foreign.Storable (Storable(poke))
import qualified Foreign.Storable (Storable(..))
import GHC.Generics (Generic)
import GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Word (Word64)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.CStruct.Extends (forgetExtensions)
import Vulkan.Extensions.WSITypes (AHardwareBuffer)
import Vulkan.CStruct.Extends (Chain)
import Vulkan.Core11.Enums.ChromaLocation (ChromaLocation)
import Vulkan.Core10.ImageView (ComponentMapping)
import Vulkan.Core10.Handles (Device)
import Vulkan.Core10.Handles (Device(..))
import Vulkan.Dynamic (DeviceCmds(pVkGetAndroidHardwareBufferPropertiesANDROID))
import Vulkan.Dynamic (DeviceCmds(pVkGetMemoryAndroidHardwareBufferANDROID))
import Vulkan.Core10.Handles (DeviceMemory)
import Vulkan.Core10.BaseType (DeviceSize)
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.Format (Format)
import Vulkan.Core10.Enums.FormatFeatureFlagBits (FormatFeatureFlags)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
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.Core11.Enums.SamplerYcbcrModelConversion (SamplerYcbcrModelConversion)
import Vulkan.Core11.Enums.SamplerYcbcrRange (SamplerYcbcrRange)
import Vulkan.CStruct.Extends (SomeStruct)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Exception (VulkanException(..))
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Extensions.WSITypes (AHardwareBuffer)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetAndroidHardwareBufferPropertiesANDROID
:: FunPtr (Ptr Device_T -> Ptr AHardwareBuffer -> Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID) -> IO Result) -> Ptr Device_T -> Ptr AHardwareBuffer -> Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID) -> IO Result
getAndroidHardwareBufferPropertiesANDROID :: forall a io
. (Extendss AndroidHardwareBufferPropertiesANDROID a, PokeChain a, PeekChain a, MonadIO io)
=>
Device
->
(Ptr AHardwareBuffer)
-> io (AndroidHardwareBufferPropertiesANDROID a)
getAndroidHardwareBufferPropertiesANDROID :: Device
-> Ptr AHardwareBuffer
-> io (AndroidHardwareBufferPropertiesANDROID a)
getAndroidHardwareBufferPropertiesANDROID device :: Device
device buffer :: Ptr AHardwareBuffer
buffer = IO (AndroidHardwareBufferPropertiesANDROID a)
-> io (AndroidHardwareBufferPropertiesANDROID a)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (AndroidHardwareBufferPropertiesANDROID a)
-> io (AndroidHardwareBufferPropertiesANDROID a))
-> (ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(AndroidHardwareBufferPropertiesANDROID a)
-> IO (AndroidHardwareBufferPropertiesANDROID a))
-> ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(AndroidHardwareBufferPropertiesANDROID a)
-> io (AndroidHardwareBufferPropertiesANDROID a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(AndroidHardwareBufferPropertiesANDROID a)
-> IO (AndroidHardwareBufferPropertiesANDROID a)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(AndroidHardwareBufferPropertiesANDROID a)
-> io (AndroidHardwareBufferPropertiesANDROID a))
-> ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(AndroidHardwareBufferPropertiesANDROID a)
-> io (AndroidHardwareBufferPropertiesANDROID a)
forall a b. (a -> b) -> a -> b
$ do
let vkGetAndroidHardwareBufferPropertiesANDROIDPtr :: FunPtr
(Ptr Device_T
-> Ptr AHardwareBuffer
-> ("pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID))
-> IO Result)
vkGetAndroidHardwareBufferPropertiesANDROIDPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> Ptr AHardwareBuffer
-> ("pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID))
-> IO Result)
pVkGetAndroidHardwareBufferPropertiesANDROID (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
IO () -> ContT (AndroidHardwareBufferPropertiesANDROID a) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (AndroidHardwareBufferPropertiesANDROID a) IO ())
-> IO () -> ContT (AndroidHardwareBufferPropertiesANDROID a) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> Ptr AHardwareBuffer
-> ("pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID))
-> IO Result)
vkGetAndroidHardwareBufferPropertiesANDROIDPtr FunPtr
(Ptr Device_T
-> Ptr AHardwareBuffer
-> ("pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID))
-> IO Result)
-> FunPtr
(Ptr Device_T
-> Ptr AHardwareBuffer
-> ("pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID))
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> Ptr AHardwareBuffer
-> ("pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID))
-> IO Result)
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 vkGetAndroidHardwareBufferPropertiesANDROID is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetAndroidHardwareBufferPropertiesANDROID' :: Ptr Device_T
-> Ptr AHardwareBuffer
-> ("pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID))
-> IO Result
vkGetAndroidHardwareBufferPropertiesANDROID' = FunPtr
(Ptr Device_T
-> Ptr AHardwareBuffer
-> ("pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID))
-> IO Result)
-> Ptr Device_T
-> Ptr AHardwareBuffer
-> ("pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID))
-> IO Result
mkVkGetAndroidHardwareBufferPropertiesANDROID FunPtr
(Ptr Device_T
-> Ptr AHardwareBuffer
-> ("pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID))
-> IO Result)
vkGetAndroidHardwareBufferPropertiesANDROIDPtr
Ptr (AndroidHardwareBufferPropertiesANDROID a)
pPProperties <- ((Ptr (AndroidHardwareBufferPropertiesANDROID a)
-> IO (AndroidHardwareBufferPropertiesANDROID a))
-> IO (AndroidHardwareBufferPropertiesANDROID a))
-> ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(Ptr (AndroidHardwareBufferPropertiesANDROID a))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (forall b.
ToCStruct (AndroidHardwareBufferPropertiesANDROID a) =>
(Ptr (AndroidHardwareBufferPropertiesANDROID a) -> IO b) -> IO b
forall a b. ToCStruct a => (Ptr a -> IO b) -> IO b
withZeroCStruct @(AndroidHardwareBufferPropertiesANDROID _))
Result
r <- IO Result
-> ContT (AndroidHardwareBufferPropertiesANDROID a) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
-> ContT (AndroidHardwareBufferPropertiesANDROID a) IO Result)
-> IO Result
-> ContT (AndroidHardwareBufferPropertiesANDROID a) IO Result
forall a b. (a -> b) -> a -> b
$ Ptr Device_T
-> Ptr AHardwareBuffer
-> ("pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID))
-> IO Result
vkGetAndroidHardwareBufferPropertiesANDROID' (Device -> Ptr Device_T
deviceHandle (Device
device)) (Ptr AHardwareBuffer
buffer) (Ptr (AndroidHardwareBufferPropertiesANDROID a)
-> "pProperties"
::: Ptr (SomeStruct AndroidHardwareBufferPropertiesANDROID)
forall (a :: [*] -> *) (es :: [*]).
Ptr (a es) -> Ptr (SomeStruct a)
forgetExtensions (Ptr (AndroidHardwareBufferPropertiesANDROID a)
pPProperties))
IO () -> ContT (AndroidHardwareBufferPropertiesANDROID a) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (AndroidHardwareBufferPropertiesANDROID a) IO ())
-> IO () -> ContT (AndroidHardwareBufferPropertiesANDROID a) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
AndroidHardwareBufferPropertiesANDROID a
pProperties <- IO (AndroidHardwareBufferPropertiesANDROID a)
-> ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(AndroidHardwareBufferPropertiesANDROID a)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO (AndroidHardwareBufferPropertiesANDROID a)
-> ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(AndroidHardwareBufferPropertiesANDROID a))
-> IO (AndroidHardwareBufferPropertiesANDROID a)
-> ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(AndroidHardwareBufferPropertiesANDROID a)
forall a b. (a -> b) -> a -> b
$ Ptr (AndroidHardwareBufferPropertiesANDROID a)
-> IO (AndroidHardwareBufferPropertiesANDROID a)
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @(AndroidHardwareBufferPropertiesANDROID _) Ptr (AndroidHardwareBufferPropertiesANDROID a)
pPProperties
AndroidHardwareBufferPropertiesANDROID a
-> ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(AndroidHardwareBufferPropertiesANDROID a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AndroidHardwareBufferPropertiesANDROID a
-> ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(AndroidHardwareBufferPropertiesANDROID a))
-> AndroidHardwareBufferPropertiesANDROID a
-> ContT
(AndroidHardwareBufferPropertiesANDROID a)
IO
(AndroidHardwareBufferPropertiesANDROID a)
forall a b. (a -> b) -> a -> b
$ (AndroidHardwareBufferPropertiesANDROID a
pProperties)
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
unsafe
#endif
"dynamic" mkVkGetMemoryAndroidHardwareBufferANDROID
:: FunPtr (Ptr Device_T -> Ptr MemoryGetAndroidHardwareBufferInfoANDROID -> Ptr (Ptr AHardwareBuffer) -> IO Result) -> Ptr Device_T -> Ptr MemoryGetAndroidHardwareBufferInfoANDROID -> Ptr (Ptr AHardwareBuffer) -> IO Result
getMemoryAndroidHardwareBufferANDROID :: forall io
. (MonadIO io)
=>
Device
->
MemoryGetAndroidHardwareBufferInfoANDROID
-> io (Ptr AHardwareBuffer)
getMemoryAndroidHardwareBufferANDROID :: Device
-> MemoryGetAndroidHardwareBufferInfoANDROID
-> io (Ptr AHardwareBuffer)
getMemoryAndroidHardwareBufferANDROID device :: Device
device info :: MemoryGetAndroidHardwareBufferInfoANDROID
info = IO (Ptr AHardwareBuffer) -> io (Ptr AHardwareBuffer)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr AHardwareBuffer) -> io (Ptr AHardwareBuffer))
-> (ContT (Ptr AHardwareBuffer) IO (Ptr AHardwareBuffer)
-> IO (Ptr AHardwareBuffer))
-> ContT (Ptr AHardwareBuffer) IO (Ptr AHardwareBuffer)
-> io (Ptr AHardwareBuffer)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT (Ptr AHardwareBuffer) IO (Ptr AHardwareBuffer)
-> IO (Ptr AHardwareBuffer)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT (Ptr AHardwareBuffer) IO (Ptr AHardwareBuffer)
-> io (Ptr AHardwareBuffer))
-> ContT (Ptr AHardwareBuffer) IO (Ptr AHardwareBuffer)
-> io (Ptr AHardwareBuffer)
forall a b. (a -> b) -> a -> b
$ do
let vkGetMemoryAndroidHardwareBufferANDROIDPtr :: FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO Result)
vkGetMemoryAndroidHardwareBufferANDROIDPtr = DeviceCmds
-> FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO Result)
pVkGetMemoryAndroidHardwareBufferANDROID (Device -> DeviceCmds
deviceCmds (Device
device :: Device))
IO () -> ContT (Ptr AHardwareBuffer) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (Ptr AHardwareBuffer) IO ())
-> IO () -> ContT (Ptr AHardwareBuffer) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO Result)
vkGetMemoryAndroidHardwareBufferANDROIDPtr FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO Result)
-> FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO Result)
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 vkGetMemoryAndroidHardwareBufferANDROID is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
let vkGetMemoryAndroidHardwareBufferANDROID' :: Ptr Device_T
-> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO Result
vkGetMemoryAndroidHardwareBufferANDROID' = FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO Result)
-> Ptr Device_T
-> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO Result
mkVkGetMemoryAndroidHardwareBufferANDROID FunPtr
(Ptr Device_T
-> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO Result)
vkGetMemoryAndroidHardwareBufferANDROIDPtr
"pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
pInfo <- ((("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer))
-> ContT
(Ptr AHardwareBuffer)
IO
("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer))
-> ContT
(Ptr AHardwareBuffer)
IO
("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID))
-> ((("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer))
-> ContT
(Ptr AHardwareBuffer)
IO
("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
forall a b. (a -> b) -> a -> b
$ MemoryGetAndroidHardwareBufferInfoANDROID
-> (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer)
forall a b. ToCStruct a => a -> (Ptr a -> IO b) -> IO b
withCStruct (MemoryGetAndroidHardwareBufferInfoANDROID
info)
"pBuffer" ::: Ptr (Ptr AHardwareBuffer)
pPBuffer <- ((("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer))
-> ContT
(Ptr AHardwareBuffer) IO ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer))
-> ContT
(Ptr AHardwareBuffer) IO ("pBuffer" ::: Ptr (Ptr AHardwareBuffer)))
-> ((("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer))
-> ContT
(Ptr AHardwareBuffer) IO ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
forall a b. (a -> b) -> a -> b
$ IO ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> (("pBuffer" ::: Ptr (Ptr AHardwareBuffer)) -> IO ())
-> (("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
forall a. Int -> IO (Ptr a)
callocBytes @(Ptr AHardwareBuffer) 8) ("pBuffer" ::: Ptr (Ptr AHardwareBuffer)) -> IO ()
forall a. Ptr a -> IO ()
free
Result
r <- IO Result -> ContT (Ptr AHardwareBuffer) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result -> ContT (Ptr AHardwareBuffer) IO Result)
-> IO Result -> ContT (Ptr AHardwareBuffer) IO Result
forall a b. (a -> b) -> a -> b
$ Ptr Device_T
-> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO Result
vkGetMemoryAndroidHardwareBufferANDROID' (Device -> Ptr Device_T
deviceHandle (Device
device)) "pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
pInfo ("pBuffer" ::: Ptr (Ptr AHardwareBuffer)
pPBuffer)
IO () -> ContT (Ptr AHardwareBuffer) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO () -> ContT (Ptr AHardwareBuffer) IO ())
-> IO () -> ContT (Ptr AHardwareBuffer) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (VulkanException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> VulkanException
VulkanException Result
r))
Ptr AHardwareBuffer
pBuffer <- IO (Ptr AHardwareBuffer)
-> ContT (Ptr AHardwareBuffer) IO (Ptr AHardwareBuffer)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO (Ptr AHardwareBuffer)
-> ContT (Ptr AHardwareBuffer) IO (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer)
-> ContT (Ptr AHardwareBuffer) IO (Ptr AHardwareBuffer)
forall a b. (a -> b) -> a -> b
$ ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr AHardwareBuffer) "pBuffer" ::: Ptr (Ptr AHardwareBuffer)
pPBuffer
Ptr AHardwareBuffer
-> ContT (Ptr AHardwareBuffer) IO (Ptr AHardwareBuffer)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Ptr AHardwareBuffer
-> ContT (Ptr AHardwareBuffer) IO (Ptr AHardwareBuffer))
-> Ptr AHardwareBuffer
-> ContT (Ptr AHardwareBuffer) IO (Ptr AHardwareBuffer)
forall a b. (a -> b) -> a -> b
$ (Ptr AHardwareBuffer
pBuffer)
data ImportAndroidHardwareBufferInfoANDROID = ImportAndroidHardwareBufferInfoANDROID
{
ImportAndroidHardwareBufferInfoANDROID -> Ptr AHardwareBuffer
buffer :: Ptr AHardwareBuffer }
deriving (Typeable, ImportAndroidHardwareBufferInfoANDROID
-> ImportAndroidHardwareBufferInfoANDROID -> Bool
(ImportAndroidHardwareBufferInfoANDROID
-> ImportAndroidHardwareBufferInfoANDROID -> Bool)
-> (ImportAndroidHardwareBufferInfoANDROID
-> ImportAndroidHardwareBufferInfoANDROID -> Bool)
-> Eq ImportAndroidHardwareBufferInfoANDROID
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportAndroidHardwareBufferInfoANDROID
-> ImportAndroidHardwareBufferInfoANDROID -> Bool
$c/= :: ImportAndroidHardwareBufferInfoANDROID
-> ImportAndroidHardwareBufferInfoANDROID -> Bool
== :: ImportAndroidHardwareBufferInfoANDROID
-> ImportAndroidHardwareBufferInfoANDROID -> Bool
$c== :: ImportAndroidHardwareBufferInfoANDROID
-> ImportAndroidHardwareBufferInfoANDROID -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ImportAndroidHardwareBufferInfoANDROID)
#endif
deriving instance Show ImportAndroidHardwareBufferInfoANDROID
instance ToCStruct ImportAndroidHardwareBufferInfoANDROID where
withCStruct :: ImportAndroidHardwareBufferInfoANDROID
-> (Ptr ImportAndroidHardwareBufferInfoANDROID -> IO b) -> IO b
withCStruct x :: ImportAndroidHardwareBufferInfoANDROID
x f :: Ptr ImportAndroidHardwareBufferInfoANDROID -> IO b
f = Int
-> Int
-> (Ptr ImportAndroidHardwareBufferInfoANDROID -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr ImportAndroidHardwareBufferInfoANDROID -> IO b) -> IO b)
-> (Ptr ImportAndroidHardwareBufferInfoANDROID -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ImportAndroidHardwareBufferInfoANDROID
p -> Ptr ImportAndroidHardwareBufferInfoANDROID
-> ImportAndroidHardwareBufferInfoANDROID -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ImportAndroidHardwareBufferInfoANDROID
p ImportAndroidHardwareBufferInfoANDROID
x (Ptr ImportAndroidHardwareBufferInfoANDROID -> IO b
f Ptr ImportAndroidHardwareBufferInfoANDROID
p)
pokeCStruct :: Ptr ImportAndroidHardwareBufferInfoANDROID
-> ImportAndroidHardwareBufferInfoANDROID -> IO b -> IO b
pokeCStruct p :: Ptr ImportAndroidHardwareBufferInfoANDROID
p ImportAndroidHardwareBufferInfoANDROID{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportAndroidHardwareBufferInfoANDROID
p Ptr ImportAndroidHardwareBufferInfoANDROID
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportAndroidHardwareBufferInfoANDROID
p Ptr ImportAndroidHardwareBufferInfoANDROID -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> Ptr AHardwareBuffer -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportAndroidHardwareBufferInfoANDROID
p Ptr ImportAndroidHardwareBufferInfoANDROID
-> Int -> "pBuffer" ::: Ptr (Ptr AHardwareBuffer)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr AHardwareBuffer))) (Ptr AHardwareBuffer
buffer)
IO b
f
cStructSize :: Int
cStructSize = 24
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr ImportAndroidHardwareBufferInfoANDROID -> IO b -> IO b
pokeZeroCStruct p :: Ptr ImportAndroidHardwareBufferInfoANDROID
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportAndroidHardwareBufferInfoANDROID
p Ptr ImportAndroidHardwareBufferInfoANDROID
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportAndroidHardwareBufferInfoANDROID
p Ptr ImportAndroidHardwareBufferInfoANDROID -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> Ptr AHardwareBuffer -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ImportAndroidHardwareBufferInfoANDROID
p Ptr ImportAndroidHardwareBufferInfoANDROID
-> Int -> "pBuffer" ::: Ptr (Ptr AHardwareBuffer)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr AHardwareBuffer))) (Ptr AHardwareBuffer
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct ImportAndroidHardwareBufferInfoANDROID where
peekCStruct :: Ptr ImportAndroidHardwareBufferInfoANDROID
-> IO ImportAndroidHardwareBufferInfoANDROID
peekCStruct p :: Ptr ImportAndroidHardwareBufferInfoANDROID
p = do
Ptr AHardwareBuffer
buffer <- ("pBuffer" ::: Ptr (Ptr AHardwareBuffer))
-> IO (Ptr AHardwareBuffer)
forall a. Storable a => Ptr a -> IO a
peek @(Ptr AHardwareBuffer) ((Ptr ImportAndroidHardwareBufferInfoANDROID
p Ptr ImportAndroidHardwareBufferInfoANDROID
-> Int -> "pBuffer" ::: Ptr (Ptr AHardwareBuffer)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr (Ptr AHardwareBuffer)))
ImportAndroidHardwareBufferInfoANDROID
-> IO ImportAndroidHardwareBufferInfoANDROID
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ImportAndroidHardwareBufferInfoANDROID
-> IO ImportAndroidHardwareBufferInfoANDROID)
-> ImportAndroidHardwareBufferInfoANDROID
-> IO ImportAndroidHardwareBufferInfoANDROID
forall a b. (a -> b) -> a -> b
$ Ptr AHardwareBuffer -> ImportAndroidHardwareBufferInfoANDROID
ImportAndroidHardwareBufferInfoANDROID
Ptr AHardwareBuffer
buffer
instance Storable ImportAndroidHardwareBufferInfoANDROID where
sizeOf :: ImportAndroidHardwareBufferInfoANDROID -> Int
sizeOf ~ImportAndroidHardwareBufferInfoANDROID
_ = 24
alignment :: ImportAndroidHardwareBufferInfoANDROID -> Int
alignment ~ImportAndroidHardwareBufferInfoANDROID
_ = 8
peek :: Ptr ImportAndroidHardwareBufferInfoANDROID
-> IO ImportAndroidHardwareBufferInfoANDROID
peek = Ptr ImportAndroidHardwareBufferInfoANDROID
-> IO ImportAndroidHardwareBufferInfoANDROID
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr ImportAndroidHardwareBufferInfoANDROID
-> ImportAndroidHardwareBufferInfoANDROID -> IO ()
poke ptr :: Ptr ImportAndroidHardwareBufferInfoANDROID
ptr poked :: ImportAndroidHardwareBufferInfoANDROID
poked = Ptr ImportAndroidHardwareBufferInfoANDROID
-> ImportAndroidHardwareBufferInfoANDROID -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ImportAndroidHardwareBufferInfoANDROID
ptr ImportAndroidHardwareBufferInfoANDROID
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ImportAndroidHardwareBufferInfoANDROID where
zero :: ImportAndroidHardwareBufferInfoANDROID
zero = Ptr AHardwareBuffer -> ImportAndroidHardwareBufferInfoANDROID
ImportAndroidHardwareBufferInfoANDROID
Ptr AHardwareBuffer
forall a. Zero a => a
zero
data AndroidHardwareBufferUsageANDROID = AndroidHardwareBufferUsageANDROID
{
AndroidHardwareBufferUsageANDROID -> Word64
androidHardwareBufferUsage :: Word64 }
deriving (Typeable, AndroidHardwareBufferUsageANDROID
-> AndroidHardwareBufferUsageANDROID -> Bool
(AndroidHardwareBufferUsageANDROID
-> AndroidHardwareBufferUsageANDROID -> Bool)
-> (AndroidHardwareBufferUsageANDROID
-> AndroidHardwareBufferUsageANDROID -> Bool)
-> Eq AndroidHardwareBufferUsageANDROID
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AndroidHardwareBufferUsageANDROID
-> AndroidHardwareBufferUsageANDROID -> Bool
$c/= :: AndroidHardwareBufferUsageANDROID
-> AndroidHardwareBufferUsageANDROID -> Bool
== :: AndroidHardwareBufferUsageANDROID
-> AndroidHardwareBufferUsageANDROID -> Bool
$c== :: AndroidHardwareBufferUsageANDROID
-> AndroidHardwareBufferUsageANDROID -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (AndroidHardwareBufferUsageANDROID)
#endif
deriving instance Show AndroidHardwareBufferUsageANDROID
instance ToCStruct AndroidHardwareBufferUsageANDROID where
withCStruct :: AndroidHardwareBufferUsageANDROID
-> (Ptr AndroidHardwareBufferUsageANDROID -> IO b) -> IO b
withCStruct x :: AndroidHardwareBufferUsageANDROID
x f :: Ptr AndroidHardwareBufferUsageANDROID -> IO b
f = Int
-> Int -> (Ptr AndroidHardwareBufferUsageANDROID -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr AndroidHardwareBufferUsageANDROID -> IO b) -> IO b)
-> (Ptr AndroidHardwareBufferUsageANDROID -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr AndroidHardwareBufferUsageANDROID
p -> Ptr AndroidHardwareBufferUsageANDROID
-> AndroidHardwareBufferUsageANDROID -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr AndroidHardwareBufferUsageANDROID
p AndroidHardwareBufferUsageANDROID
x (Ptr AndroidHardwareBufferUsageANDROID -> IO b
f Ptr AndroidHardwareBufferUsageANDROID
p)
pokeCStruct :: Ptr AndroidHardwareBufferUsageANDROID
-> AndroidHardwareBufferUsageANDROID -> IO b -> IO b
pokeCStruct p :: Ptr AndroidHardwareBufferUsageANDROID
p AndroidHardwareBufferUsageANDROID{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferUsageANDROID
p Ptr AndroidHardwareBufferUsageANDROID -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferUsageANDROID
p Ptr AndroidHardwareBufferUsageANDROID -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferUsageANDROID
p Ptr AndroidHardwareBufferUsageANDROID -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word64)) (Word64
androidHardwareBufferUsage)
IO b
f
cStructSize :: Int
cStructSize = 24
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr AndroidHardwareBufferUsageANDROID -> IO b -> IO b
pokeZeroCStruct p :: Ptr AndroidHardwareBufferUsageANDROID
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferUsageANDROID
p Ptr AndroidHardwareBufferUsageANDROID -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferUsageANDROID
p Ptr AndroidHardwareBufferUsageANDROID -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferUsageANDROID
p Ptr AndroidHardwareBufferUsageANDROID -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word64)) (Word64
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct AndroidHardwareBufferUsageANDROID where
peekCStruct :: Ptr AndroidHardwareBufferUsageANDROID
-> IO AndroidHardwareBufferUsageANDROID
peekCStruct p :: Ptr AndroidHardwareBufferUsageANDROID
p = do
Word64
androidHardwareBufferUsage <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr AndroidHardwareBufferUsageANDROID
p Ptr AndroidHardwareBufferUsageANDROID -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word64))
AndroidHardwareBufferUsageANDROID
-> IO AndroidHardwareBufferUsageANDROID
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AndroidHardwareBufferUsageANDROID
-> IO AndroidHardwareBufferUsageANDROID)
-> AndroidHardwareBufferUsageANDROID
-> IO AndroidHardwareBufferUsageANDROID
forall a b. (a -> b) -> a -> b
$ Word64 -> AndroidHardwareBufferUsageANDROID
AndroidHardwareBufferUsageANDROID
Word64
androidHardwareBufferUsage
instance Storable AndroidHardwareBufferUsageANDROID where
sizeOf :: AndroidHardwareBufferUsageANDROID -> Int
sizeOf ~AndroidHardwareBufferUsageANDROID
_ = 24
alignment :: AndroidHardwareBufferUsageANDROID -> Int
alignment ~AndroidHardwareBufferUsageANDROID
_ = 8
peek :: Ptr AndroidHardwareBufferUsageANDROID
-> IO AndroidHardwareBufferUsageANDROID
peek = Ptr AndroidHardwareBufferUsageANDROID
-> IO AndroidHardwareBufferUsageANDROID
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr AndroidHardwareBufferUsageANDROID
-> AndroidHardwareBufferUsageANDROID -> IO ()
poke ptr :: Ptr AndroidHardwareBufferUsageANDROID
ptr poked :: AndroidHardwareBufferUsageANDROID
poked = Ptr AndroidHardwareBufferUsageANDROID
-> AndroidHardwareBufferUsageANDROID -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr AndroidHardwareBufferUsageANDROID
ptr AndroidHardwareBufferUsageANDROID
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero AndroidHardwareBufferUsageANDROID where
zero :: AndroidHardwareBufferUsageANDROID
zero = Word64 -> AndroidHardwareBufferUsageANDROID
AndroidHardwareBufferUsageANDROID
Word64
forall a. Zero a => a
zero
data AndroidHardwareBufferPropertiesANDROID (es :: [Type]) = AndroidHardwareBufferPropertiesANDROID
{
AndroidHardwareBufferPropertiesANDROID es -> Chain es
next :: Chain es
,
AndroidHardwareBufferPropertiesANDROID es -> Word64
allocationSize :: DeviceSize
,
AndroidHardwareBufferPropertiesANDROID es -> Word32
memoryTypeBits :: Word32
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (AndroidHardwareBufferPropertiesANDROID (es :: [Type]))
#endif
deriving instance Show (Chain es) => Show (AndroidHardwareBufferPropertiesANDROID es)
instance Extensible AndroidHardwareBufferPropertiesANDROID where
extensibleType :: StructureType
extensibleType = StructureType
STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID
setNext :: AndroidHardwareBufferPropertiesANDROID ds
-> Chain es -> AndroidHardwareBufferPropertiesANDROID es
setNext x :: AndroidHardwareBufferPropertiesANDROID ds
x next :: Chain es
next = AndroidHardwareBufferPropertiesANDROID ds
x{$sel:next:AndroidHardwareBufferPropertiesANDROID :: Chain es
next = Chain es
next}
getNext :: AndroidHardwareBufferPropertiesANDROID es -> Chain es
getNext AndroidHardwareBufferPropertiesANDROID{..} = Chain es
next
extends :: forall e b proxy. Typeable e => proxy e -> (Extends AndroidHardwareBufferPropertiesANDROID e => b) -> Maybe b
extends :: proxy e
-> (Extends AndroidHardwareBufferPropertiesANDROID e => b)
-> Maybe b
extends _ f :: Extends AndroidHardwareBufferPropertiesANDROID e => b
f
| Just Refl <- (Typeable e,
Typeable AndroidHardwareBufferFormatPropertiesANDROID) =>
Maybe (e :~: AndroidHardwareBufferFormatPropertiesANDROID)
forall k (a :: k) (b :: k).
(Typeable a, Typeable b) =>
Maybe (a :~: b)
eqT @e @AndroidHardwareBufferFormatPropertiesANDROID = b -> Maybe b
forall a. a -> Maybe a
Just b
Extends AndroidHardwareBufferPropertiesANDROID e => b
f
| Bool
otherwise = Maybe b
forall a. Maybe a
Nothing
instance (Extendss AndroidHardwareBufferPropertiesANDROID es, PokeChain es) => ToCStruct (AndroidHardwareBufferPropertiesANDROID es) where
withCStruct :: AndroidHardwareBufferPropertiesANDROID es
-> (Ptr (AndroidHardwareBufferPropertiesANDROID es) -> IO b)
-> IO b
withCStruct x :: AndroidHardwareBufferPropertiesANDROID es
x f :: Ptr (AndroidHardwareBufferPropertiesANDROID es) -> IO b
f = Int
-> Int
-> (Ptr (AndroidHardwareBufferPropertiesANDROID es) -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 32 8 ((Ptr (AndroidHardwareBufferPropertiesANDROID es) -> IO b) -> IO b)
-> (Ptr (AndroidHardwareBufferPropertiesANDROID es) -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr (AndroidHardwareBufferPropertiesANDROID es)
p -> Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> AndroidHardwareBufferPropertiesANDROID es -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr (AndroidHardwareBufferPropertiesANDROID es)
p AndroidHardwareBufferPropertiesANDROID es
x (Ptr (AndroidHardwareBufferPropertiesANDROID es) -> IO b
f Ptr (AndroidHardwareBufferPropertiesANDROID es)
p)
pokeCStruct :: Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> AndroidHardwareBufferPropertiesANDROID es -> IO b -> IO b
pokeCStruct p :: Ptr (AndroidHardwareBufferPropertiesANDROID es)
p AndroidHardwareBufferPropertiesANDROID{..} 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 (AndroidHardwareBufferPropertiesANDROID es)
p Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID)
Ptr ()
pNext'' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ Chain es -> (Ptr (Chain es) -> IO b) -> IO b
forall (es :: [*]) a.
PokeChain es =>
Chain es -> (Ptr (Chain es) -> IO a) -> IO a
withChain (Chain es
next)
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 (AndroidHardwareBufferPropertiesANDROID es)
p Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
pNext''
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 Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (AndroidHardwareBufferPropertiesANDROID es)
p Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceSize)) (Word64
allocationSize)
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 (AndroidHardwareBufferPropertiesANDROID es)
p Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word32)) (Word32
memoryTypeBits)
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 = 32
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr (AndroidHardwareBufferPropertiesANDROID es) -> IO b -> IO b
pokeZeroCStruct p :: Ptr (AndroidHardwareBufferPropertiesANDROID es)
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 (AndroidHardwareBufferPropertiesANDROID es)
p Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID)
Ptr ()
pNext' <- (Ptr (Chain es) -> Ptr ())
-> ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Ptr (Chain es) -> Ptr ()
forall a b. Ptr a -> Ptr b
castPtr (ContT b IO (Ptr (Chain es)) -> ContT b IO (Ptr ()))
-> (((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr (Chain es)))
-> ((Ptr (Chain es) -> IO b) -> IO b)
-> ContT b IO (Ptr ())
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr (Chain es))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ()))
-> ((Ptr (Chain es) -> IO b) -> IO b) -> ContT b IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ forall a. PokeChain es => (Ptr (Chain es) -> IO a) -> IO a
forall (es :: [*]) a.
PokeChain es =>
(Ptr (Chain es) -> IO a) -> IO a
withZeroChain @es
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 (AndroidHardwareBufferPropertiesANDROID es)
p Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) Ptr ()
pNext'
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 Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (AndroidHardwareBufferPropertiesANDROID es)
p Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceSize)) (Word64
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 Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr (AndroidHardwareBufferPropertiesANDROID es)
p Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word32)) (Word32
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 (Extendss AndroidHardwareBufferPropertiesANDROID es, PeekChain es) => FromCStruct (AndroidHardwareBufferPropertiesANDROID es) where
peekCStruct :: Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> IO (AndroidHardwareBufferPropertiesANDROID es)
peekCStruct p :: Ptr (AndroidHardwareBufferPropertiesANDROID es)
p = do
Ptr ()
pNext <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek @(Ptr ()) ((Ptr (AndroidHardwareBufferPropertiesANDROID es)
p Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ())))
Chain es
next <- Ptr (Chain es) -> IO (Chain es)
forall (es :: [*]). PeekChain es => Ptr (Chain es) -> IO (Chain es)
peekChain (Ptr () -> Ptr (Chain es)
forall a b. Ptr a -> Ptr b
castPtr Ptr ()
pNext)
Word64
allocationSize <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek @DeviceSize ((Ptr (AndroidHardwareBufferPropertiesANDROID es)
p Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceSize))
Word32
memoryTypeBits <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek @Word32 ((Ptr (AndroidHardwareBufferPropertiesANDROID es)
p Ptr (AndroidHardwareBufferPropertiesANDROID es)
-> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word32))
AndroidHardwareBufferPropertiesANDROID es
-> IO (AndroidHardwareBufferPropertiesANDROID es)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AndroidHardwareBufferPropertiesANDROID es
-> IO (AndroidHardwareBufferPropertiesANDROID es))
-> AndroidHardwareBufferPropertiesANDROID es
-> IO (AndroidHardwareBufferPropertiesANDROID es)
forall a b. (a -> b) -> a -> b
$ Chain es
-> Word64 -> Word32 -> AndroidHardwareBufferPropertiesANDROID es
forall (es :: [*]).
Chain es
-> Word64 -> Word32 -> AndroidHardwareBufferPropertiesANDROID es
AndroidHardwareBufferPropertiesANDROID
Chain es
next Word64
allocationSize Word32
memoryTypeBits
instance es ~ '[] => Zero (AndroidHardwareBufferPropertiesANDROID es) where
zero :: AndroidHardwareBufferPropertiesANDROID es
zero = Chain es
-> Word64 -> Word32 -> AndroidHardwareBufferPropertiesANDROID es
forall (es :: [*]).
Chain es
-> Word64 -> Word32 -> AndroidHardwareBufferPropertiesANDROID es
AndroidHardwareBufferPropertiesANDROID
()
Word64
forall a. Zero a => a
zero
Word32
forall a. Zero a => a
zero
data MemoryGetAndroidHardwareBufferInfoANDROID = MemoryGetAndroidHardwareBufferInfoANDROID
{
MemoryGetAndroidHardwareBufferInfoANDROID -> DeviceMemory
memory :: DeviceMemory }
deriving (Typeable, MemoryGetAndroidHardwareBufferInfoANDROID
-> MemoryGetAndroidHardwareBufferInfoANDROID -> Bool
(MemoryGetAndroidHardwareBufferInfoANDROID
-> MemoryGetAndroidHardwareBufferInfoANDROID -> Bool)
-> (MemoryGetAndroidHardwareBufferInfoANDROID
-> MemoryGetAndroidHardwareBufferInfoANDROID -> Bool)
-> Eq MemoryGetAndroidHardwareBufferInfoANDROID
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemoryGetAndroidHardwareBufferInfoANDROID
-> MemoryGetAndroidHardwareBufferInfoANDROID -> Bool
$c/= :: MemoryGetAndroidHardwareBufferInfoANDROID
-> MemoryGetAndroidHardwareBufferInfoANDROID -> Bool
== :: MemoryGetAndroidHardwareBufferInfoANDROID
-> MemoryGetAndroidHardwareBufferInfoANDROID -> Bool
$c== :: MemoryGetAndroidHardwareBufferInfoANDROID
-> MemoryGetAndroidHardwareBufferInfoANDROID -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (MemoryGetAndroidHardwareBufferInfoANDROID)
#endif
deriving instance Show MemoryGetAndroidHardwareBufferInfoANDROID
instance ToCStruct MemoryGetAndroidHardwareBufferInfoANDROID where
withCStruct :: MemoryGetAndroidHardwareBufferInfoANDROID
-> (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO b)
-> IO b
withCStruct x :: MemoryGetAndroidHardwareBufferInfoANDROID
x f :: ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID) -> IO b
f = Int
-> Int
-> (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO b)
-> IO b)
-> (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: "pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p -> ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> MemoryGetAndroidHardwareBufferInfoANDROID -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p MemoryGetAndroidHardwareBufferInfoANDROID
x (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID) -> IO b
f "pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p)
pokeCStruct :: ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> MemoryGetAndroidHardwareBufferInfoANDROID -> IO b -> IO b
pokeCStruct p :: "pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p MemoryGetAndroidHardwareBufferInfoANDROID{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr DeviceMemory -> DeviceMemory -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> Int -> Ptr DeviceMemory
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceMemory)) (DeviceMemory
memory)
IO b
f
cStructSize :: Int
cStructSize = 24
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO b -> IO b
pokeZeroCStruct p :: "pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr DeviceMemory -> DeviceMemory -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> Int -> Ptr DeviceMemory
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceMemory)) (DeviceMemory
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct MemoryGetAndroidHardwareBufferInfoANDROID where
peekCStruct :: ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO MemoryGetAndroidHardwareBufferInfoANDROID
peekCStruct p :: "pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p = do
DeviceMemory
memory <- Ptr DeviceMemory -> IO DeviceMemory
forall a. Storable a => Ptr a -> IO a
peek @DeviceMemory (("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
p ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> Int -> Ptr DeviceMemory
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr DeviceMemory))
MemoryGetAndroidHardwareBufferInfoANDROID
-> IO MemoryGetAndroidHardwareBufferInfoANDROID
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MemoryGetAndroidHardwareBufferInfoANDROID
-> IO MemoryGetAndroidHardwareBufferInfoANDROID)
-> MemoryGetAndroidHardwareBufferInfoANDROID
-> IO MemoryGetAndroidHardwareBufferInfoANDROID
forall a b. (a -> b) -> a -> b
$ DeviceMemory -> MemoryGetAndroidHardwareBufferInfoANDROID
MemoryGetAndroidHardwareBufferInfoANDROID
DeviceMemory
memory
instance Storable MemoryGetAndroidHardwareBufferInfoANDROID where
sizeOf :: MemoryGetAndroidHardwareBufferInfoANDROID -> Int
sizeOf ~MemoryGetAndroidHardwareBufferInfoANDROID
_ = 24
alignment :: MemoryGetAndroidHardwareBufferInfoANDROID -> Int
alignment ~MemoryGetAndroidHardwareBufferInfoANDROID
_ = 8
peek :: ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO MemoryGetAndroidHardwareBufferInfoANDROID
peek = ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> IO MemoryGetAndroidHardwareBufferInfoANDROID
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> MemoryGetAndroidHardwareBufferInfoANDROID -> IO ()
poke ptr :: "pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
ptr poked :: MemoryGetAndroidHardwareBufferInfoANDROID
poked = ("pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID)
-> MemoryGetAndroidHardwareBufferInfoANDROID -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pInfo" ::: Ptr MemoryGetAndroidHardwareBufferInfoANDROID
ptr MemoryGetAndroidHardwareBufferInfoANDROID
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero MemoryGetAndroidHardwareBufferInfoANDROID where
zero :: MemoryGetAndroidHardwareBufferInfoANDROID
zero = DeviceMemory -> MemoryGetAndroidHardwareBufferInfoANDROID
MemoryGetAndroidHardwareBufferInfoANDROID
DeviceMemory
forall a. Zero a => a
zero
data AndroidHardwareBufferFormatPropertiesANDROID = AndroidHardwareBufferFormatPropertiesANDROID
{
AndroidHardwareBufferFormatPropertiesANDROID -> Format
format :: Format
,
AndroidHardwareBufferFormatPropertiesANDROID -> Word64
externalFormat :: Word64
,
AndroidHardwareBufferFormatPropertiesANDROID -> FormatFeatureFlags
formatFeatures :: FormatFeatureFlags
,
AndroidHardwareBufferFormatPropertiesANDROID -> ComponentMapping
samplerYcbcrConversionComponents :: ComponentMapping
,
AndroidHardwareBufferFormatPropertiesANDROID
-> SamplerYcbcrModelConversion
suggestedYcbcrModel :: SamplerYcbcrModelConversion
,
AndroidHardwareBufferFormatPropertiesANDROID -> SamplerYcbcrRange
suggestedYcbcrRange :: SamplerYcbcrRange
,
AndroidHardwareBufferFormatPropertiesANDROID -> ChromaLocation
suggestedXChromaOffset :: ChromaLocation
,
AndroidHardwareBufferFormatPropertiesANDROID -> ChromaLocation
suggestedYChromaOffset :: ChromaLocation
}
deriving (Typeable)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (AndroidHardwareBufferFormatPropertiesANDROID)
#endif
deriving instance Show AndroidHardwareBufferFormatPropertiesANDROID
instance ToCStruct AndroidHardwareBufferFormatPropertiesANDROID where
withCStruct :: AndroidHardwareBufferFormatPropertiesANDROID
-> (Ptr AndroidHardwareBufferFormatPropertiesANDROID -> IO b)
-> IO b
withCStruct x :: AndroidHardwareBufferFormatPropertiesANDROID
x f :: Ptr AndroidHardwareBufferFormatPropertiesANDROID -> IO b
f = Int
-> Int
-> (Ptr AndroidHardwareBufferFormatPropertiesANDROID -> IO b)
-> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 72 8 ((Ptr AndroidHardwareBufferFormatPropertiesANDROID -> IO b)
-> IO b)
-> (Ptr AndroidHardwareBufferFormatPropertiesANDROID -> IO b)
-> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr AndroidHardwareBufferFormatPropertiesANDROID
p -> Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> AndroidHardwareBufferFormatPropertiesANDROID -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr AndroidHardwareBufferFormatPropertiesANDROID
p AndroidHardwareBufferFormatPropertiesANDROID
x (Ptr AndroidHardwareBufferFormatPropertiesANDROID -> IO b
f Ptr AndroidHardwareBufferFormatPropertiesANDROID
p)
pokeCStruct :: Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> AndroidHardwareBufferFormatPropertiesANDROID -> IO b -> IO b
pokeCStruct p :: Ptr AndroidHardwareBufferFormatPropertiesANDROID
p AndroidHardwareBufferFormatPropertiesANDROID{..} 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 AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID)
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 AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> 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 Format -> Format -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr Format
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Format)) (Format
format)
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 Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word64)) (Word64
externalFormat)
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 FormatFeatureFlags -> FormatFeatureFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr FormatFeatureFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr FormatFeatureFlags)) (FormatFeatureFlags
formatFeatures)
((() -> 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 ComponentMapping -> ComponentMapping -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr ComponentMapping
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 36 :: Ptr ComponentMapping)) (ComponentMapping
samplerYcbcrConversionComponents) (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 SamplerYcbcrModelConversion
-> SamplerYcbcrModelConversion -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr SamplerYcbcrModelConversion
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr SamplerYcbcrModelConversion)) (SamplerYcbcrModelConversion
suggestedYcbcrModel)
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 SamplerYcbcrRange -> SamplerYcbcrRange -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr SamplerYcbcrRange
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr SamplerYcbcrRange)) (SamplerYcbcrRange
suggestedYcbcrRange)
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 ChromaLocation -> ChromaLocation -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr ChromaLocation
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr ChromaLocation)) (ChromaLocation
suggestedXChromaOffset)
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 ChromaLocation -> ChromaLocation -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr ChromaLocation
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 64 :: Ptr ChromaLocation)) (ChromaLocation
suggestedYChromaOffset)
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 = 72
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr AndroidHardwareBufferFormatPropertiesANDROID -> IO b -> IO b
pokeZeroCStruct p :: Ptr AndroidHardwareBufferFormatPropertiesANDROID
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 AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID)
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 AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> 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 Format -> Format -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr Format
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Format)) (Format
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 Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word64)) (Word64
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 FormatFeatureFlags -> FormatFeatureFlags -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr FormatFeatureFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr FormatFeatureFlags)) (FormatFeatureFlags
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 ComponentMapping -> ComponentMapping -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr ComponentMapping
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 36 :: Ptr ComponentMapping)) (ComponentMapping
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 () -> 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 SamplerYcbcrModelConversion
-> SamplerYcbcrModelConversion -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr SamplerYcbcrModelConversion
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr SamplerYcbcrModelConversion)) (SamplerYcbcrModelConversion
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 SamplerYcbcrRange -> SamplerYcbcrRange -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr SamplerYcbcrRange
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr SamplerYcbcrRange)) (SamplerYcbcrRange
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 ChromaLocation -> ChromaLocation -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr ChromaLocation
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr ChromaLocation)) (ChromaLocation
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 ChromaLocation -> ChromaLocation -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr ChromaLocation
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 64 :: Ptr ChromaLocation)) (ChromaLocation
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 AndroidHardwareBufferFormatPropertiesANDROID where
peekCStruct :: Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> IO AndroidHardwareBufferFormatPropertiesANDROID
peekCStruct p :: Ptr AndroidHardwareBufferFormatPropertiesANDROID
p = do
Format
format <- Ptr Format -> IO Format
forall a. Storable a => Ptr a -> IO a
peek @Format ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr Format
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Format))
Word64
externalFormat <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 24 :: Ptr Word64))
FormatFeatureFlags
formatFeatures <- Ptr FormatFeatureFlags -> IO FormatFeatureFlags
forall a. Storable a => Ptr a -> IO a
peek @FormatFeatureFlags ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr FormatFeatureFlags
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 32 :: Ptr FormatFeatureFlags))
ComponentMapping
samplerYcbcrConversionComponents <- Ptr ComponentMapping -> IO ComponentMapping
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct @ComponentMapping ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr ComponentMapping
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 36 :: Ptr ComponentMapping))
SamplerYcbcrModelConversion
suggestedYcbcrModel <- Ptr SamplerYcbcrModelConversion -> IO SamplerYcbcrModelConversion
forall a. Storable a => Ptr a -> IO a
peek @SamplerYcbcrModelConversion ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr SamplerYcbcrModelConversion
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 52 :: Ptr SamplerYcbcrModelConversion))
SamplerYcbcrRange
suggestedYcbcrRange <- Ptr SamplerYcbcrRange -> IO SamplerYcbcrRange
forall a. Storable a => Ptr a -> IO a
peek @SamplerYcbcrRange ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr SamplerYcbcrRange
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 56 :: Ptr SamplerYcbcrRange))
ChromaLocation
suggestedXChromaOffset <- Ptr ChromaLocation -> IO ChromaLocation
forall a. Storable a => Ptr a -> IO a
peek @ChromaLocation ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr ChromaLocation
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 60 :: Ptr ChromaLocation))
ChromaLocation
suggestedYChromaOffset <- Ptr ChromaLocation -> IO ChromaLocation
forall a. Storable a => Ptr a -> IO a
peek @ChromaLocation ((Ptr AndroidHardwareBufferFormatPropertiesANDROID
p Ptr AndroidHardwareBufferFormatPropertiesANDROID
-> Int -> Ptr ChromaLocation
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 64 :: Ptr ChromaLocation))
AndroidHardwareBufferFormatPropertiesANDROID
-> IO AndroidHardwareBufferFormatPropertiesANDROID
forall (f :: * -> *) a. Applicative f => a -> f a
pure (AndroidHardwareBufferFormatPropertiesANDROID
-> IO AndroidHardwareBufferFormatPropertiesANDROID)
-> AndroidHardwareBufferFormatPropertiesANDROID
-> IO AndroidHardwareBufferFormatPropertiesANDROID
forall a b. (a -> b) -> a -> b
$ Format
-> Word64
-> FormatFeatureFlags
-> ComponentMapping
-> SamplerYcbcrModelConversion
-> SamplerYcbcrRange
-> ChromaLocation
-> ChromaLocation
-> AndroidHardwareBufferFormatPropertiesANDROID
AndroidHardwareBufferFormatPropertiesANDROID
Format
format Word64
externalFormat FormatFeatureFlags
formatFeatures ComponentMapping
samplerYcbcrConversionComponents SamplerYcbcrModelConversion
suggestedYcbcrModel SamplerYcbcrRange
suggestedYcbcrRange ChromaLocation
suggestedXChromaOffset ChromaLocation
suggestedYChromaOffset
instance Zero AndroidHardwareBufferFormatPropertiesANDROID where
zero :: AndroidHardwareBufferFormatPropertiesANDROID
zero = Format
-> Word64
-> FormatFeatureFlags
-> ComponentMapping
-> SamplerYcbcrModelConversion
-> SamplerYcbcrRange
-> ChromaLocation
-> ChromaLocation
-> AndroidHardwareBufferFormatPropertiesANDROID
AndroidHardwareBufferFormatPropertiesANDROID
Format
forall a. Zero a => a
zero
Word64
forall a. Zero a => a
zero
FormatFeatureFlags
forall a. Zero a => a
zero
ComponentMapping
forall a. Zero a => a
zero
SamplerYcbcrModelConversion
forall a. Zero a => a
zero
SamplerYcbcrRange
forall a. Zero a => a
zero
ChromaLocation
forall a. Zero a => a
zero
ChromaLocation
forall a. Zero a => a
zero
data ExternalFormatANDROID = ExternalFormatANDROID
{
ExternalFormatANDROID -> Word64
externalFormat :: Word64 }
deriving (Typeable, ExternalFormatANDROID -> ExternalFormatANDROID -> Bool
(ExternalFormatANDROID -> ExternalFormatANDROID -> Bool)
-> (ExternalFormatANDROID -> ExternalFormatANDROID -> Bool)
-> Eq ExternalFormatANDROID
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExternalFormatANDROID -> ExternalFormatANDROID -> Bool
$c/= :: ExternalFormatANDROID -> ExternalFormatANDROID -> Bool
== :: ExternalFormatANDROID -> ExternalFormatANDROID -> Bool
$c== :: ExternalFormatANDROID -> ExternalFormatANDROID -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (ExternalFormatANDROID)
#endif
deriving instance Show ExternalFormatANDROID
instance ToCStruct ExternalFormatANDROID where
withCStruct :: ExternalFormatANDROID
-> (Ptr ExternalFormatANDROID -> IO b) -> IO b
withCStruct x :: ExternalFormatANDROID
x f :: Ptr ExternalFormatANDROID -> IO b
f = Int -> Int -> (Ptr ExternalFormatANDROID -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr ExternalFormatANDROID -> IO b) -> IO b)
-> (Ptr ExternalFormatANDROID -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr ExternalFormatANDROID
p -> Ptr ExternalFormatANDROID -> ExternalFormatANDROID -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExternalFormatANDROID
p ExternalFormatANDROID
x (Ptr ExternalFormatANDROID -> IO b
f Ptr ExternalFormatANDROID
p)
pokeCStruct :: Ptr ExternalFormatANDROID -> ExternalFormatANDROID -> IO b -> IO b
pokeCStruct p :: Ptr ExternalFormatANDROID
p ExternalFormatANDROID{..} f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalFormatANDROID
p Ptr ExternalFormatANDROID -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalFormatANDROID
p Ptr ExternalFormatANDROID -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalFormatANDROID
p Ptr ExternalFormatANDROID -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word64)) (Word64
externalFormat)
IO b
f
cStructSize :: Int
cStructSize = 24
cStructAlignment :: Int
cStructAlignment = 8
pokeZeroCStruct :: Ptr ExternalFormatANDROID -> IO b -> IO b
pokeZeroCStruct p :: Ptr ExternalFormatANDROID
p f :: IO b
f = do
Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalFormatANDROID
p Ptr ExternalFormatANDROID -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID)
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalFormatANDROID
p Ptr ExternalFormatANDROID -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
Ptr Word64 -> Word64 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr ExternalFormatANDROID
p Ptr ExternalFormatANDROID -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word64)) (Word64
forall a. Zero a => a
zero)
IO b
f
instance FromCStruct ExternalFormatANDROID where
peekCStruct :: Ptr ExternalFormatANDROID -> IO ExternalFormatANDROID
peekCStruct p :: Ptr ExternalFormatANDROID
p = do
Word64
externalFormat <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek @Word64 ((Ptr ExternalFormatANDROID
p Ptr ExternalFormatANDROID -> Int -> Ptr Word64
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr Word64))
ExternalFormatANDROID -> IO ExternalFormatANDROID
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ExternalFormatANDROID -> IO ExternalFormatANDROID)
-> ExternalFormatANDROID -> IO ExternalFormatANDROID
forall a b. (a -> b) -> a -> b
$ Word64 -> ExternalFormatANDROID
ExternalFormatANDROID
Word64
externalFormat
instance Storable ExternalFormatANDROID where
sizeOf :: ExternalFormatANDROID -> Int
sizeOf ~ExternalFormatANDROID
_ = 24
alignment :: ExternalFormatANDROID -> Int
alignment ~ExternalFormatANDROID
_ = 8
peek :: Ptr ExternalFormatANDROID -> IO ExternalFormatANDROID
peek = Ptr ExternalFormatANDROID -> IO ExternalFormatANDROID
forall a. FromCStruct a => Ptr a -> IO a
peekCStruct
poke :: Ptr ExternalFormatANDROID -> ExternalFormatANDROID -> IO ()
poke ptr :: Ptr ExternalFormatANDROID
ptr poked :: ExternalFormatANDROID
poked = Ptr ExternalFormatANDROID
-> ExternalFormatANDROID -> IO () -> IO ()
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr ExternalFormatANDROID
ptr ExternalFormatANDROID
poked (() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ())
instance Zero ExternalFormatANDROID where
zero :: ExternalFormatANDROID
zero = Word64 -> ExternalFormatANDROID
ExternalFormatANDROID
Word64
forall a. Zero a => a
zero
type ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION = 3
pattern ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION :: forall a . Integral a => a
pattern $bANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION :: a
$mANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION = 3
type ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME = "VK_ANDROID_external_memory_android_hardware_buffer"
pattern ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME :: a
$mANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME = "VK_ANDROID_external_memory_android_hardware_buffer"