{-# language CPP #-}
-- | = Name
--
-- XR_FB_color_space - instance extension
--
-- = Specification
--
-- See
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_FB_color_space  XR_FB_color_space>
-- in the main specification for complete information.
--
-- = Registered Extension Number
--
-- 109
--
-- = Revision
--
-- 1
--
-- = Extension and Version Dependencies
--
-- -   Requires OpenXR 1.0
--
-- = See Also
--
-- 'ColorSpaceFB', 'SystemColorSpacePropertiesFB',
-- 'enumerateColorSpacesFB', 'setColorSpaceFB'
--
-- = Document Notes
--
-- For more information, see the
-- <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_FB_color_space OpenXR Specification>
--
-- This page is a generated document. Fixes and changes should be made to
-- the generator scripts, not directly.
module OpenXR.Extensions.XR_FB_color_space  ( enumerateColorSpacesFB
                                            , setColorSpaceFB
                                            , SystemColorSpacePropertiesFB(..)
                                            , ColorSpaceFB( COLOR_SPACE_UNMANAGED_FB
                                                          , COLOR_SPACE_REC2020_FB
                                                          , COLOR_SPACE_REC709_FB
                                                          , COLOR_SPACE_RIFT_CV1_FB
                                                          , COLOR_SPACE_RIFT_S_FB
                                                          , COLOR_SPACE_QUEST_FB
                                                          , COLOR_SPACE_P3_FB
                                                          , COLOR_SPACE_ADOBE_RGB_FB
                                                          , ..
                                                          )
                                            , FB_color_space_SPEC_VERSION
                                            , pattern FB_color_space_SPEC_VERSION
                                            , FB_COLOR_SPACE_EXTENSION_NAME
                                            , pattern FB_COLOR_SPACE_EXTENSION_NAME
                                            ) where

import OpenXR.Internal.Utils (enumReadPrec)
import OpenXR.Internal.Utils (enumShowsPrec)
import OpenXR.Internal.Utils (traceAroundEvent)
import Control.Exception.Base (bracket)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import Foreign.Marshal.Alloc (allocaBytesAligned)
import Foreign.Marshal.Alloc (callocBytes)
import Foreign.Marshal.Alloc (free)
import GHC.Base (when)
import GHC.IO (throwIO)
import GHC.Ptr (nullFunPtr)
import Foreign.Ptr (nullPtr)
import Foreign.Ptr (plusPtr)
import GHC.Show (showsPrec)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Cont (evalContT)
import Data.Vector (generateM)
import OpenXR.CStruct (FromCStruct)
import OpenXR.CStruct (FromCStruct(..))
import OpenXR.CStruct (ToCStruct)
import OpenXR.CStruct (ToCStruct(..))
import OpenXR.Zero (Zero)
import OpenXR.Zero (Zero(..))
import Control.Monad.IO.Class (MonadIO)
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 GHC.IO.Exception (IOErrorType(..))
import GHC.IO.Exception (IOException(..))
import Data.Int (Int32)
import Foreign.Ptr (FunPtr)
import Foreign.Ptr (Ptr)
import GHC.Read (Read(readPrec))
import GHC.Show (Show(showsPrec))
import Data.Word (Word32)
import Data.Kind (Type)
import Control.Monad.Trans.Cont (ContT(..))
import Data.Vector (Vector)
import OpenXR.CStruct.Utils (advancePtrBytes)
import OpenXR.NamedType ((:::))
import OpenXR.Dynamic (InstanceCmds(pXrEnumerateColorSpacesFB))
import OpenXR.Dynamic (InstanceCmds(pXrSetColorSpaceFB))
import OpenXR.Exception (OpenXrException(..))
import OpenXR.Core10.Enums.Result (Result)
import OpenXR.Core10.Enums.Result (Result(..))
import OpenXR.Core10.Handles (Session)
import OpenXR.Core10.Handles (Session(..))
import OpenXR.Core10.Handles (Session_T)
import OpenXR.Core10.Enums.StructureType (StructureType)
import OpenXR.Core10.Enums.Result (Result(SUCCESS))
import OpenXR.Core10.Enums.StructureType (StructureType(TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB))
foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkXrEnumerateColorSpacesFB
  :: FunPtr (Ptr Session_T -> Word32 -> Ptr Word32 -> Ptr ColorSpaceFB -> IO Result) -> Ptr Session_T -> Word32 -> Ptr Word32 -> Ptr ColorSpaceFB -> IO Result

-- | xrEnumerateColorSpacesFB - Enumerates color spaces
--
-- == Parameter Descriptions
--
-- -   @session@ is the session that enumerates the supported color spaces.
--
-- -   @colorSpaceCapacityInput@ is the capacity of the @colorSpaces@
--     array, or 0 to retrieve the required capacity.
--
-- -   @colorSpaceCountOutput@ is a pointer to the count of 'ColorSpaceFB'
--     @colorSpaces@ written, or a pointer to the required capacity in the
--     case that @colorSpaceCapacityInput@ is @0@.
--
-- -   @colorSpaces@ is a pointer to an array of 'ColorSpaceFB' color
--     spaces, but /can/ be @NULL@ if @colorSpaceCapacityInput@ is @0@.
--
-- -   See
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#buffer-size-parameters Buffer Size Parameters>
--     chapter for a detailed description of retrieving the required
--     @colorSpaces@ size.
--
-- = Description
--
-- 'enumerateColorSpacesFB' enumerates the color spaces supported by the
-- current session. Runtimes /must/ always return identical buffer contents
-- from this enumeration for the lifetime of the session.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-xrEnumerateColorSpacesFB-extension-notenabled# The @@
--     extension /must/ be enabled prior to calling
--     'enumerateColorSpacesFB'
--
-- -   #VUID-xrEnumerateColorSpacesFB-session-parameter# @session@ /must/
--     be a valid 'OpenXR.Core10.Handles.Session' handle
--
-- -   #VUID-xrEnumerateColorSpacesFB-colorSpaceCountOutput-parameter#
--     @colorSpaceCountOutput@ /must/ be a pointer to a @uint32_t@ value
--
-- -   #VUID-xrEnumerateColorSpacesFB-colorSpaces-parameter# If
--     @colorSpaceCapacityInput@ is not @0@, @colorSpaces@ /must/ be a
--     pointer to an array of @colorSpaceCapacityInput@ 'ColorSpaceFB'
--     values
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-successcodes Success>]
--
--     -   'OpenXR.Core10.Enums.Result.SUCCESS'
--
--     -   'OpenXR.Core10.Enums.Result.SESSION_LOSS_PENDING'
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-errorcodes Failure>]
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_INSTANCE_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SESSION_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_RUNTIME_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SIZE_INSUFFICIENT'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_FUNCTION_UNSUPPORTED'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
-- = See Also
--
-- 'ColorSpaceFB', 'OpenXR.Core10.Handles.Session', 'setColorSpaceFB'
enumerateColorSpacesFB :: forall io
                        . (MonadIO io)
                       => -- No documentation found for Nested "xrEnumerateColorSpacesFB" "session"
                          Session
                       -> io (Result, ("colorSpaces" ::: Vector ColorSpaceFB))
