module Data.SpirV.Reflect.Traits where

import Data.Vector.Storable qualified as Storable
import Data.Word (Word32)
import GHC.Generics (Generic)

import Data.SpirV.Reflect.Enums qualified as Enums

data Numeric = Numeric
  { Numeric -> Scalar
scalar :: Scalar
  , Numeric -> Vector
vector :: Vector
  , Numeric -> Matrix
matrix :: Matrix
  }
  deriving (Numeric -> Numeric -> Bool
(Numeric -> Numeric -> Bool)
-> (Numeric -> Numeric -> Bool) -> Eq Numeric
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Numeric -> Numeric -> Bool
$c/= :: Numeric -> Numeric -> Bool
== :: Numeric -> Numeric -> Bool
$c== :: Numeric -> Numeric -> Bool
Eq, Eq Numeric
Eq Numeric
-> (Numeric -> Numeric -> Ordering)
-> (Numeric -> Numeric -> Bool)
-> (Numeric -> Numeric -> Bool)
-> (Numeric -> Numeric -> Bool)
-> (Numeric -> Numeric -> Bool)
-> (Numeric -> Numeric -> Numeric)
-> (Numeric -> Numeric -> Numeric)
-> Ord Numeric
Numeric -> Numeric -> Bool
Numeric -> Numeric -> Ordering
Numeric -> Numeric -> Numeric
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 :: Numeric -> Numeric -> Numeric
$cmin :: Numeric -> Numeric -> Numeric
max :: Numeric -> Numeric -> Numeric
$cmax :: Numeric -> Numeric -> Numeric
>= :: Numeric -> Numeric -> Bool
$c>= :: Numeric -> Numeric -> Bool
> :: Numeric -> Numeric -> Bool
$c> :: Numeric -> Numeric -> Bool
<= :: Numeric -> Numeric -> Bool
$c<= :: Numeric -> Numeric -> Bool
< :: Numeric -> Numeric -> Bool
$c< :: Numeric -> Numeric -> Bool
compare :: Numeric -> Numeric -> Ordering
$ccompare :: Numeric -> Numeric -> Ordering
$cp1Ord :: Eq Numeric
Ord, Int -> Numeric -> ShowS
[Numeric] -> ShowS
Numeric -> String
(Int -> Numeric -> ShowS)
-> (Numeric -> String) -> ([Numeric] -> ShowS) -> Show Numeric
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Numeric] -> ShowS
$cshowList :: [Numeric] -> ShowS
show :: Numeric -> String
$cshow :: Numeric -> String
showsPrec :: Int -> Numeric -> ShowS
$cshowsPrec :: Int -> Numeric -> ShowS
Show, (forall x. Numeric -> Rep Numeric x)
-> (forall x. Rep Numeric x -> Numeric) -> Generic Numeric
forall x. Rep Numeric x -> Numeric
forall x. Numeric -> Rep Numeric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Numeric x -> Numeric
$cfrom :: forall x. Numeric -> Rep Numeric x
Generic)

