{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
module Vulkan.Requirement
(
InstanceRequirement(..)
, DeviceRequirement(..)
,
KnownFeatureStruct(..)
, KnownPropertyStruct(..)
, SFeatureStruct(..)
, SPropertyStruct(..)
) where
import Data.Typeable
( Typeable )
import Data.Word
( Word32 )
import Data.ByteString
( ByteString )
import Vulkan.Core10.Device
( DeviceCreateInfo(..)
)
import Vulkan.Core10.DeviceInitialization
( PhysicalDeviceFeatures, PhysicalDeviceProperties
)
import Vulkan.Core11.Promoted_From_VK_KHR_get_physical_device_properties2
( PhysicalDeviceFeatures2(..), PhysicalDeviceProperties2(..) )
import Vulkan.CStruct
( FromCStruct, ToCStruct )
import Vulkan.CStruct.Extends
( Extends )
import Vulkan.Zero
data InstanceRequirement where
RequireInstanceVersion
:: { InstanceRequirement -> Word32
version :: Word32 }
-> InstanceRequirement
RequireInstanceLayer
:: { InstanceRequirement -> ByteString
instanceLayerName :: ByteString
, InstanceRequirement -> Word32
instanceLayerMinVersion :: Word32
}
-> InstanceRequirement
RequireInstanceExtension
:: { InstanceRequirement -> Maybe ByteString
instanceExtensionLayerName :: Maybe ByteString
, InstanceRequirement -> ByteString
instanceExtensionName :: ByteString
, InstanceRequirement -> Word32
instanceExtensionMinVersion :: Word32
}
-> InstanceRequirement
data DeviceRequirement where
RequireDeviceVersion
:: { DeviceRequirement -> Word32
version :: Word32 }
-> DeviceRequirement
RequireDeviceFeature
:: forall struct
. KnownFeatureStruct struct
=> { DeviceRequirement -> ByteString
featureName :: ByteString
, ()
checkFeature :: struct -> Bool
, ()
enableFeature :: struct -> struct
}
-> DeviceRequirement
RequireDeviceProperty
:: forall struct
. KnownPropertyStruct struct
=> { DeviceRequirement -> ByteString
propertyName :: ByteString
, ()
checkProperty :: struct -> Bool
}
-> DeviceRequirement
RequireDeviceExtension
:: { DeviceRequirement -> Maybe ByteString
deviceExtensionLayerName :: Maybe ByteString
, DeviceRequirement -> ByteString
deviceExtensionName :: ByteString
, DeviceRequirement -> Word32
deviceExtensionMinVersion :: Word32
}
-> DeviceRequirement
data SFeatureStruct feat where
BasicFeatureStruct
:: SFeatureStruct PhysicalDeviceFeatures
ExtendedFeatureStruct
:: ( Show feat
, Extends PhysicalDeviceFeatures2 feat, Extends DeviceCreateInfo feat
, Zero feat, FromCStruct feat, ToCStruct feat
)
=> SFeatureStruct feat
class Typeable feat => KnownFeatureStruct feat where
sFeatureStruct :: SFeatureStruct feat
instance KnownFeatureStruct PhysicalDeviceFeatures where
sFeatureStruct :: SFeatureStruct PhysicalDeviceFeatures
sFeatureStruct = SFeatureStruct PhysicalDeviceFeatures
BasicFeatureStruct
instance {-# OVERLAPPABLE #-}
( Typeable feat, Show feat
, Extends PhysicalDeviceFeatures2 feat, Extends DeviceCreateInfo feat
, Zero feat, FromCStruct feat, ToCStruct feat
)
=> KnownFeatureStruct feat where
sFeatureStruct :: SFeatureStruct feat
sFeatureStruct = forall feat.
(Show feat, Extends PhysicalDeviceFeatures2 feat,
Extends DeviceCreateInfo feat, Zero feat, FromCStruct feat,
ToCStruct feat) =>
SFeatureStruct feat
ExtendedFeatureStruct
data SPropertyStruct prop where
BasicPropertyStruct
:: SPropertyStruct PhysicalDeviceProperties
ExtendedPropertyStruct
:: ( Typeable prop, Extends PhysicalDeviceProperties2 prop, FromCStruct prop, ToCStruct prop )
=> SPropertyStruct prop
class Typeable prop => KnownPropertyStruct prop where
sPropertyStruct :: SPropertyStruct prop
instance KnownPropertyStruct PhysicalDeviceProperties where
sPropertyStruct :: SPropertyStruct PhysicalDeviceProperties
sPropertyStruct = SPropertyStruct PhysicalDeviceProperties
BasicPropertyStruct
instance {-# OVERLAPPABLE #-}
( Typeable prop, Extends PhysicalDeviceProperties2 prop, FromCStruct prop, ToCStruct prop )
=> KnownPropertyStruct prop where
sPropertyStruct :: SPropertyStruct prop
sPropertyStruct = forall prop.
(Typeable prop, Extends PhysicalDeviceProperties2 prop,
FromCStruct prop, ToCStruct prop) =>
SPropertyStruct prop
ExtendedPropertyStruct