enumerateColorSpacesFB :: Session -> io (Result, "colorSpaces" ::: Vector ColorSpaceFB)
enumerateColorSpacesFB session :: Session
session = IO (Result, "colorSpaces" ::: Vector ColorSpaceFB)
-> io (Result, "colorSpaces" ::: Vector ColorSpaceFB)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Result, "colorSpaces" ::: Vector ColorSpaceFB)
 -> io (Result, "colorSpaces" ::: Vector ColorSpaceFB))
-> (ContT
      (Result, "colorSpaces" ::: Vector ColorSpaceFB)
      IO
      (Result, "colorSpaces" ::: Vector ColorSpaceFB)
    -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
-> io (Result, "colorSpaces" ::: Vector ColorSpaceFB)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContT
  (Result, "colorSpaces" ::: Vector ColorSpaceFB)
  IO
  (Result, "colorSpaces" ::: Vector ColorSpaceFB)
-> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB)
forall (m :: * -> *) r. Monad m => ContT r m r -> m r
evalContT (ContT
   (Result, "colorSpaces" ::: Vector ColorSpaceFB)
   IO
   (Result, "colorSpaces" ::: Vector ColorSpaceFB)
 -> io (Result, "colorSpaces" ::: Vector ColorSpaceFB))
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
-> io (Result, "colorSpaces" ::: Vector ColorSpaceFB)
forall a b. (a -> b) -> a -> b
$ do
  let xrEnumerateColorSpacesFBPtr :: FunPtr
  (Ptr Session_T
   -> ("colorSpaceCapacityInput" ::: Word32)
   -> ("colorSpaceCountOutput"
       ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
   -> ("colorSpaces" ::: Ptr ColorSpaceFB)
   -> IO Result)
xrEnumerateColorSpacesFBPtr = InstanceCmds
-> FunPtr
     (Ptr Session_T
      -> ("colorSpaceCapacityInput" ::: Word32)
      -> ("colorSpaceCountOutput"
          ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
      -> ("colorSpaces" ::: Ptr ColorSpaceFB)
      -> IO Result)
pXrEnumerateColorSpacesFB (Session -> InstanceCmds
instanceCmds (Session
session :: Session))
  IO ()
-> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO ())
-> IO ()
-> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr
  (Ptr Session_T
   -> ("colorSpaceCapacityInput" ::: Word32)
   -> ("colorSpaceCountOutput"
       ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
   -> ("colorSpaces" ::: Ptr ColorSpaceFB)
   -> IO Result)
xrEnumerateColorSpacesFBPtr FunPtr
  (Ptr Session_T
   -> ("colorSpaceCapacityInput" ::: Word32)
   -> ("colorSpaceCountOutput"
       ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
   -> ("colorSpaces" ::: Ptr ColorSpaceFB)
   -> IO Result)
-> FunPtr
     (Ptr Session_T
      -> ("colorSpaceCapacityInput" ::: Word32)
      -> ("colorSpaceCountOutput"
          ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
      -> ("colorSpaces" ::: Ptr ColorSpaceFB)
      -> IO Result)
-> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr
  (Ptr Session_T
   -> ("colorSpaceCapacityInput" ::: Word32)
   -> ("colorSpaceCountOutput"
       ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
   -> ("colorSpaces" ::: Ptr ColorSpaceFB)
   -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for xrEnumerateColorSpacesFB is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let xrEnumerateColorSpacesFB' :: Ptr Session_T
-> ("colorSpaceCapacityInput" ::: Word32)
-> ("colorSpaceCountOutput"
    ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
-> ("colorSpaces" ::: Ptr ColorSpaceFB)
-> IO Result
xrEnumerateColorSpacesFB' = FunPtr
  (Ptr Session_T
   -> ("colorSpaceCapacityInput" ::: Word32)
   -> ("colorSpaceCountOutput"
       ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
   -> ("colorSpaces" ::: Ptr ColorSpaceFB)
   -> IO Result)
-> Ptr Session_T
-> ("colorSpaceCapacityInput" ::: Word32)
-> ("colorSpaceCountOutput"
    ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
-> ("colorSpaces" ::: Ptr ColorSpaceFB)
-> IO Result
mkXrEnumerateColorSpacesFB FunPtr
  (Ptr Session_T
   -> ("colorSpaceCapacityInput" ::: Word32)
   -> ("colorSpaceCountOutput"
       ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
   -> ("colorSpaces" ::: Ptr ColorSpaceFB)
   -> IO Result)
xrEnumerateColorSpacesFBPtr
  let session' :: Ptr Session_T
session' = Session -> Ptr Session_T
sessionHandle (Session
session)
  "colorSpaceCountOutput"
::: Ptr ("colorSpaceCapacityInput" ::: Word32)
pColorSpaceCountOutput <- ((("colorSpaceCountOutput"
   ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
  -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
 -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     ("colorSpaceCountOutput"
      ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("colorSpaceCountOutput"
    ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
   -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
  -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
 -> ContT
      (Result, "colorSpaces" ::: Vector ColorSpaceFB)
      IO
      ("colorSpaceCountOutput"
       ::: Ptr ("colorSpaceCapacityInput" ::: Word32)))
-> ((("colorSpaceCountOutput"
      ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
     -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
    -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     ("colorSpaceCountOutput"
      ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
forall a b. (a -> b) -> a -> b
$ IO
  ("colorSpaceCountOutput"
   ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
-> (("colorSpaceCountOutput"
     ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
    -> IO ())
-> (("colorSpaceCountOutput"
     ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
    -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
-> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int
-> IO
     ("colorSpaceCountOutput"
      ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
forall a. Int -> IO (Ptr a)
callocBytes @Word32 4) ("colorSpaceCountOutput"
 ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
-> IO ()
forall a. Ptr a -> IO ()
free
  Result
r <- IO Result
-> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
 -> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO Result)
-> IO Result
-> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrEnumerateColorSpacesFB" (Ptr Session_T
-> ("colorSpaceCapacityInput" ::: Word32)
-> ("colorSpaceCountOutput"
    ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
-> ("colorSpaces" ::: Ptr ColorSpaceFB)
-> IO Result
xrEnumerateColorSpacesFB' Ptr Session_T
session' (0) ("colorSpaceCountOutput"
::: Ptr ("colorSpaceCapacityInput" ::: Word32)
pColorSpaceCountOutput) ("colorSpaces" ::: Ptr ColorSpaceFB
forall a. Ptr a
nullPtr))
  IO ()
-> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO ())
-> IO ()
-> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (OpenXrException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> OpenXrException
OpenXrException Result
r))
  "colorSpaceCapacityInput" ::: Word32
colorSpaceCountOutput <- IO ("colorSpaceCapacityInput" ::: Word32)
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     ("colorSpaceCapacityInput" ::: Word32)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("colorSpaceCapacityInput" ::: Word32)
 -> ContT
      (Result, "colorSpaces" ::: Vector ColorSpaceFB)
      IO
      ("colorSpaceCapacityInput" ::: Word32))
-> IO ("colorSpaceCapacityInput" ::: Word32)
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     ("colorSpaceCapacityInput" ::: Word32)
forall a b. (a -> b) -> a -> b
$ ("colorSpaceCountOutput"
 ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
-> IO ("colorSpaceCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 "colorSpaceCountOutput"
::: Ptr ("colorSpaceCapacityInput" ::: Word32)
pColorSpaceCountOutput
  "colorSpaces" ::: Ptr ColorSpaceFB
pColorSpaces <- ((("colorSpaces" ::: Ptr ColorSpaceFB)
  -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
 -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     ("colorSpaces" ::: Ptr ColorSpaceFB)
forall k (r :: k) (m :: k -> *) a.
((a -> m r) -> m r) -> ContT r m a
ContT (((("colorSpaces" ::: Ptr ColorSpaceFB)
   -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
  -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
 -> ContT
      (Result, "colorSpaces" ::: Vector ColorSpaceFB)
      IO
      ("colorSpaces" ::: Ptr ColorSpaceFB))
-> ((("colorSpaces" ::: Ptr ColorSpaceFB)
     -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
    -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     ("colorSpaces" ::: Ptr ColorSpaceFB)
forall a b. (a -> b) -> a -> b
$ IO ("colorSpaces" ::: Ptr ColorSpaceFB)
-> (("colorSpaces" ::: Ptr ColorSpaceFB) -> IO ())
-> (("colorSpaces" ::: Ptr ColorSpaceFB)
    -> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB))
-> IO (Result, "colorSpaces" ::: Vector ColorSpaceFB)
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket (Int -> IO ("colorSpaces" ::: Ptr ColorSpaceFB)
forall a. Int -> IO (Ptr a)
callocBytes @ColorSpaceFB ((("colorSpaceCapacityInput" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ("colorSpaceCapacityInput" ::: Word32
colorSpaceCountOutput)) Int -> Int -> Int
forall a. Num a => a -> a -> a
* 4)) ("colorSpaces" ::: Ptr ColorSpaceFB) -> IO ()
forall a. Ptr a -> IO ()
free
  Result
r' <- IO Result
-> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO Result
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO Result
 -> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO Result)
-> IO Result
-> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO Result
forall a b. (a -> b) -> a -> b
$ String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrEnumerateColorSpacesFB" (Ptr Session_T
-> ("colorSpaceCapacityInput" ::: Word32)
-> ("colorSpaceCountOutput"
    ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
-> ("colorSpaces" ::: Ptr ColorSpaceFB)
-> IO Result
xrEnumerateColorSpacesFB' Ptr Session_T
session' (("colorSpaceCapacityInput" ::: Word32
colorSpaceCountOutput)) ("colorSpaceCountOutput"
::: Ptr ("colorSpaceCapacityInput" ::: Word32)
pColorSpaceCountOutput) ("colorSpaces" ::: Ptr ColorSpaceFB
pColorSpaces))
  IO ()
-> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO ()
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ()
 -> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO ())
-> IO ()
-> ContT (Result, "colorSpaces" ::: Vector ColorSpaceFB) IO ()
forall a b. (a -> b) -> a -> b
$ Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r' Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (OpenXrException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> OpenXrException
OpenXrException Result
r'))
  "colorSpaceCapacityInput" ::: Word32
colorSpaceCountOutput' <- IO ("colorSpaceCapacityInput" ::: Word32)
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     ("colorSpaceCapacityInput" ::: Word32)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("colorSpaceCapacityInput" ::: Word32)
 -> ContT
      (Result, "colorSpaces" ::: Vector ColorSpaceFB)
      IO
      ("colorSpaceCapacityInput" ::: Word32))
-> IO ("colorSpaceCapacityInput" ::: Word32)
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     ("colorSpaceCapacityInput" ::: Word32)
forall a b. (a -> b) -> a -> b
$ ("colorSpaceCountOutput"
 ::: Ptr ("colorSpaceCapacityInput" ::: Word32))
-> IO ("colorSpaceCapacityInput" ::: Word32)
forall a. Storable a => Ptr a -> IO a
peek @Word32 "colorSpaceCountOutput"
::: Ptr ("colorSpaceCapacityInput" ::: Word32)
pColorSpaceCountOutput
  "colorSpaces" ::: Vector ColorSpaceFB
colorSpaces' <- IO ("colorSpaces" ::: Vector ColorSpaceFB)
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     ("colorSpaces" ::: Vector ColorSpaceFB)
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (IO ("colorSpaces" ::: Vector ColorSpaceFB)
 -> ContT
      (Result, "colorSpaces" ::: Vector ColorSpaceFB)
      IO
      ("colorSpaces" ::: Vector ColorSpaceFB))
-> IO ("colorSpaces" ::: Vector ColorSpaceFB)
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     ("colorSpaces" ::: Vector ColorSpaceFB)
forall a b. (a -> b) -> a -> b
$ Int
-> (Int -> IO ColorSpaceFB)
-> IO ("colorSpaces" ::: Vector ColorSpaceFB)
forall (m :: * -> *) a.
Monad m =>
Int -> (Int -> m a) -> m (Vector a)
generateM (("colorSpaceCapacityInput" ::: Word32) -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ("colorSpaceCapacityInput" ::: Word32
colorSpaceCountOutput')) (\i :: Int
i -> ("colorSpaces" ::: Ptr ColorSpaceFB) -> IO ColorSpaceFB
forall a. Storable a => Ptr a -> IO a
peek @ColorSpaceFB (("colorSpaces" ::: Ptr ColorSpaceFB
pColorSpaces ("colorSpaces" ::: Ptr ColorSpaceFB)
-> Int -> "colorSpaces" ::: Ptr ColorSpaceFB
forall a. Ptr a -> Int -> Ptr a
`advancePtrBytes` (4 Int -> Int -> Int
forall a. Num a => a -> a -> a
* (Int
i)) :: Ptr ColorSpaceFB)))
  (Result, "colorSpaces" ::: Vector ColorSpaceFB)
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((Result, "colorSpaces" ::: Vector ColorSpaceFB)
 -> ContT
      (Result, "colorSpaces" ::: Vector ColorSpaceFB)
      IO
      (Result, "colorSpaces" ::: Vector ColorSpaceFB))
-> (Result, "colorSpaces" ::: Vector ColorSpaceFB)
-> ContT
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
     IO
     (Result, "colorSpaces" ::: Vector ColorSpaceFB)
forall a b. (a -> b) -> a -> b
$ ((Result
r'), "colorSpaces" ::: Vector ColorSpaceFB
colorSpaces')


foreign import ccall
#if !defined(SAFE_FOREIGN_CALLS)
  unsafe
#endif
  "dynamic" mkXrSetColorSpaceFB
  :: FunPtr (Ptr Session_T -> ColorSpaceFB -> IO Result) -> Ptr Session_T -> ColorSpaceFB -> IO Result

-- | xrSetColorSpaceFB - Set a color space
--
-- == Parameter Descriptions
--
-- = Description
--
-- 'setColorSpaceFB' provides a mechanism for an application to specify the
-- color space used in the final rendered frame. If this function is not
-- called, the session will use the color space deemed appropriate by the
-- runtime. Facebook HMDs for both PC and Mobile product lines default to
-- 'COLOR_SPACE_RIFT_CV1_FB'. The runtime /must/ return
-- 'OpenXR.Core10.Enums.Result.ERROR_COLOR_SPACE_UNSUPPORTED_FB' if
-- @colorSpace@ is not one of the values enumerated by
-- 'enumerateColorSpacesFB'.
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-xrSetColorSpaceFB-extension-notenabled# The @@ extension
--     /must/ be enabled prior to calling 'setColorSpaceFB'
--
-- -   #VUID-xrSetColorSpaceFB-session-parameter# @session@ /must/ be a
--     valid 'OpenXR.Core10.Handles.Session' handle
--
-- -   #VUID-xrSetColorSpaceFB-colorspace-parameter# @colorspace@ /must/ be
--     a valid 'ColorSpaceFB' value
--
-- == Return Codes
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-successcodes Success>]
--
--     -   'OpenXR.Core10.Enums.Result.SUCCESS'
--
--     -   'OpenXR.Core10.Enums.Result.SESSION_LOSS_PENDING'
--
-- [<https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#fundamentals-errorcodes Failure>]
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_INSTANCE_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_SESSION_LOST'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_RUNTIME_FAILURE'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_HANDLE_INVALID'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_COLOR_SPACE_UNSUPPORTED_FB'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_FEATURE_UNSUPPORTED'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_FUNCTION_UNSUPPORTED'
--
--     -   'OpenXR.Core10.Enums.Result.ERROR_VALIDATION_FAILURE'
--
-- = See Also
--
-- 'ColorSpaceFB', 'OpenXR.Core10.Handles.Session',
-- 'enumerateColorSpacesFB'
setColorSpaceFB :: forall io
                 . (MonadIO io)
                => -- | @session@ is a valid 'OpenXR.Core10.Handles.Session' handle.
                   Session
                -> -- No documentation found for Nested "xrSetColorSpaceFB" "colorspace"
                   ColorSpaceFB
                -> io (Result)
setColorSpaceFB :: Session -> ColorSpaceFB -> io Result
setColorSpaceFB session :: Session
session colorspace :: ColorSpaceFB
colorspace = IO Result -> io Result
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Result -> io Result) -> IO Result -> io Result
forall a b. (a -> b) -> a -> b
$ do
  let xrSetColorSpaceFBPtr :: FunPtr (Ptr Session_T -> ColorSpaceFB -> IO Result)
xrSetColorSpaceFBPtr = InstanceCmds -> FunPtr (Ptr Session_T -> ColorSpaceFB -> IO Result)
pXrSetColorSpaceFB (Session -> InstanceCmds
instanceCmds (Session
session :: Session))
  Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (FunPtr (Ptr Session_T -> ColorSpaceFB -> IO Result)
xrSetColorSpaceFBPtr FunPtr (Ptr Session_T -> ColorSpaceFB -> IO Result)
-> FunPtr (Ptr Session_T -> ColorSpaceFB -> IO Result) -> Bool
forall a. Eq a => a -> a -> Bool
/= FunPtr (Ptr Session_T -> ColorSpaceFB -> IO Result)
forall a. FunPtr a
nullFunPtr) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$
    IOException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO ()) -> IOException -> IO ()
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
InvalidArgument "" "The function pointer for xrSetColorSpaceFB is null" Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
  let xrSetColorSpaceFB' :: Ptr Session_T -> ColorSpaceFB -> IO Result
xrSetColorSpaceFB' = FunPtr (Ptr Session_T -> ColorSpaceFB -> IO Result)
-> Ptr Session_T -> ColorSpaceFB -> IO Result
mkXrSetColorSpaceFB FunPtr (Ptr Session_T -> ColorSpaceFB -> IO Result)
xrSetColorSpaceFBPtr
  Result
r <- String -> IO Result -> IO Result
forall a. String -> IO a -> IO a
traceAroundEvent "xrSetColorSpaceFB" (Ptr Session_T -> ColorSpaceFB -> IO Result
xrSetColorSpaceFB' (Session -> Ptr Session_T
sessionHandle (Session
session)) (ColorSpaceFB
colorspace))
  Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Result
r Result -> Result -> Bool
forall a. Ord a => a -> a -> Bool
< Result
SUCCESS) (OpenXrException -> IO ()
forall e a. Exception e => e -> IO a
throwIO (Result -> OpenXrException
OpenXrException Result
r))
  Result -> IO Result
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Result -> IO Result) -> Result -> IO Result
forall a b. (a -> b) -> a -> b
$ (Result
r)


-- | XrSystemColorSpacePropertiesFB - System property for color space
--
-- == Valid Usage (Implicit)
--
-- -   #VUID-XrSystemColorSpacePropertiesFB-extension-notenabled# The @@
--     extension /must/ be enabled prior to using
--     'SystemColorSpacePropertiesFB'
--
-- -   #VUID-XrSystemColorSpacePropertiesFB-type-type# @type@ /must/ be
--     'OpenXR.Core10.Enums.StructureType.TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB'
--
-- -   #VUID-XrSystemColorSpacePropertiesFB-next-next# @next@ /must/ be
--     @NULL@ or a valid pointer to the
--     <https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#valid-usage-for-structure-pointer-chains next structure in a structure chain>
--
-- -   #VUID-XrSystemColorSpacePropertiesFB-colorSpace-parameter#
--     @colorSpace@ /must/ be a valid 'ColorSpaceFB' value
--
-- = See Also
--
-- 'ColorSpaceFB', 'OpenXR.Core10.Enums.StructureType.StructureType'
data SystemColorSpacePropertiesFB = SystemColorSpacePropertiesFB
  { -- | @colorSpace@ is the native color space of the XR device.
    SystemColorSpacePropertiesFB -> ColorSpaceFB
colorSpace :: ColorSpaceFB }
  deriving (Typeable, SystemColorSpacePropertiesFB
-> SystemColorSpacePropertiesFB -> Bool
(SystemColorSpacePropertiesFB
 -> SystemColorSpacePropertiesFB -> Bool)
-> (SystemColorSpacePropertiesFB
    -> SystemColorSpacePropertiesFB -> Bool)
-> Eq SystemColorSpacePropertiesFB
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SystemColorSpacePropertiesFB
-> SystemColorSpacePropertiesFB -> Bool
$c/= :: SystemColorSpacePropertiesFB
-> SystemColorSpacePropertiesFB -> Bool
== :: SystemColorSpacePropertiesFB
-> SystemColorSpacePropertiesFB -> Bool
$c== :: SystemColorSpacePropertiesFB
-> SystemColorSpacePropertiesFB -> Bool
Eq)
#if defined(GENERIC_INSTANCES)
deriving instance Generic (SystemColorSpacePropertiesFB)
#endif
deriving instance Show SystemColorSpacePropertiesFB

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

instance FromCStruct SystemColorSpacePropertiesFB where
  peekCStruct :: Ptr SystemColorSpacePropertiesFB -> IO SystemColorSpacePropertiesFB
peekCStruct p :: Ptr SystemColorSpacePropertiesFB
p = do
    ColorSpaceFB
colorSpace <- ("colorSpaces" ::: Ptr ColorSpaceFB) -> IO ColorSpaceFB
forall a. Storable a => Ptr a -> IO a
peek @ColorSpaceFB ((Ptr SystemColorSpacePropertiesFB
p Ptr SystemColorSpacePropertiesFB
-> Int -> "colorSpaces" ::: Ptr ColorSpaceFB
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 16 :: Ptr ColorSpaceFB))
    SystemColorSpacePropertiesFB -> IO SystemColorSpacePropertiesFB
forall (f :: * -> *) a. Applicative f => a -> f a
pure (SystemColorSpacePropertiesFB -> IO SystemColorSpacePropertiesFB)
-> SystemColorSpacePropertiesFB -> IO SystemColorSpacePropertiesFB
forall a b. (a -> b) -> a -> b
$ ColorSpaceFB -> SystemColorSpacePropertiesFB
SystemColorSpacePropertiesFB
             ColorSpaceFB
colorSpace

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

instance Zero SystemColorSpacePropertiesFB where
  zero :: SystemColorSpacePropertiesFB
zero = ColorSpaceFB -> SystemColorSpacePropertiesFB
SystemColorSpacePropertiesFB
           ColorSpaceFB
forall a. Zero a => a
zero


-- | XrColorSpaceFB - Color Space Type
--
-- == Enumerant Descriptions
--
-- = See Also
--
-- 'SystemColorSpacePropertiesFB', 'enumerateColorSpacesFB',
-- 'setColorSpaceFB'
newtype ColorSpaceFB = ColorSpaceFB Int32
  deriving newtype (ColorSpaceFB -> ColorSpaceFB -> Bool
(ColorSpaceFB -> ColorSpaceFB -> Bool)
-> (ColorSpaceFB -> ColorSpaceFB -> Bool) -> Eq ColorSpaceFB
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColorSpaceFB -> ColorSpaceFB -> Bool
$c/= :: ColorSpaceFB -> ColorSpaceFB -> Bool
== :: ColorSpaceFB -> ColorSpaceFB -> Bool
$c== :: ColorSpaceFB -> ColorSpaceFB -> Bool
Eq, Eq ColorSpaceFB
Eq ColorSpaceFB =>
(ColorSpaceFB -> ColorSpaceFB -> Ordering)
-> (ColorSpaceFB -> ColorSpaceFB -> Bool)
-> (ColorSpaceFB -> ColorSpaceFB -> Bool)
-> (ColorSpaceFB -> ColorSpaceFB -> Bool)
-> (ColorSpaceFB -> ColorSpaceFB -> Bool)
-> (ColorSpaceFB -> ColorSpaceFB -> ColorSpaceFB)
-> (ColorSpaceFB -> ColorSpaceFB -> ColorSpaceFB)
-> Ord ColorSpaceFB
ColorSpaceFB -> ColorSpaceFB -> Bool
ColorSpaceFB -> ColorSpaceFB -> Ordering
ColorSpaceFB -> ColorSpaceFB -> ColorSpaceFB
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ColorSpaceFB -> ColorSpaceFB -> ColorSpaceFB
$cmin :: ColorSpaceFB -> ColorSpaceFB -> ColorSpaceFB
max :: ColorSpaceFB -> ColorSpaceFB -> ColorSpaceFB
$cmax :: ColorSpaceFB -> ColorSpaceFB -> ColorSpaceFB
>= :: ColorSpaceFB -> ColorSpaceFB -> Bool
$c>= :: ColorSpaceFB -> ColorSpaceFB -> Bool
> :: ColorSpaceFB -> ColorSpaceFB -> Bool
$c> :: ColorSpaceFB -> ColorSpaceFB -> Bool
<= :: ColorSpaceFB -> ColorSpaceFB -> Bool
$c<= :: ColorSpaceFB -> ColorSpaceFB -> Bool
< :: ColorSpaceFB -> ColorSpaceFB -> Bool
$c< :: ColorSpaceFB -> ColorSpaceFB -> Bool
compare :: ColorSpaceFB -> ColorSpaceFB -> Ordering
$ccompare :: ColorSpaceFB -> ColorSpaceFB -> Ordering
$cp1Ord :: Eq ColorSpaceFB
Ord, Ptr b -> Int -> IO ColorSpaceFB
Ptr b -> Int -> ColorSpaceFB -> IO ()
("colorSpaces" ::: Ptr ColorSpaceFB) -> IO ColorSpaceFB
("colorSpaces" ::: Ptr ColorSpaceFB) -> Int -> IO ColorSpaceFB
("colorSpaces" ::: Ptr ColorSpaceFB)
-> Int -> ColorSpaceFB -> IO ()
("colorSpaces" ::: Ptr ColorSpaceFB) -> ColorSpaceFB -> IO ()
ColorSpaceFB -> Int
(ColorSpaceFB -> Int)
-> (ColorSpaceFB -> Int)
-> (("colorSpaces" ::: Ptr ColorSpaceFB) -> Int -> IO ColorSpaceFB)
-> (("colorSpaces" ::: Ptr ColorSpaceFB)
    -> Int -> ColorSpaceFB -> IO ())
-> (forall b. Ptr b -> Int -> IO ColorSpaceFB)
-> (forall b. Ptr b -> Int -> ColorSpaceFB -> IO ())
-> (("colorSpaces" ::: Ptr ColorSpaceFB) -> IO ColorSpaceFB)
-> (("colorSpaces" ::: Ptr ColorSpaceFB) -> ColorSpaceFB -> IO ())
-> Storable ColorSpaceFB
forall b. Ptr b -> Int -> IO ColorSpaceFB
forall b. Ptr b -> Int -> ColorSpaceFB -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: ("colorSpaces" ::: Ptr ColorSpaceFB) -> ColorSpaceFB -> IO ()
$cpoke :: ("colorSpaces" ::: Ptr ColorSpaceFB) -> ColorSpaceFB -> IO ()
peek :: ("colorSpaces" ::: Ptr ColorSpaceFB) -> IO ColorSpaceFB
$cpeek :: ("colorSpaces" ::: Ptr ColorSpaceFB) -> IO ColorSpaceFB
pokeByteOff :: Ptr b -> Int -> ColorSpaceFB -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> ColorSpaceFB -> IO ()
peekByteOff :: Ptr b -> Int -> IO ColorSpaceFB
$cpeekByteOff :: forall b. Ptr b -> Int -> IO ColorSpaceFB
pokeElemOff :: ("colorSpaces" ::: Ptr ColorSpaceFB)
-> Int -> ColorSpaceFB -> IO ()
$cpokeElemOff :: ("colorSpaces" ::: Ptr ColorSpaceFB)
-> Int -> ColorSpaceFB -> IO ()
peekElemOff :: ("colorSpaces" ::: Ptr ColorSpaceFB) -> Int -> IO ColorSpaceFB
$cpeekElemOff :: ("colorSpaces" ::: Ptr ColorSpaceFB) -> Int -> IO ColorSpaceFB
alignment :: ColorSpaceFB -> Int
$calignment :: ColorSpaceFB -> Int
sizeOf :: ColorSpaceFB -> Int
$csizeOf :: ColorSpaceFB -> Int
Storable, ColorSpaceFB
ColorSpaceFB -> Zero ColorSpaceFB
forall a. a -> Zero a
zero :: ColorSpaceFB
$czero :: ColorSpaceFB
Zero)

-- | 'COLOR_SPACE_UNMANAGED_FB'. No color correction, not recommended for
-- production use.
pattern $bCOLOR_SPACE_UNMANAGED_FB :: ColorSpaceFB
$mCOLOR_SPACE_UNMANAGED_FB :: forall r. ColorSpaceFB -> (Void# -> r) -> (Void# -> r) -> r
COLOR_SPACE_UNMANAGED_FB = ColorSpaceFB 0
-- | 'COLOR_SPACE_REC2020_FB'. Standard Rec. 2020 chromacities. This is the
-- preferred color space for standardized color across all Oculus HMDs with
-- D65 white point.
pattern $bCOLOR_SPACE_REC2020_FB :: ColorSpaceFB
$mCOLOR_SPACE_REC2020_FB :: forall r. ColorSpaceFB -> (Void# -> r) -> (Void# -> r) -> r
COLOR_SPACE_REC2020_FB   = ColorSpaceFB 1
-- | 'COLOR_SPACE_REC709_FB'. Standard Rec. 709 chromaticities, similar to
-- sRGB.
pattern $bCOLOR_SPACE_REC709_FB :: ColorSpaceFB
$mCOLOR_SPACE_REC709_FB :: forall r. ColorSpaceFB -> (Void# -> r) -> (Void# -> r) -> r
COLOR_SPACE_REC709_FB    = ColorSpaceFB 2
-- | 'COLOR_SPACE_RIFT_CV1_FB'. Unique color space, between P3 and Adobe RGB
-- using D75 white point.
--
-- Color Space Details with Chromacity Primaries in CIE 1931 xy:
--
-- -   Red: (0.666, 0.334)
--
-- -   Green: (0.238, 0.714)
--
-- -   Blue: (0.139, 0.053)
--
-- -   White: (0.298, 0.318)
pattern $bCOLOR_SPACE_RIFT_CV1_FB :: ColorSpaceFB
$mCOLOR_SPACE_RIFT_CV1_FB :: forall r. ColorSpaceFB -> (Void# -> r) -> (Void# -> r) -> r
COLOR_SPACE_RIFT_CV1_FB  = ColorSpaceFB 3
-- | 'COLOR_SPACE_RIFT_S_FB'. Unique color space. Similar to Rec 709 using
-- D75.
--
-- Color Space Details with Chromacity Primaries in CIE 1931 xy:
--
-- -   Red: (0.640, 0.330)
--
-- -   Green: (0.292, 0.586)
--
-- -   Blue: (0.156, 0.058)
--
-- -   White: (0.298, 0.318)
pattern $bCOLOR_SPACE_RIFT_S_FB :: ColorSpaceFB
$mCOLOR_SPACE_RIFT_S_FB :: forall r. ColorSpaceFB -> (Void# -> r) -> (Void# -> r) -> r
COLOR_SPACE_RIFT_S_FB    = ColorSpaceFB 4
-- | 'COLOR_SPACE_QUEST_FB'. Unique color space. Similar to Rift CV1 using
-- D75 white point
--
-- Color Space Details with Chromacity Primaries in CIE 1931 xy:
--
-- -   Red: (0.661, 0.338)
--
-- -   Green: (0.228, 0.718)
--
-- -   Blue: (0.142, 0.042)
--
-- -   White: (0.298, 0.318)
pattern $bCOLOR_SPACE_QUEST_FB :: ColorSpaceFB
$mCOLOR_SPACE_QUEST_FB :: forall r. ColorSpaceFB -> (Void# -> r) -> (Void# -> r) -> r
COLOR_SPACE_QUEST_FB     = ColorSpaceFB 5
-- | 'COLOR_SPACE_P3_FB'. Similar to DCI-P3, but uses D65 white point
-- instead.
--
-- Color Space Details with Chromacity Primaries in CIE 1931 xy:
--
-- -   Red: (0.680, 0.320)
--
-- -   Green: (0.265, 0.690)
--
-- -   Blue: (0.150, 0.060)
--
-- -   White: (0.313, 0.329)
pattern $bCOLOR_SPACE_P3_FB :: ColorSpaceFB
$mCOLOR_SPACE_P3_FB :: forall r. ColorSpaceFB -> (Void# -> r) -> (Void# -> r) -> r
COLOR_SPACE_P3_FB        = ColorSpaceFB 6
-- | 'COLOR_SPACE_ADOBE_RGB_FB'. Standard Adobe chromacities.
pattern $bCOLOR_SPACE_ADOBE_RGB_FB :: ColorSpaceFB
$mCOLOR_SPACE_ADOBE_RGB_FB :: forall r. ColorSpaceFB -> (Void# -> r) -> (Void# -> r) -> r
COLOR_SPACE_ADOBE_RGB_FB = ColorSpaceFB 7
{-# complete COLOR_SPACE_UNMANAGED_FB,
             COLOR_SPACE_REC2020_FB,
             COLOR_SPACE_REC709_FB,
             COLOR_SPACE_RIFT_CV1_FB,
             COLOR_SPACE_RIFT_S_FB,
             COLOR_SPACE_QUEST_FB,
             COLOR_SPACE_P3_FB,
             COLOR_SPACE_ADOBE_RGB_FB :: ColorSpaceFB #-}

conNameColorSpaceFB :: String
conNameColorSpaceFB :: String
conNameColorSpaceFB = "ColorSpaceFB"

enumPrefixColorSpaceFB :: String
enumPrefixColorSpaceFB :: String
enumPrefixColorSpaceFB = "COLOR_SPACE_"

showTableColorSpaceFB :: [(ColorSpaceFB, String)]
showTableColorSpaceFB :: [(ColorSpaceFB, String)]
showTableColorSpaceFB =
  [ (ColorSpaceFB
COLOR_SPACE_UNMANAGED_FB, "UNMANAGED_FB")
  , (ColorSpaceFB
COLOR_SPACE_REC2020_FB  , "REC2020_FB")
  , (ColorSpaceFB
COLOR_SPACE_REC709_FB   , "REC709_FB")
  , (ColorSpaceFB
COLOR_SPACE_RIFT_CV1_FB , "RIFT_CV1_FB")
  , (ColorSpaceFB
COLOR_SPACE_RIFT_S_FB   , "RIFT_S_FB")
  , (ColorSpaceFB
COLOR_SPACE_QUEST_FB    , "QUEST_FB")
  , (ColorSpaceFB
COLOR_SPACE_P3_FB       , "P3_FB")
  , (ColorSpaceFB
COLOR_SPACE_ADOBE_RGB_FB, "ADOBE_RGB_FB")
  ]

instance Show ColorSpaceFB where
  showsPrec :: Int -> ColorSpaceFB -> ShowS
showsPrec = String
-> [(ColorSpaceFB, String)]
-> String
-> (ColorSpaceFB -> Int32)
-> (Int32 -> ShowS)
-> Int
-> ColorSpaceFB
-> ShowS
forall a i.
Eq a =>
String
-> [(a, String)]
-> String
-> (a -> i)
-> (i -> ShowS)
-> Int
-> a
-> ShowS
enumShowsPrec String
enumPrefixColorSpaceFB
                            [(ColorSpaceFB, String)]
showTableColorSpaceFB
                            String
conNameColorSpaceFB
                            (\(ColorSpaceFB x :: Int32
x) -> Int32
x)
                            (Int -> Int32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec 11)

instance Read ColorSpaceFB where
  readPrec :: ReadPrec ColorSpaceFB
readPrec = String
-> [(ColorSpaceFB, String)]
-> String
-> (Int32 -> ColorSpaceFB)
-> ReadPrec ColorSpaceFB
forall i a.
Read i =>
String -> [(a, String)] -> String -> (i -> a) -> ReadPrec a
enumReadPrec String
enumPrefixColorSpaceFB [(ColorSpaceFB, String)]
showTableColorSpaceFB String
conNameColorSpaceFB Int32 -> ColorSpaceFB
ColorSpaceFB


type FB_color_space_SPEC_VERSION = 1

-- No documentation found for TopLevel "XR_FB_color_space_SPEC_VERSION"
pattern FB_color_space_SPEC_VERSION :: forall a . Integral a => a
pattern $bFB_color_space_SPEC_VERSION :: a
$mFB_color_space_SPEC_VERSION :: forall r a. Integral a => a -> (Void# -> r) -> (Void# -> r) -> r
FB_color_space_SPEC_VERSION = 1


type FB_COLOR_SPACE_EXTENSION_NAME = "XR_FB_color_space"

-- No documentation found for TopLevel "XR_FB_COLOR_SPACE_EXTENSION_NAME"
pattern FB_COLOR_SPACE_EXTENSION_NAME :: forall a . (Eq a, IsString a) => a
pattern $bFB_COLOR_SPACE_EXTENSION_NAME :: a
$mFB_COLOR_SPACE_EXTENSION_NAME :: forall r a.
(Eq a, IsString a) =>
a -> (Void# -> r) -> (Void# -> r) -> r
FB_COLOR_SPACE_EXTENSION_NAME = "XR_FB_color_space"