data Scalar = Scalar
  { Scalar -> Word32
width      :: Word32
  , Scalar -> Word32
signedness :: Word32
  }
  deriving (Scalar -> Scalar -> Bool
(Scalar -> Scalar -> Bool)
-> (Scalar -> Scalar -> Bool) -> Eq Scalar
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scalar -> Scalar -> Bool
$c/= :: Scalar -> Scalar -> Bool
== :: Scalar -> Scalar -> Bool
$c== :: Scalar -> Scalar -> Bool
Eq, Eq Scalar
Eq Scalar
-> (Scalar -> Scalar -> Ordering)
-> (Scalar -> Scalar -> Bool)
-> (Scalar -> Scalar -> Bool)
-> (Scalar -> Scalar -> Bool)
-> (Scalar -> Scalar -> Bool)
-> (Scalar -> Scalar -> Scalar)
-> (Scalar -> Scalar -> Scalar)
-> Ord Scalar
Scalar -> Scalar -> Bool
Scalar -> Scalar -> Ordering
Scalar -> Scalar -> Scalar
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 :: Scalar -> Scalar -> Scalar
$cmin :: Scalar -> Scalar -> Scalar
max :: Scalar -> Scalar -> Scalar
$cmax :: Scalar -> Scalar -> Scalar
>= :: Scalar -> Scalar -> Bool
$c>= :: Scalar -> Scalar -> Bool
> :: Scalar -> Scalar -> Bool
$c> :: Scalar -> Scalar -> Bool
<= :: Scalar -> Scalar -> Bool
$c<= :: Scalar -> Scalar -> Bool
< :: Scalar -> Scalar -> Bool
$c< :: Scalar -> Scalar -> Bool
compare :: Scalar -> Scalar -> Ordering
$ccompare :: Scalar -> Scalar -> Ordering
$cp1Ord :: Eq Scalar
Ord, Int -> Scalar -> ShowS
[Scalar] -> ShowS
Scalar -> String
(Int -> Scalar -> ShowS)
-> (Scalar -> String) -> ([Scalar] -> ShowS) -> Show Scalar
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scalar] -> ShowS
$cshowList :: [Scalar] -> ShowS
show :: Scalar -> String
$cshow :: Scalar -> String
showsPrec :: Int -> Scalar -> ShowS
$cshowsPrec :: Int -> Scalar -> ShowS
Show, (forall x. Scalar -> Rep Scalar x)
-> (forall x. Rep Scalar x -> Scalar) -> Generic Scalar
forall x. Rep Scalar x -> Scalar
forall x. Scalar -> Rep Scalar x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Scalar x -> Scalar
$cfrom :: forall x. Scalar -> Rep Scalar x
Generic)

data Vector = Vector
  { Vector -> Word32
component_count :: Word32
  }
  deriving (Vector -> Vector -> Bool
(Vector -> Vector -> Bool)
-> (Vector -> Vector -> Bool) -> Eq Vector
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Vector -> Vector -> Bool
$c/= :: Vector -> Vector -> Bool
== :: Vector -> Vector -> Bool
$c== :: Vector -> Vector -> Bool
Eq, Eq Vector
Eq Vector
-> (Vector -> Vector -> Ordering)
-> (Vector -> Vector -> Bool)
-> (Vector -> Vector -> Bool)
-> (Vector -> Vector -> Bool)
-> (Vector -> Vector -> Bool)
-> (Vector -> Vector -> Vector)
-> (Vector -> Vector -> Vector)
-> Ord Vector
Vector -> Vector -> Bool
Vector -> Vector -> Ordering
Vector -> Vector -> Vector
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 :: Vector -> Vector -> Vector
$cmin :: Vector -> Vector -> Vector
max :: Vector -> Vector -> Vector
$cmax :: Vector -> Vector -> Vector
>= :: Vector -> Vector -> Bool
$c>= :: Vector -> Vector -> Bool
> :: Vector -> Vector -> Bool
$c> :: Vector -> Vector -> Bool
<= :: Vector -> Vector -> Bool
$c<= :: Vector -> Vector -> Bool
< :: Vector -> Vector -> Bool
$c< :: Vector -> Vector -> Bool
compare :: Vector -> Vector -> Ordering
$ccompare :: Vector -> Vector -> Ordering
$cp1Ord :: Eq Vector
Ord, Int -> Vector -> ShowS
[Vector] -> ShowS
Vector -> String
(Int -> Vector -> ShowS)
-> (Vector -> String) -> ([Vector] -> ShowS) -> Show Vector
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Vector] -> ShowS
$cshowList :: [Vector] -> ShowS
show :: Vector -> String
$cshow :: Vector -> String
showsPrec :: Int -> Vector -> ShowS
$cshowsPrec :: Int -> Vector -> ShowS
Show, (forall x. Vector -> Rep Vector x)
-> (forall x. Rep Vector x -> Vector) -> Generic Vector
forall x. Rep Vector x -> Vector
forall x. Vector -> Rep Vector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Vector x -> Vector
$cfrom :: forall x. Vector -> Rep Vector x
Generic)

