| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Mischief.Shader.Functions
Synopsis
- sample :: Expr 'TTexture -> Expr 'TSampler -> Vec 2 Float -> Vec 4 Float
- textureDimensions :: Expr 'TTexture -> Vec 2 Uint
- unsafeCall :: forall (a :: Types). SingI a => Text -> [Param] -> Expr a
- (&) :: forall (a :: Types). (Algebric a ~ 'True, Integral a ~ 'True) => Expr a -> Expr a -> Expr a
- class Num (a :: Types) where
- (^+) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a)
- (+^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a)
- (^-) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a)
- (-^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a)
- (^*) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a)
- (*^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a)
- (*!) :: forall (n :: Nat) (m :: Nat). Float -> Mat n m -> Mat n m
- (!*) :: forall (n :: Nat) (m :: Nat). Mat n m -> Float -> Mat n m
- (^*!) :: forall (m :: Nat) (n :: Nat). Vec m Float -> Mat n m -> Vec n Float
- (!*^) :: forall (n :: Nat) (m :: Nat). Mat n m -> Vec n Float -> Vec m Float
- (!*!) :: forall (k :: Nat) (r :: Nat) (c :: Nat). Mat k r -> Mat c k -> Mat c r
- class Div (a :: Types) where
- (^/) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a)
- (/^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a)
- class Modulo (a :: Types) where
- (^%) :: forall (a :: PrimitiveTypes) (n :: Nat). Integral ('Primitive a) ~ 'True => Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a)
- (%^) :: forall (a :: PrimitiveTypes) (n :: Nat). Integral ('Primitive a) ~ 'True => Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a)
- type family ChangePrimitive a (b :: PrimitiveTypes) :: Types where ...
- class Equal (a :: Types) where
- class Comparable (a :: Types) where
- (<) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b
- (<=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b
- (>) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b
- (>=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b
- all :: forall (n :: Nat). KnownNat n => Expr ('VectorType n 'TBool) -> Boolean
- any :: forall (n :: Nat). KnownNat n => Expr ('VectorType n 'TBool) -> Boolean
- (&&) :: Boolean -> Boolean -> Boolean
- (||) :: Boolean -> Boolean -> Boolean
- pick :: forall (a :: Types) m. SingI a => [(Boolean, Shader m (Expr a))] -> Shader m (Expr a) -> Shader m (Expr a)
- pickM :: forall (a :: Types) m. SingI a => [(Shader m Boolean, Shader m (Expr a))] -> Shader m (Expr a) -> Shader m (Expr a)
- abs :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a
- acos :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- acosh :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- asin :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a
- asinh :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a
- atan :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- atanh :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- atan2 :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a
- ceil :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- clamp :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a -> Expr a -> Expr a
- cos :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- cosh :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- countLeadingZeros :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a
- countOneBits :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a
- countTrailingZeros :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a
- cross :: forall (a :: PrimitiveTypes). (SingI ('VectorType 3 a), Fractional (Expr ('Primitive a)) ~ 'True) => Expr ('VectorType 3 a) -> Expr ('VectorType 3 a) -> Expr ('VectorType 3 a)
- degrees :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- determinant :: forall (n :: Nat). SingI n => Expr ('MatrixType n n) -> Float
- distance :: forall (a :: Types) (b :: PrimitiveTypes). (SingI a, Fractional (Expr a) ~ 'True, VectorOrSingleOf a ~ b) => Expr a -> Expr a -> Expr ('Primitive b)
- dot :: forall (n :: Nat) (a :: PrimitiveTypes). (SingI ('VectorType n a), SingI a, SingI n, Algebric ('Primitive a) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('Primitive a)
- dot4U8Packed :: Uint -> Uint -> Uint
- dot4I8Packed :: Uint -> Uint -> Int
- exp :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- exp2 :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- extractBits :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Uint -> Uint -> Expr a
- faceForward :: forall (a :: PrimitiveTypes) (n :: Nat). (SingI a, SingI n, Fractional (Expr ('Primitive a)) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a)
- firstLeadingBit :: forall {k} (a :: Types) (n :: k). (SingI a, SingI n, Integral a ~ 'True) => Expr a -> Expr a
- firstTrailingBit :: forall {k} (a :: Types) (n :: k). (SingI a, SingI n, Integral a ~ 'True) => Expr a -> Expr a
- floor :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- fma :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a -> Expr a
- fract :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- insertBits :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a -> Uint -> Uint -> Expr a
- inverseSqrt :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- length :: forall {k} (a :: PrimitiveTypes) (b :: Types) (n :: k). (SingI a, SingI b, SingI n, VectorOrSingleOf b ~ a) => Expr b -> Expr ('Primitive a)
- log :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- log2 :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- max :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a -> Expr a
- min :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a -> Expr a
- class Mix (a :: k) (b :: k1)
- mix :: forall (a :: Types) (b :: Types). (SingI a, SingI b, Fractional (Expr a) ~ 'True, Fractional (Expr b) ~ 'True, Mix a b) => Expr a -> Expr a -> Expr b -> Expr a
- normalize :: forall (n :: Nat) (a :: PrimitiveTypes). (SingI n, SingI a, Fractional (Expr ('VectorType n a)) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a)
- pow :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a
- quantizeToF16 :: forall (a :: Types). (SingI a, VectorOrSingleOf a ~ 'TFloat) => Expr a -> Expr a
- radians :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- reflect :: forall (n :: Nat) (a :: PrimitiveTypes). (SingI n, SingI a, Fractional (Expr ('VectorType n a)) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a)
- refract :: forall (a :: Types) (b :: PrimitiveTypes). (SingI a, SingI b, VectorOrSingleOf a ~ b) => Expr a -> Expr a -> Expr ('Primitive b) -> Expr a
- reverseBits :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a
- round :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- saturate :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- sign :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a
- sin :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- sinh :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- smoothstep :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a -> Expr a
- sqrt :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- step :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a
- tan :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- tanh :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
- transpose :: forall (n :: Nat) (m :: Nat). (SingI n, SingI m) => Expr ('MatrixType n m) -> Expr ('MatrixType m n)
- trunc :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a
Documentation
(&) :: forall (a :: Types). (Algebric a ~ 'True, Integral a ~ 'True) => Expr a -> Expr a -> Expr a Source #
class Num (a :: Types) where Source #
Minimal complete definition
Nothing
Instances
| Num ('Primitive a) Source # | |
| Num ('MatrixType n m) Source # | |
Defined in Mischief.Shader.Functions Methods (+) :: Expr ('MatrixType n m) -> Expr ('MatrixType n m) -> Expr ('MatrixType n m) Source # (-) :: Expr ('MatrixType n m) -> Expr ('MatrixType n m) -> Expr ('MatrixType n m) Source # (*) :: Expr ('MatrixType n m) -> Expr ('MatrixType n m) -> Expr ('MatrixType n m) Source # | |
| Num ('VectorType n a) Source # | |
Defined in Mischief.Shader.Functions Methods (+) :: Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source # (-) :: Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source # (*) :: Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source # | |
(^+) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a) Source #
(+^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #
(^-) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a) Source #
(-^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #
(^*) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a) Source #
(*^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #
(^/) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a) Source #
(/^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #
(^%) :: forall (a :: PrimitiveTypes) (n :: Nat). Integral ('Primitive a) ~ 'True => Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a) Source #
(%^) :: forall (a :: PrimitiveTypes) (n :: Nat). Integral ('Primitive a) ~ 'True => Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #
type family ChangePrimitive a (b :: PrimitiveTypes) :: Types where ... Source #
Equations
| ChangePrimitive (Expr ('Primitive a)) b = 'Primitive b | |
| ChangePrimitive (Expr ('VectorType n a)) b = 'VectorType n b |
class Equal (a :: Types) where Source #
Minimal complete definition
Nothing
Methods
(==) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #
(/=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #
Instances
| Algebric a ~ 'True => Equal a Source # | |
| Equal ('Primitive 'TBool) Source # | |
Defined in Mischief.Shader.Functions Methods (==) :: forall (b :: Types). ChangePrimitive (Expr ('Primitive 'TBool)) 'TBool ~ b => Expr ('Primitive 'TBool) -> Expr ('Primitive 'TBool) -> Expr b Source # (/=) :: forall (b :: Types). ChangePrimitive (Expr ('Primitive 'TBool)) 'TBool ~ b => Expr ('Primitive 'TBool) -> Expr ('Primitive 'TBool) -> Expr b Source # | |
| Equal ('VectorType n 'TBool) Source # | |
Defined in Mischief.Shader.Functions Methods (==) :: forall (b :: Types). ChangePrimitive (Expr ('VectorType n 'TBool)) 'TBool ~ b => Expr ('VectorType n 'TBool) -> Expr ('VectorType n 'TBool) -> Expr b Source # (/=) :: forall (b :: Types). ChangePrimitive (Expr ('VectorType n 'TBool)) 'TBool ~ b => Expr ('VectorType n 'TBool) -> Expr ('VectorType n 'TBool) -> Expr b Source # | |
class Comparable (a :: Types) where Source #
Minimal complete definition
Nothing
Methods
(<) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #
(<=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #
(>) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #
(>=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #
Instances
| Algebric a ~ 'True => Comparable a Source # | |
Defined in Mischief.Shader.Functions Methods (<) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source # (<=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source # (>) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source # (>=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source # | |
pick :: forall (a :: Types) m. SingI a => [(Boolean, Shader m (Expr a))] -> Shader m (Expr a) -> Shader m (Expr a) Source #
Pass a list of tuples of conditions and branches, and an extra branch that will act as the default. Will return the result of the first branch in the list that has a positive condition. Otherwise the default.
Follow the same guidelines as for select.
Example
let x = undefined :: Float let y = undefined :: Float let z = undefined :: Float r <- pick [(x > y, pure $ vec2 5 5), (y > z, pure $ vec2 6 6) ] (pure $ vec2 1 9)
pickM :: forall (a :: Types) m. SingI a => [(Shader m Boolean, Shader m (Expr a))] -> Shader m (Expr a) -> Shader m (Expr a) Source #
atan2 :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a Source #
clamp :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a -> Expr a -> Expr a Source #
countLeadingZeros :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a Source #
countTrailingZeros :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a Source #
cross :: forall (a :: PrimitiveTypes). (SingI ('VectorType 3 a), Fractional (Expr ('Primitive a)) ~ 'True) => Expr ('VectorType 3 a) -> Expr ('VectorType 3 a) -> Expr ('VectorType 3 a) Source #
determinant :: forall (n :: Nat). SingI n => Expr ('MatrixType n n) -> Float Source #
distance :: forall (a :: Types) (b :: PrimitiveTypes). (SingI a, Fractional (Expr a) ~ 'True, VectorOrSingleOf a ~ b) => Expr a -> Expr a -> Expr ('Primitive b) Source #
dot :: forall (n :: Nat) (a :: PrimitiveTypes). (SingI ('VectorType n a), SingI a, SingI n, Algebric ('Primitive a) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('Primitive a) Source #
extractBits :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Uint -> Uint -> Expr a Source #
faceForward :: forall (a :: PrimitiveTypes) (n :: Nat). (SingI a, SingI n, Fractional (Expr ('Primitive a)) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #
firstLeadingBit :: forall {k} (a :: Types) (n :: k). (SingI a, SingI n, Integral a ~ 'True) => Expr a -> Expr a Source #
firstTrailingBit :: forall {k} (a :: Types) (n :: k). (SingI a, SingI n, Integral a ~ 'True) => Expr a -> Expr a Source #
fma :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a -> Expr a Source #
insertBits :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a -> Uint -> Uint -> Expr a Source #
inverseSqrt :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #
length :: forall {k} (a :: PrimitiveTypes) (b :: Types) (n :: k). (SingI a, SingI b, SingI n, VectorOrSingleOf b ~ a) => Expr b -> Expr ('Primitive a) Source #
class Mix (a :: k) (b :: k1) Source #
Instances
| Mix (a :: k) (a :: k) Source # | |
Defined in Mischief.Shader.Functions | |
| Mix ('VectorType n a :: Types) ('Primitive a :: Types) Source # | |
Defined in Mischief.Shader.Functions | |
mix :: forall (a :: Types) (b :: Types). (SingI a, SingI b, Fractional (Expr a) ~ 'True, Fractional (Expr b) ~ 'True, Mix a b) => Expr a -> Expr a -> Expr b -> Expr a Source #
normalize :: forall (n :: Nat) (a :: PrimitiveTypes). (SingI n, SingI a, Fractional (Expr ('VectorType n a)) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a) Source #
pow :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a Source #
quantizeToF16 :: forall (a :: Types). (SingI a, VectorOrSingleOf a ~ 'TFloat) => Expr a -> Expr a Source #
reflect :: forall (n :: Nat) (a :: PrimitiveTypes). (SingI n, SingI a, Fractional (Expr ('VectorType n a)) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #
refract :: forall (a :: Types) (b :: PrimitiveTypes). (SingI a, SingI b, VectorOrSingleOf a ~ b) => Expr a -> Expr a -> Expr ('Primitive b) -> Expr a Source #
saturate :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #
smoothstep :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a -> Expr a Source #
step :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a Source #