GPipe-2.2.5: Typesafe functional GPU graphics programming

Safe HaskellNone
LanguageHaskell98

Graphics.GPipe.Expr

Contents

Description

This module provides the DSL for shader operations in GPipe. The type S x a is an opaque type that represents a value of type a in a shader stage x, eg S F Float means a floating point value in a fragment stream.

Synopsis

Atomic shader type

data S x a Source #

Instances
FragmentInput VBool Source # 
Instance details

Defined in Graphics.GPipe.Internal.FragmentStream

Associated Types

type FragmentFormat VBool :: Type Source #

FragmentInput VWord Source # 
Instance details

Defined in Graphics.GPipe.Internal.FragmentStream

Associated Types

type FragmentFormat VWord :: Type Source #

FragmentInput VInt Source # 
Instance details

Defined in Graphics.GPipe.Internal.FragmentStream

Associated Types

type FragmentFormat VInt :: Type Source #

FragmentInput VFloat Source # 
Instance details

Defined in Graphics.GPipe.Internal.FragmentStream

Associated Types

type FragmentFormat VFloat :: Type Source #

Floating (S a Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

pi :: S a Float #

exp :: S a Float -> S a Float #

log :: S a Float -> S a Float #

sqrt :: S a Float -> S a Float #

(**) :: S a Float -> S a Float -> S a Float #

logBase :: S a Float -> S a Float -> S a Float #

sin :: S a Float -> S a Float #

cos :: S a Float -> S a Float #

tan :: S a Float -> S a Float #

asin :: S a Float -> S a Float #

acos :: S a Float -> S a Float #

atan :: S a Float -> S a Float #

sinh :: S a Float -> S a Float #

cosh :: S a Float -> S a Float #

tanh :: S a Float -> S a Float #

asinh :: S a Float -> S a Float #

acosh :: S a Float -> S a Float #

atanh :: S a Float -> S a Float #

log1p :: S a Float -> S a Float #

expm1 :: S a Float -> S a Float #

log1pexp :: S a Float -> S a Float #

log1mexp :: S a Float -> S a Float #

Fractional (S a Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

(/) :: S a Float -> S a Float -> S a Float #

recip :: S a Float -> S a Float #

fromRational :: Rational -> S a Float #

Num (S a Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

(+) :: S a Word -> S a Word -> S a Word #

(-) :: S a Word -> S a Word -> S a Word #

(*) :: S a Word -> S a Word -> S a Word #

negate :: S a Word -> S a Word #

abs :: S a Word -> S a Word #

signum :: S a Word -> S a Word #

fromInteger :: Integer -> S a Word #

Num (S a Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

(+) :: S a Int -> S a Int -> S a Int #

(-) :: S a Int -> S a Int -> S a Int #

(*) :: S a Int -> S a Int -> S a Int #

negate :: S a Int -> S a Int #

abs :: S a Int -> S a Int #

signum :: S a Int -> S a Int #

fromInteger :: Integer -> S a Int #

Num (S a Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

(+) :: S a Float -> S a Float -> S a Float #

(-) :: S a Float -> S a Float -> S a Float #

(*) :: S a Float -> S a Float -> S a Float #

negate :: S a Float -> S a Float #

abs :: S a Float -> S a Float #

signum :: S a Float -> S a Float #

fromInteger :: Integer -> S a Float #

Boolean (S a Bool) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

true :: S a Bool #

false :: S a Bool #

notB :: S a Bool -> S a Bool #

(&&*) :: S a Bool -> S a Bool -> S a Bool #

(||*) :: S a Bool -> S a Bool -> S a Bool #

IfB (S a Bool) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

ifB :: bool ~ BooleanOf (S a Bool) => bool -> S a Bool -> S a Bool -> S a Bool #

IfB (S a Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

ifB :: bool ~ BooleanOf (S a Word) => bool -> S a Word -> S a Word -> S a Word #

IfB (S a Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

ifB :: bool ~ BooleanOf (S a Int) => bool -> S a Int -> S a Int -> S a Int #

IfB (S a Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

ifB :: bool ~ BooleanOf (S a Float) => bool -> S a Float -> S a Float -> S a Float #

Eq x => EqB (S a x) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

(==*) :: bool ~ BooleanOf (S a x) => S a x -> S a x -> bool #

(/=*) :: bool ~ BooleanOf (S a x) => S a x -> S a x -> bool #

Ord x => OrdB (S a x) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

(<*) :: bool ~ BooleanOf (S a x) => S a x -> S a x -> bool #

(<=*) :: bool ~ BooleanOf (S a x) => S a x -> S a x -> bool #

(>*) :: bool ~ BooleanOf (S a x) => S a x -> S a x -> bool #

(>=*) :: bool ~ BooleanOf (S a x) => S a x -> S a x -> bool #

Conjugate (S a Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

conjugate :: S a Word -> S a Word #

Conjugate (S a Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

conjugate :: S a Int -> S a Int #

Conjugate (S a Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

conjugate :: S a Float -> S a Float #

TrivialConjugate (S a Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

TrivialConjugate (S a Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

TrivialConjugate (S a Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Convert (S x Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ConvertFloat (S x Word) :: Type Source #

type ConvertInt (S x Word) :: Type Source #

type ConvertWord (S x Word) :: Type Source #

Convert (S x Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ConvertFloat (S x Int) :: Type Source #

type ConvertInt (S x Int) :: Type Source #

type ConvertWord (S x Int) :: Type Source #

Methods

toFloat :: S x Int -> ConvertFloat (S x Int) Source #

toInt :: S x Int -> ConvertInt (S x Int) Source #

toWord :: S x Int -> ConvertWord (S x Int) Source #

Convert (S x Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ConvertFloat (S x Float) :: Type Source #

type ConvertInt (S x Float) :: Type Source #

type ConvertWord (S x Float) :: Type Source #

FloatingOrd (S x Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

clamp :: S x Float -> S x Float -> S x Float -> S x Float Source #

saturate :: S x Float -> S x Float Source #

step :: S x Float -> S x Float -> S x Float Source #

smoothstep :: S x Float -> S x Float -> S x Float -> S x Float Source #

Real' (S x Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

rsqrt :: S x Float -> S x Float Source #

exp2 :: S x Float -> S x Float Source #

log2 :: S x Float -> S x Float Source #

floor' :: S x Float -> S x Float Source #

ceiling' :: S x Float -> S x Float Source #

fract' :: S x Float -> S x Float Source #

mod'' :: S x Float -> S x Float -> S x Float Source #

mix :: S x Float -> S x Float -> S x Float -> S x Float Source #

atan2' :: S x Float -> S x Float -> S x Float Source #

Integral' (S a Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: S a Word -> S a Word -> S a Word Source #

mod' :: S a Word -> S a Word -> S a Word Source #

Integral' (S a Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: S a Int -> S a Int -> S a Int Source #

mod' :: S a Int -> S a Int -> S a Int Source #

ShaderType (S x Bool) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (S x Bool) :: Type Source #

Methods

toBase :: x -> S x Bool -> ShaderBase (ShaderBaseType (S x Bool)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (S x Bool)) x -> S x Bool Source #

ShaderType (S x Word) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (S x Word) :: Type Source #

Methods

toBase :: x -> S x Word -> ShaderBase (ShaderBaseType (S x Word)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (S x Word)) x -> S x Word Source #

ShaderType (S x Int) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (S x Int) :: Type Source #

Methods

toBase :: x -> S x Int -> ShaderBase (ShaderBaseType (S x Int)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (S x Int)) x -> S x Int Source #

ShaderType (S x Float) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (S x Float) :: Type Source #

type FragmentFormat VBool Source # 
Instance details

Defined in Graphics.GPipe.Internal.FragmentStream

type FragmentFormat VWord Source # 
Instance details

Defined in Graphics.GPipe.Internal.FragmentStream

type FragmentFormat VInt Source # 
Instance details

Defined in Graphics.GPipe.Internal.FragmentStream

type FragmentFormat VFloat Source # 
Instance details

Defined in Graphics.GPipe.Internal.FragmentStream

type BooleanOf (S a x) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type BooleanOf (S a x) = S a Bool
type ConvertFloat (S x Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ConvertFloat (S x Word) = S x Float
type ConvertFloat (S x Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ConvertFloat (S x Int) = S x Float
type ConvertFloat (S x Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ConvertFloat (S x Float) = S x Float
type ConvertInt (S x Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ConvertInt (S x Word) = S x Int
type ConvertInt (S x Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ConvertInt (S x Int) = S x Int
type ConvertInt (S x Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ConvertInt (S x Float) = S x Int
type ConvertWord (S x Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ConvertWord (S x Word) = S x Word
type ConvertWord (S x Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ConvertWord (S x Int) = S x Word
type ConvertWord (S x Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ConvertWord (S x Float) = S x Word
type ShaderBaseType (S x Bool) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ShaderBaseType (S x Bool) = S x Bool
type ShaderBaseType (S x Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ShaderBaseType (S x Word) = S x Word
type ShaderBaseType (S x Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

type ShaderBaseType (S x Int) = S x Int
type ShaderBaseType (S x Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

data V Source #

Phantom type used as first argument in S V a that denotes that the shader value is a vertex value

data F Source #

Phantom type used as first argument in S F a that denotes that the shader value is a fragment value

type VInt = S V Int Source #

type VWord = S V Word Source #

type VBool = S V Bool Source #

type FInt = S F Int Source #

type FWord = S F Word Source #

type FBool = S F Bool Source #

Type classes where the Prelude ones are lacking

class Convert a where Source #

Provides a common way to convert numeric types to integer and floating point representations.

Associated Types

type ConvertFloat a Source #

type ConvertInt a Source #

type ConvertWord a Source #

Methods

toFloat :: a -> ConvertFloat a Source #

Convert to a floating point number.

toInt :: a -> ConvertInt a Source #

Convert to an integral number, using truncation if necessary.

toWord :: a -> ConvertWord a Source #

Convert to an unsigned integral number, using truncation if necessary.

Instances
Convert Float Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Convert Int Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ConvertFloat Int :: Type Source #

type ConvertInt Int :: Type Source #

type ConvertWord Int :: Type Source #

Convert Word Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ConvertFloat Word :: Type Source #

type ConvertInt Word :: Type Source #

type ConvertWord Word :: Type Source #

Convert (S x Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ConvertFloat (S x Word) :: Type Source #

type ConvertInt (S x Word) :: Type Source #

type ConvertWord (S x Word) :: Type Source #

Convert (S x Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ConvertFloat (S x Int) :: Type Source #

type ConvertInt (S x Int) :: Type Source #

type ConvertWord (S x Int) :: Type Source #

Methods

toFloat :: S x Int -> ConvertFloat (S x Int) Source #

toInt :: S x Int -> ConvertInt (S x Int) Source #

toWord :: S x Int -> ConvertWord (S x Int) Source #

Convert (S x Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ConvertFloat (S x Float) :: Type Source #

type ConvertInt (S x Float) :: Type Source #

type ConvertWord (S x Float) :: Type Source #

class Integral' a where Source #

Methods

div' :: a -> a -> a Source #

mod' :: a -> a -> a Source #

Instances
Integral' Int Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: Int -> Int -> Int Source #

mod' :: Int -> Int -> Int Source #

Integral' Int8 Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: Int8 -> Int8 -> Int8 Source #

mod' :: Int8 -> Int8 -> Int8 Source #

Integral' Int16 Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: Int16 -> Int16 -> Int16 Source #

mod' :: Int16 -> Int16 -> Int16 Source #

Integral' Int32 Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: Int32 -> Int32 -> Int32 Source #

mod' :: Int32 -> Int32 -> Int32 Source #

Integral' Word Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: Word -> Word -> Word Source #

mod' :: Word -> Word -> Word Source #

Integral' Word8 Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: Word8 -> Word8 -> Word8 Source #

mod' :: Word8 -> Word8 -> Word8 Source #

Integral' Word16 Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Integral' Word32 Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Integral' a => Integral' (V0 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: V0 a -> V0 a -> V0 a Source #

mod' :: V0 a -> V0 a -> V0 a Source #

Integral' a => Integral' (V4 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: V4 a -> V4 a -> V4 a Source #

mod' :: V4 a -> V4 a -> V4 a Source #

Integral' a => Integral' (V3 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: V3 a -> V3 a -> V3 a Source #

mod' :: V3 a -> V3 a -> V3 a Source #

Integral' a => Integral' (V2 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: V2 a -> V2 a -> V2 a Source #

mod' :: V2 a -> V2 a -> V2 a Source #

Integral' a => Integral' (V1 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: V1 a -> V1 a -> V1 a Source #

mod' :: V1 a -> V1 a -> V1 a Source #

Integral' (S a Word) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: S a Word -> S a Word -> S a Word Source #

mod' :: S a Word -> S a Word -> S a Word Source #

Integral' (S a Int) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

div' :: S a Int -> S a Int -> S a Int Source #

mod' :: S a Int -> S a Int -> S a Int Source #

class Floating a => Real' a where Source #

This class provides the GPU functions either not found in Prelude's numerical classes, or that has wrong types. Instances are also provided for normal Floats and Doubles.

Minimal complete definition

(floor' | ceiling'), atan2'

Methods

rsqrt :: a -> a Source #

exp2 :: a -> a Source #

log2 :: a -> a Source #

floor' :: a -> a Source #

ceiling' :: a -> a Source #

fract' :: a -> a Source #

mod'' :: a -> a -> a Source #

mix :: a -> a -> a -> a Source #

atan2' :: a -> a -> a Source #

Instances
Real' Double Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Real' Float Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Real' a => Real' (V0 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

rsqrt :: V0 a -> V0 a Source #

exp2 :: V0 a -> V0 a Source #

log2 :: V0 a -> V0 a Source #

floor' :: V0 a -> V0 a Source #

ceiling' :: V0 a -> V0 a Source #

fract' :: V0 a -> V0 a Source #

mod'' :: V0 a -> V0 a -> V0 a Source #

mix :: V0 a -> V0 a -> V0 a -> V0 a Source #

atan2' :: V0 a -> V0 a -> V0 a Source #

Real' a => Real' (V4 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

rsqrt :: V4 a -> V4 a Source #

exp2 :: V4 a -> V4 a Source #

log2 :: V4 a -> V4 a Source #

floor' :: V4 a -> V4 a Source #

ceiling' :: V4 a -> V4 a Source #

fract' :: V4 a -> V4 a Source #

mod'' :: V4 a -> V4 a -> V4 a Source #

mix :: V4 a -> V4 a -> V4 a -> V4 a Source #

atan2' :: V4 a -> V4 a -> V4 a Source #

Real' a => Real' (V3 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

rsqrt :: V3 a -> V3 a Source #

exp2 :: V3 a -> V3 a Source #

log2 :: V3 a -> V3 a Source #

floor' :: V3 a -> V3 a Source #

ceiling' :: V3 a -> V3 a Source #

fract' :: V3 a -> V3 a Source #

mod'' :: V3 a -> V3 a -> V3 a Source #

mix :: V3 a -> V3 a -> V3 a -> V3 a Source #

atan2' :: V3 a -> V3 a -> V3 a Source #

Real' a => Real' (V2 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

rsqrt :: V2 a -> V2 a Source #

exp2 :: V2 a -> V2 a Source #

log2 :: V2 a -> V2 a Source #

floor' :: V2 a -> V2 a Source #

ceiling' :: V2 a -> V2 a Source #

fract' :: V2 a -> V2 a Source #

mod'' :: V2 a -> V2 a -> V2 a Source #

mix :: V2 a -> V2 a -> V2 a -> V2 a Source #

atan2' :: V2 a -> V2 a -> V2 a Source #

Real' a => Real' (V1 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

rsqrt :: V1 a -> V1 a Source #

exp2 :: V1 a -> V1 a Source #

log2 :: V1 a -> V1 a Source #

floor' :: V1 a -> V1 a Source #

ceiling' :: V1 a -> V1 a Source #

fract' :: V1 a -> V1 a Source #

mod'' :: V1 a -> V1 a -> V1 a Source #

mix :: V1 a -> V1 a -> V1 a -> V1 a Source #

atan2' :: V1 a -> V1 a -> V1 a Source #

Real' (S x Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Methods

rsqrt :: S x Float -> S x Float Source #

exp2 :: S x Float -> S x Float Source #

log2 :: S x Float -> S x Float Source #

floor' :: S x Float -> S x Float Source #

ceiling' :: S x Float -> S x Float Source #

fract' :: S x Float -> S x Float Source #

mod'' :: S x Float -> S x Float -> S x Float Source #

mix :: S x Float -> S x Float -> S x Float -> S x Float Source #

atan2' :: S x Float -> S x Float -> S x Float Source #

class (IfB a, OrdB a, Floating a) => FloatingOrd a where Source #

This class provides various order comparing functions

Minimal complete definition

Nothing

Methods

clamp :: a -> a -> a -> a Source #

saturate :: a -> a Source #

step :: a -> a -> a Source #

smoothstep :: a -> a -> a -> a Source #

Additional functions

dFdx :: FFloat -> FFloat Source #

The derivative in x using local differencing of the rasterized value.

dFdy :: FFloat -> FFloat Source #

The derivative in y using local differencing of the rasterized value.

fwidth :: FFloat -> FFloat Source #

The sum of the absolute derivative in x and y using local differencing of the rasterized value.

Shader control structures

while :: forall a x. ShaderType a x => (a -> S x Bool) -> (a -> a) -> a -> a Source #

while f g x will iteratively transform x with g as long as f generates true.

ifThen :: forall a x. ShaderType a x => S x Bool -> (a -> a) -> a -> a Source #

ifThen c f x will return f x if c evaluates to true or x otherwise.

In most cases functionally equivalent to ifThenElse' but usually generate smaller shader code since the last argument is not inlined into the two branches, which also would affect implicit derivates (e.g. dFdx, dFdy or sampling using SampleAuto)

ifThenElse :: forall a b x. (ShaderType a x, ShaderType b x) => S x Bool -> (a -> b) -> (a -> b) -> a -> b Source #

ifThenElse c f g x will return f x if c evaluates to true or g x otherwise.

In most cases functionally equivalent to ifThenElse' but usually generate smaller shader code since the last argument is not inlined into the two branches, which also would affect implicit derivates (e.g. dFdx, dFdy or sampling using SampleAuto)

ifThenElse' :: forall a x. ShaderType a x => S x Bool -> a -> a -> a Source #

Works just like ifB, return second argument if first is true otherwise return third argument.

The difference from ifB is that it in most cases generate more efficient code when a is a compound type (e.g. a tuple or a vector). For simple types such as S x Float, ifThenElse' == ifB.

data ShaderBase a x Source #

An opaque type

class ShaderType a x where Source #

Constraint for types that may pass in and out of shader control structures. Define your own instances in terms of others and make sure to make toBase as lazy as possible.

Associated Types

type ShaderBaseType a Source #

A base type that this type can convert into. Use the ShaderBaseType function on an existing instance of ShaderType to define this in your instance.

Methods

toBase :: x -> a -> ShaderBase (ShaderBaseType a) x Source #

Convert this type to the shader base type. Make sure this is as lazy as possible (e.g. use tilde (~) on each pattern match).

fromBase :: x -> ShaderBase (ShaderBaseType a) x -> a Source #

Convert back from the shader base type to this type.

Instances
ShaderType () x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType () :: Type Source #

Methods

toBase :: x -> () -> ShaderBase (ShaderBaseType ()) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType ()) x -> () Source #

ShaderType a x => ShaderType (V0 a) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (V0 a) :: Type Source #

Methods

toBase :: x -> V0 a -> ShaderBase (ShaderBaseType (V0 a)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (V0 a)) x -> V0 a Source #

ShaderType a x => ShaderType (V4 a) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (V4 a) :: Type Source #

Methods

toBase :: x -> V4 a -> ShaderBase (ShaderBaseType (V4 a)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (V4 a)) x -> V4 a Source #

ShaderType a x => ShaderType (V3 a) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (V3 a) :: Type Source #

Methods

toBase :: x -> V3 a -> ShaderBase (ShaderBaseType (V3 a)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (V3 a)) x -> V3 a Source #

ShaderType a x => ShaderType (V2 a) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (V2 a) :: Type Source #

Methods

toBase :: x -> V2 a -> ShaderBase (ShaderBaseType (V2 a)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (V2 a)) x -> V2 a Source #

ShaderType a x => ShaderType (V1 a) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (V1 a) :: Type Source #

Methods

toBase :: x -> V1 a -> ShaderBase (ShaderBaseType (V1 a)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (V1 a)) x -> V1 a Source #

(ShaderType a x, ShaderType b x) => ShaderType (a, b) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (a, b) :: Type Source #

Methods

toBase :: x -> (a, b) -> ShaderBase (ShaderBaseType (a, b)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (a, b)) x -> (a, b) Source #

ShaderType (S x Bool) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (S x Bool) :: Type Source #

Methods

toBase :: x -> S x Bool -> ShaderBase (ShaderBaseType (S x Bool)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (S x Bool)) x -> S x Bool Source #

ShaderType (S x Word) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (S x Word) :: Type Source #

Methods

toBase :: x -> S x Word -> ShaderBase (ShaderBaseType (S x Word)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (S x Word)) x -> S x Word Source #

ShaderType (S x Int) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (S x Int) :: Type Source #

Methods

toBase :: x -> S x Int -> ShaderBase (ShaderBaseType (S x Int)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (S x Int)) x -> S x Int Source #

ShaderType (S x Float) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (S x Float) :: Type Source #

(ShaderType a x, ShaderType b x, ShaderType c x) => ShaderType (a, b, c) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (a, b, c) :: Type Source #

Methods

toBase :: x -> (a, b, c) -> ShaderBase (ShaderBaseType (a, b, c)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (a, b, c)) x -> (a, b, c) Source #

(ShaderType a x, ShaderType b x, ShaderType c x, ShaderType d x) => ShaderType (a, b, c, d) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (a, b, c, d) :: Type Source #

Methods

toBase :: x -> (a, b, c, d) -> ShaderBase (ShaderBaseType (a, b, c, d)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (a, b, c, d)) x -> (a, b, c, d) Source #

(ShaderType a x, ShaderType b x, ShaderType c x, ShaderType d x, ShaderType e x) => ShaderType (a, b, c, d, e) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (a, b, c, d, e) :: Type Source #

Methods

toBase :: x -> (a, b, c, d, e) -> ShaderBase (ShaderBaseType (a, b, c, d, e)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (a, b, c, d, e)) x -> (a, b, c, d, e) Source #

(ShaderType a x, ShaderType b x, ShaderType c x, ShaderType d x, ShaderType e x, ShaderType f x) => ShaderType (a, b, c, d, e, f) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (a, b, c, d, e, f) :: Type Source #

Methods

toBase :: x -> (a, b, c, d, e, f) -> ShaderBase (ShaderBaseType (a, b, c, d, e, f)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (a, b, c, d, e, f)) x -> (a, b, c, d, e, f) Source #

(ShaderType a x, ShaderType b x, ShaderType c x, ShaderType d x, ShaderType e x, ShaderType f x, ShaderType g x) => ShaderType (a, b, c, d, e, f, g) x Source # 
Instance details

Defined in Graphics.GPipe.Internal.Expr

Associated Types

type ShaderBaseType (a, b, c, d, e, f, g) :: Type Source #

Methods

toBase :: x -> (a, b, c, d, e, f, g) -> ShaderBase (ShaderBaseType (a, b, c, d, e, f, g)) x Source #

fromBase :: x -> ShaderBase (ShaderBaseType (a, b, c, d, e, f, g)) x -> (a, b, c, d, e, f, g) Source #