{-# language CPP #-}
-- | = Name
--
-- VK_EXT_image_2d_view_of_3d - device extension
--
-- == VK_EXT_image_2d_view_of_3d
--
-- [__Name String__]
--     @VK_EXT_image_2d_view_of_3d@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     394
--
-- [__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_maintenance1 VK_KHR_maintenance1>
--     and
--     <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_get_physical_device_properties2 VK_KHR_get_physical_device_properties2>
--
-- [__Special Use__]
--
--     -   <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#extendingvulkan-compatibility-specialuse OpenGL \/ ES support>
--
-- [__Contact__]
--
--     -   Mike Blumenkrantz
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_image_2d_view_of_3d] @zmike%0A*Here describe the issue or question you have about the VK_EXT_image_2d_view_of_3d extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2022-02-22
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Mike Blumenkrantz, Valve
--
--     -   Piers Daniell, NVIDIA
--
--     -   Spencer Fricke, Samsung
--
--     -   Ricardo Garcia, Igalia
--
--     -   Graeme Leese, Broadcom
--
--     -   Ralph Potter, Samsung
--
--     -   Stu Smith, AMD
--
--     -   Shahbaz Youssefi, Google
--
--     -   Alex Walters, Imagination
--
-- == Description
--
-- This extension allows a single slice of a 3D image to be used as a 2D
-- view in image descriptors, matching both the functionality of
-- glBindImageTexture in OpenGL with the @layer@ parameter set to true and
-- 2D view binding provided by the extension EGL_KHR_gl_texture_3D_image.
-- It is primarily intended to support GL emulation.
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2',
--     'Vulkan.Core10.Device.DeviceCreateInfo':
--
--     -   'PhysicalDeviceImage2DViewOf3DFeaturesEXT'
--
-- == New Enum Constants
--
-- -   'EXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME'
--
-- -   'EXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION'
--
-- -   Extending
--     'Vulkan.Core10.Enums.ImageCreateFlagBits.ImageCreateFlagBits':
--
--     -   'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT'
--
-- == Version History
--
-- -   Revision 1, 2022-03-25 (Mike Blumenkrantz)
--
--     -   Internal revisions
--
-- == See Also
--
-- 'PhysicalDeviceImage2DViewOf3DFeaturesEXT'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_image_2d_view_of_3d Vulkan Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module Vulkan.Extensions.VK_EXT_image_2d_view_of_3d  ( PhysicalDeviceImage2DViewOf3DFeaturesEXT(..)
                                                     , EXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION
                                                     , pattern EXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION
                                                     , EXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME
                                                     , pattern EXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME
                                                     ) 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.FundamentalTypes (bool32ToBool)
import Vulkan.Core10.FundamentalTypes (boolToBool32)
import Vulkan.Core10.FundamentalTypes (Bool32)
import Vulkan.Core10.Enums.StructureType (StructureType)
import Vulkan.Core10.Enums.StructureType (StructureType(STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT))
-- | VkPhysicalDeviceImage2DViewOf3DFeaturesEXT - Structure describing
-- whether single-slice 2D views of 3D images can be used in image
-- descriptors
--
-- = Members
--
-- This structure describes the following features:
--
-- = Description
--
-- If the 'PhysicalDeviceImage2DViewOf3DFeaturesEXT' structure is included
-- in the @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceFeatures2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceFeatures2',
-- it is filled in to indicate whether each corresponding feature is
-- supported. 'PhysicalDeviceImage2DViewOf3DFeaturesEXT' /can/ also be used
-- in the @pNext@ chain of 'Vulkan.Core10.Device.DeviceCreateInfo' to
-- selectively enable these features.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_image_2d_view_of_3d VK_EXT_image_2d_view_of_3d>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceImage2DViewOf3DFeaturesEXT = PhysicalDeviceImage2DViewOf3DFeaturesEXT
  { -- | #features-image2DViewOf3D# @image2DViewOf3D@ indicates that the
    -- implementation supports using a 2D view of a 3D image in a descriptor of
    -- type 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_STORAGE_IMAGE'
    -- if the image is created using
    -- 'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT'.
    PhysicalDeviceImage2DViewOf3DFeaturesEXT -> Bool
image2DViewOf3D :: Bool
  , -- | #features-sampler2DViewOf3D# @sampler2DViewOf3D@ indicates that the
    -- implementation supports using a 2D view of a 3D image in a descriptor of
    -- type 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_SAMPLED_IMAGE'
    -- or
    -- 'Vulkan.Core10.Enums.DescriptorType.DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER'
    -- if the image is created using
    -- 'Vulkan.Core10.Enums.ImageCreateFlagBits.IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT'.
    PhysicalDeviceImage2DViewOf3DFeaturesEXT -> Bool
sampler2DViewOf3D :: Bool
  }
  deriving (Typeable, PhysicalDeviceImage2DViewOf3DFeaturesEXT
-> PhysicalDeviceImage2DViewOf3DFeaturesEXT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceImage2DViewOf3DFeaturesEXT
-> PhysicalDeviceImage2DViewOf3DFeaturesEXT -> Bool
$c/= :: PhysicalDeviceImage2DViewOf3DFeaturesEXT
-> PhysicalDeviceImage2DViewOf3DFeaturesEXT -> Bool
== :: PhysicalDeviceImage2DViewOf3DFeaturesEXT
-> PhysicalDeviceImage2DViewOf3DFeaturesEXT -> Bool
$c== :: PhysicalDeviceImage2DViewOf3DFeaturesEXT
-> PhysicalDeviceImage2DViewOf3DFeaturesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceImage2DViewOf3DFeaturesEXT)
#endif
deriving instance Show PhysicalDeviceImage2DViewOf3DFeaturesEXT

instance ToCStruct PhysicalDeviceImage2DViewOf3DFeaturesEXT where
  withCStruct :: forall b.
PhysicalDeviceImage2DViewOf3DFeaturesEXT
-> (Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT -> IO b) -> IO b
withCStruct PhysicalDeviceImage2DViewOf3DFeaturesEXT
x Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
24 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p PhysicalDeviceImage2DViewOf3DFeaturesEXT
x (Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT -> IO b
f Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
-> PhysicalDeviceImage2DViewOf3DFeaturesEXT -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p PhysicalDeviceImage2DViewOf3DFeaturesEXT{Bool
sampler2DViewOf3D :: Bool
image2DViewOf3D :: Bool
$sel:sampler2DViewOf3D:PhysicalDeviceImage2DViewOf3DFeaturesEXT :: PhysicalDeviceImage2DViewOf3DFeaturesEXT -> Bool
$sel:image2DViewOf3D:PhysicalDeviceImage2DViewOf3DFeaturesEXT :: PhysicalDeviceImage2DViewOf3DFeaturesEXT -> Bool
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
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 PhysicalDeviceImage2DViewOf3DFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
image2DViewOf3D))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
sampler2DViewOf3D))
    IO b
