{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TypeSynonymInstances #-}

module Data.SpirV.Enum.MemoryModel where

import Data.Word (Word32)
import Foreign.Storable (Storable)

newtype MemoryModel = MemoryModel Word32
  deriving newtype (MemoryModel -> MemoryModel -> Bool
(MemoryModel -> MemoryModel -> Bool)
-> (MemoryModel -> MemoryModel -> Bool) -> Eq MemoryModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MemoryModel -> MemoryModel -> Bool
== :: MemoryModel -> MemoryModel -> Bool
$c/= :: MemoryModel -> MemoryModel -> Bool
/= :: MemoryModel -> MemoryModel -> Bool
Eq, Eq MemoryModel
Eq MemoryModel =>
(MemoryModel -> MemoryModel -> Ordering)
-> (MemoryModel -> MemoryModel -> Bool)
-> (MemoryModel -> MemoryModel -> Bool)
-> (MemoryModel -> MemoryModel -> Bool)
-> (MemoryModel -> MemoryModel -> Bool)
-> (MemoryModel -> MemoryModel -> MemoryModel)
-> (MemoryModel -> MemoryModel -> MemoryModel)
-> Ord MemoryModel
MemoryModel -> MemoryModel -> Bool
MemoryModel -> MemoryModel -> Ordering
MemoryModel -> MemoryModel -> MemoryModel
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
$ccompare :: MemoryModel -> MemoryModel -> Ordering
compare :: MemoryModel -> MemoryModel -> Ordering
$c< :: MemoryModel -> MemoryModel -> Bool
< :: MemoryModel -> MemoryModel -> Bool
$c<= :: MemoryModel -> MemoryModel -> Bool
<= :: MemoryModel -> MemoryModel -> Bool
$c> :: MemoryModel -> MemoryModel -> Bool
> :: MemoryModel -> MemoryModel -> Bool
$c>= :: MemoryModel -> MemoryModel -> Bool
>= :: MemoryModel -> MemoryModel -> Bool
$cmax :: MemoryModel -> MemoryModel -> MemoryModel
max :: MemoryModel -> MemoryModel -> MemoryModel
$cmin :: MemoryModel -> MemoryModel -> MemoryModel
min :: MemoryModel -> MemoryModel -> MemoryModel
Ord, Ptr MemoryModel -> IO MemoryModel
Ptr MemoryModel -> Int -> IO MemoryModel
Ptr MemoryModel -> Int -> MemoryModel -> IO ()
Ptr MemoryModel -> MemoryModel -> IO ()
MemoryModel -> Int
(MemoryModel -> Int)
-> (MemoryModel -> Int)
-> (Ptr MemoryModel -> Int -> IO MemoryModel)
-> (Ptr MemoryModel -> Int -> MemoryModel -> IO ())
-> (forall b. Ptr b -> Int -> IO MemoryModel)
-> (forall b. Ptr b -> Int -> MemoryModel -> IO ())
-> (Ptr MemoryModel -> IO MemoryModel)
-> (Ptr MemoryModel -> MemoryModel -> IO ())
-> Storable MemoryModel
forall b. Ptr b -> Int -> IO MemoryModel
forall b. Ptr b -> Int -> MemoryModel -> 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
$csizeOf :: MemoryModel -> Int
sizeOf :: MemoryModel -> Int
$calignment :: MemoryModel -> Int
alignment :: MemoryModel -> Int
$cpeekElemOff :: Ptr MemoryModel -> Int -> IO MemoryModel
peekElemOff :: Ptr MemoryModel -> Int -> IO MemoryModel
$cpokeElemOff :: Ptr MemoryModel -> Int -> MemoryModel -> IO ()
pokeElemOff :: Ptr MemoryModel -> Int -> MemoryModel -> IO ()
$cpeekByteOff :: forall b. Ptr b -> Int -> IO MemoryModel
peekByteOff :: forall b. Ptr b -> Int -> IO MemoryModel
$cpokeByteOff :: forall b. Ptr b -> Int -> MemoryModel -> IO ()
pokeByteOff :: forall b. Ptr b -> Int -> MemoryModel -> IO ()
$cpeek :: Ptr MemoryModel -> IO MemoryModel
peek :: Ptr MemoryModel -> IO MemoryModel
$cpoke :: Ptr MemoryModel -> MemoryModel -> IO ()
poke :: Ptr MemoryModel -> MemoryModel -> IO ()
Storable)

instance Show MemoryModel where
  showsPrec :: Int -> MemoryModel -> ShowS
showsPrec Int
p (MemoryModel Word32
v) = case Word32
v of
    Word32
0 -> String -> ShowS
showString String
"Simple"
    Word32
1 -> String -> ShowS
showString String
"GLSL450"
    Word32
2 -> String -> ShowS
showString String
"OpenCL"
    Word32
3 -> String -> ShowS
showString String
"Vulkan"
    Word32
x -> Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ String -> ShowS
showString String
"MemoryModel " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec (Int
p Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) Word32
x

pattern Simple :: MemoryModel
pattern $mSimple :: forall {r}. MemoryModel -> ((# #) -> r) -> ((# #) -> r) -> r
$bSimple :: MemoryModel
Simple = MemoryModel 0

pattern GLSL450 :: MemoryModel
pattern $mGLSL450 :: forall {r}. MemoryModel -> ((# #) -> r) -> ((# #) -> r) -> r
$bGLSL450 :: MemoryModel
GLSL450 = MemoryModel 1

pattern OpenCL :: MemoryModel
pattern $mOpenCL :: forall {r}. MemoryModel -> ((# #) -> r) -> ((# #) -> r) -> r
$bOpenCL :: MemoryModel
OpenCL = MemoryModel 2

pattern Vulkan :: MemoryModel
pattern $mVulkan :: forall {r}. MemoryModel -> ((# #) -> r) -> ((# #) -> r) -> r
$bVulkan :: MemoryModel
Vulkan = MemoryModel 3

pattern VulkanKHR :: MemoryModel
pattern $mVulkanKHR :: forall {r}. MemoryModel -> ((# #) -> r) -> ((# #) -> r) -> r
$bVulkanKHR :: MemoryModel
VulkanKHR = MemoryModel 3