data Matrix = Matrix
  { Matrix -> Word32
column_count :: Word32
  , Matrix -> Word32
row_count    :: Word32
  , Matrix -> Word32
stride       :: Word32 -- ^ Measured in bytes
  }
  deriving (Matrix -> Matrix -> Bool
(Matrix -> Matrix -> Bool)
-> (Matrix -> Matrix -> Bool) -> Eq Matrix
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Matrix -> Matrix -> Bool
$c/= :: Matrix -> Matrix -> Bool
== :: Matrix -> Matrix -> Bool
$c== :: Matrix -> Matrix -> Bool
Eq, Eq Matrix
Eq Matrix
-> (Matrix -> Matrix -> Ordering)
-> (Matrix -> Matrix -> Bool)
-> (Matrix -> Matrix -> Bool)
-> (Matrix -> Matrix -> Bool)
-> (Matrix -> Matrix -> Bool)
-> (Matrix -> Matrix -> Matrix)
-> (Matrix -> Matrix -> Matrix)
-> Ord Matrix
Matrix -> Matrix -> Bool
Matrix -> Matrix -> Ordering
Matrix -> Matrix -> Matrix
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 :: Matrix -> Matrix -> Matrix
$cmin :: Matrix -> Matrix -> Matrix
max :: Matrix -> Matrix -> Matrix
$cmax :: Matrix -> Matrix -> Matrix
>= :: Matrix -> Matrix -> Bool
$c>= :: Matrix -> Matrix -> Bool
> :: Matrix -> Matrix -> Bool
$c> :: Matrix -> Matrix -> Bool
<= :: Matrix -> Matrix -> Bool
$c<= :: Matrix -> Matrix -> Bool
< :: Matrix -> Matrix -> Bool
$c< :: Matrix -> Matrix -> Bool
compare :: Matrix -> Matrix -> Ordering
$ccompare :: Matrix -> Matrix -> Ordering
$cp1Ord :: Eq Matrix
Ord, Int -> Matrix -> ShowS
[Matrix] -> ShowS
Matrix -> String
(Int -> Matrix -> ShowS)
-> (Matrix -> String) -> ([Matrix] -> ShowS) -> Show Matrix
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Matrix] -> ShowS
$cshowList :: [Matrix] -> ShowS
show :: Matrix -> String
$cshow :: Matrix -> String
showsPrec :: Int -> Matrix -> ShowS
$cshowsPrec :: Int -> Matrix -> ShowS
Show, (forall x. Matrix -> Rep Matrix x)
-> (forall x. Rep Matrix x -> Matrix) -> Generic Matrix
forall x. Rep Matrix x -> Matrix
forall x. Matrix -> Rep Matrix x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Matrix x -> Matrix
$cfrom :: forall x. Matrix -> Rep Matrix x
Generic)

