{-# language CPP #-}
-- | = Name
--
-- VK_GGP_frame_token - device extension
--
-- == VK_GGP_frame_token
--
-- [__Name String__]
--     @VK_GGP_frame_token@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     192
--
-- [__Revision__]
--     1
--
-- [__Ratification Status__]
--     Not ratified
--
-- [__Extension and Version Dependencies__]
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_swapchain VK_KHR_swapchain>
--     and
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_GGP_stream_descriptor_surface VK_GGP_stream_descriptor_surface>
--
-- [__Contact__]
--
--     -   Jean-Francois Roy
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_GGP_frame_token] @jfroy%0A*Here describe the issue or question you have about the VK_GGP_frame_token extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2019-01-28
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Jean-Francois Roy, Google
--
--     -   Richard O’Grady, Google
--
-- == Description
--
-- This extension allows an application that uses the @VK_KHR_swapchain@
-- extension in combination with a Google Games Platform surface provided
-- by the @VK_GGP_stream_descriptor_surface@ extension to associate a
-- Google Games Platform frame token with a present operation.
--
-- == New Structures
--
-- -   Extending 'Vulkan.Extensions.VK_KHR_swapchain.PresentInfoKHR':
--
--     -   'PresentFrameTokenGGP'
--
-- == New Enum Constants
--
-- -   'GGP_FRAME_TOKEN_EXTENSION_NAME'
--
-- -   'GGP_FRAME_TOKEN_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP'
--
-- == Version History
--
-- -   Revision 1, 2018-11-26 (Jean-Francois Roy)
--
--     -   Initial revision.
--
-- == See Also
--
-- 'PresentFrameTokenGGP'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_GGP_frame_token Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_GGP_frame_token  ( PresentFrameTokenGGP(..)
                                             , GGP_FRAME_TOKEN_SPEC_VERSION
                                             , pattern GGP_FRAME_TOKEN_SPEC_VERSION
                                             , GGP_FRAME_TOKEN_EXTENSION_NAME
                                             , pattern GGP_FRAME_TOKEN_EXTENSION_NAME
                                             , GgpFrameToken
                                             ) where

import Foreign.Marshal.Alloc (allocaBytes)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
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 Foreign.Ptr (Ptr)
import Data.Word (Word32)
import Data.Kind (Type)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP))
-- | VkPresentFrameTokenGGP - The Google Games Platform frame token
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_GGP_frame_token VK_GGP_frame_token>,
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PresentFrameTokenGGP = PresentFrameTokenGGP
  { -- | @frameToken@ is the Google Games Platform frame token.
    --
    -- #VUID-VkPresentFrameTokenGGP-frameToken-02680# @frameToken@ /must/ be a
    -- valid 'GgpFrameToken'
    PresentFrameTokenGGP -> GgpFrameToken
frameToken :: GgpFrameToken }
  deriving (Typeable, PresentFrameTokenGGP -> PresentFrameTokenGGP -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PresentFrameTokenGGP -> PresentFrameTokenGGP -> Bool
$c/= :: PresentFrameTokenGGP -> PresentFrameTokenGGP -> Bool
== :: PresentFrameTokenGGP -> PresentFrameTokenGGP -> Bool
$c== :: PresentFrameTokenGGP -> PresentFrameTokenGGP -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PresentFrameTokenGGP)
#endif
deriving instance Show PresentFrameTokenGGP

instance ToCStruct PresentFrameTokenGGP where
  withCStruct :: forall b.
PresentFrameTokenGGP -> (Ptr PresentFrameTokenGGP -> IO b) -> IO b
withCStruct PresentFrameTokenGGP
x Ptr PresentFrameTokenGGP -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr PresentFrameTokenGGP
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PresentFrameTokenGGP
p PresentFrameTokenGGP
x (Ptr PresentFrameTokenGGP -> IO b
f Ptr PresentFrameTokenGGP
p)
  pokeCStruct :: forall b.
Ptr PresentFrameTokenGGP -> PresentFrameTokenGGP -> IO b -> IO b
pokeCStruct Ptr PresentFrameTokenGGP
p PresentFrameTokenGGP{GgpFrameToken
frameToken :: GgpFrameToken
$sel:frameToken:PresentFrameTokenGGP :: PresentFrameTokenGGP -> GgpFrameToken
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PresentFrameTokenGGP
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PresentFrameTokenGGP
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PresentFrameTokenGGP
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr GgpFrameToken)) (GgpFrameToken
frameToken)
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr PresentFrameTokenGGP -> IO b -> IO b
pokeZeroCStruct Ptr PresentFrameTokenGGP
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PresentFrameTokenGGP
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PresentFrameTokenGGP
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8 :: Ptr (Ptr ()))) (forall a. Ptr a
nullPtr)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PresentFrameTokenGGP
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr GgpFrameToken)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PresentFrameTokenGGP where
  peekCStruct :: Ptr PresentFrameTokenGGP -> IO PresentFrameTokenGGP
peekCStruct Ptr PresentFrameTokenGGP
p = do
    GgpFrameToken
frameToken <- forall a. Storable a => Ptr a -> IO a
peek @GgpFrameToken ((Ptr PresentFrameTokenGGP
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr GgpFrameToken))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ GgpFrameToken -> PresentFrameTokenGGP
PresentFrameTokenGGP
             GgpFrameToken
frameToken

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

instance Zero PresentFrameTokenGGP where
  zero :: PresentFrameTokenGGP
zero = GgpFrameToken -> PresentFrameTokenGGP
PresentFrameTokenGGP
           forall a. Zero a => a
zero


type GGP_FRAME_TOKEN_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_GGP_FRAME_TOKEN_SPEC_VERSION"
pattern GGP_FRAME_TOKEN_SPEC_VERSION :: forall a . Integral a => a
pattern $bGGP_FRAME_TOKEN_SPEC_VERSION :: forall a. Integral a => a
$mGGP_FRAME_TOKEN_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
GGP_FRAME_TOKEN_SPEC_VERSION = 1


type GGP_FRAME_TOKEN_EXTENSION_NAME = "VK_GGP_frame_token"

-- No documentation found for TopLevel "VK_GGP_FRAME_TOKEN_EXTENSION_NAME"
pattern GGP_FRAME_TOKEN_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bGGP_FRAME_TOKEN_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mGGP_FRAME_TOKEN_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
GGP_FRAME_TOKEN_EXTENSION_NAME = "VK_GGP_frame_token"


type GgpFrameToken = Word32