{-# 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__]
--     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_KHR_copy_commands2 VK_KHR_copy_commands2>
--
-- [__Contact__]
--
--     -   Jeff Leger
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_QCOM_rotated_copy_commands] @jackohound%0A*Here describe the issue or question you have about the VK_QCOM_rotated_copy_commands extension* >
--
-- == 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 render passes.
--
-- 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.Core13.Promoted_From_VK_KHR_copy_commands2.BufferImageCopy2',
--     'Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2.ImageBlit2':
--
--     -   '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://registry.khronos.org/vulkan/specs/1.3-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 (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.Kind (Type)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Extensions.VK_KHR_surface (SurfaceTransformFlagBitsKHR)
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
--
-- = Description
--
-- Including this structure in the @pNext@ chain of
-- 'Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2.BufferImageCopy2'
-- defines a rotation to be performed when copying between an image and a
-- buffer. Including this structure in the @pNext@ chain of
-- 'Vulkan.Core13.Promoted_From_VK_KHR_copy_commands2.BlitImageInfo2'
-- defines a rotation to be performed when blitting between two images. If
-- this structure is not specified in either case, the implementation
-- behaves as if it was specified with a @transform@ equal to
-- 'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR'.
--
-- Specifying a transform for a copy between an image and a buffer
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#copies-buffers-images-rotation-addressing rotates the region accessed in the image around the offset>.
-- Specifying a transform for a blit performs a similar transform as
-- described in
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#copies-images-scaling-rotation Image Blits with Scaling and Rotation>.
--
-- Rotations other than
-- 'Vulkan.Extensions.VK_KHR_surface.SURFACE_TRANSFORM_IDENTITY_BIT_KHR'
-- /can/ only be specified for single-plane 2D images with a 1x1x1
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#formats-compatibility-classes texel block extent>.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_QCOM_rotated_copy_commands VK_QCOM_rotated_copy_commands>,
-- '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
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 :: forall b.
CopyCommandTransformInfoQCOM
-> (Ptr CopyCommandTransformInfoQCOM -> IO b) -> IO b
withCStruct CopyCommandTransformInfoQCOM
x Ptr CopyCommandTransformInfoQCOM -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr CopyCommandTransformInfoQCOM
p -> 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 :: forall b.
Ptr CopyCommandTransformInfoQCOM
-> CopyCommandTransformInfoQCOM -> IO b -> IO b
pokeCStruct Ptr CopyCommandTransformInfoQCOM
p CopyCommandTransformInfoQCOM{SurfaceTransformFlagBitsKHR
transform :: SurfaceTransformFlagBitsKHR
$sel:transform:CopyCommandTransformInfoQCOM :: CopyCommandTransformInfoQCOM -> SurfaceTransformFlagBitsKHR
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyCommandTransformInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyCommandTransformInfoQCOM
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 CopyCommandTransformInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr SurfaceTransformFlagBitsKHR)) (SurfaceTransformFlagBitsKHR
transform)
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr CopyCommandTransformInfoQCOM -> IO b -> IO b
pokeZeroCStruct Ptr CopyCommandTransformInfoQCOM
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyCommandTransformInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr CopyCommandTransformInfoQCOM
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 CopyCommandTransformInfoQCOM
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr SurfaceTransformFlagBitsKHR)) (forall a. Zero a => a
zero)
    IO b
f

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

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

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


type QCOM_ROTATED_COPY_COMMANDS_SPEC_VERSION = 1

-- 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 :: forall a. Integral a => a
$mQCOM_ROTATED_COPY_COMMANDS_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
QCOM_ROTATED_COPY_COMMANDS_SPEC_VERSION = 1


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 :: forall a. (Eq a, IsString a) => a
$mQCOM_ROTATED_COPY_COMMANDS_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
QCOM_ROTATED_COPY_COMMANDS_EXTENSION_NAME = "VK_QCOM_rotated_copy_commands"