f
  cStructSize :: Int
cStructSize = Int
24
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b.
Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
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 PhysicalDeviceImage2DViewOf3DFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
    IO b
f

instance FromCStruct PhysicalDeviceImage2DViewOf3DFeaturesEXT where
  peekCStruct :: Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
-> IO PhysicalDeviceImage2DViewOf3DFeaturesEXT
peekCStruct Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p = do
    Bool32
image2DViewOf3D <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    Bool32
sampler2DViewOf3D <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceImage2DViewOf3DFeaturesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Bool -> Bool -> PhysicalDeviceImage2DViewOf3DFeaturesEXT
PhysicalDeviceImage2DViewOf3DFeaturesEXT
             (Bool32 -> Bool
bool32ToBool Bool32
image2DViewOf3D) (Bool32 -> Bool
bool32ToBool Bool32
sampler2DViewOf3D)

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

instance Zero PhysicalDeviceImage2DViewOf3DFeaturesEXT where
  zero :: PhysicalDeviceImage2DViewOf3DFeaturesEXT
zero = Bool -> Bool -> PhysicalDeviceImage2DViewOf3DFeaturesEXT
PhysicalDeviceImage2DViewOf3DFeaturesEXT
           forall a. Zero a => a
zero
           forall a. Zero a => a
zero


type EXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION"
pattern EXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION :: forall a. Integral a => a
$mEXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION = 1


type EXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME = "VK_EXT_image_2d_view_of_3d"

-- No documentation found for TopLevel "VK_EXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME"
pattern EXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mEXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME = "VK_EXT_image_2d_view_of_3d"