data Array = Array
  { Array -> Word32
dims_count :: Word32
  , Array -> Vector Word32
dims       :: Storable.Vector Word32
  , Array -> Maybe Word32
stride     :: Maybe Word32
  }
  deriving (Array -> Array -> Bool
(Array -> Array -> Bool) -> (Array -> Array -> Bool) -> Eq Array
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Array -> Array -> Bool
$c/= :: Array -> Array -> Bool
== :: Array -> Array -> Bool
$c== :: Array -> Array -> Bool
Eq, Eq Array
Eq Array
-> (Array -> Array -> Ordering)
-> (Array -> Array -> Bool)
-> (Array -> Array -> Bool)
-> (Array -> Array -> Bool)
-> (Array -> Array -> Bool)
-> (Array -> Array -> Array)
-> (Array -> Array -> Array)
-> Ord Array
Array -> Array -> Bool
Array -> Array -> Ordering
Array -> Array -> Array
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 :: Array -> Array -> Array
$cmin :: Array -> Array -> Array
max :: Array -> Array -> Array
$cmax :: Array -> Array -> Array
>= :: Array -> Array -> Bool
$c>= :: Array -> Array -> Bool
> :: Array -> Array -> Bool
$c> :: Array -> Array -> Bool
<= :: Array -> Array -> Bool
$c<= :: Array -> Array -> Bool
< :: Array -> Array -> Bool
$c< :: Array -> Array -> Bool
compare :: Array -> Array -> Ordering
$ccompare :: Array -> Array -> Ordering
$cp1Ord :: Eq Array
Ord, Int -> Array -> ShowS
[Array] -> ShowS
Array -> String
(Int -> Array -> ShowS)
-> (Array -> String) -> ([Array] -> ShowS) -> Show Array
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Array] -> ShowS
$cshowList :: [Array] -> ShowS
show :: Array -> String
$cshow :: Array -> String
showsPrec :: Int -> Array -> ShowS
$cshowsPrec :: Int -> Array -> ShowS
Show, (forall x. Array -> Rep Array x)
-> (forall x. Rep Array x -> Array) -> Generic Array
forall x. Rep Array x -> Array
forall x. Array -> Rep Array x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Array x -> Array
$cfrom :: forall x. Array -> Rep Array x
Generic)

data Image = Image
  { Image -> Dim
dim          :: Enums.Dim
  , Image -> Word32
depth        :: Word32
  , Image -> Word32
arrayed      :: Word32
  , Image -> Word32
ms           :: Word32 -- ^ 0: single-sampled, 1: multisampled
  , Image -> Word32
sampled      :: Word32
  , Image -> ImageFormat
image_format :: Enums.ImageFormat
  }
  deriving (Image -> Image -> Bool
(Image -> Image -> Bool) -> (Image -> Image -> Bool) -> Eq Image
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Image -> Image -> Bool
$c/= :: Image -> Image -> Bool
== :: Image -> Image -> Bool
$c== :: Image -> Image -> Bool
Eq, Eq Image
Eq Image
-> (Image -> Image -> Ordering)
-> (Image -> Image -> Bool)
-> (Image -> Image -> Bool)
-> (Image -> Image -> Bool)
-> (Image -> Image -> Bool)
-> (Image -> Image -> Image)
-> (Image -> Image -> Image)
-> Ord Image
Image -> Image -> Bool
Image -> Image -> Ordering
Image -> Image -> Image
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 :: Image -> Image -> Image
$cmin :: Image -> Image -> Image
max :: Image -> Image -> Image
$cmax :: Image -> Image -> Image
>= :: Image -> Image -> Bool
$c>= :: Image -> Image -> Bool
> :: Image -> Image -> Bool
$c> :: Image -> Image -> Bool
<= :: Image -> Image -> Bool
$c<= :: Image -> Image -> Bool
< :: Image -> Image -> Bool
$c< :: Image -> Image -> Bool
compare :: Image -> Image -> Ordering
$ccompare :: Image -> Image -> Ordering
$cp1Ord :: Eq Image
Ord, Int -> Image -> ShowS
[Image] -> ShowS
Image -> String
(Int -> Image -> ShowS)
-> (Image -> String) -> ([Image] -> ShowS) -> Show Image
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Image] -> ShowS
$cshowList :: [Image] -> ShowS
show :: Image -> String
$cshow :: Image -> String
showsPrec :: Int -> Image -> ShowS
$cshowsPrec :: Int -> Image -> ShowS
Show, (forall x. Image -> Rep Image x)
-> (forall x. Rep Image x -> Image) -> Generic Image
forall x. Rep Image x -> Image
forall x. Image -> Rep Image x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Image x -> Image
$cfrom :: forall x. Image -> Rep Image x
Generic)