{-# language CPP #-}
-- | = Name
--
-- VK_QCOM_rotated_copy_commands - device extension
--
-- == VK_QCOM_rotated_copy_commands
--
-- [__Name String__]
--     @VK_QCOM_rotated_copy_commands@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     334
--
-- [__Revision__]
--     0
--
-- [__Extension and Version Dependencies__]
--
--     -   Requires Vulkan 1.0
--
--     -   Requires @VK_KHR_swapchain@
--
--     -   Requires @VK_KHR_copy_commands2@
--
-- [__Contact__]
--
--     -   Jeff Leger
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?title=VK_QCOM_rotated_copy_commands:%20&body=@jackohound%20 >
--
-- == Other Extension Metadata
--
-- [Last Modified Date]
--     2020-09-18
--
-- [__Interactions and External Dependencies__]
--
--     -   None
--
-- [Contributors]
--
--     -   Jeff Leger, Qualcomm Technologies, Inc.
--
-- == Description
--
-- This extension extends adds an optional rotation transform to copy
-- commands 'Vulkan.Extensions.VK_KHR_copy_commands2.cmdBlitImage2KHR',
-- 'Vulkan.Extensions.VK_KHR_copy_commands2.cmdCopyImageToBuffer2KHR' and
-- 'Vulkan.Extensions.VK_KHR_copy_commands2.cmdCopyBufferToImage2KHR'. When
-- copying between two resources, where one resource contains rotated
-- content and the other does not, a rotated copy may be desired. This
-- extension may be used in combination with VK_QCOM_render_pass_transform
-- which adds rotated renderpasses.
--
-- This extension adds an extension structure to the following commands:
-- vkCmdBlitImage2KHR, vkCmdCopyImageToBuffer2KHR and
-- vkCmdCopyBufferToImage2KHR
--
-- == Issues
--
-- 1) What is an appropriate name for the added extension structure? The
-- style guide says \"Structures which extend other structures through the
-- pNext chain should reflect the name of the base structure they
-- extend.\", but in this case a single extension structure is used to
-- extend three base structures (vkCmdBlitImage2KHR,
-- vkCmdCopyImageToBuffer2KHR and vkCmdCopyBufferToImage2KHR). Creating
-- three identical structures with unique names seemed undesirable.
-- __RESOLVED__: Deviate from the style guide for extension structure
-- naming.
--
-- 2) Should this extension add a rotation capability to
-- vkCmdCopyImage2KHR?
--
-- __RESOLVED__: No. Use of rotated vkCmdBlitImage2KHR can fully address
-- this use-case.
--
-- 3) Should this extension add a rotation capability to
-- vkCmdResolveImage2KHR?
--
-- __RESOLVED__ No. Use of vkCmdResolveImage2KHR is very slow and extremely
-- bandwidth intensive on Qualcomm’s GPU architecture and use of
-- pResolveAttachments in vkRenderPass is the strongly preferred approach.
-- Therefore, we choose not to introduce a rotation capability to
-- vkCmdResolveImage2KHR.
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Extensions.VK_KHR_copy_commands2.BufferImageCopy2KHR',
--     'Vulkan.Extensions.VK_KHR_copy_commands2.ImageBlit2KHR':
--
--     -   'CopyCommandTransformInfoQCOM'
--
-- == New Enum Constants
--
-- -   'QCOM_rotated_copy_commands_EXTENSION_NAME'
--
-- -   'QCOM_rotated_copy_commands_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM'
--
-- == Version History
--
-- -   Revision 1, 2020-09-19 (Jeff Leger)
--
-- = See Also
--
-- 'CopyCommandTransformInfoQCOM'
--
-- = Document Notes
--
-- For more information, see the
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_QCOM_rotated_copy_commands Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_QCOM_rotated_copy_commands  ( CopyCommandTransformInfoQCOM(..)
                                                        , QCOM_rotated_copy_commands_SPEC_VERSION
                                                        , pattern QCOM_rotated_copy_commands_SPEC_VERSION
                                                        , QCOM_rotated_copy_commands_EXTENSION_NAME
                                                        , pattern QCOM_rotated_copy_commands_EXTENSION_NAME
                                                        , SurfaceTransformFlagBitsKHR(..)
                                                        , SurfaceTransformFlagsKHR
                                                        ) where

