{-# language CPP #-}
-- | = Name
--
-- VK_KHR_android_surface - instance extension
--
-- == VK_KHR_android_surface
--
-- [__Name String__]
--     @VK_KHR_android_surface@
--
-- [__Extension Type__]
--     Instance extension
--
-- [__Registered Extension Number__]
--     9
--
-- [__Revision__]
--     6
--
-- [__Ratification Status__]
--     Ratified
--
-- [__Extension and Version Dependencies__]
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_surface VK_KHR_surface>
--
-- [__Contact__]
--
--     -   Jesse Hall
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_KHR_android_surface] @critsec%0A*Here describe the issue or question you have about the VK_KHR_android_surface extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2016-01-14
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Patrick Doane, Blizzard
--
--     -   Faith Ekstrand, Intel
--
--     -   Ian Elliott, LunarG
--
--     -   Courtney Goeltzenleuchter, LunarG
--
--     -   Jesse Hall, Google
--
--     -   James Jones, NVIDIA
--
--     -   Antoine Labour, Google
--
--     -   Jon Leech, Khronos
--
--     -   David Mao, AMD
--
--     -   Norbert Nopper, Freescale
--
--     -   Alon Or-bach, Samsung
--
--     -   Daniel Rakos, AMD
--
--     -   Graham Sellers, AMD
--
--     -   Ray Smith, ARM
--
--     -   Jeff Vigil, Qualcomm
--
--     -   Chia-I Wu, LunarG
--
-- == Description
--
-- The @VK_KHR_android_surface@ extension is an instance extension. It
-- provides a mechanism to create a 'Vulkan.Extensions.Handles.SurfaceKHR'
-- object (defined by the @VK_KHR_surface@ extension) that refers to an
-- 'ANativeWindow', Android’s native surface type. The 'ANativeWindow'
-- represents the producer endpoint of any buffer queue, regardless of
-- consumer endpoint. Common consumer endpoints for @ANativeWindows@ are
-- the system window compositor, video encoders, and application-specific
-- compositors importing the images through a @SurfaceTexture@.
--
-- == New Base Types
--
-- -   'ANativeWindow'
--
-- == New Commands
--
-- -   'createAndroidSurfaceKHR'
--
-- == New Structures
--
-- -   'AndroidSurfaceCreateInfoKHR'
--
-- == New Bitmasks
--
-- -   'AndroidSurfaceCreateFlagsKHR'
--
-- == New Enum Constants
--
-- -   'KHR_ANDROID_SURFACE_EXTENSION_NAME'
--
-- -   'KHR_ANDROID_SURFACE_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR'
--
-- == Issues
--
-- 1) Does Android need a way to query for compatibility between a
-- particular physical device (and queue family?) and a specific Android
-- display?
--
-- __RESOLVED__: No. Currently on Android, any physical device is expected
-- to be able to present to the system compositor, and all queue families
-- must support the necessary image layout transitions and synchronization
-- operations.
--
-- == Version History
--
-- -   Revision 1, 2015-09-23 (Jesse Hall)
--
--     -   Initial draft.
--
-- -   Revision 2, 2015-10-26 (Ian Elliott)
--
--     -   Renamed from VK_EXT_KHR_android_surface to
--         VK_KHR_android_surface.
--
-- -   Revision 3, 2015-11-03 (Daniel Rakos)
--
--     -   Added allocation callbacks to surface creation function.
--
-- -   Revision 4, 2015-11-10 (Jesse Hall)
--
--     -   Removed VK_ERROR_INVALID_ANDROID_WINDOW_KHR.
--
-- -   Revision 5, 2015-11-28 (Daniel Rakos)
--
--     -   Updated the surface create function to take a pCreateInfo
--         structure.
--
-- -   Revision 6, 2016-01-14 (James Jones)
--
--     -   Moved VK_ERROR_NATIVE_WINDOW_IN_USE_KHR from the
--         VK_KHR_android_surface to the VK_KHR_surface extension.
--
-- == See Also
--
-- 'ANativeWindow', 'AndroidSurfaceCreateFlagsKHR',
-- 'AndroidSurfaceCreateInfoKHR', 'createAndroidSurfaceKHR'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_KHR_android_surface Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_KHR_android_surface  ( createAndroidSurfaceKHR
                                                 , AndroidSurfaceCreateInfoKHR(..)
                                                 , AndroidSurfaceCreateFlagsKHR(..)
                                                 , KHR_ANDROID_SURFACE_SPEC_VERSION
                                                 , pattern KHR_ANDROID_SURFACE_SPEC_VERSION
                                                 , KHR_ANDROID_SURFACE_EXTENSION_NAME
                                                 , pattern KHR_ANDROID_SURFACE_EXTENSION_NAME
                                                 , ANativeWindow
                                                 , SurfaceKHR(..)
                                                 ) where

