{-# language CPP #-}
-- | = Name
--
-- VK_EXT_physical_device_drm - device extension
--
-- == VK_EXT_physical_device_drm
--
-- [__Name String__]
--     @VK_EXT_physical_device_drm@
--
-- [__Extension Type__]
--     Device extension
--
-- [__Registered Extension Number__]
--     354
--
-- [__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_get_physical_device_properties2 VK_KHR_get_physical_device_properties2>
--
-- [__Contact__]
--
--     -   Simon Ser
--         <https://github.com/KhronosGroup/Vulkan-Docs/issues/new?body=[VK_EXT_physical_device_drm] @emersion%0A*Here describe the issue or question you have about the VK_EXT_physical_device_drm extension* >
--
-- == Other Extension Metadata
--
-- [__Last Modified Date__]
--     2021-06-09
--
-- [__IP Status__]
--     No known IP claims.
--
-- [__Contributors__]
--
--     -   Simon Ser
--
-- == Description
--
-- This extension provides new facilities to query DRM properties for
-- physical devices, enabling users to match Vulkan physical devices with
-- DRM nodes on Linux.
--
-- Its functionality closely overlaps with
-- @EGL_EXT_device_drm@<https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_physical_device_drm-fn1 1>^.
-- Unlike the EGL extension, this extension does not expose a string
-- containing the name of the device file and instead exposes device minor
-- numbers.
--
-- DRM defines multiple device node types. Each physical device may have
-- one primary node and one render node associated. Physical devices may
-- have no primary node (e.g. if the device does not have a display
-- subsystem), may have no render node (e.g. if it is a software rendering
-- engine), or may have neither (e.g. if it is a software rendering engine
-- without a display subsystem).
--
-- To query DRM properties for a physical device, chain
-- 'PhysicalDeviceDrmPropertiesEXT' to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2'.
--
-- == New Structures
--
-- -   Extending
--     'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2':
--
--     -   'PhysicalDeviceDrmPropertiesEXT'
--
-- == New Enum Constants
--
-- -   'EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME'
--
-- -   'EXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION'
--
-- -   Extending 'Vulkan.Core10.Enums.StructureType.StructureType':
--
--     -   'Vulkan.Core10.Enums.StructureType.STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT'
--
-- == References
--
-- 1.  #VK_EXT_physical_device_drm-fn1#
--     <https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_device_drm.txt EGL_EXT_device_drm>
--
-- == Version History
--
-- -   Revision 1, 2021-06-09
--
--     -   First stable revision
--
-- == See Also
--
-- 'PhysicalDeviceDrmPropertiesEXT'
--
-- == Document Notes
--
-- For more information, see the
-- <https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VK_EXT_physical_device_drm 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_physical_device_drm  ( PhysicalDeviceDrmPropertiesEXT(..)
                                                     , EXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION
                                                     , pattern EXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION
                                                     , EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME
                                                     , pattern EXT_PHYSICAL_DEVICE_DRM_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 Data.Int (Int64)
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_DRM_PROPERTIES_EXT))
-- | VkPhysicalDeviceDrmPropertiesEXT - Structure containing DRM information
-- of a physical device
--
-- = Description
--
-- If the 'PhysicalDeviceDrmPropertiesEXT' structure is included in the
-- @pNext@ chain of the
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.PhysicalDeviceProperties2'
-- structure passed to
-- 'Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2.getPhysicalDeviceProperties2',
-- it is filled in with each corresponding implementation-dependent
-- property.
--
-- These are properties of the DRM information of a physical device.
--
-- == Valid Usage (Implicit)
--
-- = See Also
--
-- <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_EXT_physical_device_drm VK_EXT_physical_device_drm>,
-- 'Vulkan.Core10.FundamentalTypes.Bool32',
-- 'Vulkan.Core10.Enums.StructureType.StructureType'
data PhysicalDeviceDrmPropertiesEXT = PhysicalDeviceDrmPropertiesEXT
  { -- | @hasPrimary@ is a boolean indicating whether the physical device has a
    -- DRM primary node.
    PhysicalDeviceDrmPropertiesEXT -> Bool
hasPrimary :: Bool
  , -- | @hasRender@ is a boolean indicating whether the physical device has a
    -- DRM render node.
    PhysicalDeviceDrmPropertiesEXT -> Bool
hasRender :: Bool
  , -- | @primaryMajor@ is the DRM primary node major number, if any.
    PhysicalDeviceDrmPropertiesEXT -> Int64
primaryMajor :: Int64
  , -- | @primaryMinor@ is the DRM primary node minor number, if any.
    PhysicalDeviceDrmPropertiesEXT -> Int64
primaryMinor :: Int64
  , -- | @renderMajor@ is the DRM render node major number, if any.
    PhysicalDeviceDrmPropertiesEXT -> Int64
renderMajor :: Int64
  , -- | @renderMinor@ is the DRM render node minor number, if any.
    PhysicalDeviceDrmPropertiesEXT -> Int64
renderMinor :: Int64
  }
  deriving (Typeable, PhysicalDeviceDrmPropertiesEXT
-> PhysicalDeviceDrmPropertiesEXT -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalDeviceDrmPropertiesEXT
-> PhysicalDeviceDrmPropertiesEXT -> Bool
$c/= :: PhysicalDeviceDrmPropertiesEXT
-> PhysicalDeviceDrmPropertiesEXT -> Bool
== :: PhysicalDeviceDrmPropertiesEXT
-> PhysicalDeviceDrmPropertiesEXT -> Bool
$c== :: PhysicalDeviceDrmPropertiesEXT
-> PhysicalDeviceDrmPropertiesEXT -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (PhysicalDeviceDrmPropertiesEXT)
#endif
deriving instance Show PhysicalDeviceDrmPropertiesEXT

instance ToCStruct PhysicalDeviceDrmPropertiesEXT where
  withCStruct :: forall b.
PhysicalDeviceDrmPropertiesEXT
-> (Ptr PhysicalDeviceDrmPropertiesEXT -> IO b) -> IO b
withCStruct PhysicalDeviceDrmPropertiesEXT
x Ptr PhysicalDeviceDrmPropertiesEXT -> IO b
f = forall a b. Int -> (Ptr a -> IO b) -> IO b
allocaBytes Int
56 forall a b. (a -> b) -> a -> b
$ \Ptr PhysicalDeviceDrmPropertiesEXT
p -> forall a b. ToCStruct a => Ptr a -> a -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceDrmPropertiesEXT
p PhysicalDeviceDrmPropertiesEXT
x (Ptr PhysicalDeviceDrmPropertiesEXT -> IO b
f Ptr PhysicalDeviceDrmPropertiesEXT
p)
  pokeCStruct :: forall b.
Ptr PhysicalDeviceDrmPropertiesEXT
-> PhysicalDeviceDrmPropertiesEXT -> IO b -> IO b
pokeCStruct Ptr PhysicalDeviceDrmPropertiesEXT
p PhysicalDeviceDrmPropertiesEXT{Bool
Int64
renderMinor :: Int64
renderMajor :: Int64
primaryMinor :: Int64
primaryMajor :: Int64
hasRender :: Bool
hasPrimary :: Bool
$sel:renderMinor:PhysicalDeviceDrmPropertiesEXT :: PhysicalDeviceDrmPropertiesEXT -> Int64
$sel:renderMajor:PhysicalDeviceDrmPropertiesEXT :: PhysicalDeviceDrmPropertiesEXT -> Int64
$sel:primaryMinor:PhysicalDeviceDrmPropertiesEXT :: PhysicalDeviceDrmPropertiesEXT -> Int64
$sel:primaryMajor:PhysicalDeviceDrmPropertiesEXT :: PhysicalDeviceDrmPropertiesEXT -> Int64
$sel:hasRender:PhysicalDeviceDrmPropertiesEXT :: PhysicalDeviceDrmPropertiesEXT -> Bool
$sel:hasPrimary:PhysicalDeviceDrmPropertiesEXT :: PhysicalDeviceDrmPropertiesEXT -> Bool
..} IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
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 PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
hasPrimary))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (Bool
hasRender))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Int64)) (Int64
primaryMajor)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Int64)) (Int64
primaryMinor)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Int64)) (Int64
renderMajor)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Int64)) (Int64
renderMinor)
    IO b