import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
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.Kind (Type)
import Vulkan.CStruct (FromCStruct)
import Vulkan.CStruct (FromCStruct(..))
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Extensions.VK_KHR_surface (SurfaceTransformFlagBitsKHR)
import Vulkan.CStruct (ToCStruct)
import Vulkan.CStruct (ToCStruct(..))
import Vulkan.Zero (Zero(..))
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM))
import Vulkan.Extensions.VK_KHR_surface (SurfaceTransformFlagBitsKHR(..))
import Vulkan.Extensions.VK_KHR_surface (SurfaceTransformFlagsKHR)
-- | VkCopyCommandTransformInfoQCOM - Structure describing transform
-- parameters of rotated copy command
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- 'Vulkan.Core10.Enums.StructureType.StructureType',
-- 'Vulkan.Extensions.VK_KHR_surface.SurfaceTransformFlagBitsKHR'
data CopyCommandTransformInfoQCOM = CopyCommandTransformInfoQCOM
  { -- | @transform@ is a
    -- 'Vulkan.Extensions.VK_KHR_surface.SurfaceTransformFlagBitsKHR' value
    -- describing the transform to be applied.
    --
    -- #VUID-VkCopyCommandTransformInfoQCOM-transform-04560# @transform@ /must/
    -- be
    -- 'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR',
    -- 'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_90_BIT_KHR',
    -- 'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_180_BIT_KHR',
    -- or
    -- 'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_ROTATE_270_BIT_KHR'
    CopyCommandTransformInfoQCOM -> SurfaceTransformFlagBitsKHR
transform :: SurfaceTransformFlagBitsKHR }
  deriving (Typeable, CopyCommandTransformInfoQCOM
-> CopyCommandTransformInfoQCOM -> Bool
(CopyCommandTransformInfoQCOM
 -> CopyCommandTransformInfoQCOM -> Bool)
-> (CopyCommandTransformInfoQCOM
    -> CopyCommandTransformInfoQCOM -> Bool)
-> Eq CopyCommandTransformInfoQCOM
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyCommandTransformInfoQCOM
-> CopyCommandTransformInfoQCOM -> Bool
$c/= :: CopyCommandTransformInfoQCOM
-> CopyCommandTransformInfoQCOM -> Bool
== :: CopyCommandTransformInfoQCOM
-> CopyCommandTransformInfoQCOM -> Bool
$c== :: CopyCommandTransformInfoQCOM
-> CopyCommandTransformInfoQCOM -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (CopyCommandTransformInfoQCOM)
#endif
deriving instance Show CopyCommandTransformInfoQCOM

instance ToCStruct CopyCommandTransformInfoQCOM where
  withCStruct :: CopyCommandTransformInfoQCOM
-> (Ptr CopyCommandTransformInfoQCOM -> IO b) -> IO b
withCStruct x :: CopyCommandTransformInfoQCOM
x f :: Ptr CopyCommandTransformInfoQCOM -> IO b
f = Int -> Int -> (Ptr CopyCommandTransformInfoQCOM -> IO b) -> IO b
forall a b. Int -> Int -> (Ptr a -> IO b) -> IO b
allocaBytesAligned 24 8 ((Ptr CopyCommandTransformInfoQCOM -> IO b) -> IO b)
-> (Ptr CopyCommandTransformInfoQCOM -> IO b) -> IO b
forall a b. (a -> b) -> a -> b
$ \p :: Ptr CopyCommandTransformInfoQCOM
p -> Ptr CopyCommandTransformInfoQCOM
-> CopyCommandTransformInfoQCOM -> IO b -> IO b
forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr CopyCommandTransformInfoQCOM
p CopyCommandTransformInfoQCOM
x (Ptr CopyCommandTransformInfoQCOM -> IO b
f Ptr CopyCommandTransformInfoQCOM
p)
  pokeCStruct :: Ptr CopyCommandTransformInfoQCOM
-> CopyCommandTransformInfoQCOM -> IO b -> IO b
pokeCStruct p :: Ptr CopyCommandTransformInfoQCOM
p CopyCommandTransformInfoQCOM{..} f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyCommandTransformInfoQCOM
p Ptr CopyCommandTransformInfoQCOM -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyCommandTransformInfoQCOM
p Ptr CopyCommandTransformInfoQCOM -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr SurfaceTransformFlagBitsKHR
-> SurfaceTransformFlagBitsKHR -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyCommandTransformInfoQCOM
p Ptr CopyCommandTransformInfoQCOM
-> Int -> Ptr SurfaceTransformFlagBitsKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SurfaceTransformFlagBitsKHR)) (SurfaceTransformFlagBitsKHR
transform)
    IO b
f
  cStructSize :: Int
cStructSize = 24
  cStructAlignment :: Int
cStructAlignment = 8
  pokeZeroCStruct :: Ptr CopyCommandTransformInfoQCOM -> IO b -> IO b
pokeZeroCStruct p :: Ptr CopyCommandTransformInfoQCOM
p f :: IO b
f = do
    Ptr StructureType -> StructureType -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyCommandTransformInfoQCOM
p Ptr CopyCommandTransformInfoQCOM -> Int -> Ptr StructureType
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM)
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyCommandTransformInfoQCOM
p Ptr CopyCommandTransformInfoQCOM -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 8 :: Ptr (Ptr ()))) (Ptr ()
forall a. Ptr a
nullPtr)
    Ptr SurfaceTransformFlagBitsKHR
-> SurfaceTransformFlagBitsKHR -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyCommandTransformInfoQCOM
p Ptr CopyCommandTransformInfoQCOM
-> Int -> Ptr SurfaceTransformFlagBitsKHR
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr SurfaceTransformFlagBitsKHR)) (SurfaceTransformFlagBitsKHR
forall a. Zero a => a
zero)
    IO b
f

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

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

instance Zero CopyCommandTransformInfoQCOM where
  zero :: CopyCommandTransformInfoQCOM
zero = SurfaceTransformFlagBitsKHR -> CopyCommandTransformInfoQCOM
CopyCommandTransformInfoQCOM
           SurfaceTransformFlagBitsKHR
forall a. Zero a => a
zero


type QCOM_rotated_copy_commands_SPEC_VERSION = 0

-- No documentation found for TopLevel "VK_QCOM_rotated_copy_commands_SPEC_VERSION"
pattern QCOM_rotated_copy_commands_SPEC_VERSION :: forall a . Integral a => a
pattern $bQCOM_rotated_copy_commands_SPEC_VERSION :: a
$mQCOM_rotated_copy_commands_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
QCOM_rotated_copy_commands_SPEC_VERSION = 0


type QCOM_rotated_copy_commands_EXTENSION_NAME = "VK_QCOM_rotated_copy_commands"

-- No documentation found for TopLevel "VK_QCOM_rotated_copy_commands_EXTENSION_NAME"
pattern QCOM_rotated_copy_commands_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bQCOM_rotated_copy_commands_EXTENSION_NAME :: a
$mQCOM_rotated_copy_commands_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
QCOM_rotated_copy_commands_EXTENSION_NAME = "VK_QCOM_rotated_copy_commands"