import Data.Bits (Bits)
import Data.Bits (FiniteBits)
import Vulkan.Internal.Utils (enumReadPrec)
import Vulkan.Internal.Utils (enumShowsPrec)
import Vulkan.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
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 (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Show (showString)
import Numeric (showHex)
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 Vulkan.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
import Data.String (IsString)
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 GHC.Read (Read(readPrec))
import GHC.Show (Show(showsPrec))
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Vulkan.NamedType ((:::))
import Vulkan.Core10.AllocationCallbacks (AllocationCallbacks)
import Vulkan.Core10.FundamentalTypes (Flags)
import Vulkan.Core10.Handles (Instance)
import Vulkan.Core10.Handles (Instance(..))
import Vulkan.Core10.Handles (Instance(Instance))
import Vulkan.Dynamic (InstanceCmds(pVkCreateAndroidSurfaceKHR))
import Vulkan.Core10.Handles (Instance_T)
import Vulkan.Core10.Enums.Result (Result)
import Vulkan.Core10.Enums.Result (Result(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Extensions.Handles (SurfaceKHR)
import Vulkan.Extensions.Handles (SurfaceKHR(..))
import Vulkan.Exception (VulkanException(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR))
import Vulkan.Core10.Enums.Result (Result(SUCCESS))
import Vulkan.Extensions.Handles (SurfaceKHR(..))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkVkCreateAndroidSurfaceKHR
  :: FunPtr (Ptr Instance_T -> Ptr AndroidSurfaceCreateInfoKHR -> Ptr AllocationCallbacks -> Ptr SurfaceKHR -> IO Result) -> Ptr Instance_T -> Ptr AndroidSurfaceCreateInfoKHR -> Ptr AllocationCallbacks -> Ptr SurfaceKHR -> IO Result

-- | vkCreateAndroidSurfaceKHR - Create a
-- 'Vulkan.Extensions.Handles.SurfaceKHR' object for an Android native
-- window
--
-- = Description
--
-- During the lifetime of a surface created using a particular
-- 'ANativeWindow' handle any attempts to create another surface for the
-- same 'ANativeWindow' and any attempts to connect to the same
-- 'ANativeWindow' through other platform mechanisms will fail.
--
-- Note
--
-- In particular, only one 'Vulkan.Extensions.Handles.SurfaceKHR' /can/
-- exist at a time for a given window. Similarly, a native window /cannot/
-- be used by both a 'Vulkan.Extensions.Handles.SurfaceKHR' and
-- @EGLSurface@ simultaneously.
--
-- If successful, 'createAndroidSurfaceKHR' increments the
-- 'ANativeWindow'’s reference count, and
-- 'Vulkan.Extensions.VK_KHR_surface.destroySurfaceKHR' will decrement it.
--
-- On Android, when a swapchain’s @imageExtent@ does not match the
-- surface’s @currentExtent@, the presentable images will be scaled to the
-- surface’s dimensions during presentation. @minImageExtent@ is (1,1), and
-- @maxImageExtent@ is the maximum image size supported by the consumer.
-- For the system compositor, @currentExtent@ is the window size (i.e. the
-- consumer’s preferred size).
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-vkCreateAndroidSurfaceKHR-instance-parameter# @instance@
--     /must/ be a valid 'Vulkan.Core10.Handles.Instance' handle
--
-- -   #VUID-vkCreateAndroidSurfaceKHR-pCreateInfo-parameter# @pCreateInfo@
--     /must/ be a valid pointer to a valid 'AndroidSurfaceCreateInfoKHR'
--     structure
--
-- -   #VUID-vkCreateAndroidSurfaceKHR-pAllocator-parameter# If
--     @pAllocator@ is not @NULL@, @pAllocator@ /must/ be a valid pointer
--     to a valid 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks'
--     structure
--
-- -   #VUID-vkCreateAndroidSurfaceKHR-pSurface-parameter# @pSurface@
--     /must/ be a valid pointer to a
--     'Vulkan.Extensions.Handles.SurfaceKHR' handle
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-successcodes Success>]
--
--     -   'Vulkan.Core10.Enums.Result.SUCCESS'
--
-- [<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#fundamentals-errorcodes Failure>]
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_HOST_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_OUT_OF_DEVICE_MEMORY'
--
--     -   'Vulkan.Core10.Enums.Result.ERROR_NATIVE_WINDOW_IN_USE_KHR'
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_android_surface VK_KHR_android_surface>,
-- 'Vulkan.Core10.AllocationCallbacks.AllocationCallbacks',
-- 'AndroidSurfaceCreateInfoKHR', 'Vulkan.Core10.Handles.Instance',
-- 'Vulkan.Extensions.Handles.SurfaceKHR'
createAndroidSurfaceKHR :: forall io
                         . (MonadIO io)
                        => -- | @instance@ is the instance to associate the surface with.
                           Instance
                        -> -- | @pCreateInfo@ is a pointer to a 'AndroidSurfaceCreateInfoKHR' structure
                           -- containing parameters affecting the creation of the surface object.
                           AndroidSurfaceCreateInfoKHR
                        -> -- | @pAllocator@ is the allocator used for host memory allocated for the
                           -- surface object when there is no more specific allocator available (see
                           -- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#memory-allocation Memory Allocation>).
                           ("allocator" ::: Maybe AllocationCallbacks)
                        -> io (SurfaceKHR)
createAndroidSurfaceKHR :: forall (io :: * -> *).
MonadIO io =>
Instance
-> AndroidSurfaceCreateInfoKHR
-> ("allocator" ::: Maybe AllocationCallbacks)
-> io SurfaceKHR
createAndroidSurfaceKHR Instance
instance' AndroidSurfaceCreateInfoKHR
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 vkCreateAndroidSurfaceKHRPtr :: FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateAndroidSurfaceKHRPtr = InstanceCmds
-> FunPtr
     (Ptr Instance_T
      -> ("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR)
      -> ("pAllocator" ::: Ptr AllocationCallbacks)
      -> ("pSurface" ::: Ptr SurfaceKHR)
      -> IO Result)
pVkCreateAndroidSurfaceKHR (case Instance
instance' of Instance{InstanceCmds
$sel:instanceCmds:Instance :: Instance -> InstanceCmds
instanceCmds :: InstanceCmds
instanceCmds} -> InstanceCmds
instanceCmds)
  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 Instance_T
   -> ("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateAndroidSurfaceKHRPtr 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 vkCreateAndroidSurfaceKHR is null" forall a. Maybe a
Nothing forall a. Maybe a
Nothing
  let vkCreateAndroidSurfaceKHR' :: Ptr Instance_T
-> ("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
vkCreateAndroidSurfaceKHR' = FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
-> Ptr Instance_T
-> ("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
mkVkCreateAndroidSurfaceKHR FunPtr
  (Ptr Instance_T
   -> ("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR)
   -> ("pAllocator" ::: Ptr AllocationCallbacks)
   -> ("pSurface" ::: Ptr SurfaceKHR)
   -> IO Result)
vkCreateAndroidSurfaceKHRPtr
  "pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
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 (AndroidSurfaceCreateInfoKHR
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)
  "pSurface" ::: Ptr SurfaceKHR
pPSurface <- 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 @SurfaceKHR 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
"vkCreateAndroidSurfaceKHR" (Ptr Instance_T
-> ("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR)
-> ("pAllocator" ::: Ptr AllocationCallbacks)
-> ("pSurface" ::: Ptr SurfaceKHR)
-> IO Result
vkCreateAndroidSurfaceKHR'
                                                              (Instance -> Ptr Instance_T
instanceHandle (Instance
instance'))
                                                              "pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
pCreateInfo
                                                              "pAllocator" ::: Ptr AllocationCallbacks
pAllocator
                                                              ("pSurface" ::: Ptr SurfaceKHR
pPSurface))
  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))
  SurfaceKHR
pSurface <- 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 @SurfaceKHR "pSurface" ::: Ptr SurfaceKHR
pPSurface
  forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ (SurfaceKHR
pSurface)


-- | VkAndroidSurfaceCreateInfoKHR - Structure specifying parameters of a
-- newly created Android surface object
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_android_surface VK_KHR_android_surface>,
-- 'AndroidSurfaceCreateFlagsKHR',
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'createAndroidSurfaceKHR'
data AndroidSurfaceCreateInfoKHR = AndroidSurfaceCreateInfoKHR
  { -- | @flags@ is reserved for future use.
    --
    -- #VUID-VkAndroidSurfaceCreateInfoKHR-flags-zerobitmask# @flags@ /must/ be
    -- @0@
    AndroidSurfaceCreateInfoKHR -> AndroidSurfaceCreateFlagsKHR
flags :: AndroidSurfaceCreateFlagsKHR
  , -- | @window@ is a pointer to the 'ANativeWindow' to associate the surface
    -- with.
    --
    -- #VUID-VkAndroidSurfaceCreateInfoKHR-window-01248# @window@ /must/ point
    -- to a valid Android 'ANativeWindow'
    AndroidSurfaceCreateInfoKHR -> Ptr ANativeWindow
window :: Ptr ANativeWindow
  }
  deriving (Typeable, AndroidSurfaceCreateInfoKHR -> AndroidSurfaceCreateInfoKHR -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AndroidSurfaceCreateInfoKHR -> AndroidSurfaceCreateInfoKHR -> Bool
$c/= :: AndroidSurfaceCreateInfoKHR -> AndroidSurfaceCreateInfoKHR -> Bool
== :: AndroidSurfaceCreateInfoKHR -> AndroidSurfaceCreateInfoKHR -> Bool
$c== :: AndroidSurfaceCreateInfoKHR -> AndroidSurfaceCreateInfoKHR -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (AndroidSurfaceCreateInfoKHR)
#endif
deriving instance Show AndroidSurfaceCreateInfoKHR

instance ToCStruct AndroidSurfaceCreateInfoKHR where
  withCStruct :: forall b.
AndroidSurfaceCreateInfoKHR
-> (("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR) -> IO b)
-> IO b
withCStruct AndroidSurfaceCreateInfoKHR
x ("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR) -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
32 forall a b. (a -> b) -> a -> b
$ \"pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct "pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p AndroidSurfaceCreateInfoKHR
x (("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR) -> IO b
f "pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p)
  pokeCStruct :: forall b.
("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR)
-> AndroidSurfaceCreateInfoKHR -> IO b -> IO b
pokeCStruct "pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p AndroidSurfaceCreateInfoKHR{Ptr ANativeWindow
AndroidSurfaceCreateFlagsKHR
window :: Ptr ANativeWindow
flags :: AndroidSurfaceCreateFlagsKHR
$sel:window:AndroidSurfaceCreateInfoKHR :: AndroidSurfaceCreateInfoKHR -> Ptr ANativeWindow
$sel:flags:AndroidSurfaceCreateInfoKHR :: AndroidSurfaceCreateInfoKHR -> AndroidSurfaceCreateFlagsKHR
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr AndroidSurfaceCreateFlagsKHR)) (AndroidSurfaceCreateFlagsKHR
flags)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ANativeWindow))) (Ptr ANativeWindow
window)
    IO b
f
  cStructSize :: Int
cStructSize = Int
32
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR) -> IO b -> IO b
pokeZeroCStruct "pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke (("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ANativeWindow))) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct AndroidSurfaceCreateInfoKHR where
  peekCStruct :: ("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR)
-> IO AndroidSurfaceCreateInfoKHR
peekCStruct "pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p = do
    AndroidSurfaceCreateFlagsKHR
flags <- forall a. Storable a => Ptr a -> IO a
peek @AndroidSurfaceCreateFlagsKHR (("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr AndroidSurfaceCreateFlagsKHR))
    Ptr ANativeWindow
window <- forall a. Storable a => Ptr a -> IO a
peek @(Ptr ANativeWindow) (("pCreateInfo" ::: Ptr AndroidSurfaceCreateInfoKHR
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr (Ptr ANativeWindow)))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ AndroidSurfaceCreateFlagsKHR
-> Ptr ANativeWindow -> AndroidSurfaceCreateInfoKHR
AndroidSurfaceCreateInfoKHR
             AndroidSurfaceCreateFlagsKHR
flags Ptr ANativeWindow
window

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

instance Zero AndroidSurfaceCreateInfoKHR where
  zero :: AndroidSurfaceCreateInfoKHR
zero = AndroidSurfaceCreateFlagsKHR
-> Ptr ANativeWindow -> AndroidSurfaceCreateInfoKHR
AndroidSurfaceCreateInfoKHR
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


-- | VkAndroidSurfaceCreateFlagsKHR - Reserved for future use
--
-- = Description
--
-- 'AndroidSurfaceCreateFlagsKHR' is a bitmask type for setting a mask, but
-- is currently reserved for future use.
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_android_surface VK_KHR_android_surface>,
-- 'AndroidSurfaceCreateInfoKHR'
newtype AndroidSurfaceCreateFlagsKHR = AndroidSurfaceCreateFlagsKHR Flags
  deriving newtype (AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
$c/= :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
== :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
$c== :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
Eq, Eq AndroidSurfaceCreateFlagsKHR
AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Ordering
AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
$cmin :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
max :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
$cmax :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
>= :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
$c>= :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
> :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
$c> :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
<= :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
$c<= :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
< :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
$c< :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Bool
compare :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Ordering
$ccompare :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> Ordering
Ord, Ptr AndroidSurfaceCreateFlagsKHR -> IO AndroidSurfaceCreateFlagsKHR
Ptr AndroidSurfaceCreateFlagsKHR
-> Int -> IO AndroidSurfaceCreateFlagsKHR
Ptr AndroidSurfaceCreateFlagsKHR
-> Int -> AndroidSurfaceCreateFlagsKHR -> IO ()
Ptr AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> IO ()
AndroidSurfaceCreateFlagsKHR -> Int
forall b. Ptr b -> Int -> IO AndroidSurfaceCreateFlagsKHR
forall b. Ptr b -> Int -> AndroidSurfaceCreateFlagsKHR -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> IO ()
$cpoke :: Ptr AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> IO ()
peek :: Ptr AndroidSurfaceCreateFlagsKHR -> IO AndroidSurfaceCreateFlagsKHR
$cpeek :: Ptr AndroidSurfaceCreateFlagsKHR -> IO AndroidSurfaceCreateFlagsKHR
pokeByteOff :: forall b. Ptr b -> Int -> AndroidSurfaceCreateFlagsKHR -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> AndroidSurfaceCreateFlagsKHR -> IO ()
peekByteOff :: forall b. Ptr b -> Int -> IO AndroidSurfaceCreateFlagsKHR
$cpeekByteOff :: forall b. Ptr b -> Int -> IO AndroidSurfaceCreateFlagsKHR
pokeElemOff :: Ptr AndroidSurfaceCreateFlagsKHR
-> Int -> AndroidSurfaceCreateFlagsKHR -> IO ()
$cpokeElemOff :: Ptr AndroidSurfaceCreateFlagsKHR
-> Int -> AndroidSurfaceCreateFlagsKHR -> IO ()
peekElemOff :: Ptr AndroidSurfaceCreateFlagsKHR
-> Int -> IO AndroidSurfaceCreateFlagsKHR
$cpeekElemOff :: Ptr AndroidSurfaceCreateFlagsKHR
-> Int -> IO AndroidSurfaceCreateFlagsKHR
alignment :: AndroidSurfaceCreateFlagsKHR -> Int
$calignment :: AndroidSurfaceCreateFlagsKHR -> Int
sizeOf :: AndroidSurfaceCreateFlagsKHR -> Int
$csizeOf :: AndroidSurfaceCreateFlagsKHR -> Int
Storable, AndroidSurfaceCreateFlagsKHR
forall a. a -> Zero a
zero :: AndroidSurfaceCreateFlagsKHR
$czero :: AndroidSurfaceCreateFlagsKHR
Zero, Eq AndroidSurfaceCreateFlagsKHR
AndroidSurfaceCreateFlagsKHR
Int -> AndroidSurfaceCreateFlagsKHR
AndroidSurfaceCreateFlagsKHR -> Bool
AndroidSurfaceCreateFlagsKHR -> Int
AndroidSurfaceCreateFlagsKHR -> Maybe Int
AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
AndroidSurfaceCreateFlagsKHR -> Int -> Bool
AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
forall a.
Eq a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
popCount :: AndroidSurfaceCreateFlagsKHR -> Int
$cpopCount :: AndroidSurfaceCreateFlagsKHR -> Int
rotateR :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
$crotateR :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
rotateL :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
$crotateL :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
unsafeShiftR :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
$cunsafeShiftR :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
shiftR :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
$cshiftR :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
unsafeShiftL :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
$cunsafeShiftL :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
shiftL :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
$cshiftL :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
isSigned :: AndroidSurfaceCreateFlagsKHR -> Bool
$cisSigned :: AndroidSurfaceCreateFlagsKHR -> Bool
bitSize :: AndroidSurfaceCreateFlagsKHR -> Int
$cbitSize :: AndroidSurfaceCreateFlagsKHR -> Int
bitSizeMaybe :: AndroidSurfaceCreateFlagsKHR -> Maybe Int
$cbitSizeMaybe :: AndroidSurfaceCreateFlagsKHR -> Maybe Int
testBit :: AndroidSurfaceCreateFlagsKHR -> Int -> Bool
$ctestBit :: AndroidSurfaceCreateFlagsKHR -> Int -> Bool
complementBit :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
$ccomplementBit :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
clearBit :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
$cclearBit :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
setBit :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
$csetBit :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
bit :: Int -> AndroidSurfaceCreateFlagsKHR
$cbit :: Int -> AndroidSurfaceCreateFlagsKHR
zeroBits :: AndroidSurfaceCreateFlagsKHR
$czeroBits :: AndroidSurfaceCreateFlagsKHR
rotate :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
$crotate :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
shift :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
$cshift :: AndroidSurfaceCreateFlagsKHR -> Int -> AndroidSurfaceCreateFlagsKHR
complement :: AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
$ccomplement :: AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
xor :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
$cxor :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
.|. :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
$c.|. :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
.&. :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
$c.&. :: AndroidSurfaceCreateFlagsKHR
-> AndroidSurfaceCreateFlagsKHR -> AndroidSurfaceCreateFlagsKHR
Bits, Bits AndroidSurfaceCreateFlagsKHR
AndroidSurfaceCreateFlagsKHR -> Int
forall b.
Bits b -> (b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
countTrailingZeros :: AndroidSurfaceCreateFlagsKHR -> Int
$ccountTrailingZeros :: AndroidSurfaceCreateFlagsKHR -> Int
countLeadingZeros :: AndroidSurfaceCreateFlagsKHR -> Int
$ccountLeadingZeros :: AndroidSurfaceCreateFlagsKHR -> Int
finiteBitSize :: AndroidSurfaceCreateFlagsKHR -> Int
$cfiniteBitSize :: AndroidSurfaceCreateFlagsKHR -> Int
FiniteBits)

conNameAndroidSurfaceCreateFlagsKHR :: String
conNameAndroidSurfaceCreateFlagsKHR :: String
conNameAndroidSurfaceCreateFlagsKHR = String
"AndroidSurfaceCreateFlagsKHR"

enumPrefixAndroidSurfaceCreateFlagsKHR :: String
enumPrefixAndroidSurfaceCreateFlagsKHR :: String
enumPrefixAndroidSurfaceCreateFlagsKHR = String
""

showTableAndroidSurfaceCreateFlagsKHR :: [(AndroidSurfaceCreateFlagsKHR, String)]
showTableAndroidSurfaceCreateFlagsKHR :: [(AndroidSurfaceCreateFlagsKHR, String)]
showTableAndroidSurfaceCreateFlagsKHR = []

instance Show AndroidSurfaceCreateFlagsKHR where
  showsPrec :: Int -> AndroidSurfaceCreateFlagsKHR -> ShowS
showsPrec =
    forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec
      String
enumPrefixAndroidSurfaceCreateFlagsKHR
      [(AndroidSurfaceCreateFlagsKHR, String)]
showTableAndroidSurfaceCreateFlagsKHR
      String
conNameAndroidSurfaceCreateFlagsKHR
      (\(AndroidSurfaceCreateFlagsKHR Flags
x) -> Flags
x)
      (\Flags
x -> String -> ShowS
showString String
"0x" forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Integral a, Show a) => a -> ShowS
showHex Flags
x)

instance Read AndroidSurfaceCreateFlagsKHR where
  readPrec :: ReadPrec AndroidSurfaceCreateFlagsKHR
readPrec =
    forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec
      String
enumPrefixAndroidSurfaceCreateFlagsKHR
      [(AndroidSurfaceCreateFlagsKHR, String)]
showTableAndroidSurfaceCreateFlagsKHR
      String
conNameAndroidSurfaceCreateFlagsKHR
      Flags -> AndroidSurfaceCreateFlagsKHR
AndroidSurfaceCreateFlagsKHR

type KHR_ANDROID_SURFACE_SPEC_VERSION = 6

-- No documentation found for TopLevel "VK_KHR_ANDROID_SURFACE_SPEC_VERSION"
pattern KHR_ANDROID_SURFACE_SPEC_VERSION :: forall a . Integral a => a
pattern $bKHR_ANDROID_SURFACE_SPEC_VERSION :: forall a. Integral a => a
$mKHR_ANDROID_SURFACE_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
KHR_ANDROID_SURFACE_SPEC_VERSION = 6


type KHR_ANDROID_SURFACE_EXTENSION_NAME = "VK_KHR_android_surface"

-- No documentation found for TopLevel "VK_KHR_ANDROID_SURFACE_EXTENSION_NAME"
pattern KHR_ANDROID_SURFACE_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bKHR_ANDROID_SURFACE_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mKHR_ANDROID_SURFACE_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
KHR_ANDROID_SURFACE_EXTENSION_NAME = "VK_KHR_android_surface"


data ANativeWindow