f
  cStructSize :: Int
cStructSize = Int
56
  cStructAlignment :: Int
cStructAlignment = Int
8
  pokeZeroCStruct :: forall b. Ptr PhysicalDeviceDrmPropertiesEXT -> IO b -> IO b
pokeZeroCStruct Ptr PhysicalDeviceDrmPropertiesEXT
p IO b
f = do
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: Ptr StructureType)) (StructureType
STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
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 PhysicalDeviceDrmPropertiesEXT
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 PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32)) (Bool -> Bool32
boolToBool32 (forall a. Zero a => a
zero))
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Int64)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Int64)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Int64)) (forall a. Zero a => a
zero)
    forall a. Storable a => Ptr a -> a -> IO ()
poke ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Int64)) (forall a. Zero a => a
zero)
    IO b
f

instance FromCStruct PhysicalDeviceDrmPropertiesEXT where
  peekCStruct :: Ptr PhysicalDeviceDrmPropertiesEXT
-> IO PhysicalDeviceDrmPropertiesEXT
peekCStruct Ptr PhysicalDeviceDrmPropertiesEXT
p = do
    Bool32
hasPrimary <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16 :: Ptr Bool32))
    Bool32
hasRender <- forall a. Storable a => Ptr a -> IO a
peek @Bool32 ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20 :: Ptr Bool32))
    Int64
primaryMajor <- forall a. Storable a => Ptr a -> IO a
peek @Int64 ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24 :: Ptr Int64))
    Int64
primaryMinor <- forall a. Storable a => Ptr a -> IO a
peek @Int64 ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
32 :: Ptr Int64))
    Int64
renderMajor <- forall a. Storable a => Ptr a -> IO a
peek @Int64 ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
40 :: Ptr Int64))
    Int64
renderMinor <- forall a. Storable a => Ptr a -> IO a
peek @Int64 ((Ptr PhysicalDeviceDrmPropertiesEXT
p forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
48 :: Ptr Int64))
    forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ Bool
-> Bool
-> Int64
-> Int64
-> Int64
-> Int64
-> PhysicalDeviceDrmPropertiesEXT
PhysicalDeviceDrmPropertiesEXT
             (Bool32 -> Bool
bool32ToBool Bool32
hasPrimary)
             (Bool32 -> Bool
bool32ToBool Bool32
hasRender)
             Int64
primaryMajor
             Int64
primaryMinor
             Int64
renderMajor
             Int64
renderMinor

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

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


type EXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION = 1

-- No documentation found for TopLevel "VK_EXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION"
pattern EXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION :: forall a . Integral a => a
pattern $bEXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION :: forall a. Integral a => a
$mEXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION :: forall {r} {a}.
Integral a =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION = 1


type EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME = "VK_EXT_physical_device_drm"

-- No documentation found for TopLevel "VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME"
pattern EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bEXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME :: forall a. (Eq a, IsString a) => a
$mEXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME :: forall {r} {a}.
(Eq a, IsString a) =>
a -> ((# #) -> r) -> ((# #) -> r) -> r
EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME = "VK_EXT_physical_device_drm"