-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Typesafe functional GPU graphics programming
--
-- A typesafe API based on the conceptual model of OpenGL, but without
-- the imperative state machine. Aims to be as close to the raw OpenGL
-- performance as possible, without compromising type safety or
-- functional style. Includes DSL for shaders to provide type safety even
-- when crossing into that domain. Uses OpenGL 4.5 core profile under the
-- hood.
@package GPipe-Core
@version 0.2.3.1
module Graphics.GPipe.Internal.Debug
traceIt :: Show a => String -> a -> a
traceList :: Show a => String -> [a] -> [a]
checkGlError :: String -> IO ()
getErrorMessage :: GLenum -> String
module Graphics.GPipe.Internal.Expr
tshow :: Show a => a -> Text
type NextTempVar = Int
type NextGlobal = Int
data SType
STypeFloat :: SType
STypeInt :: SType
STypeBool :: SType
STypeUInt :: SType
STypeDyn :: Text -> SType
STypeMat :: Int -> Int -> SType
STypeVec :: Int -> SType
STypeIVec :: Int -> SType
STypeUVec :: Int -> SType
STypeGenerativeGeometry :: SType
stypeName :: SType -> Text
stypeSize :: SType -> Int
type ExprM = SNMapReaderT [Text] (StateT ExprState IO)
type GlobDeclM = Writer Text
data ExprState
ExprState :: ShaderInputs -> !NextTempVar -> !Builder -> ExprState
data ShaderInputs
ShaderInputs :: IntMap (GlobDeclM ()) -> IntMap (GlobDeclM ()) -> IntMap (GlobDeclM (), (ExprM (), GlobDeclM ())) -> Maybe (GlobDeclM ()) -> ShaderInputs
[shaderUsedUniformBlocks] :: ShaderInputs -> IntMap (GlobDeclM ())
[shaderUsedSamplers] :: ShaderInputs -> IntMap (GlobDeclM ())
[shaderUsedInput] :: ShaderInputs -> IntMap (GlobDeclM (), (ExprM (), GlobDeclM ()))
[shaderGeometry] :: ShaderInputs -> Maybe (GlobDeclM ())
data ExprResult
ExprResult :: String -> [Int] -> [Int] -> [Int] -> GlobDeclM () -> ExprM () -> ExprResult
[finalSource] :: ExprResult -> String
[unis] :: ExprResult -> [Int]
[samps] :: ExprResult -> [Int]
[inps] :: ExprResult -> [Int]
[prevDecls] :: ExprResult -> GlobDeclM ()
[prevSs] :: ExprResult -> ExprM ()
runExprM :: GlobDeclM () -> ExprM () -> IO ExprResult
data ShaderStageInput
ShaderStageInput :: GlobDeclM () -> ExprM () -> ShaderStageInput
[outputDeclarations] :: ShaderStageInput -> GlobDeclM ()
[expression] :: ShaderStageInput -> ExprM ()
data ShaderStageOutput
ShaderStageOutput :: String -> [Int] -> [Int] -> [Int] -> GlobDeclM () -> ExprM () -> ShaderStageOutput
-- | The shader GLSL source to be compiled.
[source] :: ShaderStageOutput -> String
-- | The uniforms used in this shader.
[uniforms] :: ShaderStageOutput -> [Int]
-- | The samplers used in this shader.
[samplers] :: ShaderStageOutput -> [Int]
-- | The input variables used in this shader.
[inputs] :: ShaderStageOutput -> [Int]
-- | The output declations to include in the previous shader to provide the
-- needed input variables.
[previousDeclarations] :: ShaderStageOutput -> GlobDeclM ()
-- | The expression to evaluate in order to produce the previous shader.
[prevExpression] :: ShaderStageOutput -> ExprM ()
evaluateExpression :: [ExprM ()] -> ExprM () -> GlobDeclM () -> IO ShaderStageOutput
newtype S x a
S :: ExprM Text -> S x a
[unS] :: S x a -> ExprM Text
scalarS :: SType -> ExprM RValue -> S c a
vec2S :: SType -> ExprM RValue -> V2 (S c a)
vec3S :: SType -> ExprM RValue -> V3 (S c a)
vec4S :: SType -> ExprM RValue -> V4 (S c a)
scalarS' :: RValue -> S c a
vec2S' :: RValue -> V2 (S c a)
vec3S' :: RValue -> V3 (S c a)
vec4S' :: RValue -> V4 (S c a)
vec2S'' :: S c a -> V2 (S c a)
vec3S'' :: S c a -> V3 (S c a)
vec4S'' :: S c a -> V4 (S c a)
-- | Phantom type used as first argument in S V a
-- that denotes that the shader value is a vertex value
data V
-- | Phantom type used as first argument in S F a
-- that denotes that the shader value is a fragment value
data F
-- | We reuse V for geometry shader, which simplify things and makes sense
-- save the GenerativeGeometry…
type G = V
newtype GenerativeGeometry p a
GenerativeGeometry :: a -> GenerativeGeometry p a
type VFloat = S V Float
type VInt = S V Int
type VWord = S V Word
type VBool = S V Bool
type GGenerativeGeometry p a = S G (GenerativeGeometry p a)
type FFloat = S F Float
type FInt = S F Int
type FWord = S F Word
type FBool = S F Bool
useVInput :: SType -> Int -> ExprM Text
useGInput :: Text -> SType -> Int -> Int -> ExprM Text -> ExprM Text
useFInputFromG :: Text -> SType -> Int -> ExprM Text -> ExprM Text
useFInput :: Text -> Text -> SType -> Int -> ExprM Text -> ExprM Text
declareGeometryLayout :: Text -> Text -> Int -> ExprM ()
useUniform :: GlobDeclM () -> Int -> Int -> ExprM Text
useSampler :: Text -> Text -> Int -> ExprM Text
getNext :: Monad m => StateT ExprState m Int
type RValue = Text
tellAssignment :: SType -> ExprM RValue -> ExprM Text
tellAssignment' :: Text -> RValue -> ExprM ()
tellST :: Text -> StateT ExprState IO ()
discard :: FBool -> ExprM ()
tellGlobalLn :: Text -> GlobDeclM ()
tellGlobal :: Text -> GlobDeclM ()
-- | An opaque type
data ShaderBase a x
[ShaderBaseFloat] :: S x Float -> ShaderBase (S x Float) x
[ShaderBaseInt] :: S x Int -> ShaderBase (S x Int) x
[ShaderBaseWord] :: S x Word -> ShaderBase (S x Word) x
[ShaderBaseBool] :: S x Bool -> ShaderBase (S x Bool) x
[ShaderBaseUnit] :: ShaderBase () x
[ShaderBaseProd] :: ShaderBase a x -> ShaderBase b x -> ShaderBase (a, b) x
[ShaderBaseGenerativeGeometry] :: S x (GenerativeGeometry p a) -> ShaderBase (S x (GenerativeGeometry p a)) x
shaderbaseDeclare :: ShaderBase a x -> WriterT [Text] ExprM (ShaderBase a x)
shaderbaseAssign :: ShaderBase a x -> StateT [Text] ExprM ()
shaderbaseReturn :: ShaderBase a x -> ReaderT (ExprM [Text]) (State ExprState) (ShaderBase a x)
shaderbaseDeclareDef :: SType -> WriterT [Text] ExprM (S x a)
shaderbaseAssignDef :: S x a -> StateT [Text] ExprM ()
shaderbaseReturnDef :: ReaderT (ExprM [Text]) (State ExprState) (S x a)
-- | 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.
class ShaderType a x where {
-- | 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.
type family ShaderBaseType a;
}
-- | Convert this type to the shader base type. Make sure this is as lazy
-- as possible (e.g. use tilde (~) on each pattern match).
toBase :: ShaderType a x => x -> a -> ShaderBase (ShaderBaseType a) x
-- | Convert back from the shader base type to this type.
fromBase :: ShaderType a x => x -> ShaderBase (ShaderBaseType a) x -> a
-- | 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.
ifThenElse' :: forall a x. ShaderType a x => S x Bool -> a -> a -> a
-- | 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 b x. (ShaderType a x, ShaderType b x) => S x Bool -> (a -> b) -> (a -> b) -> a -> b
-- | 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)
ifThen :: forall a x. ShaderType a x => S x Bool -> (a -> a) -> a -> a
tellIf :: RValue -> ExprM ()
-- | while f g x will iteratively transform x with
-- g as long as f generates true.
while :: forall a x. ShaderType a x => (a -> S x Bool) -> (a -> a) -> a -> a
errShaderType :: a
bin :: SType -> Text -> S c x -> S c y -> S c z
fun1 :: SType -> Text -> S c x -> S c y
fun2 :: SType -> Text -> S c x -> S c y -> S c z
fun3 :: SType -> Text -> S c x -> S c y -> S c z -> S c w
fun4 :: SType -> Text -> S c x -> S c y -> S c z -> S c w -> S c r
postop :: SType -> Text -> S c x -> S c y
preop :: SType -> Text -> S c x -> S c y
binf :: Text -> S c x -> S c y -> S c Float
fun1f :: Text -> S c x -> S c Float
fun2f :: Text -> S c x -> S c y -> S c Float
fun3f :: Text -> S c x -> S c y -> S c z -> S c Float
preopf :: Text -> S c x -> S c Float
postopf :: Text -> S c x -> S c Float
bini :: Text -> S c x -> S c y -> S c Int
fun1i :: Text -> S c x -> S c Int
preopi :: Text -> S c x -> S c Int
binu :: Text -> S c x -> S c y -> S c Word
fun1u :: Text -> S c x -> S c Word
preopu :: Text -> S c x -> S c Word
class Integral' a
div' :: Integral' a => a -> a -> a
mod' :: Integral' a => a -> a -> a
class Bits' a
and' :: Bits' a => a -> a -> a
or' :: Bits' a => a -> a -> a
xor' :: Bits' a => a -> a -> a
complement' :: Bits' a => a -> a
shiftL' :: Bits' a => a -> a -> a
shiftR' :: Bits' a => a -> a -> a
bitSize' :: Bits' a => a -> Int
-- | 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.
class Floating a => Real' a
rsqrt :: Real' a => a -> a
exp2 :: Real' a => a -> a
log2 :: Real' a => a -> a
floor' :: Real' a => a -> a
ceiling' :: Real' a => a -> a
fract' :: Real' a => a -> a
mod'' :: Real' a => a -> a -> a
mix :: Real' a => a -> a -> a -> a
atan2' :: Real' a => a -> a -> a
-- | This class provides various order comparing functions
class (IfB a, OrdB a, Floating a) => FloatingOrd a
clamp :: FloatingOrd a => a -> a -> a -> a
saturate :: FloatingOrd a => a -> a
step :: FloatingOrd a => a -> a -> a
smoothstep :: FloatingOrd a => a -> a -> a -> a
-- | Provides a common way to convert numeric types to integer and floating
-- point representations.
class Convert a where {
type family ConvertFloat a;
type family ConvertInt a;
type family ConvertWord a;
}
-- | Convert to a floating point number.
toFloat :: Convert a => a -> ConvertFloat a
-- | Convert to an integral number, using truncation if necessary.
toInt :: Convert a => a -> ConvertInt a
-- | Convert to an unsigned integral number, using truncation if necessary.
toWord :: Convert a => a -> ConvertWord a
-- | The derivative in x using local differencing of the rasterized value.
dFdx :: FFloat -> FFloat
-- | The derivative in y using local differencing of the rasterized value.
dFdy :: FFloat -> FFloat
-- | The sum of the absolute derivative in x and y using local differencing
-- of the rasterized value.
fwidth :: FFloat -> FFloat
fromV :: Foldable t => (a1 -> S x1 a2) -> Text -> t a1 -> S x2 a3
fromVec4 :: V4 (S x Float) -> S x (V4 Float)
fromVec3 :: V3 (S x Float) -> S x (V3 Float)
fromVec2 :: V2 (S x Float) -> S x (V2 Float)
fromMat22 :: V2 (V2 (S x Float)) -> S x (V2 (V2 Float))
fromMat23 :: V2 (V3 (S x Float)) -> S x (V2 (V3 Float))
fromMat24 :: V2 (V4 (S x Float)) -> S x (V2 (V4 Float))
fromMat32 :: V3 (V2 (S x Float)) -> S x (V3 (V2 Float))
fromMat33 :: V3 (V3 (S x Float)) -> S x (V3 (V3 Float))
fromMat34 :: V3 (V4 (S x Float)) -> S x (V3 (V4 Float))
fromMat42 :: V4 (V2 (S x Float)) -> S x (V4 (V2 Float))
fromMat43 :: V4 (V3 (S x Float)) -> S x (V4 (V3 Float))
fromMat44 :: V4 (V4 (S x Float)) -> S x (V4 (V4 Float))
mulToV4 :: S c x -> S c y -> V4 (S c a)
mulToV3 :: S c x -> S c y -> V3 (S c a)
mulToV2 :: S c x -> S c y -> V2 (S c a)
mulToM :: Functor f => (Int, S c z -> f a) -> (Int, a -> b) -> S c x -> S c y -> f b
d2 :: Num a1 => (a1, S c a2 -> V2 (S c a2))
d3 :: Num a1 => (a1, S c a2 -> V3 (S c a2))
d4 :: Num a1 => (a1, S c a2 -> V4 (S c a2))
unV1 :: V1 t -> t
outerToM :: Functor f => (Int, S c z -> f a) -> (Int, a -> b) -> S c x -> S c y -> f b
length4 :: V4 (S x Float) -> S x Float
length3 :: V3 (S x Float) -> S x Float
length2 :: V2 (S x Float) -> S x Float
normalize4 :: V4 (S x Float) -> V4 (S x Float)
normalize3 :: V3 (S x Float) -> V3 (S x Float)
normalize2 :: V2 (S x Float) -> V2 (S x Float)
dist4 :: V4 (S x Float) -> V4 (S x Float) -> S x Float
dist3 :: V3 (S x Float) -> V3 (S x Float) -> S x Float
dist2 :: V2 (S x Float) -> V2 (S x Float) -> S x Float
crossS :: V3 (S x Float) -> V3 (S x Float) -> V3 (S x Float)
minS :: S x Float -> S x Float -> S x Float
maxS :: S x Float -> S x Float -> S x Float
mul_12_21vv :: V2 (S x Float) -> V2 (S x Float) -> S x Float
mul_13_31vv :: V3 (S x Float) -> V3 (S x Float) -> S x Float
mul_14_41vv :: V4 (S x Float) -> V4 (S x Float) -> S x Float
mul_12_21vm :: V2 (S x Float) -> V2 (V1 (S x Float)) -> V1 (S x Float)
mul_13_31vm :: V3 (S x Float) -> V3 (V1 (S x Float)) -> V1 (S x Float)
mul_14_41vm :: V4 (S x Float) -> V4 (V1 (S x Float)) -> V1 (S x Float)
mul_12_21mv :: V1 (V2 (S x Float)) -> V2 (S x Float) -> V1 (S x Float)
mul_13_31mv :: V1 (V3 (S x Float)) -> V3 (S x Float) -> V1 (S x Float)
mul_14_41mv :: V1 (V4 (S x Float)) -> V4 (S x Float) -> V1 (S x Float)
mul_12_21mm :: V1 (V2 (S x Float)) -> V2 (V1 (S x Float)) -> V1 (V1 (S x Float))
mul_13_31mm :: V1 (V3 (S x Float)) -> V3 (V1 (S x Float)) -> V1 (V1 (S x Float))
mul_14_41mm :: V1 (V4 (S x Float)) -> V4 (V1 (S x Float)) -> V1 (V1 (S x Float))
mul_21_12 :: V2 (S x Float) -> V2 (S x Float) -> V2 (V2 (S x Float))
mul_21_13 :: V2 (S x Float) -> V3 (S x Float) -> V2 (V3 (S x Float))
mul_21_14 :: V2 (S x Float) -> V4 (S x Float) -> V2 (V4 (S x Float))
mul_31_12 :: V3 (S x Float) -> V2 (S x Float) -> V3 (V2 (S x Float))
mul_31_13 :: V3 (S x Float) -> V3 (S x Float) -> V3 (V3 (S x Float))
mul_31_14 :: V3 (S x Float) -> V4 (S x Float) -> V3 (V4 (S x Float))
mul_41_12 :: V4 (S x Float) -> V2 (S x Float) -> V4 (V2 (S x Float))
mul_41_13 :: V4 (S x Float) -> V3 (S x Float) -> V4 (V3 (S x Float))
mul_41_14 :: V4 (S x Float) -> V4 (S x Float) -> V4 (V4 (S x Float))
mul_21_12m :: V2 (V1 (S x Float)) -> V1 (V2 (S x Float)) -> V2 (V2 (S x Float))
mul_21_13m :: V2 (V1 (S x Float)) -> V1 (V3 (S x Float)) -> V2 (V3 (S x Float))
mul_21_14m :: V2 (V1 (S x Float)) -> V1 (V4 (S x Float)) -> V2 (V4 (S x Float))
mul_31_12m :: V3 (V1 (S x Float)) -> V1 (V2 (S x Float)) -> V3 (V2 (S x Float))
mul_31_13m :: V3 (V1 (S x Float)) -> V1 (V3 (S x Float)) -> V3 (V3 (S x Float))
mul_31_14m :: V3 (V1 (S x Float)) -> V1 (V4 (S x Float)) -> V3 (V4 (S x Float))
mul_41_12m :: V4 (V1 (S x Float)) -> V1 (V2 (S x Float)) -> V4 (V2 (S x Float))
mul_41_13m :: V4 (V1 (S x Float)) -> V1 (V3 (S x Float)) -> V4 (V3 (S x Float))
mul_41_14m :: V4 (V1 (S x Float)) -> V1 (V4 (S x Float)) -> V4 (V4 (S x Float))
mul_12_22 :: V2 (S x Float) -> V2 (V2 (S x Float)) -> V2 (S x Float)
mul_13_32 :: V3 (S x Float) -> V3 (V2 (S x Float)) -> V2 (S x Float)
mul_14_42 :: V4 (S x Float) -> V4 (V2 (S x Float)) -> V2 (S x Float)
mul_12_23 :: V2 (S x Float) -> V2 (V3 (S x Float)) -> V3 (S x Float)
mul_13_33 :: V3 (S x Float) -> V3 (V3 (S x Float)) -> V3 (S x Float)
mul_14_43 :: V4 (S x Float) -> V4 (V3 (S x Float)) -> V3 (S x Float)
mul_12_24 :: V2 (S x Float) -> V2 (V4 (S x Float)) -> V4 (S x Float)
mul_13_34 :: V3 (S x Float) -> V3 (V4 (S x Float)) -> V4 (S x Float)
mul_14_44 :: V4 (S x Float) -> V4 (V4 (S x Float)) -> V4 (S x Float)
mul_12_22m :: V1 (V2 (S x Float)) -> V2 (V2 (S x Float)) -> V1 (V2 (S x Float))
mul_13_32m :: V1 (V3 (S x Float)) -> V3 (V2 (S x Float)) -> V1 (V2 (S x Float))
mul_14_42m :: V1 (V4 (S x Float)) -> V4 (V2 (S x Float)) -> V1 (V2 (S x Float))
mul_12_23m :: V1 (V2 (S x Float)) -> V2 (V3 (S x Float)) -> V1 (V3 (S x Float))
mul_13_33m :: V1 (V3 (S x Float)) -> V3 (V3 (S x Float)) -> V1 (V3 (S x Float))
mul_14_43m :: V1 (V4 (S x Float)) -> V4 (V3 (S x Float)) -> V1 (V3 (S x Float))
mul_12_24m :: V1 (V2 (S x Float)) -> V2 (V4 (S x Float)) -> V1 (V4 (S x Float))
mul_13_34m :: V1 (V3 (S x Float)) -> V3 (V4 (S x Float)) -> V1 (V4 (S x Float))
mul_14_44m :: V1 (V4 (S x Float)) -> V4 (V4 (S x Float)) -> V1 (V4 (S x Float))
mul_22_21 :: V2 (V2 (S x Float)) -> V2 (S x Float) -> V2 (S x Float)
mul_23_31 :: V2 (V3 (S x Float)) -> V3 (S x Float) -> V2 (S x Float)
mul_24_41 :: V2 (V4 (S x Float)) -> V4 (S x Float) -> V2 (S x Float)
mul_32_21 :: V3 (V2 (S x Float)) -> V2 (S x Float) -> V3 (S x Float)
mul_33_31 :: V3 (V3 (S x Float)) -> V3 (S x Float) -> V3 (S x Float)
mul_34_41 :: V3 (V4 (S x Float)) -> V4 (S x Float) -> V3 (S x Float)
mul_42_21 :: V4 (V2 (S x Float)) -> V2 (S x Float) -> V4 (S x Float)
mul_43_31 :: V4 (V3 (S x Float)) -> V3 (S x Float) -> V4 (S x Float)
mul_44_41 :: V4 (V4 (S x Float)) -> V4 (S x Float) -> V4 (S x Float)
mul_22_21m :: V2 (V2 (S x Float)) -> V2 (V1 (S x Float)) -> V2 (V1 (S x Float))
mul_23_31m :: V2 (V3 (S x Float)) -> V3 (V1 (S x Float)) -> V2 (V1 (S x Float))
mul_24_41m :: V2 (V4 (S x Float)) -> V4 (V1 (S x Float)) -> V2 (V1 (S x Float))
mul_32_21m :: V3 (V2 (S x Float)) -> V2 (V1 (S x Float)) -> V3 (V1 (S x Float))
mul_33_31m :: V3 (V3 (S x Float)) -> V3 (V1 (S x Float)) -> V3 (V1 (S x Float))
mul_34_41m :: V3 (V4 (S x Float)) -> V4 (V1 (S x Float)) -> V3 (V1 (S x Float))
mul_42_21m :: V4 (V2 (S x Float)) -> V2 (V1 (S x Float)) -> V4 (V1 (S x Float))
mul_43_31m :: V4 (V3 (S x Float)) -> V3 (V1 (S x Float)) -> V4 (V1 (S x Float))
mul_44_41m :: V4 (V4 (S x Float)) -> V4 (V1 (S x Float)) -> V4 (V1 (S x Float))
mul_22_22 :: V2 (V2 (S x Float)) -> V2 (V2 (S x Float)) -> V2 (V2 (S x Float))
mul_23_32 :: V2 (V3 (S x Float)) -> V3 (V2 (S x Float)) -> V2 (V2 (S x Float))
mul_24_42 :: V2 (V4 (S x Float)) -> V4 (V2 (S x Float)) -> V2 (V2 (S x Float))
mul_22_23 :: V2 (V2 (S x Float)) -> V2 (V3 (S x Float)) -> V2 (V3 (S x Float))
mul_23_33 :: V2 (V3 (S x Float)) -> V3 (V3 (S x Float)) -> V2 (V3 (S x Float))
mul_24_43 :: V2 (V4 (S x Float)) -> V4 (V3 (S x Float)) -> V2 (V3 (S x Float))
mul_22_24 :: V2 (V2 (S x Float)) -> V2 (V4 (S x Float)) -> V2 (V4 (S x Float))
mul_23_34 :: V2 (V3 (S x Float)) -> V3 (V4 (S x Float)) -> V2 (V4 (S x Float))
mul_24_44 :: V2 (V4 (S x Float)) -> V4 (V4 (S x Float)) -> V2 (V4 (S x Float))
mul_32_22 :: V3 (V2 (S x Float)) -> V2 (V2 (S x Float)) -> V3 (V2 (S x Float))
mul_33_32 :: V3 (V3 (S x Float)) -> V3 (V2 (S x Float)) -> V3 (V2 (S x Float))
mul_34_42 :: V3 (V4 (S x Float)) -> V4 (V2 (S x Float)) -> V3 (V2 (S x Float))
mul_32_23 :: V3 (V2 (S x Float)) -> V2 (V3 (S x Float)) -> V3 (V3 (S x Float))
mul_33_33 :: V3 (V3 (S x Float)) -> V3 (V3 (S x Float)) -> V3 (V3 (S x Float))
mul_34_43 :: V3 (V4 (S x Float)) -> V4 (V3 (S x Float)) -> V3 (V3 (S x Float))
mul_32_24 :: V3 (V2 (S x Float)) -> V2 (V4 (S x Float)) -> V3 (V4 (S x Float))
mul_33_34 :: V3 (V3 (S x Float)) -> V3 (V4 (S x Float)) -> V3 (V4 (S x Float))
mul_34_44 :: V3 (V4 (S x Float)) -> V4 (V4 (S x Float)) -> V3 (V4 (S x Float))
mul_42_22 :: V4 (V2 (S x Float)) -> V2 (V2 (S x Float)) -> V4 (V2 (S x Float))
mul_43_32 :: V4 (V3 (S x Float)) -> V3 (V2 (S x Float)) -> V4 (V2 (S x Float))
mul_44_42 :: V4 (V4 (S x Float)) -> V4 (V2 (S x Float)) -> V4 (V2 (S x Float))
mul_42_23 :: V4 (V2 (S x Float)) -> V2 (V3 (S x Float)) -> V4 (V3 (S x Float))
mul_43_33 :: V4 (V3 (S x Float)) -> V3 (V3 (S x Float)) -> V4 (V3 (S x Float))
mul_44_43 :: V4 (V4 (S x Float)) -> V4 (V3 (S x Float)) -> V4 (V3 (S x Float))
mul_42_24 :: V4 (V2 (S x Float)) -> V2 (V4 (S x Float)) -> V4 (V4 (S x Float))
mul_43_34 :: V4 (V3 (S x Float)) -> V3 (V4 (S x Float)) -> V4 (V4 (S x Float))
mul_44_44 :: V4 (V4 (S x Float)) -> V4 (V4 (S x Float)) -> V4 (V4 (S x Float))
instance Graphics.GPipe.Internal.Expr.Convert GHC.Types.Float
instance Graphics.GPipe.Internal.Expr.Convert GHC.Types.Int
instance Graphics.GPipe.Internal.Expr.Convert GHC.Types.Word
instance Graphics.GPipe.Internal.Expr.Convert (Graphics.GPipe.Internal.Expr.S x GHC.Types.Float)
instance Graphics.GPipe.Internal.Expr.Convert (Graphics.GPipe.Internal.Expr.S x GHC.Types.Int)
instance Graphics.GPipe.Internal.Expr.Convert (Graphics.GPipe.Internal.Expr.S x GHC.Types.Word)
instance Graphics.GPipe.Internal.Expr.FloatingOrd GHC.Types.Float
instance Graphics.GPipe.Internal.Expr.FloatingOrd GHC.Types.Double
instance Graphics.GPipe.Internal.Expr.FloatingOrd (Graphics.GPipe.Internal.Expr.S x GHC.Types.Float)
instance Graphics.GPipe.Internal.Expr.Real' GHC.Types.Float
instance Graphics.GPipe.Internal.Expr.Real' GHC.Types.Double
instance Graphics.GPipe.Internal.Expr.Real' (Graphics.GPipe.Internal.Expr.S x GHC.Types.Float)
instance Graphics.GPipe.Internal.Expr.Real' a => Graphics.GPipe.Internal.Expr.Real' (Linear.V0.V0 a)
instance Graphics.GPipe.Internal.Expr.Real' a => Graphics.GPipe.Internal.Expr.Real' (Linear.V1.V1 a)
instance Graphics.GPipe.Internal.Expr.Real' a => Graphics.GPipe.Internal.Expr.Real' (Linear.V2.V2 a)
instance Graphics.GPipe.Internal.Expr.Real' a => Graphics.GPipe.Internal.Expr.Real' (Linear.V3.V3 a)
instance Graphics.GPipe.Internal.Expr.Real' a => Graphics.GPipe.Internal.Expr.Real' (Linear.V4.V4 a)
instance Graphics.GPipe.Internal.Expr.Bits' (Graphics.GPipe.Internal.Expr.S a GHC.Types.Int)
instance Graphics.GPipe.Internal.Expr.Bits' (Graphics.GPipe.Internal.Expr.S a GHC.Types.Word)
instance Graphics.GPipe.Internal.Expr.Integral' GHC.Types.Int
instance Graphics.GPipe.Internal.Expr.Integral' GHC.Int.Int32
instance Graphics.GPipe.Internal.Expr.Integral' GHC.Int.Int16
instance Graphics.GPipe.Internal.Expr.Integral' GHC.Int.Int8
instance Graphics.GPipe.Internal.Expr.Integral' GHC.Types.Word
instance Graphics.GPipe.Internal.Expr.Integral' GHC.Word.Word32
instance Graphics.GPipe.Internal.Expr.Integral' GHC.Word.Word16
instance Graphics.GPipe.Internal.Expr.Integral' GHC.Word.Word8
instance Graphics.GPipe.Internal.Expr.Integral' (Graphics.GPipe.Internal.Expr.S a GHC.Types.Int)
instance Graphics.GPipe.Internal.Expr.Integral' (Graphics.GPipe.Internal.Expr.S a GHC.Types.Word)
instance Graphics.GPipe.Internal.Expr.Integral' a => Graphics.GPipe.Internal.Expr.Integral' (Linear.V0.V0 a)
instance Graphics.GPipe.Internal.Expr.Integral' a => Graphics.GPipe.Internal.Expr.Integral' (Linear.V1.V1 a)
instance Graphics.GPipe.Internal.Expr.Integral' a => Graphics.GPipe.Internal.Expr.Integral' (Linear.V2.V2 a)
instance Graphics.GPipe.Internal.Expr.Integral' a => Graphics.GPipe.Internal.Expr.Integral' (Linear.V3.V3 a)
instance Graphics.GPipe.Internal.Expr.Integral' a => Graphics.GPipe.Internal.Expr.Integral' (Linear.V4.V4 a)
instance Graphics.GPipe.Internal.Expr.ShaderType (Graphics.GPipe.Internal.Expr.S x GHC.Types.Float) x
instance Graphics.GPipe.Internal.Expr.ShaderType (Graphics.GPipe.Internal.Expr.S x GHC.Types.Int) x
instance Graphics.GPipe.Internal.Expr.ShaderType (Graphics.GPipe.Internal.Expr.S x GHC.Types.Word) x
instance Graphics.GPipe.Internal.Expr.ShaderType (Graphics.GPipe.Internal.Expr.S x GHC.Types.Bool) x
instance Graphics.GPipe.Internal.Expr.ShaderType () x
instance Graphics.GPipe.Internal.Expr.ShaderType (Graphics.GPipe.Internal.Expr.S x (Graphics.GPipe.Internal.Expr.GenerativeGeometry p a)) x
instance Graphics.GPipe.Internal.Expr.ShaderType a x => Graphics.GPipe.Internal.Expr.ShaderType (Linear.V0.V0 a) x
instance Graphics.GPipe.Internal.Expr.ShaderType a x => Graphics.GPipe.Internal.Expr.ShaderType (Linear.V1.V1 a) x
instance Graphics.GPipe.Internal.Expr.ShaderType a x => Graphics.GPipe.Internal.Expr.ShaderType (Linear.V2.V2 a) x
instance Graphics.GPipe.Internal.Expr.ShaderType a x => Graphics.GPipe.Internal.Expr.ShaderType (Linear.V3.V3 a) x
instance Graphics.GPipe.Internal.Expr.ShaderType a x => Graphics.GPipe.Internal.Expr.ShaderType (Linear.V4.V4 a) x
instance (Graphics.GPipe.Internal.Expr.ShaderType a x, Graphics.GPipe.Internal.Expr.ShaderType b x) => Graphics.GPipe.Internal.Expr.ShaderType (a, b) x
instance (Graphics.GPipe.Internal.Expr.ShaderType a x, Graphics.GPipe.Internal.Expr.ShaderType b x, Graphics.GPipe.Internal.Expr.ShaderType c x) => Graphics.GPipe.Internal.Expr.ShaderType (a, b, c) x
instance (Graphics.GPipe.Internal.Expr.ShaderType a x, Graphics.GPipe.Internal.Expr.ShaderType b x, Graphics.GPipe.Internal.Expr.ShaderType c x, Graphics.GPipe.Internal.Expr.ShaderType d x) => Graphics.GPipe.Internal.Expr.ShaderType (a, b, c, d) x
instance (Graphics.GPipe.Internal.Expr.ShaderType a x, Graphics.GPipe.Internal.Expr.ShaderType b x, Graphics.GPipe.Internal.Expr.ShaderType c x, Graphics.GPipe.Internal.Expr.ShaderType d x, Graphics.GPipe.Internal.Expr.ShaderType e x) => Graphics.GPipe.Internal.Expr.ShaderType (a, b, c, d, e) x
instance (Graphics.GPipe.Internal.Expr.ShaderType a x, Graphics.GPipe.Internal.Expr.ShaderType b x, Graphics.GPipe.Internal.Expr.ShaderType c x, Graphics.GPipe.Internal.Expr.ShaderType d x, Graphics.GPipe.Internal.Expr.ShaderType e x, Graphics.GPipe.Internal.Expr.ShaderType f x) => Graphics.GPipe.Internal.Expr.ShaderType (a, b, c, d, e, f) x
instance (Graphics.GPipe.Internal.Expr.ShaderType a x, Graphics.GPipe.Internal.Expr.ShaderType b x, Graphics.GPipe.Internal.Expr.ShaderType c x, Graphics.GPipe.Internal.Expr.ShaderType d x, Graphics.GPipe.Internal.Expr.ShaderType e x, Graphics.GPipe.Internal.Expr.ShaderType f x, Graphics.GPipe.Internal.Expr.ShaderType g x) => Graphics.GPipe.Internal.Expr.ShaderType (a, b, c, d, e, f, g) x
instance Data.Boolean.IfB (Graphics.GPipe.Internal.Expr.S a (Graphics.GPipe.Internal.Expr.GenerativeGeometry p b))
instance GHC.Num.Num (Graphics.GPipe.Internal.Expr.S a GHC.Types.Float)
instance GHC.Num.Num (Graphics.GPipe.Internal.Expr.S a GHC.Types.Int)
instance GHC.Num.Num (Graphics.GPipe.Internal.Expr.S a GHC.Types.Word)
instance GHC.Real.Fractional (Graphics.GPipe.Internal.Expr.S a GHC.Types.Float)
instance GHC.Float.Floating (Graphics.GPipe.Internal.Expr.S a GHC.Types.Float)
instance Data.Boolean.Boolean (Graphics.GPipe.Internal.Expr.S a GHC.Types.Bool)
instance GHC.Classes.Eq x => Data.Boolean.EqB (Graphics.GPipe.Internal.Expr.S a x)
instance GHC.Classes.Ord x => Data.Boolean.OrdB (Graphics.GPipe.Internal.Expr.S a x)
instance Data.Boolean.IfB (Graphics.GPipe.Internal.Expr.S a GHC.Types.Float)
instance Data.Boolean.IfB (Graphics.GPipe.Internal.Expr.S a GHC.Types.Int)
instance Data.Boolean.IfB (Graphics.GPipe.Internal.Expr.S a GHC.Types.Word)
instance Data.Boolean.IfB (Graphics.GPipe.Internal.Expr.S a GHC.Types.Bool)
instance Linear.Conjugate.Conjugate (Graphics.GPipe.Internal.Expr.S a GHC.Types.Float)
instance Linear.Conjugate.Conjugate (Graphics.GPipe.Internal.Expr.S a GHC.Types.Int)
instance Linear.Conjugate.Conjugate (Graphics.GPipe.Internal.Expr.S a GHC.Types.Word)
instance Linear.Conjugate.TrivialConjugate (Graphics.GPipe.Internal.Expr.S a GHC.Types.Float)
instance Linear.Conjugate.TrivialConjugate (Graphics.GPipe.Internal.Expr.S a GHC.Types.Int)
instance Linear.Conjugate.TrivialConjugate (Graphics.GPipe.Internal.Expr.S a GHC.Types.Word)
-- | 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.
module Graphics.GPipe.Expr
data S x a
-- | Phantom type used as first argument in S V a
-- that denotes that the shader value is a vertex value
data V
-- | Phantom type used as first argument in S F a
-- that denotes that the shader value is a fragment value
data F
type VFloat = S V Float
type VInt = S V Int
type VWord = S V Word
type VBool = S V Bool
type FFloat = S F Float
type FInt = S F Int
type FWord = S F Word
type FBool = S F Bool
type GGenerativeGeometry p a = S G (GenerativeGeometry p a)
-- | Provides a common way to convert numeric types to integer and floating
-- point representations.
class Convert a where {
type family ConvertFloat a;
type family ConvertInt a;
type family ConvertWord a;
}
-- | Convert to a floating point number.
toFloat :: Convert a => a -> ConvertFloat a
-- | Convert to an integral number, using truncation if necessary.
toInt :: Convert a => a -> ConvertInt a
-- | Convert to an unsigned integral number, using truncation if necessary.
toWord :: Convert a => a -> ConvertWord a
class Integral' a
div' :: Integral' a => a -> a -> a
mod' :: Integral' a => a -> a -> a
class Bits' a
and' :: Bits' a => a -> a -> a
or' :: Bits' a => a -> a -> a
xor' :: Bits' a => a -> a -> a
complement' :: Bits' a => a -> a
shiftL' :: Bits' a => a -> a -> a
shiftR' :: Bits' a => a -> a -> a
bitSize' :: Bits' a => a -> Int
-- | 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.
class Floating a => Real' a
rsqrt :: Real' a => a -> a
exp2 :: Real' a => a -> a
log2 :: Real' a => a -> a
floor' :: Real' a => a -> a
ceiling' :: Real' a => a -> a
fract' :: Real' a => a -> a
mod'' :: Real' a => a -> a -> a
mix :: Real' a => a -> a -> a -> a
atan2' :: Real' a => a -> a -> a
-- | This class provides various order comparing functions
class (IfB a, OrdB a, Floating a) => FloatingOrd a
clamp :: FloatingOrd a => a -> a -> a -> a
saturate :: FloatingOrd a => a -> a
step :: FloatingOrd a => a -> a -> a
smoothstep :: FloatingOrd a => a -> a -> a -> a
-- | The derivative in x using local differencing of the rasterized value.
dFdx :: FFloat -> FFloat
-- | The derivative in y using local differencing of the rasterized value.
dFdy :: FFloat -> FFloat
-- | The sum of the absolute derivative in x and y using local differencing
-- of the rasterized value.
fwidth :: FFloat -> FFloat
-- | while f g x will iteratively transform x with
-- g as long as f generates true.
while :: forall a x. ShaderType a x => (a -> S x Bool) -> (a -> a) -> a -> a
-- | 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)
ifThen :: forall a x. ShaderType a x => S x Bool -> (a -> a) -> a -> a
-- | 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 b x. (ShaderType a x, ShaderType b x) => S x Bool -> (a -> b) -> (a -> b) -> a -> b
-- | 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.
ifThenElse' :: forall a x. ShaderType a x => S x Bool -> a -> a -> a
-- | An opaque type
data ShaderBase a x
-- | 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.
class ShaderType a x where {
-- | 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.
type family ShaderBaseType a;
}
-- | Convert this type to the shader base type. Make sure this is as lazy
-- as possible (e.g. use tilde (~) on each pattern match).
toBase :: ShaderType a x => x -> a -> ShaderBase (ShaderBaseType a) x
-- | Convert back from the shader base type to this type.
fromBase :: ShaderType a x => x -> ShaderBase (ShaderBaseType a) x -> a
module Graphics.GPipe.Internal.Format
data RFloat
data RInt
data RWord
data RGFloat
data RGInt
data RGWord
data RGBFloat
data RGBInt
data RGBWord
data RGBAFloat
data RGBAInt
data RGBAWord
data Depth
data Stencil
data DepthStencil
data Format a
[R8] :: Format RFloat
[R8S] :: Format RFloat
[R16] :: Format RFloat
[R16S] :: Format RFloat
[R16F] :: Format RFloat
[R32F] :: Format RFloat
[R8I] :: Format RInt
[R16I] :: Format RInt
[R32I] :: Format RInt
[R8UI] :: Format RWord
[R16UI] :: Format RWord
[R32UI] :: Format RWord
[RG8] :: Format RGFloat
[RG8S] :: Format RGFloat
[RG16] :: Format RGFloat
[RG16S] :: Format RGFloat
[RG16F] :: Format RGFloat
[RG32F] :: Format RGFloat
[RG8I] :: Format RGInt
[RG16I] :: Format RGInt
[RG32I] :: Format RGInt
[RG8UI] :: Format RGWord
[RG16UI] :: Format RGWord
[RG32UI] :: Format RGWord
[R3G3B2] :: Format RGBFloat
[RGB4] :: Format RGBFloat
[RGB5] :: Format RGBFloat
[RGB8] :: Format RGBFloat
[RGB8S] :: Format RGBFloat
[RGB10] :: Format RGBFloat
[RGB12] :: Format RGBFloat
[RGB16] :: Format RGBFloat
[RGB16S] :: Format RGBFloat
[RGB16F] :: Format RGBFloat
[RGB32F] :: Format RGBFloat
[R11FG11FB10F] :: Format RGBFloat
[RGB9E5] :: Format RGBFloat
[SRGB8] :: Format RGBFloat
[RGB8I] :: Format RGBInt
[RGB16I] :: Format RGBInt
[RGB32I] :: Format RGBInt
[RGBWord] :: Format RGBWord
[RGB8UI] :: Format RGBWord
[RGB16UI] :: Format RGBWord
[RGB32UI] :: Format RGBWord
[RGBA2] :: Format RGBAFloat
[RGBA4] :: Format RGBAFloat
[RGB5A1] :: Format RGBAFloat
[RGBA8] :: Format RGBAFloat
[RGBA8S] :: Format RGBAFloat
[RGB10A2] :: Format RGBAFloat
[RGBA12] :: Format RGBAFloat
[RGBA16] :: Format RGBAFloat
[RGBA16S] :: Format RGBAFloat
[RGBA16F] :: Format RGBAFloat
[RGBA32F] :: Format RGBAFloat
[SRGB8A8] :: Format RGBAFloat
[RGBA8I] :: Format RGBAInt
[RGBA16I] :: Format RGBAInt
[RGBA32I] :: Format RGBAInt
[RGBA8UI] :: Format RGBAWord
[RGBA16UI] :: Format RGBAWord
[RGBA32UI] :: Format RGBAWord
[Depth16] :: Format Depth
[Depth24] :: Format Depth
[Depth32] :: Format Depth
[Depth32F] :: Format Depth
[Stencil1] :: Format Stencil
[Stencil4] :: Format Stencil
[Stencil8] :: Format Stencil
[Stencil16] :: Format Stencil
[Depth24Stencil8] :: Format DepthStencil
[Depth32FStencil8] :: Format DepthStencil
getGlInternalFormat :: Format f -> GLenum
class TextureFormat f
getGlFormat :: TextureFormat f => f -> GLenum
class TextureFormat f => ColorSampleable f where {
type family Color f a;
type family ColorElement f :: *;
}
typeStr :: ColorSampleable f => f -> Text
typeStr4 :: ColorSampleable f => f -> Text
toColor :: ColorSampleable f => f -> V4 x -> Color f x
fromColor :: ColorSampleable f => f -> Color f x -> [x]
setBorderColor :: ColorSampleable f => f -> GLenum -> Color f (ColorElement f) -> IO ()
samplerPrefix :: ColorSampleable f => f -> Text
class ColorSampleable c => ColorRenderable c
isSrgb :: ColorRenderable c => Format c -> Bool
clearColor :: ColorRenderable c => c -> Color c (ColorElement c) -> IO ()
class ColorSampleable f => DepthRenderable f
class StencilRenderable f
class ColorRenderable c => ContextColorFormat c
redBits :: ContextColorFormat c => Format c -> Int
greenBits :: ContextColorFormat c => Format c -> Int
blueBits :: ContextColorFormat c => Format c -> Int
alphaBits :: ContextColorFormat c => Format c -> Int
colorBits :: ContextColorFormat c => Format c -> (Int, Int, Int, Int, Bool)
depthBits :: Format Depth -> Int
stencilBits :: Format Stencil -> Int
depthStencilBits :: Format DepthStencil -> (Int, Int)
data WindowFormat c ds
[WindowFormatColor] :: ContextColorFormat c => Format c -> WindowFormat c ()
[WindowFormatColorDepth] :: ContextColorFormat c => Format c -> Format Depth -> WindowFormat c Depth
[WindowFormatColorStencil] :: ContextColorFormat c => Format c -> Format Stencil -> WindowFormat c Stencil
[WindowFormatColorDepthStencilSeparate] :: ContextColorFormat c => Format c -> Format Depth -> Format Stencil -> WindowFormat c DepthStencil
[WindowFormatColorDepthStencilCombined] :: ContextColorFormat c => Format c -> Format DepthStencil -> WindowFormat c DepthStencil
[WindowFormatDepth] :: Format Depth -> WindowFormat () Depth
[WindowFormatStencil] :: Format Stencil -> WindowFormat () Stencil
[WindowFormatDepthStencilSeparate] :: Format Depth -> Format Stencil -> WindowFormat () DepthStencil
[WindowFormatDepthStencilCombined] :: Format DepthStencil -> WindowFormat () DepthStencil
type WindowBits = ((Int, Int, Int, Int, Bool), Int, Int)
windowBits :: WindowFormat c ds -> WindowBits
instance Graphics.GPipe.Internal.Format.ContextColorFormat Graphics.GPipe.Internal.Format.RFloat
instance Graphics.GPipe.Internal.Format.ContextColorFormat Graphics.GPipe.Internal.Format.RGFloat
instance Graphics.GPipe.Internal.Format.ContextColorFormat Graphics.GPipe.Internal.Format.RGBFloat
instance Graphics.GPipe.Internal.Format.ContextColorFormat Graphics.GPipe.Internal.Format.RGBAFloat
instance Graphics.GPipe.Internal.Format.StencilRenderable Graphics.GPipe.Internal.Format.Stencil
instance Graphics.GPipe.Internal.Format.StencilRenderable Graphics.GPipe.Internal.Format.DepthStencil
instance Graphics.GPipe.Internal.Format.DepthRenderable Graphics.GPipe.Internal.Format.Depth
instance Graphics.GPipe.Internal.Format.DepthRenderable Graphics.GPipe.Internal.Format.DepthStencil
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RFloat
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RInt
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RWord
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RGFloat
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RGInt
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RGWord
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RGBFloat
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RGBInt
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RGBWord
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RGBAFloat
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RGBAInt
instance Graphics.GPipe.Internal.Format.ColorRenderable Graphics.GPipe.Internal.Format.RGBAWord
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RFloat
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RInt
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RWord
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RGFloat
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RGInt
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RGWord
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RGBFloat
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RGBInt
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RGBWord
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RGBAFloat
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RGBAInt
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.RGBAWord
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.Depth
instance Graphics.GPipe.Internal.Format.ColorSampleable Graphics.GPipe.Internal.Format.DepthStencil
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RFloat
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RInt
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RWord
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RGFloat
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RGInt
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RGWord
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RGBFloat
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RGBInt
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RGBWord
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RGBAFloat
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RGBAInt
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.RGBAWord
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.Depth
instance Graphics.GPipe.Internal.Format.TextureFormat Graphics.GPipe.Internal.Format.DepthStencil
module Graphics.GPipe.Internal.Context
-- | Class implementing a window handler that can create openGL contexts,
-- such as GLFW or GLUT
class ContextHandler ctx where {
-- | Implementation specific context handler parameters, eg error handling
-- and event processing policies
data family ContextHandlerParameters ctx;
-- | Implementation specific window type
type family ContextWindow ctx;
-- | Implementation specific window parameters, eg initial size and border
-- decoration
type family WindowParameters ctx;
}
-- | Create a context handler. Called from the main thread
contextHandlerCreate :: ContextHandler ctx => ContextHandlerParameters ctx -> IO ctx
-- | Delete the context handler. All contexts created from this handler
-- will be deleted using contextDelete prior to calling this.
contextHandlerDelete :: ContextHandler ctx => ctx -> IO ()
-- | Create a new context sharing all other contexts created by this
-- ContextHandler. If the parameter is Nothing, a hidden off-screen
-- context is created, otherwise creates a window with the provided
-- window bits and implementation specific parameters. Only ever called
-- from the mainthread (i.e. the thread that called
-- contextHandlerCreate).
createContext :: ContextHandler ctx => ctx -> Maybe (WindowBits, WindowParameters ctx) -> IO (ContextWindow ctx)
-- | Run an OpenGL IO action in this context, that doesn't return any value
-- to the caller. This may be run after contextDelete or
-- contextHandlerDelete has been called. The thread calling this may not
-- be the same creating the context (for finalizers it is most definetly
-- not). May also be called on previously deleted windows in the case of
-- finalizers.
contextDoAsync :: ContextHandler ctx => ctx -> Maybe (ContextWindow ctx) -> IO () -> IO ()
-- | Swap the front and back buffers in the context's default frame buffer.
-- Only ever called from the mainthread (i.e. the thread that called
-- contextHandlerCreate). Never called on deleted windows.
contextSwap :: ContextHandler ctx => ctx -> ContextWindow ctx -> IO ()
-- | Get the current size of the context's default framebuffer (which may
-- change if the window is resized). Only ever called from the mainthread
-- (i.e. the thread that called contextHandlerCreate)
contextFrameBufferSize :: ContextHandler ctx => ctx -> ContextWindow ctx -> IO (Int, Int)
-- | Delete a context and close any associated window. Only ever called
-- from the mainthread (i.e. the thread that called
-- contextHandlerCreate). Only ever called once per window, and
-- will always be called for each window before the context is deleted
-- with contextHandlerDelete.
contextDelete :: ContextHandler ctx => ctx -> ContextWindow ctx -> IO ()
-- | The monad transformer that encapsulates a GPipe context (which wraps
-- an OpenGl context).
--
-- A value of type ContextT ctx os m a is an action on a context
-- with these parameters:
--
--
-- - ctx The context handler.
-- - os An abstract type that is used to denote the
-- object space. This is an forall type defined by the runContextT
-- call which will restrict any objects created inside this context to be
-- returned from it or used by another context (the same trick as the
-- ST monad uses).
-- - m The monad this monad transformer wraps. Need to
-- have IO in the bottom for this ContextT to be
-- runnable.
-- - a The value returned from this monad action.
--
data ContextT ctx os m a
-- | This kind of exception may be thrown from GPipe when a GPU hardware
-- limit is reached (for instance, too many textures are drawn to from
-- the same FragmentStream)
newtype GPipeException
GPipeException :: String -> GPipeException
-- | Run a ContextT monad transformer that encapsulates an object
-- space. You need an implementation of a ContextHandler, which is
-- provided by an auxillary package, such as GPipe-GLFW.
runContextT :: (MonadIO m, MonadAsyncException m, ContextHandler ctx) => ContextHandlerParameters ctx -> (forall os. ContextT ctx os m a) -> m a
-- | Creates a window
newWindow :: (ContextHandler ctx, MonadIO m) => WindowFormat c ds -> WindowParameters ctx -> ContextT ctx os m (Window os c ds)
-- | Deletes a window. Any rendering to this window will become a noop.
deleteWindow :: (ContextHandler ctx, MonadIO m) => Window os c ds -> ContextT ctx os m ()
-- | Run this action after a render call to swap out the context
-- windows back buffer with the front buffer, effectively showing the
-- result. This call may block if vsync is enabled in the system and/or
-- too many frames are outstanding. After this call, the context window
-- content is undefined and should be cleared at earliest convenience
-- using clearContextColor and friends.
swapWindowBuffers :: (ContextHandler ctx, MonadIO m) => Window os c ds -> ContextT ctx os m ()
-- | Return the current size of the context frame buffer. This is needed to
-- set viewport size and to get the aspect ratio to calculate projection
-- matrices.
getFrameBufferSize :: (ContextHandler ctx, MonadIO m) => Window os c ds -> ContextT ctx os m (V2 Int)
-- | Use the context window handle, which type is specific to the window
-- system used. This handle shouldn't be returned from this function
withContextWindow :: MonadIO m => Window os c ds -> (Maybe (ContextWindow ctx) -> IO a) -> ContextT ctx os m a
newtype WindowState
WindowState :: ContextData -> WindowState
[windowContextData] :: WindowState -> ContextData
data RenderState
RenderState :: PerWindowRenderState -> IntSet -> Name -> RenderState
[perWindowRenderState] :: RenderState -> PerWindowRenderState
[renderWriteTextures] :: RenderState -> IntSet
[renderLastUsedWin] :: RenderState -> Name
liftNonWinContextIO :: (ContextHandler ctx, MonadIO m) => IO a -> ContextT ctx os m a
liftNonWinContextAsyncIO :: (ContextHandler ctx, MonadIO m) => IO () -> ContextT ctx os m ()
addContextFinalizer :: (ContextHandler ctx, MonadIO m) => IORef a -> IO () -> ContextT ctx os m ()
newtype Window os c ds
Window :: Name -> Window os c ds
[getWinName] :: Window os c ds -> Name
-- | Removes a VAO entry from all SharedContextDatas when one of the
-- buffers are deleted. This will in turn make the VAO finalizer to be
-- run.
addVAOBufferFinalizer :: MonadIO m => IORef GLuint -> ContextT ctx os m ()
-- | Removes a FBO entry from all SharedContextDatas when one of the
-- textures are deleted. This will in turn make the FBO finalizer to be
-- run.
addFBOTextureFinalizer :: MonadIO m => Bool -> IORef GLuint -> ContextT ctx os m ()
getVAO :: ContextData -> [VAOKey] -> IO (Maybe (IORef GLuint))
setVAO :: ContextData -> [VAOKey] -> IORef GLuint -> IO ()
getFBO :: ContextData -> FBOKeys -> IO (Maybe (IORef GLuint))
setFBO :: ContextData -> FBOKeys -> IORef GLuint -> IO ()
type ContextData = MVar (VAOCache, FBOCache)
data VAOKey
VAOKey :: !GLuint -> !Int -> !GLint -> !Bool -> !Int -> VAOKey
[vaoBname] :: VAOKey -> !GLuint
[vaoCombBufferOffset] :: VAOKey -> !Int
[vaoComponents] :: VAOKey -> !GLint
[vaoNorm] :: VAOKey -> !Bool
[vaoDiv] :: VAOKey -> !Int
data FBOKey
FBOKey :: !GLuint -> !Int -> !Int -> FBOKey
[fboTname] :: FBOKey -> !GLuint
[fboTlayerOrNegIfRendBuff] :: FBOKey -> !Int
[fboTlevel] :: FBOKey -> !Int
data FBOKeys
FBOKeys :: [FBOKey] -> Maybe FBOKey -> Maybe FBOKey -> FBOKeys
[fboColors] :: FBOKeys -> [FBOKey]
[fboDepth] :: FBOKeys -> Maybe FBOKey
[fboStencil] :: FBOKeys -> Maybe FBOKey
-- | A monad in which shaders are run.
newtype Render os a
Render :: ExceptT String (ReaderT RenderEnv (StateT RenderState IO)) a -> Render os a
[unRender] :: Render os a -> ExceptT String (ReaderT RenderEnv (StateT RenderState IO)) a
-- | Run a Render monad, that may have the effect of windows or
-- textures being drawn to.
--
-- May throw a GPipeException if a combination of draw images
-- (FBO) used by this render call is unsupported by the graphics driver
render :: (ContextHandler ctx, MonadIO m, MonadException m) => Render os () -> ContextT ctx os m ()
registerRenderWriteTexture :: Int -> Render os ()
getLastRenderWin :: Render os (Name, ContextData, ContextDoAsync)
asSync :: (IO () -> IO ()) -> IO x -> IO x
instance GHC.Show.Show Graphics.GPipe.Internal.Context.GPipeException
instance GHC.Classes.Ord Graphics.GPipe.Internal.Context.VAOKey
instance GHC.Classes.Eq Graphics.GPipe.Internal.Context.VAOKey
instance GHC.Classes.Ord Graphics.GPipe.Internal.Context.FBOKey
instance GHC.Classes.Eq Graphics.GPipe.Internal.Context.FBOKey
instance GHC.Classes.Ord Graphics.GPipe.Internal.Context.FBOKeys
instance GHC.Classes.Eq Graphics.GPipe.Internal.Context.FBOKeys
instance GHC.Base.Functor (Graphics.GPipe.Internal.Context.Render os)
instance GHC.Base.Applicative (Graphics.GPipe.Internal.Context.Render os)
instance GHC.Base.Monad (Graphics.GPipe.Internal.Context.Render os)
instance Control.Monad.Exception.MonadAsyncException m => Control.Monad.Exception.MonadAsyncException (Graphics.GPipe.Internal.Context.ContextT ctx os m)
instance Control.Monad.Exception.MonadException m => Control.Monad.Exception.MonadException (Graphics.GPipe.Internal.Context.ContextT ctx os m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Graphics.GPipe.Internal.Context.ContextT ctx os m)
instance GHC.Base.Monad m => GHC.Base.Monad (Graphics.GPipe.Internal.Context.ContextT ctx os m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Graphics.GPipe.Internal.Context.ContextT ctx os m)
instance GHC.Base.Functor m => GHC.Base.Functor (Graphics.GPipe.Internal.Context.ContextT ctx os m)
instance Control.Monad.Trans.Class.MonadTrans (Graphics.GPipe.Internal.Context.ContextT ctx os)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.Fail.MonadFail (Graphics.GPipe.Internal.Context.ContextT ctx os m)
instance GHC.Exception.Type.Exception Graphics.GPipe.Internal.Context.GPipeException
instance GHC.Classes.Eq (Graphics.GPipe.Internal.Context.Window os c ds)
module Graphics.GPipe.Internal.Compiler
type WinId = Int
data Drawcall s
Drawcall :: (s -> (Either WinId (IO FBOKeys, IO ()), IO ())) -> Maybe (s -> IO (GLuint, GLuint, GLuint, GLuint)) -> Int -> Maybe Int -> String -> Maybe String -> Maybe String -> [Int] -> [Int] -> [Int] -> [Int] -> [Int] -> [Int] -> [Int] -> Int -> Drawcall s
[drawcallFbo] :: Drawcall s -> s -> (Either WinId (IO FBOKeys, IO ()), IO ())
[feedbackBuffer] :: Drawcall s -> Maybe (s -> IO (GLuint, GLuint, GLuint, GLuint))
[primitiveName] :: Drawcall s -> Int
[rasterizationName] :: Drawcall s -> Maybe Int
[vertexSource] :: Drawcall s -> String
[optionalGeometrySource] :: Drawcall s -> Maybe String
[optionalFragmentSource] :: Drawcall s -> Maybe String
[usedInputs] :: Drawcall s -> [Int]
[usedVUniforms] :: Drawcall s -> [Int]
[usedVSamplers] :: Drawcall s -> [Int]
[usedGUniforms] :: Drawcall s -> [Int]
[usedGSamplers] :: Drawcall s -> [Int]
[usedFUniforms] :: Drawcall s -> [Int]
[usedFSamplers] :: Drawcall s -> [Int]
[primStrUBufferSize] :: Drawcall s -> Int
mapDrawcall :: (s -> s') -> Drawcall s' -> Drawcall s
type Binding = Int
data RenderIOState s
RenderIOState :: IntMap (s -> Binding -> IO ()) -> IntMap (s -> Binding -> IO Int) -> IntMap (s -> IO ()) -> IntMap (s -> GLuint -> IO ()) -> IntMap (s -> [([Binding], GLuint, Int) -> ((IO [VAOKey], IO ()), IO ())]) -> RenderIOState s
[uniformNameToRenderIO] :: RenderIOState s -> IntMap (s -> Binding -> IO ())
[samplerNameToRenderIO] :: RenderIOState s -> IntMap (s -> Binding -> IO Int)
[rasterizationNameToRenderIO] :: RenderIOState s -> IntMap (s -> IO ())
[transformFeedbackToRenderIO] :: RenderIOState s -> IntMap (s -> GLuint -> IO ())
[inputArrayToRenderIO] :: RenderIOState s -> IntMap (s -> [([Binding], GLuint, Int) -> ((IO [VAOKey], IO ()), IO ())])
newRenderIOState :: RenderIOState s
mapRenderIOState :: (s -> s') -> RenderIOState s' -> RenderIOState s -> RenderIOState s
-- | May throw a GPipeException The multiple drawcalls to be compiled are
-- intended to use the same environment s (and only one is
-- selected dynamically when rendering). public
compileDrawcalls :: (Monad m, MonadIO m, MonadException m, ContextHandler ctx) => [IO (Drawcall s)] -> RenderIOState s -> ContextT ctx os m (s -> Render os ())
safeGenerateDrawcalls :: [IO (Drawcall s)] -> IO ([(Drawcall s, [Int], [Int], [Int], [Int])], [String])
innerCompile :: RenderIOState s -> (Drawcall s, [Int], [Int], [Int], [Int]) -> IO (Either String ((IORef GLuint, IO ()), s -> Render os ()))
createRenderer :: RenderIOState s -> (Drawcall s, [Int], [Int], [Int], [Int]) -> GLuint -> Int -> IO ((IORef GLuint, IO ()), s -> Render os ())
createFeedbackRenderer :: RenderIOState s -> (Drawcall s, [Int], [Int], [Int], [Int]) -> GLuint -> (s -> IO (GLuint, GLuint, GLuint, GLuint)) -> Int -> IO ((IORef GLuint, IO ()), s -> Render os ())
compileOpenGlShader :: GLuint -> String -> IO (Maybe String)
linkProgram :: GLuint -> IO (Maybe String)
createUniformBuffer :: Integral a => a -> IO GLuint
addPrimitiveStreamUniform :: Word32 -> Int -> IntMap (s -> Binding -> IO ()) -> IntMap (s -> Binding -> IO ())
bind :: IntMap (s -> Binding -> IO x) -> [(Int, Int)] -> s -> (x -> IO Bool) -> IO Bool
orderedUnion :: Ord a => [a] -> [a] -> [a]
oldAllocateWhichGiveStrangeResults :: Int -> [[Int]] -> [[Int]]
allocateConsecutiveIndexes :: Int -> [[Int]] -> [[Int]]
getFboError :: MonadIO m => m (Maybe String)
-- | A whenJust that accepts a monoidal return value. private
whenJust' :: (Monad m, Monoid b) => Maybe a -> (a -> m b) -> m b
module Graphics.GPipe.Internal.Buffer
-- | The class that constraints which types can live in a buffer.
class BufferFormat f where {
-- | The type a value of this format has when it lives on the host (i.e.
-- normal Haskell world)
type family HostFormat f;
}
-- | An arrow action that turns a value from it's host representation to
-- it's buffer representation. Use toBuffer from the GPipe
-- provided instances to operate in this arrow. Also note that this arrow
-- needs to be able to return a value lazily, so ensure you use
--
--
-- proc ~pattern -> do ...
--
toBuffer :: BufferFormat f => ToBuffer (HostFormat f) f
getGlType :: BufferFormat f => f -> GLenum
peekPixel :: BufferFormat f => f -> Ptr () -> IO (HostFormat f)
getGlPaddedFormat :: BufferFormat f => f -> GLenum
-- | This type family restricts what host and buffer types a texture format
-- may be converted into. 'BufferColor t h' for a texture representation
-- t and a host representation h will evaluate to a
-- buffer type used in the transfer. This family is closed, i.e. you
-- cannot create additional instances to it.
type family BufferColor c h
-- | A Buffer os b lives in the object space os and
-- contains elements of type b.
data Buffer os b
-- | The arrow type for toBuffer.
data ToBuffer a b
ToBuffer :: !Kleisli (StateT Offset (WriterT [Int] (Reader (UniformAlignment, AlignmentMode)))) a b -> !Kleisli (StateT Offset (Reader (BufferName, Stride, BInput))) a b -> !Kleisli (StateT (Ptr (), [Int]) IO) a b -> !AlignmentMode -> ToBuffer a b
-- | The atomic buffer value that represents a host value of type
-- a.
data B a
B :: IORef GLuint -> Int -> Int -> Int -> Int -> B a
[bName] :: B a -> IORef GLuint
[bOffset] :: B a -> Int
[bStride] :: B a -> Int
[bSkipElems] :: B a -> Int
[bInstanceDiv] :: B a -> Int
-- | An atomic buffer value that represents a vector of 2 as on
-- the host.
newtype B2 a
B2 :: B a -> B2 a
[unB2] :: B2 a -> B a
-- | An atomic buffer value that represents a vector of 3 as on
-- the host.
newtype B3 a
B3 :: B a -> B3 a
[unB3] :: B3 a -> B a
-- | An atomic buffer value that represents a vector of 4 as on
-- the host. This works similar to '(B a, B a, B a, B a)' but has some
-- performance advantage, especially when used in VertexArrays.
newtype B4 a
B4 :: B a -> B4 a
[unB4] :: B4 a -> B a
-- | Split up a B4 a into two B2 as.
toB22 :: forall a. (Storable a, BufferFormat (B2 a)) => B4 a -> (B2 a, B2 a)
-- | Discard the last component of a B4 a to get a
-- B3 a.
toB3 :: forall a. (Storable a, BufferFormat (B3 a)) => B4 a -> B3 a
-- | Split up a B3 a into a B2 a and a
-- B1 a.
toB21 :: forall a. (Storable a, BufferFormat (B a)) => B3 a -> (B2 a, B a)
-- | Split up a B3 a into a B1 a and a
-- B2 a.
toB12 :: forall a. (Storable a, BufferFormat (B a)) => B3 a -> (B a, B2 a)
-- | Split up a B2 a into two B1 as.
toB11 :: forall a. (Storable a, BufferFormat (B a)) => B2 a -> (B a, B a)
-- | Any buffer value that is going to be used as a uniform needs to be
-- wrapped in this newtype. This will cause is to be aligned properly for
-- uniform usage. It can still be used as input for vertex arrays, but
-- due to the uniform alignment it will probably be padded quite heavily
-- and thus wasteful.
newtype Uniform a
Uniform :: a -> Uniform a
-- | This wrapper is used for integer values to indicate that it should be
-- interpreted as a floating point value, in the range [-1,1] or [0,1]
-- depending on wether it is a signed or unsigned integer (i.e.
-- Int or Word).
newtype Normalized a
Normalized :: a -> Normalized a
-- | This works like a 'B a', but has an alignment smaller than 4 bytes
-- that is the limit for vertex buffers, and thus cannot be used for
-- those. Index buffers on the other hand need to be tightly packed, so
-- you need to use this type for index buffers of Word8 or
-- Word16.
data BPacked a
data BInput
BInput :: Int -> Int -> BInput
[bInSkipElems] :: BInput -> Int
[bInInstanceDiv] :: BInput -> Int
-- | Create a buffer with a specified number of elements.
newBuffer :: (MonadIO m, BufferFormat b, ContextHandler ctx) => Int -> ContextT ctx os m (Buffer os b)
-- | Write a buffer from the host (i.e. the normal Haskell world).
writeBuffer :: (ContextHandler ctx, MonadIO m) => Buffer os b -> BufferStartPos -> [HostFormat b] -> ContextT ctx os m ()
-- | Copies values from one buffer to another (of the same type).
--
-- copyBuffer fromBuffer fromStart toBuffer toStart length will
-- copy length elements from position fromStart in
-- fromBuffer to position toStart in toBuffer.
copyBuffer :: (ContextHandler ctx, MonadIO m) => Buffer os b -> BufferStartPos -> Buffer os b -> BufferStartPos -> Int -> ContextT ctx os m ()
type BufferStartPos = Int
bufSize :: forall os b. Buffer os b -> Int
bufName :: Buffer os b -> BufferName
bufElementSize :: Buffer os b -> Int
-- | Retrieve the number of elements in a buffer.
bufferLength :: Buffer os b -> Int
bufBElement :: Buffer os b -> BInput -> b
bufTransformFeedback :: Buffer os b -> IORef (Maybe (GLuint, GLuint))
bufferWriteInternal :: Buffer os f -> Ptr () -> [HostFormat f] -> IO (Ptr ())
makeBuffer :: forall os b. BufferFormat b => BufferName -> Int -> UniformAlignment -> Buffer os b
getUniformAlignment :: IO Int
type UniformAlignment = Int
instance GHC.Classes.Eq Graphics.GPipe.Internal.Buffer.AlignmentMode
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.BPacked GHC.Word.Word16)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.BPacked GHC.Word.Word8)
instance Graphics.GPipe.Internal.Buffer.BufferFormat a => Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.Normalized a)
instance Graphics.GPipe.Internal.Buffer.BufferFormat a => Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.Uniform a)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B4 GHC.Int.Int32)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B4 GHC.Int.Int16)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B4 GHC.Int.Int8)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B4 GHC.Word.Word32)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B4 GHC.Word.Word16)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B4 GHC.Word.Word8)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B4 GHC.Types.Float)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B3 GHC.Int.Int32)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B3 GHC.Int.Int16)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B3 GHC.Int.Int8)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B3 GHC.Word.Word32)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B3 GHC.Word.Word16)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B3 GHC.Word.Word8)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B3 GHC.Types.Float)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B2 GHC.Int.Int32)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B2 GHC.Int.Int16)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B2 GHC.Word.Word32)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B2 GHC.Word.Word16)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B2 GHC.Types.Float)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B GHC.Int.Int32)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B GHC.Word.Word32)
instance Graphics.GPipe.Internal.Buffer.BufferFormat (Graphics.GPipe.Internal.Buffer.B GHC.Types.Float)
instance GHC.Classes.Eq (Graphics.GPipe.Internal.Buffer.Buffer os b)
instance Graphics.GPipe.Internal.Buffer.BufferFormat a => Graphics.GPipe.Internal.Buffer.BufferFormat (Linear.V0.V0 a)
instance Graphics.GPipe.Internal.Buffer.BufferFormat a => Graphics.GPipe.Internal.Buffer.BufferFormat (Linear.V1.V1 a)
instance Graphics.GPipe.Internal.Buffer.BufferFormat a => Graphics.GPipe.Internal.Buffer.BufferFormat (Linear.V2.V2 a)
instance Graphics.GPipe.Internal.Buffer.BufferFormat a => Graphics.GPipe.Internal.Buffer.BufferFormat (Linear.V3.V3 a)
instance Graphics.GPipe.Internal.Buffer.BufferFormat a => Graphics.GPipe.Internal.Buffer.BufferFormat (Linear.V4.V4 a)
instance Graphics.GPipe.Internal.Buffer.BufferFormat ()
instance (Graphics.GPipe.Internal.Buffer.BufferFormat a, Graphics.GPipe.Internal.Buffer.BufferFormat b) => Graphics.GPipe.Internal.Buffer.BufferFormat (a, b)
instance (Graphics.GPipe.Internal.Buffer.BufferFormat a, Graphics.GPipe.Internal.Buffer.BufferFormat b, Graphics.GPipe.Internal.Buffer.BufferFormat c) => Graphics.GPipe.Internal.Buffer.BufferFormat (a, b, c)
instance (Graphics.GPipe.Internal.Buffer.BufferFormat a, Graphics.GPipe.Internal.Buffer.BufferFormat b, Graphics.GPipe.Internal.Buffer.BufferFormat c, Graphics.GPipe.Internal.Buffer.BufferFormat d) => Graphics.GPipe.Internal.Buffer.BufferFormat (a, b, c, d)
instance (Graphics.GPipe.Internal.Buffer.BufferFormat a, Graphics.GPipe.Internal.Buffer.BufferFormat b, Graphics.GPipe.Internal.Buffer.BufferFormat c, Graphics.GPipe.Internal.Buffer.BufferFormat d, Graphics.GPipe.Internal.Buffer.BufferFormat e) => Graphics.GPipe.Internal.Buffer.BufferFormat (a, b, c, d, e)
instance (Graphics.GPipe.Internal.Buffer.BufferFormat a, Graphics.GPipe.Internal.Buffer.BufferFormat b, Graphics.GPipe.Internal.Buffer.BufferFormat c, Graphics.GPipe.Internal.Buffer.BufferFormat d, Graphics.GPipe.Internal.Buffer.BufferFormat e, Graphics.GPipe.Internal.Buffer.BufferFormat f) => Graphics.GPipe.Internal.Buffer.BufferFormat (a, b, c, d, e, f)
instance (Graphics.GPipe.Internal.Buffer.BufferFormat a, Graphics.GPipe.Internal.Buffer.BufferFormat b, Graphics.GPipe.Internal.Buffer.BufferFormat c, Graphics.GPipe.Internal.Buffer.BufferFormat d, Graphics.GPipe.Internal.Buffer.BufferFormat e, Graphics.GPipe.Internal.Buffer.BufferFormat f, Graphics.GPipe.Internal.Buffer.BufferFormat g) => Graphics.GPipe.Internal.Buffer.BufferFormat (a, b, c, d, e, f, g)
instance Graphics.GPipe.Internal.Buffer.BufferFormat a => Graphics.GPipe.Internal.Buffer.BufferFormat (Linear.Quaternion.Quaternion a)
instance (Graphics.GPipe.Internal.Buffer.BufferFormat (f a), Graphics.GPipe.Internal.Buffer.BufferFormat a, Graphics.GPipe.Internal.Buffer.HostFormat (f a) GHC.Types.~ f (Graphics.GPipe.Internal.Buffer.HostFormat a)) => Graphics.GPipe.Internal.Buffer.BufferFormat (Linear.Affine.Point f a)
instance Graphics.GPipe.Internal.Buffer.BufferFormat a => Graphics.GPipe.Internal.Buffer.BufferFormat (Linear.Plucker.Plucker a)
instance Control.Category.Category Graphics.GPipe.Internal.Buffer.ToBuffer
instance Control.Arrow.Arrow Graphics.GPipe.Internal.Buffer.ToBuffer
-- | Buffers are arrays of data that resides on the GPU. A buffer is
-- strongly typed with an immutable size, but it's content is mutable. A
-- buffer lives in an object space and may be shared between contexts.
--
-- Buffers in GPipe are used to store vertices, indices and uniform
-- values and can also be used to copy pixel data to and from textures.
-- They can be written from the host (ie the normal Haskell world) but
-- cannot be read back (but textures can).
--
-- The atomic buffer element types are B a, B2
-- a, B3 a and B4 a where a
-- is a normal haskell type such as Int32 or Float. By
-- creating instances of the type class BufferFormat you may
-- create new composite buffer types.
module Graphics.GPipe.Buffer
-- | A Buffer os b lives in the object space os and
-- contains elements of type b.
data Buffer os b
-- | The class that constraints which types can live in a buffer.
class BufferFormat f where {
-- | The type a value of this format has when it lives on the host (i.e.
-- normal Haskell world)
type family HostFormat f;
}
-- | An arrow action that turns a value from it's host representation to
-- it's buffer representation. Use toBuffer from the GPipe
-- provided instances to operate in this arrow. Also note that this arrow
-- needs to be able to return a value lazily, so ensure you use
--
--
-- proc ~pattern -> do ...
--
toBuffer :: BufferFormat f => ToBuffer (HostFormat f) f
-- | The arrow type for toBuffer.
data ToBuffer a b
-- | The atomic buffer value that represents a host value of type
-- a.
data B a
-- | An atomic buffer value that represents a vector of 2 as on
-- the host.
data B2 a
-- | An atomic buffer value that represents a vector of 3 as on
-- the host.
data B3 a
-- | An atomic buffer value that represents a vector of 4 as on
-- the host. This works similar to '(B a, B a, B a, B a)' but has some
-- performance advantage, especially when used in VertexArrays.
data B4 a
-- | This works like a 'B a', but has an alignment smaller than 4 bytes
-- that is the limit for vertex buffers, and thus cannot be used for
-- those. Index buffers on the other hand need to be tightly packed, so
-- you need to use this type for index buffers of Word8 or
-- Word16.
data BPacked a
-- | This wrapper is used for integer values to indicate that it should be
-- interpreted as a floating point value, in the range [-1,1] or [0,1]
-- depending on wether it is a signed or unsigned integer (i.e.
-- Int or Word).
newtype Normalized a
Normalized :: a -> Normalized a
-- | Create a buffer with a specified number of elements.
newBuffer :: (MonadIO m, BufferFormat b, ContextHandler ctx) => Int -> ContextT ctx os m (Buffer os b)
-- | Retrieve the number of elements in a buffer.
bufferLength :: Buffer os b -> Int
-- | Write a buffer from the host (i.e. the normal Haskell world).
writeBuffer :: (ContextHandler ctx, MonadIO m) => Buffer os b -> BufferStartPos -> [HostFormat b] -> ContextT ctx os m ()
-- | Copies values from one buffer to another (of the same type).
--
-- copyBuffer fromBuffer fromStart toBuffer toStart length will
-- copy length elements from position fromStart in
-- fromBuffer to position toStart in toBuffer.
copyBuffer :: (ContextHandler ctx, MonadIO m) => Buffer os b -> BufferStartPos -> Buffer os b -> BufferStartPos -> Int -> ContextT ctx os m ()
type BufferStartPos = Int
-- | This type family restricts what host and buffer types a texture format
-- may be converted into. 'BufferColor t h' for a texture representation
-- t and a host representation h will evaluate to a
-- buffer type used in the transfer. This family is closed, i.e. you
-- cannot create additional instances to it.
type family BufferColor c h
-- | A Context in GPipe (just as in OpenGl) consist of two things, a window
-- and an object space. The object space consists of Buffers, Textures
-- and Shaders. You may create a context without a window (for example
-- for rendering to textures that are saved as pngs instead of showed),
-- and you can create a context that shares the object space with another
-- context.
--
-- Context creation is abstracted away from GPipe, and you need a package
-- that provides a ContextFactory, such as GPipe-GLFW.
module Graphics.GPipe.Context
-- | The monad transformer that encapsulates a GPipe context (which wraps
-- an OpenGl context).
--
-- A value of type ContextT ctx os m a is an action on a context
-- with these parameters:
--
--
-- - ctx The context handler.
-- - os An abstract type that is used to denote the
-- object space. This is an forall type defined by the runContextT
-- call which will restrict any objects created inside this context to be
-- returned from it or used by another context (the same trick as the
-- ST monad uses).
-- - m The monad this monad transformer wraps. Need to
-- have IO in the bottom for this ContextT to be
-- runnable.
-- - a The value returned from this monad action.
--
data ContextT ctx os m a
-- | Run a ContextT monad transformer that encapsulates an object
-- space. You need an implementation of a ContextHandler, which is
-- provided by an auxillary package, such as GPipe-GLFW.
runContextT :: (MonadIO m, MonadAsyncException m, ContextHandler ctx) => ContextHandlerParameters ctx -> (forall os. ContextT ctx os m a) -> m a
data Window os c ds
-- | Creates a window
newWindow :: (ContextHandler ctx, MonadIO m) => WindowFormat c ds -> WindowParameters ctx -> ContextT ctx os m (Window os c ds)
-- | Deletes a window. Any rendering to this window will become a noop.
deleteWindow :: (ContextHandler ctx, MonadIO m) => Window os c ds -> ContextT ctx os m ()
-- | Return the current size of the context frame buffer. This is needed to
-- set viewport size and to get the aspect ratio to calculate projection
-- matrices.
getFrameBufferSize :: (ContextHandler ctx, MonadIO m) => Window os c ds -> ContextT ctx os m (V2 Int)
-- | Run this action after a render call to swap out the context
-- windows back buffer with the front buffer, effectively showing the
-- result. This call may block if vsync is enabled in the system and/or
-- too many frames are outstanding. After this call, the context window
-- content is undefined and should be cleared at earliest convenience
-- using clearContextColor and friends.
swapWindowBuffers :: (ContextHandler ctx, MonadIO m) => Window os c ds -> ContextT ctx os m ()
-- | Use the context window handle, which type is specific to the window
-- system used. This handle shouldn't be returned from this function
withContextWindow :: MonadIO m => Window os c ds -> (Maybe (ContextWindow ctx) -> IO a) -> ContextT ctx os m a
-- | Class implementing a window handler that can create openGL contexts,
-- such as GLFW or GLUT
class ContextHandler ctx where {
-- | Implementation specific context handler parameters, eg error handling
-- and event processing policies
data family ContextHandlerParameters ctx;
-- | Implementation specific window type
type family ContextWindow ctx;
-- | Implementation specific window parameters, eg initial size and border
-- decoration
type family WindowParameters ctx;
}
-- | Create a context handler. Called from the main thread
contextHandlerCreate :: ContextHandler ctx => ContextHandlerParameters ctx -> IO ctx
-- | Delete the context handler. All contexts created from this handler
-- will be deleted using contextDelete prior to calling this.
contextHandlerDelete :: ContextHandler ctx => ctx -> IO ()
-- | Create a new context sharing all other contexts created by this
-- ContextHandler. If the parameter is Nothing, a hidden off-screen
-- context is created, otherwise creates a window with the provided
-- window bits and implementation specific parameters. Only ever called
-- from the mainthread (i.e. the thread that called
-- contextHandlerCreate).
createContext :: ContextHandler ctx => ctx -> Maybe (WindowBits, WindowParameters ctx) -> IO (ContextWindow ctx)
-- | Run an OpenGL IO action in this context, that doesn't return any value
-- to the caller. This may be run after contextDelete or
-- contextHandlerDelete has been called. The thread calling this may not
-- be the same creating the context (for finalizers it is most definetly
-- not). May also be called on previously deleted windows in the case of
-- finalizers.
contextDoAsync :: ContextHandler ctx => ctx -> Maybe (ContextWindow ctx) -> IO () -> IO ()
-- | Swap the front and back buffers in the context's default frame buffer.
-- Only ever called from the mainthread (i.e. the thread that called
-- contextHandlerCreate). Never called on deleted windows.
contextSwap :: ContextHandler ctx => ctx -> ContextWindow ctx -> IO ()
-- | Get the current size of the context's default framebuffer (which may
-- change if the window is resized). Only ever called from the mainthread
-- (i.e. the thread that called contextHandlerCreate)
contextFrameBufferSize :: ContextHandler ctx => ctx -> ContextWindow ctx -> IO (Int, Int)
-- | Delete a context and close any associated window. Only ever called
-- from the mainthread (i.e. the thread that called
-- contextHandlerCreate). Only ever called once per window, and
-- will always be called for each window before the context is deleted
-- with contextHandlerDelete.
contextDelete :: ContextHandler ctx => ctx -> ContextWindow ctx -> IO ()
-- | This kind of exception may be thrown from GPipe when a GPU hardware
-- limit is reached (for instance, too many textures are drawn to from
-- the same FragmentStream)
newtype GPipeException
GPipeException :: String -> GPipeException
-- | This module provides data types for all formats of textures and frame
-- buffers. None of the type classes in this module are intended to be
-- instanced by anyone else. In fact, GPipe only uses these type classes
-- through the GADT Format, which is closed, so any new instances
-- wouldnt be considered anyway.
module Graphics.GPipe.Format
data Format a
[R8] :: Format RFloat
[R8S] :: Format RFloat
[R16] :: Format RFloat
[R16S] :: Format RFloat
[R16F] :: Format RFloat
[R32F] :: Format RFloat
[R8I] :: Format RInt
[R16I] :: Format RInt
[R32I] :: Format RInt
[R8UI] :: Format RWord
[R16UI] :: Format RWord
[R32UI] :: Format RWord
[RG8] :: Format RGFloat
[RG8S] :: Format RGFloat
[RG16] :: Format RGFloat
[RG16S] :: Format RGFloat
[RG16F] :: Format RGFloat
[RG32F] :: Format RGFloat
[RG8I] :: Format RGInt
[RG16I] :: Format RGInt
[RG32I] :: Format RGInt
[RG8UI] :: Format RGWord
[RG16UI] :: Format RGWord
[RG32UI] :: Format RGWord
[R3G3B2] :: Format RGBFloat
[RGB4] :: Format RGBFloat
[RGB5] :: Format RGBFloat
[RGB8] :: Format RGBFloat
[RGB8S] :: Format RGBFloat
[RGB10] :: Format RGBFloat
[RGB12] :: Format RGBFloat
[RGB16] :: Format RGBFloat
[RGB16S] :: Format RGBFloat
[RGB16F] :: Format RGBFloat
[RGB32F] :: Format RGBFloat
[R11FG11FB10F] :: Format RGBFloat
[RGB9E5] :: Format RGBFloat
[SRGB8] :: Format RGBFloat
[RGB8I] :: Format RGBInt
[RGB16I] :: Format RGBInt
[RGB32I] :: Format RGBInt
[RGBWord] :: Format RGBWord
[RGB8UI] :: Format RGBWord
[RGB16UI] :: Format RGBWord
[RGB32UI] :: Format RGBWord
[RGBA2] :: Format RGBAFloat
[RGBA4] :: Format RGBAFloat
[RGB5A1] :: Format RGBAFloat
[RGBA8] :: Format RGBAFloat
[RGBA8S] :: Format RGBAFloat
[RGB10A2] :: Format RGBAFloat
[RGBA12] :: Format RGBAFloat
[RGBA16] :: Format RGBAFloat
[RGBA16S] :: Format RGBAFloat
[RGBA16F] :: Format RGBAFloat
[RGBA32F] :: Format RGBAFloat
[SRGB8A8] :: Format RGBAFloat
[RGBA8I] :: Format RGBAInt
[RGBA16I] :: Format RGBAInt
[RGBA32I] :: Format RGBAInt
[RGBA8UI] :: Format RGBAWord
[RGBA16UI] :: Format RGBAWord
[RGBA32UI] :: Format RGBAWord
[Depth16] :: Format Depth
[Depth24] :: Format Depth
[Depth32] :: Format Depth
[Depth32F] :: Format Depth
[Stencil1] :: Format Stencil
[Stencil4] :: Format Stencil
[Stencil8] :: Format Stencil
[Stencil16] :: Format Stencil
[Depth24Stencil8] :: Format DepthStencil
[Depth32FStencil8] :: Format DepthStencil
class TextureFormat f
data RFloat
data RInt
data RWord
data RGFloat
data RGInt
data RGWord
data RGBFloat
data RGBInt
data RGBWord
data RGBAFloat
data RGBAInt
data RGBAWord
data Depth
data Stencil
data DepthStencil
class TextureFormat f => ColorSampleable f where {
type family Color f a;
type family ColorElement f :: *;
}
class ColorSampleable c => ColorRenderable c
class ColorSampleable f => DepthRenderable f
class StencilRenderable f
data WindowFormat c ds
[WindowFormatColor] :: ContextColorFormat c => Format c -> WindowFormat c ()
[WindowFormatColorDepth] :: ContextColorFormat c => Format c -> Format Depth -> WindowFormat c Depth
[WindowFormatColorStencil] :: ContextColorFormat c => Format c -> Format Stencil -> WindowFormat c Stencil
[WindowFormatColorDepthStencilSeparate] :: ContextColorFormat c => Format c -> Format Depth -> Format Stencil -> WindowFormat c DepthStencil
[WindowFormatColorDepthStencilCombined] :: ContextColorFormat c => Format c -> Format DepthStencil -> WindowFormat c DepthStencil
[WindowFormatDepth] :: Format Depth -> WindowFormat () Depth
[WindowFormatStencil] :: Format Stencil -> WindowFormat () Stencil
[WindowFormatDepthStencilSeparate] :: Format Depth -> Format Stencil -> WindowFormat () DepthStencil
[WindowFormatDepthStencilCombined] :: Format DepthStencil -> WindowFormat () DepthStencil
class ColorRenderable c => ContextColorFormat c
windowBits :: WindowFormat c ds -> WindowBits
type WindowBits = ((Int, Int, Int, Int, Bool), Int, Int)
module Graphics.GPipe.Internal.Linear
lookAt :: Floating a => V3 a -> V3 a -> V3 a -> V4 (V4 a)
rotMatrixX :: Floating a => a -> M44 a
rotMatrixY :: Floating a => a -> M44 a
rotMatrixZ :: Floating a => a -> M44 a
module Graphics.GPipe.Internal.Orphans
instance Data.Boolean.EqB a => Data.Boolean.EqB (Linear.V0.V0 a)
instance Data.Boolean.EqB a => Data.Boolean.EqB (Linear.V1.V1 a)
instance Data.Boolean.EqB a => Data.Boolean.EqB (Linear.V2.V2 a)
instance Data.Boolean.EqB a => Data.Boolean.EqB (Linear.V3.V3 a)
instance Data.Boolean.EqB a => Data.Boolean.EqB (Linear.V4.V4 a)
instance Data.Boolean.EqB a => Data.Boolean.EqB (Linear.Quaternion.Quaternion a)
instance Data.Boolean.EqB a => Data.Boolean.EqB (Linear.Plucker.Plucker a)
instance Data.Boolean.EqB (f a) => Data.Boolean.EqB (Linear.Affine.Point f a)
instance Data.Boolean.IfB a => Data.Boolean.IfB (Linear.V0.V0 a)
instance Data.Boolean.IfB a => Data.Boolean.IfB (Linear.V1.V1 a)
instance Data.Boolean.IfB a => Data.Boolean.IfB (Linear.V2.V2 a)
instance Data.Boolean.IfB a => Data.Boolean.IfB (Linear.V3.V3 a)
instance Data.Boolean.IfB a => Data.Boolean.IfB (Linear.V4.V4 a)
instance Data.Boolean.IfB a => Data.Boolean.IfB (Linear.Quaternion.Quaternion a)
instance Data.Boolean.IfB a => Data.Boolean.IfB (Linear.Plucker.Plucker a)
instance Data.Boolean.IfB (f a) => Data.Boolean.IfB (Linear.Affine.Point f a)
module Graphics.GPipe.Internal.Shader
-- | The monad in which all GPU computations are done. 'Shader os s a'
-- lives in an object space os and a context with format
-- f, closing over an environent of type s.
newtype Shader os s a
Shader :: ShaderM s a -> Shader os s a
newtype ShaderM s a
ShaderM :: ReaderT UniformAlignment (WriterT ([IO (Drawcall s)], s -> All) (ListT (State (ShaderState s)))) a -> ShaderM s a
data ShaderState s
ShaderState :: Int -> RenderIOState s -> ShaderState s
-- | A compiled shader is just a function that takes an environment and
-- returns a Render action It could have been called
-- CompiledDrawcall or Renderer because it is the same
-- thing.
type CompiledShader os s = s -> Render os ()
-- | A monad in which shaders are run.
newtype Render os a
Render :: ExceptT String (ReaderT RenderEnv (StateT RenderState IO)) a -> Render os a
[unRender] :: Render os a -> ExceptT String (ReaderT RenderEnv (StateT RenderState IO)) a
getNewName :: ShaderM s Int
tellDrawcall :: IO (Drawcall s) -> ShaderM s ()
askUniformAlignment :: ShaderM s UniformAlignment
modifyRenderIO :: (RenderIOState s -> RenderIOState s) -> ShaderM s ()
-- | Compiles a shader into a CompiledShader. This action will
-- usually take a second or more, so put it during a loading sequence or
-- something.
--
-- May throw a GPipeException if the graphics driver doesn't
-- support something in this shader (e.g. too many interpolated floats
-- sent between a vertex and a fragment shader)
compileShader :: (ContextHandler ctx, MonadIO m, MonadException m) => Shader os s () -> ContextT ctx os m (CompiledShader os s)
-- | Map the environment to a different environment and run a Shader in
-- that sub environment, returning it's result.
mapShader :: (s -> s') -> Shader os s' a -> Shader os s a
-- | Like guard, but dependent on the Shaders environment
-- value. Since this will be evaluated at shader run time, as opposed to
-- shader compile time for guard, using this to do recursion
-- will make compileShader diverge. You can break that divergence
-- by combining it with a normal guard and a maximum loop count.
guard' :: (s -> Bool) -> Shader os s ()
-- | Conditionally run the effects of a shader when a Maybe value is
-- Just something.
maybeShader :: (s -> Maybe s') -> Shader os s' () -> Shader os s ()
-- | Select one of two Shader actions based on whether an
-- Either value is Left or Right.
chooseShader :: (s -> Either s' s'') -> Shader os s' a -> Shader os s'' a -> Shader os s a
-- | Discard all effects of a Shader action (i.e., dont draw
-- anything) and just return the resulting value.
silenceShader :: Shader os s a -> Shader os s a
instance GHC.Base.Functor (Graphics.GPipe.Internal.Shader.ShaderM s)
instance GHC.Base.Applicative (Graphics.GPipe.Internal.Shader.ShaderM s)
instance GHC.Base.Alternative (Graphics.GPipe.Internal.Shader.ShaderM s)
instance GHC.Base.Monad (Graphics.GPipe.Internal.Shader.ShaderM s)
instance GHC.Base.MonadPlus (Graphics.GPipe.Internal.Shader.ShaderM s)
instance GHC.Base.Functor (Graphics.GPipe.Internal.Shader.Shader os s)
instance GHC.Base.Applicative (Graphics.GPipe.Internal.Shader.Shader os s)
instance GHC.Base.Alternative (Graphics.GPipe.Internal.Shader.Shader os s)
instance GHC.Base.Monad (Graphics.GPipe.Internal.Shader.Shader os s)
instance GHC.Base.MonadPlus (Graphics.GPipe.Internal.Shader.Shader os s)
module Graphics.GPipe.Internal.PrimitiveArray
-- | A vertex array is the basic building block for a primitive array. It
-- is created from the contents of a Buffer, but unlike a
-- Buffer, it may be truncated, zipped with other vertex arrays,
-- and even morphed into arrays of a different type with the provided
-- Functor instance. A VertexArray t a has elements of
-- type a, and t indicates whether the vertex array may
-- be used as instances or not.
data VertexArray t a
VertexArray :: Int -> Int -> (BInput -> a) -> VertexArray t a
-- | Retrieve the number of elements in a VertexArray.
[vertexArrayLength] :: VertexArray t a -> Int
[vertexArraySkip] :: VertexArray t a -> Int
[bArrBFunc] :: VertexArray t a -> BInput -> a
-- | A phantom type to indicate that a VertexArray may only be used
-- for instances (in toPrimitiveArrayInstanced and
-- toPrimitiveArrayIndexedInstanced).
data Instances
-- | Create a VertexArray from a Buffer. The vertex array
-- will have the same number of elements as the buffer, use
-- takeVertices and dropVertices to make it smaller.
newVertexArray :: Buffer os a -> Render os (VertexArray t a)
-- | Zip two VertexArrays using the function given as first
-- argument. If either of the argument VertexArrays are restriced
-- to Instances only, then so will the resulting array be, as
-- depicted by the Combine type family.
zipVertices :: (a -> b -> c) -> VertexArray t a -> VertexArray t' b -> VertexArray (Combine t t') c
type family Combine t t'
-- | takeVertices n a creates a shorter vertex array by taking the
-- n first elements of the array a.
takeVertices :: Int -> VertexArray t a -> VertexArray t a
-- | dropVertices n a creates a shorter vertex array by dropping
-- the n first elements of the array a. The argument
-- array a must not be constrained to only Instances.
dropVertices :: Int -> VertexArray () a -> VertexArray t a
-- | replicateEach n a will create a longer vertex array, only to
-- be used for instances, by replicating each element of the array
-- a n times. E.g. replicateEach 3 {ABCD...}
-- will yield {AAABBBCCCDDD...}. This is particulary useful
-- before zipping the array with another that has a different replication
-- rate.
replicateEach :: Int -> VertexArray t a -> VertexArray Instances a
type family IndexFormat a
-- | An index array is like a vertex array, but contains only integer
-- indices. These indices must come from a tightly packed Buffer,
-- hence the lack of a Functor instance and no conversion from
-- VertexArrays.
data IndexArray
IndexArray :: IORef GLuint -> Int -> Int -> Maybe Int -> GLuint -> IndexArray
[iArrName] :: IndexArray -> IORef GLuint
-- | Numer of indices in an IndexArray.
[indexArrayLength] :: IndexArray -> Int
[offset] :: IndexArray -> Int
[restart] :: IndexArray -> Maybe Int
[indexType] :: IndexArray -> GLuint
-- | Create an IndexArray from a Buffer of unsigned integers
-- (as constrained by the closed IndexFormat type family
-- instances). The index array will have the same number of elements as
-- the buffer, use takeIndices and dropIndices to make it
-- smaller. The Maybe a argument is used to optionally denote a
-- primitive restart index.
newIndexArray :: forall os f b a. (BufferFormat b, Integral a, IndexFormat b ~ a) => Buffer os b -> Maybe a -> Render os IndexArray
-- | takeIndices n a creates a shorter index array by taking the
-- n first indices of the array a.
takeIndices :: Int -> IndexArray -> IndexArray
-- | dropIndices n a creates a shorter index array by dropping the
-- n first indices of the array a.
dropIndices :: Int -> IndexArray -> IndexArray
data Points
PointList :: Points
data Lines
LineLoop :: Lines
LineStrip :: Lines
LineList :: Lines
data LinesWithAdjacency
LineListAdjacency :: LinesWithAdjacency
LineStripAdjacency :: LinesWithAdjacency
data Triangles
TriangleList :: Triangles
TriangleStrip :: Triangles
data TrianglesWithAdjacency
TriangleListAdjacency :: TrianglesWithAdjacency
TriangleStripAdjacency :: TrianglesWithAdjacency
class PrimitiveTopology p where {
data family Geometry p a;
}
toGLtopology :: PrimitiveTopology p => p -> GLuint
toPrimitiveSize :: PrimitiveTopology p => p -> Int
toGeometryShaderOutputTopology :: PrimitiveTopology p => p -> GLuint
toLayoutIn :: PrimitiveTopology p => p -> Text
toLayoutOut :: PrimitiveTopology p => p -> Text
type InstanceCount = Int
type BaseVertex = Int
data PrimitiveArrayInt p a
PrimitiveArraySimple :: p -> Int -> BaseVertex -> a -> PrimitiveArrayInt p a
PrimitiveArrayIndexed :: p -> IndexArray -> BaseVertex -> a -> PrimitiveArrayInt p a
PrimitiveArrayInstanced :: p -> InstanceCount -> Int -> BaseVertex -> a -> PrimitiveArrayInt p a
PrimitiveArrayIndexedInstanced :: p -> IndexArray -> InstanceCount -> BaseVertex -> a -> PrimitiveArrayInt p a
-- | An array of primitives
newtype PrimitiveArray p a
PrimitiveArray :: [PrimitiveArrayInt p a] -> PrimitiveArray p a
[getPrimitiveArray] :: PrimitiveArray p a -> [PrimitiveArrayInt p a]
toPrimitiveArray :: PrimitiveTopology p => p -> VertexArray () a -> PrimitiveArray p a
toPrimitiveArrayIndexed :: PrimitiveTopology p => p -> IndexArray -> VertexArray () a -> PrimitiveArray p a
toPrimitiveArrayInstanced :: PrimitiveTopology p => p -> (a -> b -> c) -> VertexArray () a -> VertexArray t b -> PrimitiveArray p c
toPrimitiveArrayIndexedInstanced :: PrimitiveTopology p => p -> IndexArray -> (a -> b -> c) -> VertexArray () a -> VertexArray t b -> PrimitiveArray p c
instance GHC.Base.Semigroup (Graphics.GPipe.Internal.PrimitiveArray.PrimitiveArray p a)
instance GHC.Base.Monoid (Graphics.GPipe.Internal.PrimitiveArray.PrimitiveArray p a)
instance GHC.Base.Functor (Graphics.GPipe.Internal.PrimitiveArray.PrimitiveArray p)
instance Graphics.GPipe.Internal.PrimitiveArray.PrimitiveTopology Graphics.GPipe.Internal.PrimitiveArray.Points
instance Graphics.GPipe.Internal.PrimitiveArray.PrimitiveTopology Graphics.GPipe.Internal.PrimitiveArray.Lines
instance Graphics.GPipe.Internal.PrimitiveArray.PrimitiveTopology Graphics.GPipe.Internal.PrimitiveArray.LinesWithAdjacency
instance Graphics.GPipe.Internal.PrimitiveArray.PrimitiveTopology Graphics.GPipe.Internal.PrimitiveArray.Triangles
instance Graphics.GPipe.Internal.PrimitiveArray.PrimitiveTopology Graphics.GPipe.Internal.PrimitiveArray.TrianglesWithAdjacency
instance GHC.Base.Functor (Graphics.GPipe.Internal.PrimitiveArray.VertexArray t)
module Graphics.GPipe.Internal.Texture
data Texture1D os a
Texture1D :: TexName -> Size1 -> MaxLevels -> Texture1D os a
data Texture1DArray os a
Texture1DArray :: TexName -> Size2 -> MaxLevels -> Texture1DArray os a
data Texture2D os a
Texture2D :: TexName -> Size2 -> MaxLevels -> Texture2D os a
RenderBuffer2D :: TexName -> Size2 -> Texture2D os a
data Texture2DArray os a
Texture2DArray :: TexName -> Size3 -> MaxLevels -> Texture2DArray os a
data Texture3D os a
Texture3D :: TexName -> Size3 -> MaxLevels -> Texture3D os a
data TextureCube os a
TextureCube :: TexName -> Size1 -> MaxLevels -> TextureCube os a
type MaxLevels = Int
type Size1 = Int
type Size2 = V2 Int
type Size3 = V3 Int
newTexture1D :: forall ctx w os f c m. (ContextHandler ctx, ColorSampleable c, MonadIO m) => Format c -> Size1 -> MaxLevels -> ContextT ctx os m (Texture1D os (Format c))
newTexture1DArray :: forall ctx w os f c m. (ContextHandler ctx, ColorSampleable c, MonadIO m) => Format c -> Size2 -> MaxLevels -> ContextT ctx os m (Texture1DArray os (Format c))
newTexture2D :: forall ctx w os f c m. (ContextHandler ctx, TextureFormat c, MonadIO m) => Format c -> Size2 -> MaxLevels -> ContextT ctx os m (Texture2D os (Format c))
newTexture2DArray :: forall ctx w os f c m. (ContextHandler ctx, ColorSampleable c, MonadIO m) => Format c -> Size3 -> MaxLevels -> ContextT ctx os m (Texture2DArray os (Format c))
newTexture3D :: forall ctx w os f c m. (ContextHandler ctx, ColorRenderable c, MonadIO m) => Format c -> Size3 -> MaxLevels -> ContextT ctx os m (Texture3D os (Format c))
newTextureCube :: forall ctx w os f c m. (ContextHandler ctx, ColorSampleable c, MonadIO m) => Format c -> Size1 -> MaxLevels -> ContextT ctx os m (TextureCube os (Format c))
getGlValue :: (ContextHandler ctx, MonadIO m) => GLenum -> ContextT ctx os m Int
setDefaultTexParams :: GLenum -> Int -> IO ()
texture1DLevels :: Texture1D os f -> Int
texture1DArrayLevels :: Texture1DArray os f -> Int
texture2DLevels :: Texture2D os f -> Int
texture2DArrayLevels :: Texture2DArray os f -> Int
texture3DLevels :: Texture3D os f -> Int
textureCubeLevels :: TextureCube os f -> Int
texture1DSizes :: Texture1D os f -> [Size1]
texture1DArraySizes :: Texture1DArray os f -> [Size2]
texture2DSizes :: Texture2D os f -> [Size2]
texture2DArraySizes :: Texture2DArray os f -> [Size3]
texture3DSizes :: Texture3D os f -> [Size3]
textureCubeSizes :: TextureCube os f -> [Size1]
calcLevelSize :: Int -> Int -> Int
calcMaxLevels :: Int -> Int
type TexName = IORef GLuint
makeTex :: (ContextHandler ctx, MonadIO m) => ContextT ctx os m TexName
makeRenderBuff :: (ContextHandler ctx, MonadIO m) => ContextT ctx os m TexName
useTex :: Integral a => TexName -> GLenum -> a -> IO Int
useTexSync :: TexName -> GLenum -> IO ()
type Level = Int
data CubeSide
CubePosX :: CubeSide
CubeNegX :: CubeSide
CubePosY :: CubeSide
CubeNegY :: CubeSide
CubePosZ :: CubeSide
CubeNegZ :: CubeSide
type StartPos1 = Int
type StartPos2 = V2 Int
type StartPos3 = V3 Int
writeTexture1D :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture1D os (Format c) -> Level -> StartPos1 -> Size1 -> [h] -> ContextT ctx os m ()
writeTexture1DArray :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture1DArray os (Format c) -> Level -> StartPos2 -> Size2 -> [h] -> ContextT ctx os m ()
writeTexture2D :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture2D os (Format c) -> Level -> StartPos2 -> Size2 -> [h] -> ContextT ctx os m ()
writeTexture2DArray :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture2DArray os (Format c) -> Level -> StartPos3 -> Size3 -> [h] -> ContextT ctx os m ()
writeTexture3D :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture3D os (Format c) -> Level -> StartPos3 -> Size3 -> [h] -> ContextT ctx os m ()
writeTextureCube :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => TextureCube os (Format c) -> Level -> CubeSide -> StartPos2 -> Size2 -> [h] -> ContextT ctx os m ()
writeTexture1DFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture1D os (Format c) -> Level -> StartPos1 -> Size1 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
writeTexture1DArrayFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture1DArray os (Format c) -> Level -> StartPos2 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
writeTexture2DFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture2D os (Format c) -> Level -> StartPos2 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
writeTexture2DArrayFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture2DArray os (Format c) -> Level -> StartPos3 -> Size3 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
writeTexture3DFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture3D os (Format c) -> Level -> StartPos3 -> Size3 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
writeTextureCubeFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => TextureCube os (Format c) -> Level -> CubeSide -> StartPos2 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
readTexture1D :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture1D os (Format c) -> Level -> StartPos1 -> Size1 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTexture1DArray :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture1DArray os (Format c) -> Level -> StartPos2 -> Size1 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTexture2D :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture2D os (Format c) -> Level -> StartPos2 -> Size2 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTexture2DArray :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture2DArray os (Format c) -> Level -> StartPos3 -> Size2 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTexture3D :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture3D os (Format c) -> Level -> StartPos3 -> Size2 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTextureCube :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => TextureCube os (Format c) -> Level -> CubeSide -> StartPos2 -> Size2 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTexture1DToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture1D os (Format c) -> Level -> StartPos1 -> Size1 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
readTexture1DArrayToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture1DArray os (Format c) -> Level -> StartPos2 -> Size1 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
readTexture2DToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture2D os (Format c) -> Level -> StartPos2 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
readTexture2DArrayToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture2DArray os (Format c) -> Level -> StartPos3 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
readTexture3DToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture3D os (Format c) -> Level -> StartPos3 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
readTextureCubeToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => TextureCube os (Format c) -> Level -> CubeSide -> StartPos2 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
getGlColorFormat :: (TextureFormat f, BufferFormat b) => f -> b -> GLenum
setGlPixelStoreRange :: Int -> Int -> Int -> Int -> Int -> IO ()
generateTexture1DMipmap :: (ContextHandler ctx, MonadIO m) => Texture1D os f -> ContextT ctx os m ()
generateTexture1DArrayMipmap :: (ContextHandler ctx, MonadIO m) => Texture1DArray os f -> ContextT ctx os m ()
generateTexture2DMipmap :: (ContextHandler ctx, MonadIO m) => Texture2D os f -> ContextT ctx os m ()
generateTexture2DArrayMipmap :: (ContextHandler ctx, MonadIO m) => Texture2DArray os f -> ContextT ctx os m ()
generateTexture3DMipmap :: (ContextHandler ctx, MonadIO m) => Texture3D os f -> ContextT ctx os m ()
generateTextureCubeMipmap :: (ContextHandler ctx, MonadIO m) => TextureCube os f -> ContextT ctx os m ()
genMips :: forall ctx (m :: Type -> Type) os. (ContextHandler ctx, MonadIO m) => TexName -> GLenum -> ContextT ctx os m ()
data Filter
Nearest :: Filter
Linear :: Filter
data EdgeMode
Repeat :: EdgeMode
Mirror :: EdgeMode
ClampToEdge :: EdgeMode
ClampToBorder :: EdgeMode
type BorderColor c = Color c (ColorElement c)
type Anisotropy = Maybe Float
type MinFilter = Filter
type MagFilter = Filter
type LodFilter = Filter
-- | A GADT for sample filters, where SamplerFilter cannot be used
-- for integer textures.
data SamplerFilter c
[SamplerFilter] :: ColorElement c ~ Float => MagFilter -> MinFilter -> LodFilter -> Anisotropy -> SamplerFilter c
[SamplerNearest] :: SamplerFilter c
type EdgeMode2 = V2 EdgeMode
type EdgeMode3 = V3 EdgeMode
data ComparisonFunction
Never :: ComparisonFunction
Less :: ComparisonFunction
Equal :: ComparisonFunction
Lequal :: ComparisonFunction
Greater :: ComparisonFunction
Notequal :: ComparisonFunction
Gequal :: ComparisonFunction
Always :: ComparisonFunction
getGlCompFunc :: (Num a, Eq a) => ComparisonFunction -> a
newSampler1D :: forall os s c. ColorSampleable c => (s -> (Texture1D os (Format c), SamplerFilter c, (EdgeMode, BorderColor c))) -> Shader os s (Sampler1D (Format c))
newSampler1DArray :: forall os s c. ColorSampleable c => (s -> (Texture1DArray os (Format c), SamplerFilter c, (EdgeMode, BorderColor c))) -> Shader os s (Sampler1DArray (Format c))
newSampler2D :: forall os s c. ColorSampleable c => (s -> (Texture2D os (Format c), SamplerFilter c, (EdgeMode2, BorderColor c))) -> Shader os s (Sampler2D (Format c))
newSampler2DArray :: forall os s c. ColorSampleable c => (s -> (Texture2DArray os (Format c), SamplerFilter c, (EdgeMode2, BorderColor c))) -> Shader os s (Sampler2DArray (Format c))
newSampler3D :: forall os s c. ColorRenderable c => (s -> (Texture3D os (Format c), SamplerFilter c, (EdgeMode3, BorderColor c))) -> Shader os s (Sampler3D (Format c))
newSamplerCube :: forall os s c. ColorSampleable c => (s -> (TextureCube os (Format c), SamplerFilter c)) -> Shader os s (SamplerCube (Format c))
newSampler1DShadow :: forall os s d. DepthRenderable d => (s -> (Texture1D os (Format d), SamplerFilter d, (EdgeMode, BorderColor d), ComparisonFunction)) -> Shader os s (Sampler1D Shadow)
newSampler1DArrayShadow :: forall os s d. DepthRenderable d => (s -> (Texture1DArray os (Format d), SamplerFilter d, (EdgeMode, BorderColor d), ComparisonFunction)) -> Shader os s (Sampler1DArray Shadow)
newSampler2DShadow :: forall os s d. DepthRenderable d => (s -> (Texture2D os d, SamplerFilter (Format d), (EdgeMode2, BorderColor d), ComparisonFunction)) -> Shader os s (Sampler2D Shadow)
newSampler2DArrayShadow :: forall os s d. DepthRenderable d => (s -> (Texture2DArray os (Format d), SamplerFilter d, (EdgeMode2, BorderColor d), ComparisonFunction)) -> Shader os s (Sampler2DArray Shadow)
newSamplerCubeShadow :: forall os s d. DepthRenderable d => (s -> (TextureCube os (Format d), SamplerFilter d, ComparisonFunction)) -> Shader os s (SamplerCube Shadow)
setNoShadowMode :: GLenum -> IO ()
setShadowFunc :: GLenum -> ComparisonFunction -> IO ()
setEdgeMode :: GLenum -> (Maybe EdgeMode, Maybe EdgeMode, Maybe EdgeMode) -> IO () -> IO ()
setSamplerFilter :: GLenum -> SamplerFilter a -> IO ()
setSamplerFilter' :: GLenum -> MagFilter -> MinFilter -> LodFilter -> Anisotropy -> IO ()
doForSampler :: Int -> (s -> Binding -> IO Int) -> ShaderM s ()
-- | Used instead of Format for shadow samplers. These samplers have
-- specialized sampler values, see sample1DShadow and friends.
data Shadow
data Sampler1D f
Sampler1D :: Int -> Bool -> Text -> Sampler1D f
data Sampler1DArray f
Sampler1DArray :: Int -> Bool -> Text -> Sampler1DArray f
data Sampler2D f
Sampler2D :: Int -> Bool -> Text -> Sampler2D f
data Sampler2DArray f
Sampler2DArray :: Int -> Bool -> Text -> Sampler2DArray f
data Sampler3D f
Sampler3D :: Int -> Bool -> Text -> Sampler3D f
data SamplerCube f
SamplerCube :: Int -> Bool -> Text -> SamplerCube f
-- | A GADT to specify where the level of detail and/or partial derivates
-- should be taken from. Some values of this GADT are restricted to only
-- FragmentStreams.
data SampleLod vx x
[SampleAuto] :: SampleLod v F
[SampleBias] :: FFloat -> SampleLod vx F
[SampleLod] :: S x Float -> SampleLod vx x
[SampleGrad] :: vx -> vx -> SampleLod vx x
-- | For some reason, OpenGl doesnt allow explicit lod to be specified for
-- some sampler types, hence this extra GADT.
data SampleLod' vx x
[SampleAuto'] :: SampleLod' v F
[SampleBias'] :: FFloat -> SampleLod' vx F
[SampleGrad'] :: vx -> vx -> SampleLod' vx x
type SampleLod1 x = SampleLod (S x Float) x
type SampleLod2 x = SampleLod (V2 (S x Float)) x
type SampleLod3 x = SampleLod (V3 (S x Float)) x
type SampleLod2' x = SampleLod' (V2 (S x Float)) x
type SampleLod3' x = SampleLod' (V3 (S x Float)) x
fromLod' :: SampleLod' v x -> SampleLod v x
type SampleProj x = Maybe (S x Float)
type SampleOffset1 x = Maybe Int
type SampleOffset2 x = Maybe (V2 Int)
type SampleOffset3 x = Maybe (V3 Int)
-- | The type of a color sample made by a texture t
type ColorSample x f = Color f (S x (ColorElement f))
type ReferenceValue x = S x Float
sample1D :: forall c x. ColorSampleable c => Sampler1D (Format c) -> SampleLod1 x -> SampleProj x -> SampleOffset1 x -> S x Float -> ColorSample x c
sample1DArray :: forall c x. ColorSampleable c => Sampler1DArray (Format c) -> SampleLod1 x -> SampleOffset1 x -> V2 (S x Float) -> ColorSample x c
sample2D :: forall c x. ColorSampleable c => Sampler2D (Format c) -> SampleLod2 x -> SampleProj x -> SampleOffset2 x -> V2 (S x Float) -> ColorSample x c
sample2DArray :: forall c x. ColorSampleable c => Sampler2DArray (Format c) -> SampleLod2 x -> SampleOffset2 x -> V3 (S x Float) -> ColorSample x c
sample3D :: forall c x. ColorSampleable c => Sampler3D (Format c) -> SampleLod3 x -> SampleProj x -> SampleOffset3 x -> V3 (S x Float) -> ColorSample x c
sampleCube :: forall c x. ColorSampleable c => SamplerCube (Format c) -> SampleLod3 x -> V3 (S x Float) -> ColorSample x c
sample1DShadow :: forall x. Sampler1D Shadow -> SampleLod1 x -> SampleProj x -> SampleOffset1 x -> ReferenceValue x -> S x Float -> S x Float
sample1DArrayShadow :: forall x. Sampler1DArray Shadow -> SampleLod1 x -> SampleOffset1 x -> ReferenceValue x -> V2 (S x Float) -> S x Float
sample2DShadow :: forall x. Sampler2D Shadow -> SampleLod2 x -> SampleProj x -> SampleOffset2 x -> ReferenceValue x -> V2 (S x Float) -> S x Float
sample2DArrayShadow :: forall x. Sampler2DArray Shadow -> SampleLod2' x -> SampleOffset2 x -> ReferenceValue x -> V3 (S x Float) -> S x Float
sampleCubeShadow :: forall x. SamplerCube Shadow -> SampleLod3' x -> ReferenceValue x -> V3 (S x Float) -> S x Float
t1t3 :: S x Float -> S x Float -> V3 (S x Float)
t2t3 :: V2 t -> t -> V3 t
t3t4 :: V3 t -> t -> V4 t
texelFetch1D :: forall c x. ColorSampleable c => Sampler1D (Format c) -> SampleOffset1 x -> S x Level -> S x Int -> ColorSample x c
texelFetch1DArray :: forall c x. ColorSampleable c => Sampler1DArray (Format c) -> SampleOffset1 x -> S x Level -> V2 (S x Int) -> ColorSample x c
texelFetch2D :: forall c x. ColorSampleable c => Sampler2D (Format c) -> SampleOffset2 x -> S x Level -> V2 (S x Int) -> ColorSample x c
texelFetch2DArray :: forall c x. ColorSampleable c => Sampler2DArray (Format c) -> SampleOffset2 x -> S x Level -> V3 (S x Int) -> ColorSample x c
texelFetch3D :: forall c x. ColorSampleable c => Sampler3D (Format c) -> SampleOffset3 x -> S x Level -> V3 (S x Int) -> ColorSample x c
sampler1DSize :: Sampler1D f -> S x Level -> S x Int
sampler1DArraySize :: Sampler1DArray f -> S x Level -> V2 (S x Int)
sampler2DSize :: Sampler2D f -> S x Level -> V2 (S x Int)
sampler2DArraySize :: Sampler2DArray f -> S x Level -> V3 (S x Int)
sampler3DSize :: Sampler3D f -> S x Level -> V3 (S x Int)
samplerCubeSize :: SamplerCube f -> S x Level -> S x Int
addShadowPrefix :: Bool -> Text -> Text
getTextureSize :: Text -> Int -> Text -> S c Int -> ExprM Text
sample :: e -> Text -> Text -> Text -> Int -> SampleLod lcoord x -> SampleProj x -> Maybe off -> coord -> (coord -> ExprM Text) -> (lcoord -> ExprM Text) -> (off -> Text) -> (coord -> S x Float -> ExprM Text) -> V4 (S x e)
sampleShadow :: Text -> Int -> SampleLod lcoord x -> SampleProj x -> Maybe off -> coord -> (coord -> ExprM Text) -> (lcoord -> ExprM Text) -> (off -> Text) -> (coord -> S x Float -> ExprM Text) -> S x Float
fetch :: e -> Text -> Text -> Text -> Int -> S x Int -> Maybe off -> coord -> (coord -> ExprM Text) -> (off -> Text) -> V4 (S x e)
v1toF :: S c Float -> ExprM Text
v2toF :: V2 (S c Float) -> ExprM Text
v3toF :: V3 (S c Float) -> ExprM Text
v4toF :: V4 (S c Float) -> ExprM Text
iv1toF :: S c Int -> ExprM Text
iv2toF :: V2 (S c Int) -> ExprM Text
iv3toF :: V3 (S c Int) -> ExprM Text
civ1toF :: Int -> Text
civ2toF :: V2 Int -> Text
civ3toF :: V3 Int -> Text
pv1toF :: S c Float -> S c Float -> ExprM Text
pv2toF :: V2 (S c Float) -> S c Float -> ExprM Text
pv3toF :: V3 (S c Float) -> S c Float -> ExprM Text
sampleFunc :: Text -> Maybe a -> SampleLod vx x -> Maybe t1 -> t2 -> (t2 -> SNMapReaderT [Text] (StateT ExprState IO) Text) -> (vx -> SNMapReaderT [Text] (StateT ExprState IO) Text) -> (t1 -> Text) -> (t2 -> a -> SNMapReaderT [Text] (StateT ExprState IO) Text) -> SNMapReaderT [Text] (StateT ExprState IO) Text
fetchFunc :: Text -> Maybe t1 -> t2 -> S x a -> (t2 -> SNMapReaderT [Text] (StateT ExprState IO) Text) -> (t1 -> Text) -> SNMapReaderT [Text] (StateT ExprState IO) Text
offParam :: Maybe t -> (t -> Text) -> Text
offName :: Maybe t -> Text
-- | A texture image is a reference to a 2D array of pixels in a texture.
-- Some textures contain one Image per level of detail while some
-- contain several.
data Image f
Image :: TexName -> Int -> Int -> V2 Int -> (GLuint -> IO ()) -> Image f
-- | Compare two images that doesn't necessarily has same type
imageEquals :: Image a -> Image b -> Bool
getImageBinding :: Image t -> GLuint -> IO ()
getImageFBOKey :: Image t -> IO FBOKey
-- | Retrieve the 2D size an image
imageSize :: Image f -> V2 Int
getTexture1DImage :: Texture1D os f -> Level -> Render os (Image f)
getTexture1DArrayImage :: Texture1DArray os f -> Level -> Int -> Render os (Image f)
getTexture2DImage :: Texture2D os f -> Level -> Render os (Image f)
getTexture2DArrayImage :: Texture2DArray os f -> Level -> Int -> Render os (Image f)
getTexture3DImage :: Texture3D os f -> Level -> Int -> Render os (Image f)
getTextureCubeImage :: TextureCube os f -> Level -> CubeSide -> Render os (Image f)
getLayeredTextureImage :: Texture3D os f -> MaxLevels -> Render os (Image f)
registerRenderWriteTextureName :: Integral a => IORef a -> Render os ()
getGlCubeSide :: CubeSide -> GLenum
instance GHC.Enum.Bounded Graphics.GPipe.Internal.Texture.CubeSide
instance GHC.Enum.Enum Graphics.GPipe.Internal.Texture.CubeSide
instance GHC.Classes.Eq Graphics.GPipe.Internal.Texture.CubeSide
instance GHC.Enum.Enum Graphics.GPipe.Internal.Texture.Filter
instance GHC.Classes.Eq Graphics.GPipe.Internal.Texture.Filter
instance GHC.Enum.Enum Graphics.GPipe.Internal.Texture.EdgeMode
instance GHC.Classes.Eq Graphics.GPipe.Internal.Texture.EdgeMode
instance GHC.Show.Show Graphics.GPipe.Internal.Texture.ComparisonFunction
instance GHC.Classes.Ord Graphics.GPipe.Internal.Texture.ComparisonFunction
instance GHC.Classes.Eq Graphics.GPipe.Internal.Texture.ComparisonFunction
instance GHC.Classes.Eq (Graphics.GPipe.Internal.Texture.Image f)
module Graphics.GPipe.Internal.Uniform
-- | This class constraints which buffer types can be loaded as uniforms,
-- and what type those values have.
class BufferFormat a => UniformInput a where {
-- | The type the buffer value will be turned into once it becomes a vertex
-- or fragment value (the x parameter is either V or
-- F).
type family UniformFormat a x;
}
-- | An arrow action that turns a value from it's buffer representation to
-- it's vertex or fragment representation. Use toUniform from the
-- GPipe provided instances to operate in this arrow. Also note that this
-- arrow needs to be able to return a value lazily, so ensure you use
--
-- proc ~pattern -> do ....
toUniform :: UniformInput a => ToUniform x a (UniformFormat a x)
-- | Load a uniform value from a Buffer into a Shader. The
-- argument function is used to retrieve the buffer and the index into
-- this buffer from the shader environment. UBO are obviously used here
-- and there is no way to use "classic" uniform.
getUniform :: forall os s b x. UniformInput b => (s -> (Buffer os (Uniform b), Int)) -> Shader os s (UniformFormat b x)
buildUDecl :: OffsetToSType -> GlobDeclM ()
type OffsetToSType = IntMap SType
-- | The arrow type for toUniform.
newtype ToUniform x a b
ToUniform :: Kleisli (WriterT OffsetToSType (Reader (Int -> ExprM Text))) a b -> ToUniform x a b
makeUniform :: SType -> ToUniform x (B a) (S x b)
instance Control.Arrow.Arrow (Graphics.GPipe.Internal.Uniform.ToUniform x)
instance Control.Category.Category (Graphics.GPipe.Internal.Uniform.ToUniform x)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B GHC.Types.Float)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B GHC.Int.Int32)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B GHC.Word.Word32)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B2 GHC.Types.Float)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B2 GHC.Int.Int32)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B2 GHC.Word.Word32)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B3 GHC.Types.Float)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B3 GHC.Int.Int32)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B3 GHC.Word.Word32)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B4 GHC.Types.Float)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B4 GHC.Int.Int32)
instance Graphics.GPipe.Internal.Uniform.UniformInput (Graphics.GPipe.Internal.Buffer.B4 GHC.Word.Word32)
instance Graphics.GPipe.Internal.Uniform.UniformInput a => Graphics.GPipe.Internal.Uniform.UniformInput (Linear.V0.V0 a)
instance Graphics.GPipe.Internal.Uniform.UniformInput a => Graphics.GPipe.Internal.Uniform.UniformInput (Linear.V1.V1 a)
instance Graphics.GPipe.Internal.Uniform.UniformInput a => Graphics.GPipe.Internal.Uniform.UniformInput (Linear.V2.V2 a)
instance Graphics.GPipe.Internal.Uniform.UniformInput a => Graphics.GPipe.Internal.Uniform.UniformInput (Linear.V3.V3 a)
instance Graphics.GPipe.Internal.Uniform.UniformInput a => Graphics.GPipe.Internal.Uniform.UniformInput (Linear.V4.V4 a)
instance Graphics.GPipe.Internal.Uniform.UniformInput ()
instance (Graphics.GPipe.Internal.Uniform.UniformInput a, Graphics.GPipe.Internal.Uniform.UniformInput b) => Graphics.GPipe.Internal.Uniform.UniformInput (a, b)
instance (Graphics.GPipe.Internal.Uniform.UniformInput a, Graphics.GPipe.Internal.Uniform.UniformInput b, Graphics.GPipe.Internal.Uniform.UniformInput c) => Graphics.GPipe.Internal.Uniform.UniformInput (a, b, c)
instance (Graphics.GPipe.Internal.Uniform.UniformInput a, Graphics.GPipe.Internal.Uniform.UniformInput b, Graphics.GPipe.Internal.Uniform.UniformInput c, Graphics.GPipe.Internal.Uniform.UniformInput d) => Graphics.GPipe.Internal.Uniform.UniformInput (a, b, c, d)
instance (Graphics.GPipe.Internal.Uniform.UniformInput a, Graphics.GPipe.Internal.Uniform.UniformInput b, Graphics.GPipe.Internal.Uniform.UniformInput c, Graphics.GPipe.Internal.Uniform.UniformInput d, Graphics.GPipe.Internal.Uniform.UniformInput e) => Graphics.GPipe.Internal.Uniform.UniformInput (a, b, c, d, e)
instance (Graphics.GPipe.Internal.Uniform.UniformInput a, Graphics.GPipe.Internal.Uniform.UniformInput b, Graphics.GPipe.Internal.Uniform.UniformInput c, Graphics.GPipe.Internal.Uniform.UniformInput d, Graphics.GPipe.Internal.Uniform.UniformInput e, Graphics.GPipe.Internal.Uniform.UniformInput f) => Graphics.GPipe.Internal.Uniform.UniformInput (a, b, c, d, e, f)
instance (Graphics.GPipe.Internal.Uniform.UniformInput a, Graphics.GPipe.Internal.Uniform.UniformInput b, Graphics.GPipe.Internal.Uniform.UniformInput c, Graphics.GPipe.Internal.Uniform.UniformInput d, Graphics.GPipe.Internal.Uniform.UniformInput e, Graphics.GPipe.Internal.Uniform.UniformInput f, Graphics.GPipe.Internal.Uniform.UniformInput g) => Graphics.GPipe.Internal.Uniform.UniformInput (a, b, c, d, e, f, g)
instance Graphics.GPipe.Internal.Uniform.UniformInput a => Graphics.GPipe.Internal.Uniform.UniformInput (Linear.Quaternion.Quaternion a)
instance Graphics.GPipe.Internal.Uniform.UniformInput a => Graphics.GPipe.Internal.Uniform.UniformInput (Linear.Plucker.Plucker a)
module Graphics.GPipe.Internal.PrimitiveStream
type PrimitiveName = Int
type USize = Int
data PrimitiveStreamData
PrimitiveStreamData :: PrimitiveName -> USize -> PrimitiveStreamData
-- | A PrimitiveStream t a is a stream of primitives of
-- type t where the vertices are values of type a. You
-- can operate a stream's vertex values using the Functor instance
-- (this will result in a shader running on the GPU). You may also append
-- PrimitiveStreams using the Monoid instance, but if
-- possible append the origin PrimitiveArrays instead, as this
-- will create more optimized draw calls.
newtype PrimitiveStream t a
PrimitiveStream :: [(a, (Maybe PointSize, PrimitiveStreamData))] -> PrimitiveStream t a
-- | This class constraints which buffer types can be turned into vertex
-- values, and what type those values have.
class VertexInput a where {
-- | The type the buffer value will be turned into once it becomes a vertex
-- value.
type family VertexFormat a;
}
-- | An arrow action that turns a value from it's buffer representation to
-- it's vertex representation. Use toVertex from the GPipe
-- provided instances to operate in this arrow. Also note that this arrow
-- needs to be able to return a value lazily, so ensure you use
--
-- proc ~pattern -> do ....
toVertex :: VertexInput a => ToVertex a (VertexFormat a)
type UniOffset = Int
-- | The arrow type for toVertex.
data ToVertex a b
ToVertex :: !Kleisli (StateT (Ptr ()) IO) a b -> !Kleisli (StateT (Int, UniOffset, OffsetToSType) (Reader (Int -> ExprM Text))) a b -> !Kleisli (State [Binding -> (IO VAOKey, IO ())]) a b -> ToVertex a b
-- | Create a primitive stream from a primitive array provided from the
-- shader environment. TODO No way to constraint b a bit more?
toPrimitiveStream :: forall os f s a p. (PrimitiveTopology p, VertexInput a) => (s -> PrimitiveArray p a) -> Shader os s (PrimitiveStream p (VertexFormat a))
toPrimitiveStream' :: forall os f s a b p. (PrimitiveTopology p, VertexInput a) => Maybe (s -> Buffer os b) -> (s -> PrimitiveArray p a) -> Shader os s (PrimitiveStream p (VertexFormat a))
data InputIndices
InputIndices :: VInt -> VInt -> InputIndices
[inputVertexID] :: InputIndices -> VInt
[inputInstanceID] :: InputIndices -> VInt
-- | Like fmap, but where the vertex and instance IDs are provided
-- as arguments as well.
withInputIndices :: (a -> InputIndices -> b) -> PrimitiveStream p a -> PrimitiveStream p b
type PointSize = VFloat
-- | Like fmap, but where each point's size is provided as arguments
-- as well, and a new point size is set for each point in addition to the
-- new vertex value.
--
-- When a PrimitiveStream of Points is created, all points
-- will have the default size of 1.
withPointSize :: (a -> PointSize -> (b, PointSize)) -> PrimitiveStream Points a -> PrimitiveStream Points b
append :: Monad m => a -> StateT [a] m ()
makeVertexF :: forall (m :: Type -> Type) p1 b1 p2 b2 c. Monad m => p1 -> (SType -> ExprM Text -> b1) -> SType -> p2 -> StateT (Int, b2, c) m b1
makeBindVertexFx :: forall (m :: Type -> Type) a1 a2 b. (Monad m, Integral a1) => Bool -> GLint -> GLenum -> B a2 -> StateT [a1 -> (IO VAOKey, IO ())] m b
makeBindVertexFnorm :: GLint -> GLenum -> B a -> StateT [Binding -> (IO VAOKey, IO ())] Identity b
makeBindVertexF :: GLint -> GLenum -> B a -> StateT [Binding -> (IO VAOKey, IO ())] Identity b
makeVertexI :: forall (m :: Type -> Type) p1 b1 p2 b2 c. Monad m => p1 -> (SType -> ExprM Text -> b1) -> SType -> p2 -> StateT (Int, b2, c) m b1
makeBindVertexI :: forall (m :: Type -> Type) a1 a2 b. (Monad m, Integral a1) => GLint -> GLenum -> B a2 -> StateT [a1 -> (IO VAOKey, IO ())] m b
noWriter :: Kleisli (StateT (Ptr ()) IO) b1 b2
toUniformVertex :: forall a b. Storable a => SType -> ToVertex a (S V b)
unBnorm :: Normalized t -> t
instance GHC.Base.Monoid (Graphics.GPipe.Internal.PrimitiveStream.PrimitiveStream t a)
instance GHC.Base.Semigroup (Graphics.GPipe.Internal.PrimitiveStream.PrimitiveStream t a)
instance GHC.Base.Functor (Graphics.GPipe.Internal.PrimitiveStream.PrimitiveStream t)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput GHC.Types.Float
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput GHC.Int.Int32
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput GHC.Word.Word32
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B GHC.Types.Float)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B GHC.Int.Int32))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B GHC.Word.Word32))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B GHC.Int.Int32)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B GHC.Word.Word32)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B2 GHC.Types.Float)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B2 GHC.Int.Int32))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B2 GHC.Int.Int16))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B2 GHC.Word.Word32))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B2 GHC.Word.Word16))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B2 GHC.Int.Int32)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B2 GHC.Int.Int16)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B2 GHC.Word.Word32)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B2 GHC.Word.Word16)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B3 GHC.Types.Float)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B3 GHC.Int.Int32))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B3 GHC.Int.Int16))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B3 GHC.Int.Int8))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B3 GHC.Word.Word32))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B3 GHC.Word.Word16))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B3 GHC.Word.Word8))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B3 GHC.Int.Int32)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B3 GHC.Int.Int16)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B3 GHC.Int.Int8)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B3 GHC.Word.Word32)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B3 GHC.Word.Word16)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B3 GHC.Word.Word8)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B4 GHC.Types.Float)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B4 GHC.Int.Int32))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B4 GHC.Int.Int16))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B4 GHC.Int.Int8))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B4 GHC.Word.Word32))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B4 GHC.Word.Word16))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.Normalized (Graphics.GPipe.Internal.Buffer.B4 GHC.Word.Word8))
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B4 GHC.Int.Int32)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B4 GHC.Int.Int16)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B4 GHC.Int.Int8)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B4 GHC.Word.Word32)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B4 GHC.Word.Word16)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Graphics.GPipe.Internal.Buffer.B4 GHC.Word.Word8)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput ()
instance (Graphics.GPipe.Internal.PrimitiveStream.VertexInput a, Graphics.GPipe.Internal.PrimitiveStream.VertexInput b) => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (a, b)
instance (Graphics.GPipe.Internal.PrimitiveStream.VertexInput a, Graphics.GPipe.Internal.PrimitiveStream.VertexInput b, Graphics.GPipe.Internal.PrimitiveStream.VertexInput c) => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (a, b, c)
instance (Graphics.GPipe.Internal.PrimitiveStream.VertexInput a, Graphics.GPipe.Internal.PrimitiveStream.VertexInput b, Graphics.GPipe.Internal.PrimitiveStream.VertexInput c, Graphics.GPipe.Internal.PrimitiveStream.VertexInput d) => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (a, b, c, d)
instance (Graphics.GPipe.Internal.PrimitiveStream.VertexInput a, Graphics.GPipe.Internal.PrimitiveStream.VertexInput b, Graphics.GPipe.Internal.PrimitiveStream.VertexInput c, Graphics.GPipe.Internal.PrimitiveStream.VertexInput d, Graphics.GPipe.Internal.PrimitiveStream.VertexInput e) => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (a, b, c, d, e)
instance (Graphics.GPipe.Internal.PrimitiveStream.VertexInput a, Graphics.GPipe.Internal.PrimitiveStream.VertexInput b, Graphics.GPipe.Internal.PrimitiveStream.VertexInput c, Graphics.GPipe.Internal.PrimitiveStream.VertexInput d, Graphics.GPipe.Internal.PrimitiveStream.VertexInput e, Graphics.GPipe.Internal.PrimitiveStream.VertexInput f) => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (a, b, c, d, e, f)
instance (Graphics.GPipe.Internal.PrimitiveStream.VertexInput a, Graphics.GPipe.Internal.PrimitiveStream.VertexInput b, Graphics.GPipe.Internal.PrimitiveStream.VertexInput c, Graphics.GPipe.Internal.PrimitiveStream.VertexInput d, Graphics.GPipe.Internal.PrimitiveStream.VertexInput e, Graphics.GPipe.Internal.PrimitiveStream.VertexInput f, Graphics.GPipe.Internal.PrimitiveStream.VertexInput g) => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (a, b, c, d, e, f, g)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput a => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Linear.V0.V0 a)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput a => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Linear.V1.V1 a)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput a => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Linear.V2.V2 a)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput a => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Linear.V3.V3 a)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput a => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Linear.V4.V4 a)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput a => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Linear.Quaternion.Quaternion a)
instance (Graphics.GPipe.Internal.PrimitiveStream.VertexInput (f a), Graphics.GPipe.Internal.PrimitiveStream.VertexInput a, Graphics.GPipe.Internal.Buffer.HostFormat (f a) GHC.Types.~ f (Graphics.GPipe.Internal.Buffer.HostFormat a), Graphics.GPipe.Internal.PrimitiveStream.VertexFormat (f a) GHC.Types.~ f (Graphics.GPipe.Internal.PrimitiveStream.VertexFormat a)) => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Linear.Affine.Point f a)
instance Graphics.GPipe.Internal.PrimitiveStream.VertexInput a => Graphics.GPipe.Internal.PrimitiveStream.VertexInput (Linear.Plucker.Plucker a)
instance Control.Category.Category Graphics.GPipe.Internal.PrimitiveStream.ToVertex
instance Control.Arrow.Arrow Graphics.GPipe.Internal.PrimitiveStream.ToVertex
module Graphics.GPipe.Internal.FragmentStream
type VPos = V4 VFloat
type ExprPos = ExprM ()
type RasterizationName = Int
data FragmentStreamData
FragmentStreamData :: RasterizationName -> Bool -> ExprPos -> PrimitiveStreamData -> FBool -> FragmentStreamData
-- | A FragmentStream a is a stream of fragments of type
-- a. You may append FragmentStreams using the
-- Monoid instance, and you can operate a stream's values using
-- the Functor instance (this will result in a shader running on
-- the GPU).
newtype FragmentStream a
FragmentStream :: [(a, FragmentStreamData)] -> FragmentStream a
-- | The arrow type for toFragment.
newtype ToFragment a b
ToFragment :: Kleisli (State Int) a b -> ToFragment a b
-- | This class constraints which vertex types can be turned into fragment
-- values, and what type those values have.
class FragmentInput a where {
-- | The type the vertex value will be turned into once it becomes a
-- fragment value.
type family FragmentFormat a;
}
-- | An arrow action that turns a value from it's vertex representation to
-- it's fragment representation. Use toFragment from the GPipe
-- provided instances to operate in this arrow. Also note that this arrow
-- needs to be able to return a value lazily, so ensure you use
--
-- proc ~pattern -> do ....
toFragment :: FragmentInput a => ToFragment a (FragmentFormat a)
-- | Rasterize a stream of primitives into fragments, using a Side,
-- PolygonMode, Viewport and DepthRange from the
-- shader environment. Primitives will be transformed from canonical view
-- space, i.e. [(-1,-1,-1),(1,1,1)], to the 2D space defined by the
-- ViewPort parameter and the depth range defined by the
-- DepthRange parameter. PolygonMode controls whether to
-- fill in the primitives or whether to show a wireframe or points only.
rasterize :: forall p a s os f. FragmentInput a => (s -> (Side, PolygonMode, ViewPort, DepthRange)) -> PrimitiveStream p (VPos, a) -> Shader os s (FragmentStream (FragmentFormat a))
-- | Defines which side to rasterize. Non triangle primitives only has a
-- front side.
data Side
Front :: Side
Back :: Side
FrontAndBack :: Side
-- | Defines whether to fill the polygon or to show points or wireframes.
data PolygonMode
PolygonFill :: PolygonMode
PolygonLine :: Float -> PolygonMode
PolygonPoint :: PolygonMode
-- | The viewport in pixel coordinates (where (0,0) is the lower left
-- corner) in to which the canonical view volume [(-1,-1,-1),(1,1,1)] is
-- transformed and clipped/scissored.
data ViewPort
ViewPort :: V2 Int -> V2 Int -> ViewPort
[viewPortLowerLeft] :: ViewPort -> V2 Int
[viewPortSize] :: ViewPort -> V2 Int
-- | The fragment depth range to map the canonical view volume's
-- z-coordinate to. Depth values are clamped to [0,1], so DepthRange
-- 0 1 gives maximum depth resolution.
data DepthRange
DepthRange :: Float -> Float -> DepthRange
[minDepth] :: DepthRange -> Float
[maxDepth] :: DepthRange -> Float
-- | Filter out fragments from the stream where the predicate in the first
-- argument evaluates to true, and discard all other fragments.
filterFragments :: (a -> FBool) -> FragmentStream a -> FragmentStream a
data RasterizedInfo
RasterizedInfo :: V4 FFloat -> FBool -> V2 FFloat -> RasterizedInfo
[rasterizedFragCoord] :: RasterizedInfo -> V4 FFloat
[rasterizedFrontFacing] :: RasterizedInfo -> FBool
[rasterizedPointCoord] :: RasterizedInfo -> V2 FFloat
-- | Like fmap, but where various auto generated information from
-- the rasterization is provided for each vertex.
withRasterizedInfo :: (a -> RasterizedInfo -> b) -> FragmentStream a -> FragmentStream b
-- | A float value that is not interpolated (like integers), and all
-- fragments will instead get the value of the primitive's last vertex
newtype FlatVFloat
Flat :: VFloat -> FlatVFloat
-- | A float value that doesn't get divided by the interpolated position's
-- w-component during interpolation.
newtype NoPerspectiveVFloat
NoPerspective :: VFloat -> NoPerspectiveVFloat
makeFragment :: Text -> SType -> (a -> ExprM Text) -> ToFragment a (S c a1)
unFlat :: FlatVFloat -> VFloat
unNPersp :: NoPerspectiveVFloat -> VFloat
instance GHC.Base.Monoid (Graphics.GPipe.Internal.FragmentStream.FragmentStream a)
instance GHC.Base.Semigroup (Graphics.GPipe.Internal.FragmentStream.FragmentStream a)
instance Control.Arrow.Arrow Graphics.GPipe.Internal.FragmentStream.ToFragment
instance Control.Category.Category Graphics.GPipe.Internal.FragmentStream.ToFragment
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput Graphics.GPipe.Internal.FragmentStream.NoPerspectiveVFloat
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput Graphics.GPipe.Internal.FragmentStream.FlatVFloat
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput ()
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput Graphics.GPipe.Internal.Expr.VFloat
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput Graphics.GPipe.Internal.Expr.VInt
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput Graphics.GPipe.Internal.Expr.VWord
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput Graphics.GPipe.Internal.Expr.VBool
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput a => Graphics.GPipe.Internal.FragmentStream.FragmentInput (Linear.V0.V0 a)
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput a => Graphics.GPipe.Internal.FragmentStream.FragmentInput (Linear.V1.V1 a)
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput a => Graphics.GPipe.Internal.FragmentStream.FragmentInput (Linear.V2.V2 a)
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput a => Graphics.GPipe.Internal.FragmentStream.FragmentInput (Linear.V3.V3 a)
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput a => Graphics.GPipe.Internal.FragmentStream.FragmentInput (Linear.V4.V4 a)
instance (Graphics.GPipe.Internal.FragmentStream.FragmentInput a, Graphics.GPipe.Internal.FragmentStream.FragmentInput b) => Graphics.GPipe.Internal.FragmentStream.FragmentInput (a, b)
instance (Graphics.GPipe.Internal.FragmentStream.FragmentInput a, Graphics.GPipe.Internal.FragmentStream.FragmentInput b, Graphics.GPipe.Internal.FragmentStream.FragmentInput c) => Graphics.GPipe.Internal.FragmentStream.FragmentInput (a, b, c)
instance (Graphics.GPipe.Internal.FragmentStream.FragmentInput a, Graphics.GPipe.Internal.FragmentStream.FragmentInput b, Graphics.GPipe.Internal.FragmentStream.FragmentInput c, Graphics.GPipe.Internal.FragmentStream.FragmentInput d) => Graphics.GPipe.Internal.FragmentStream.FragmentInput (a, b, c, d)
instance (Graphics.GPipe.Internal.FragmentStream.FragmentInput a, Graphics.GPipe.Internal.FragmentStream.FragmentInput b, Graphics.GPipe.Internal.FragmentStream.FragmentInput c, Graphics.GPipe.Internal.FragmentStream.FragmentInput d, Graphics.GPipe.Internal.FragmentStream.FragmentInput e) => Graphics.GPipe.Internal.FragmentStream.FragmentInput (a, b, c, d, e)
instance (Graphics.GPipe.Internal.FragmentStream.FragmentInput a, Graphics.GPipe.Internal.FragmentStream.FragmentInput b, Graphics.GPipe.Internal.FragmentStream.FragmentInput c, Graphics.GPipe.Internal.FragmentStream.FragmentInput d, Graphics.GPipe.Internal.FragmentStream.FragmentInput e, Graphics.GPipe.Internal.FragmentStream.FragmentInput f) => Graphics.GPipe.Internal.FragmentStream.FragmentInput (a, b, c, d, e, f)
instance (Graphics.GPipe.Internal.FragmentStream.FragmentInput a, Graphics.GPipe.Internal.FragmentStream.FragmentInput b, Graphics.GPipe.Internal.FragmentStream.FragmentInput c, Graphics.GPipe.Internal.FragmentStream.FragmentInput d, Graphics.GPipe.Internal.FragmentStream.FragmentInput e, Graphics.GPipe.Internal.FragmentStream.FragmentInput f, Graphics.GPipe.Internal.FragmentStream.FragmentInput g) => Graphics.GPipe.Internal.FragmentStream.FragmentInput (a, b, c, d, e, f, g)
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput a => Graphics.GPipe.Internal.FragmentStream.FragmentInput (Linear.Quaternion.Quaternion a)
instance (Graphics.GPipe.Internal.FragmentStream.FragmentInput (f a), Graphics.GPipe.Internal.FragmentStream.FragmentInput a, Graphics.GPipe.Internal.FragmentStream.FragmentFormat (f a) GHC.Types.~ f (Graphics.GPipe.Internal.FragmentStream.FragmentFormat a)) => Graphics.GPipe.Internal.FragmentStream.FragmentInput (Linear.Affine.Point f a)
instance Graphics.GPipe.Internal.FragmentStream.FragmentInput a => Graphics.GPipe.Internal.FragmentStream.FragmentInput (Linear.Plucker.Plucker a)
instance GHC.Base.Functor Graphics.GPipe.Internal.FragmentStream.FragmentStream
module Graphics.GPipe.Internal.GeometryStream
type GeometrizationName = Int
type LayoutName = Text
data GeometryStreamData
GeometryStreamData :: GeometrizationName -> LayoutName -> PrimitiveStreamData -> GeometryStreamData
newtype GeometryStream a
GeometryStream :: [(a, GeometryStreamData)] -> GeometryStream a
newtype ToGeometry a b
ToGeometry :: Kleisli (State (Int, Int)) a b -> ToGeometry a b
class (AnotherVertexInput a, PrimitiveTopology p) => GeometryInput p a
toGeometry :: GeometryInput p a => ToGeometry a (Geometry p a)
newtype ToAnotherVertex a b
ToAnotherVertex :: Kleisli (State (Int, Int)) (Int, a) b -> ToAnotherVertex a b
class AnotherVertexInput a
toAnotherVertex :: AnotherVertexInput a => ToAnotherVertex a a
makeAnotherVertex :: Text -> SType -> (b -> ExprM Text) -> (S c a -> b) -> ToAnotherVertex b b
geometrize :: forall p a s os f. GeometryInput p a => PrimitiveStream p a -> Shader os s (GeometryStream (Geometry p a))
notMeantToBeRead :: Text
generativePoints :: FragmentInput a => GGenerativeGeometry Points a
generativeLineStrip :: FragmentInput a => GGenerativeGeometry Lines a
generativeTriangleStrip :: FragmentInput a => GGenerativeGeometry Triangles a
emitVertex :: GeometryExplosive a => a -> GGenerativeGeometry p a -> GGenerativeGeometry p a
emitVertexPosition :: GeometryExplosive a => (VPos, a) -> GGenerativeGeometry p (VPos, a) -> GGenerativeGeometry p (VPos, a)
emitVertexLayer :: GeometryExplosive a => (VInt, a) -> GGenerativeGeometry p (VInt, a) -> GGenerativeGeometry p (VInt, a)
emitVertexPositionAndLayer :: GeometryExplosive a => ((VPos, VInt), a) -> GGenerativeGeometry p ((VPos, VInt), a) -> GGenerativeGeometry p ((VPos, VInt), a)
endPrimitive :: GGenerativeGeometry p a -> GGenerativeGeometry p a
class FragmentInput a => GeometryExplosive a
exploseGeometry :: GeometryExplosive a => a -> Int -> ExprM Int
declareGeometry :: GeometryExplosive a => a -> State Int (GlobDeclM ())
enumerateVaryings :: GeometryExplosive a => a -> State Int [Text]
defaultExploseGeometry :: (Show b, Num b) => (t -> S x a) -> t -> b -> SNMapReaderT [Text] (StateT ExprState IO) b
defaultDeclareGeometry :: forall (m :: Type -> Type) a p. (Monad m, Num a, Show a) => SType -> p -> StateT a m (WriterT Text Identity ())
defaultEnumerateVaryings :: forall (m :: Type -> Type) a p. (Monad m, Num a, Show a) => p -> StateT a m [Text]
newtype ToFragmentFromGeometry a b
ToFragmentFromGeometry :: Kleisli (State Int) a b -> ToFragmentFromGeometry a b
class FragmentInputFromGeometry p a
toFragmentFromGeometry :: FragmentInputFromGeometry p a => ToFragmentFromGeometry (GGenerativeGeometry p (b, a)) (FragmentFormat a)
generateAndRasterize :: forall p b a s os f. (FragmentInputFromGeometry p a, PrimitiveTopology p) => (s -> (Side, PolygonMode, ViewPort, DepthRange)) -> Int -> GeometryStream (GGenerativeGeometry p (b, a)) -> Shader os s (FragmentStream (FragmentFormat a))
newtype ToAnotherFragment a b
ToAnotherFragment :: Kleisli (State Int) a b -> ToAnotherFragment a b
class FragmentInput a => AnotherFragmentInput a
toFragment2 :: AnotherFragmentInput a => ToAnotherFragment a (FragmentFormat a)
makeAnotherFragment :: Text -> SType -> (a -> ExprM Text) -> ToAnotherFragment a (S c a1)
class AnotherFragmentInput a => FragmentCreator a
createFragment :: FragmentCreator a => State Int a
instance GHC.Base.Monoid (Graphics.GPipe.Internal.GeometryStream.GeometryStream a)
instance GHC.Base.Semigroup (Graphics.GPipe.Internal.GeometryStream.GeometryStream a)
instance Control.Arrow.Arrow Graphics.GPipe.Internal.GeometryStream.ToGeometry
instance Control.Category.Category Graphics.GPipe.Internal.GeometryStream.ToGeometry
instance Control.Arrow.Arrow Graphics.GPipe.Internal.GeometryStream.ToFragmentFromGeometry
instance Control.Category.Category Graphics.GPipe.Internal.GeometryStream.ToFragmentFromGeometry
instance Control.Arrow.Arrow Graphics.GPipe.Internal.GeometryStream.ToAnotherFragment
instance Control.Category.Category Graphics.GPipe.Internal.GeometryStream.ToAnotherFragment
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator a => Graphics.GPipe.Internal.GeometryStream.FragmentInputFromGeometry Graphics.GPipe.Internal.PrimitiveArray.Triangles a
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator ()
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator Graphics.GPipe.Internal.Expr.VFloat
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator Graphics.GPipe.Internal.FragmentStream.FlatVFloat
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator Graphics.GPipe.Internal.FragmentStream.NoPerspectiveVFloat
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator Graphics.GPipe.Internal.Expr.VInt
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator Graphics.GPipe.Internal.Expr.VWord
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator Graphics.GPipe.Internal.Expr.VBool
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator a => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (Linear.V0.V0 a)
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator a => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (Linear.V1.V1 a)
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator a => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (Linear.V2.V2 a)
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator a => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (Linear.V3.V3 a)
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator a => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (Linear.V4.V4 a)
instance (Graphics.GPipe.Internal.GeometryStream.FragmentCreator a, Graphics.GPipe.Internal.GeometryStream.FragmentCreator b) => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (a, b)
instance (Graphics.GPipe.Internal.GeometryStream.FragmentCreator a, Graphics.GPipe.Internal.GeometryStream.FragmentCreator b, Graphics.GPipe.Internal.GeometryStream.FragmentCreator c) => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (a, b, c)
instance (Graphics.GPipe.Internal.GeometryStream.FragmentCreator a, Graphics.GPipe.Internal.GeometryStream.FragmentCreator b, Graphics.GPipe.Internal.GeometryStream.FragmentCreator c, Graphics.GPipe.Internal.GeometryStream.FragmentCreator d) => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (a, b, c, d)
instance (Graphics.GPipe.Internal.GeometryStream.FragmentCreator a, Graphics.GPipe.Internal.GeometryStream.FragmentCreator b, Graphics.GPipe.Internal.GeometryStream.FragmentCreator c, Graphics.GPipe.Internal.GeometryStream.FragmentCreator d, Graphics.GPipe.Internal.GeometryStream.FragmentCreator e) => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (a, b, c, d, e)
instance (Graphics.GPipe.Internal.GeometryStream.FragmentCreator a, Graphics.GPipe.Internal.GeometryStream.FragmentCreator b, Graphics.GPipe.Internal.GeometryStream.FragmentCreator c, Graphics.GPipe.Internal.GeometryStream.FragmentCreator d, Graphics.GPipe.Internal.GeometryStream.FragmentCreator e, Graphics.GPipe.Internal.GeometryStream.FragmentCreator f) => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (a, b, c, d, e, f)
instance (Graphics.GPipe.Internal.GeometryStream.FragmentCreator a, Graphics.GPipe.Internal.GeometryStream.FragmentCreator b, Graphics.GPipe.Internal.GeometryStream.FragmentCreator c, Graphics.GPipe.Internal.GeometryStream.FragmentCreator d, Graphics.GPipe.Internal.GeometryStream.FragmentCreator e, Graphics.GPipe.Internal.GeometryStream.FragmentCreator f, Graphics.GPipe.Internal.GeometryStream.FragmentCreator g) => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (a, b, c, d, e, f, g)
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator a => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (Linear.Quaternion.Quaternion a)
instance (Graphics.GPipe.Internal.GeometryStream.FragmentCreator (f a), Graphics.GPipe.Internal.GeometryStream.FragmentCreator a, Graphics.GPipe.Internal.FragmentStream.FragmentFormat (f a) GHC.Types.~ f (Graphics.GPipe.Internal.FragmentStream.FragmentFormat a)) => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (Linear.Affine.Point f a)
instance Graphics.GPipe.Internal.GeometryStream.FragmentCreator a => Graphics.GPipe.Internal.GeometryStream.FragmentCreator (Linear.Plucker.Plucker a)
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput ()
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput Graphics.GPipe.Internal.Expr.VFloat
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput Graphics.GPipe.Internal.FragmentStream.FlatVFloat
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput Graphics.GPipe.Internal.FragmentStream.NoPerspectiveVFloat
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput Graphics.GPipe.Internal.Expr.VInt
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput Graphics.GPipe.Internal.Expr.VWord
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput Graphics.GPipe.Internal.Expr.VBool
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (Linear.V0.V0 a)
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (Linear.V1.V1 a)
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (Linear.V2.V2 a)
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (Linear.V3.V3 a)
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (Linear.V4.V4 a)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput b) => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (a, b)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput b, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput c) => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (a, b, c)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput b, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput c, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput d) => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (a, b, c, d)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput b, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput c, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput d, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput e) => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (a, b, c, d, e)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput b, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput c, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput d, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput e, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput f) => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (a, b, c, d, e, f)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput b, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput c, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput d, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput e, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput f, Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput g) => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (a, b, c, d, e, f, g)
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (Linear.Quaternion.Quaternion a)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (f a), Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a, Graphics.GPipe.Internal.FragmentStream.FragmentFormat (f a) GHC.Types.~ f (Graphics.GPipe.Internal.FragmentStream.FragmentFormat a)) => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (Linear.Affine.Point f a)
instance Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput a => Graphics.GPipe.Internal.GeometryStream.AnotherFragmentInput (Linear.Plucker.Plucker a)
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive ()
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive Graphics.GPipe.Internal.Expr.VFloat
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive Graphics.GPipe.Internal.FragmentStream.FlatVFloat
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive Graphics.GPipe.Internal.FragmentStream.NoPerspectiveVFloat
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive Graphics.GPipe.Internal.Expr.VInt
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive Graphics.GPipe.Internal.Expr.VWord
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive Graphics.GPipe.Internal.Expr.VBool
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive a => Graphics.GPipe.Internal.GeometryStream.GeometryExplosive (Linear.V0.V0 a)
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive a => Graphics.GPipe.Internal.GeometryStream.GeometryExplosive (Linear.V1.V1 a)
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive a => Graphics.GPipe.Internal.GeometryStream.GeometryExplosive (Linear.V2.V2 a)
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive a => Graphics.GPipe.Internal.GeometryStream.GeometryExplosive (Linear.V3.V3 a)
instance Graphics.GPipe.Internal.GeometryStream.GeometryExplosive a => Graphics.GPipe.Internal.GeometryStream.GeometryExplosive (Linear.V4.V4 a)
instance (Graphics.GPipe.Internal.GeometryStream.GeometryExplosive a, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive b) => Graphics.GPipe.Internal.GeometryStream.GeometryExplosive (a, b)
instance (Graphics.GPipe.Internal.GeometryStream.GeometryExplosive a, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive b, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive c) => Graphics.GPipe.Internal.GeometryStream.GeometryExplosive (a, b, c)
instance (Graphics.GPipe.Internal.GeometryStream.GeometryExplosive a, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive b, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive c, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive d) => Graphics.GPipe.Internal.GeometryStream.GeometryExplosive (a, b, c, d)
instance (Graphics.GPipe.Internal.GeometryStream.GeometryExplosive a, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive b, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive c, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive d, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive e) => Graphics.GPipe.Internal.GeometryStream.GeometryExplosive (a, b, c, d, e)
instance (Graphics.GPipe.Internal.GeometryStream.GeometryExplosive a, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive b, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive c, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive d, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive e, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive f) => Graphics.GPipe.Internal.GeometryStream.GeometryExplosive (a, b, c, d, e, f)
instance (Graphics.GPipe.Internal.GeometryStream.GeometryExplosive a, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive b, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive c, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive d, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive e, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive f, Graphics.GPipe.Internal.GeometryStream.GeometryExplosive g) => Graphics.GPipe.Internal.GeometryStream.GeometryExplosive (a, b, c, d, e, f, g)
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.GeometryInput Graphics.GPipe.Internal.PrimitiveArray.Points a
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.GeometryInput Graphics.GPipe.Internal.PrimitiveArray.Lines a
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.GeometryInput Graphics.GPipe.Internal.PrimitiveArray.LinesWithAdjacency a
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.GeometryInput Graphics.GPipe.Internal.PrimitiveArray.Triangles a
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.GeometryInput Graphics.GPipe.Internal.PrimitiveArray.TrianglesWithAdjacency a
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput ()
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput Graphics.GPipe.Internal.Expr.VFloat
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput Graphics.GPipe.Internal.FragmentStream.FlatVFloat
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput Graphics.GPipe.Internal.FragmentStream.NoPerspectiveVFloat
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput Graphics.GPipe.Internal.Expr.VInt
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput Graphics.GPipe.Internal.Expr.VWord
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput Graphics.GPipe.Internal.Expr.VBool
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (Linear.V0.V0 a)
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (Linear.V1.V1 a)
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (Linear.V2.V2 a)
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (Linear.V3.V3 a)
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (Linear.V4.V4 a)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput b) => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (a, b)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput b, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput c) => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (a, b, c)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput b, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput c, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput d) => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (a, b, c, d)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput b, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput c, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput d, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput e) => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (a, b, c, d, e)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput b, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput c, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput d, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput e, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput f) => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (a, b, c, d, e, f)
instance (Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput b, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput c, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput d, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput e, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput f, Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput g) => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (a, b, c, d, e, f, g)
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (Linear.Quaternion.Quaternion a)
instance Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput a => Graphics.GPipe.Internal.GeometryStream.AnotherVertexInput (Linear.Plucker.Plucker a)
instance Control.Category.Category Graphics.GPipe.Internal.GeometryStream.ToAnotherVertex
instance Control.Arrow.Arrow Graphics.GPipe.Internal.GeometryStream.ToAnotherVertex
instance GHC.Base.Functor Graphics.GPipe.Internal.GeometryStream.GeometryStream
module Graphics.GPipe.Internal.TransformFeedback
drawNothing :: forall p a s c ds os f. (PrimitiveTopology p, VertexInput a, GeometryExplosive (VertexFormat a)) => Window os c ds -> (s -> Buffer os a) -> Int -> GeometryStream (GGenerativeGeometry p (VertexFormat a)) -> Shader os s ()
tellDrawcalls :: forall p a s c ds os. (PrimitiveTopology p, VertexInput a, GeometryExplosive (VertexFormat a)) => Window os c ds -> GeometryStream (GGenerativeGeometry p (VertexFormat a)) -> (s -> Buffer os a) -> Int -> ShaderM s ()
makeDrawcall :: forall a s c ds os. VertexInput a => Window os c ds -> (s -> Buffer os a) -> GLuint -> GeometryStreamData -> GlobDeclM () -> ExprM () -> IO (Drawcall s)
module Graphics.GPipe.GeometryStream
data GeometryStream a
class AnotherFragmentInput a => FragmentCreator a
createFragment :: FragmentCreator a => State Int a
class AnotherVertexInput a
toAnotherVertex :: AnotherVertexInput a => ToAnotherVertex a a
class FragmentInput a => AnotherFragmentInput a
toFragment2 :: AnotherFragmentInput a => ToAnotherFragment a (FragmentFormat a)
class FragmentInput a => GeometryExplosive a
exploseGeometry :: GeometryExplosive a => a -> Int -> ExprM Int
declareGeometry :: GeometryExplosive a => a -> State Int (GlobDeclM ())
enumerateVaryings :: GeometryExplosive a => a -> State Int [Text]
class (AnotherVertexInput a, PrimitiveTopology p) => GeometryInput p a
toGeometry :: GeometryInput p a => ToGeometry a (Geometry p a)
geometrize :: forall p a s os f. GeometryInput p a => PrimitiveStream p a -> Shader os s (GeometryStream (Geometry p a))
generateAndRasterize :: forall p b a s os f. (FragmentInputFromGeometry p a, PrimitiveTopology p) => (s -> (Side, PolygonMode, ViewPort, DepthRange)) -> Int -> GeometryStream (GGenerativeGeometry p (b, a)) -> Shader os s (FragmentStream (FragmentFormat a))
generativePoints :: FragmentInput a => GGenerativeGeometry Points a
generativeLineStrip :: FragmentInput a => GGenerativeGeometry Lines a
generativeTriangleStrip :: FragmentInput a => GGenerativeGeometry Triangles a
emitVertex :: GeometryExplosive a => a -> GGenerativeGeometry p a -> GGenerativeGeometry p a
emitVertexPosition :: GeometryExplosive a => (VPos, a) -> GGenerativeGeometry p (VPos, a) -> GGenerativeGeometry p (VPos, a)
emitVertexLayer :: GeometryExplosive a => (VInt, a) -> GGenerativeGeometry p (VInt, a) -> GGenerativeGeometry p (VInt, a)
emitVertexPositionAndLayer :: GeometryExplosive a => ((VPos, VInt), a) -> GGenerativeGeometry p ((VPos, VInt), a) -> GGenerativeGeometry p ((VPos, VInt), a)
endPrimitive :: GGenerativeGeometry p a -> GGenerativeGeometry p a
module Graphics.GPipe.Internal.FrameBuffer
-- | A monad in which individual color images can be drawn.
newtype DrawColors os s a
DrawColors :: StateT Int (Writer [Int -> (ExprM (), GlobDeclM (), s -> (IO FBOKey, IO (), IO ()))]) a -> DrawColors os s a
runDrawColors :: DrawColors os s a -> (ExprM (), GlobDeclM (), s -> (IO [FBOKey], IO (), IO ()))
-- | Draw color values into a color renderable texture image.
drawColor :: forall c s os. ColorRenderable c => (s -> (Image (Format c), ColorMask c, UseBlending)) -> FragColor c -> DrawColors os s ()
-- | Draw all fragments in a FragmentStream using the provided
-- function that passes each fragment value into a DrawColors
-- monad. The first argument is a function that retrieves a
-- Blending setting from the shader environment, which will be
-- used for all drawColor actions in the DrawColors monad
-- where UseBlending is True. (OpenGl 3.3 unfortunately
-- doesn't support having different blending settings for different color
-- targets.)
draw :: forall a os f s. (s -> Blending) -> FragmentStream a -> (a -> DrawColors os s ()) -> Shader os s ()
-- | Like draw, but performs a depth test on each fragment first.
-- The DrawColors monad is then only run for fragments where the
-- depth test passes.
drawDepth :: forall a os f s d. DepthRenderable d => (s -> (Blending, Image (Format d), DepthOption)) -> FragmentStream (a, FragDepth) -> (a -> DrawColors os s ()) -> Shader os s ()
-- | Like draw, but performs a stencil test on each fragment first.
-- The DrawColors monad is then only run for fragments where the
-- stencil test passes.
drawStencil :: forall a os f s st. StencilRenderable st => (s -> (Blending, Image (Format st), StencilOptions)) -> FragmentStream a -> (a -> DrawColors os s ()) -> Shader os s ()
-- | Like draw, but performs a stencil test and a depth test (in
-- that order) on each fragment first. The DrawColors monad is
-- then only run for fragments where the stencil and depth test passes.
drawDepthStencil :: forall a os f s d st. (DepthRenderable d, StencilRenderable st) => (s -> (Blending, Image (Format d), Image (Format st), DepthStencilOption)) -> FragmentStream (a, FragDepth) -> (a -> DrawColors os s ()) -> Shader os s ()
makeFBOKeys :: IO [FBOKey] -> IO (Maybe FBOKey) -> IO (Maybe FBOKey) -> IO FBOKeys
-- | Draw color values from a FragmentStream into the window.
drawWindowColor :: forall os s c ds. ContextColorFormat c => (s -> (Window os c ds, ContextColorOption c)) -> FragmentStream (FragColor c) -> Shader os s ()
-- | Perform a depth test for each fragment from a FragmentStream in
-- the window. This doesn't draw any color values and only affects the
-- depth buffer.
drawWindowDepth :: forall os s c ds. DepthRenderable ds => (s -> (Window os c ds, DepthOption)) -> FragmentStream FragDepth -> Shader os s ()
-- | Perform a depth test for each fragment from a FragmentStream
-- and write a color value from each fragment that passes the test into
-- the window.
drawWindowColorDepth :: forall os s c ds. (ContextColorFormat c, DepthRenderable ds) => (s -> (Window os c ds, ContextColorOption c, DepthOption)) -> FragmentStream (FragColor c, FragDepth) -> Shader os s ()
-- | Perform a stencil test for each fragment from a FragmentStream
-- in the window. This doesn't draw any color values and only affects the
-- stencil buffer.
drawWindowStencil :: forall os s c ds. StencilRenderable ds => (s -> (Window os c ds, StencilOptions)) -> FragmentStream () -> Shader os s ()
-- | Perform a stencil test for each fragment from a FragmentStream
-- and write a color value from each fragment that passes the test into
-- the window.
drawWindowColorStencil :: forall os s c ds. (ContextColorFormat c, StencilRenderable ds) => (s -> (Window os c ds, ContextColorOption c, StencilOptions)) -> FragmentStream (FragColor c) -> Shader os s ()
-- | Perform a stencil test and depth test (in that order) for each
-- fragment from a FragmentStream in the window. This doesnt draw
-- any color values and only affects the depth and stencil buffer.
drawWindowDepthStencil :: forall os s c ds. (DepthRenderable ds, StencilRenderable ds) => (s -> (Window os c ds, DepthStencilOption)) -> FragmentStream FragDepth -> Shader os s ()
-- | Perform a stencil test and depth test (in that order) for each
-- fragment from a FragmentStream and write a color value from
-- each fragment that passes the tests into the window.
drawWindowColorDepthStencil :: forall os s c ds. (ContextColorFormat c, DepthRenderable ds, StencilRenderable ds) => (s -> (Window os c ds, ContextColorOption c, DepthStencilOption)) -> FragmentStream (FragColor c, FragDepth) -> Shader os s ()
tellDrawcalls :: FragmentStream a -> (a -> (ExprM (), GlobDeclM (), s -> (Either WinId (IO FBOKeys, IO ()), IO ()))) -> ShaderM s ()
makeDrawcall :: (ExprM (), GlobDeclM (), s -> (Either WinId (IO FBOKeys, IO ()), IO ())) -> FragmentStreamData -> IO (Drawcall s)
setColor :: forall c. ColorSampleable c => c -> Int -> FragColor c -> (ExprM (), GlobDeclM ())
setDepth :: FFloat -> ExprM ()
make3 :: (t, t1) -> t2 -> (t, t1, t2)
type FragColor c = Color c (S F (ColorElement c))
type FragDepth = FFloat
setGlColorMask :: ColorSampleable f => f -> GLuint -> Color f Bool -> IO ()
setGlContextColorOptions :: ColorSampleable f => f -> ContextColorOption f -> IO ()
setGlBlend :: Blending -> IO ()
setGlDepthOptions :: DepthOption -> IO ()
setGlStencilOptions :: FrontBack StencilOption -> StencilOp -> StencilOp -> IO ()
setGlDepthStencilOptions :: DepthStencilOption -> IO ()
data ContextColorOption f
ContextColorOption :: Blending -> ColorMask f -> ContextColorOption f
data DepthOption
DepthOption :: DepthFunction -> DepthMask -> DepthOption
type StencilOptions = FrontBack StencilOption
data StencilOption
StencilOption :: ComparisonFunction -> Int -> StencilOp -> StencilOp -> Word -> Word -> StencilOption
[stencilTest] :: StencilOption -> ComparisonFunction
[stencilReference] :: StencilOption -> Int
[opWhenStencilFail] :: StencilOption -> StencilOp
[opWhenStencilPass] :: StencilOption -> StencilOp
[stencilReadBitMask] :: StencilOption -> Word
[stencilWriteBitMask] :: StencilOption -> Word
data DepthStencilOption
DepthStencilOption :: StencilOptions -> DepthOption -> FrontBack StencilOp -> DepthStencilOption
[dsStencilOptions] :: DepthStencilOption -> StencilOptions
[dsDepthOption] :: DepthStencilOption -> DepthOption
[opWhenStencilPassButDepthFail] :: DepthStencilOption -> FrontBack StencilOp
data FrontBack a
FrontBack :: a -> a -> FrontBack a
[front] :: FrontBack a -> a
[back] :: FrontBack a -> a
-- | True for each color component that should be written to the
-- target.
type ColorMask f = Color f Bool
-- | True if the depth component should be written to the target.
type DepthMask = Bool
-- | The function used to compare the fragment's depth and the depth
-- buffers depth with. E.g. Less means "where fragment's depth
-- is less than the buffers current depth".
type DepthFunction = ComparisonFunction
-- | Indicates whether this color draw should use the Blending
-- setting given to the draw action. If this is False, the
-- fragment's color value will simply replace the target value.
type UseBlending = Bool
-- | Denotes how each fragment's color value should be blended with the
-- target value.
data Blending
-- | The fragment's color will simply replace the target value.
NoBlending :: Blending
-- | The fragment's color will be blended using an equation and a set of
-- factors for the RGB components, and a separate equation and set of
-- factors for the Alpha component (if present), and a
-- ConstantColor that may be referenced from the
-- BlendingFactors. The ConstantColor may be
-- undefined if none of the BlendingFactors needs it. This
-- kind of blending will only be made on colors with a Float
-- representation (e.g. RGB8 or RGB32F, but not
-- RGB8I), integer colors will simply replace the target value.
BlendRgbAlpha :: (BlendEquation, BlendEquation) -> (BlendingFactors, BlendingFactors) -> ConstantColor -> Blending
-- | A logical operation that will be done on the bits of the fragment
-- color and the target color. This kind of blending is only done on
-- colors that has a integral internal representation (e.g.
-- RGB8 or RGB8I, but not RGB32F; note the
-- difference with BlendRgbAlpha restriction). For targets with
-- an internal floating point representation, the fragment value will
-- simply replace the target value.
LogicOp :: LogicOp -> Blending
type ConstantColor = V4 Float
-- | A set of blending factors used for the source (fragment) and the
-- destination (target).
data BlendingFactors
BlendingFactors :: BlendingFactor -> BlendingFactor -> BlendingFactors
[blendFactorSrc] :: BlendingFactors -> BlendingFactor
[blendFactorDst] :: BlendingFactors -> BlendingFactor
-- | The equation used to combine the source (fragment) and the destination
-- (target) after they have been multiplied with their respective
-- BlendingFactors.
data BlendEquation
FuncAdd :: BlendEquation
FuncSubtract :: BlendEquation
FuncReverseSubtract :: BlendEquation
Min :: BlendEquation
Max :: BlendEquation
-- | A factor that the source (fragment) or the destination (target) will
-- be multiplied with before combined with the other in the
-- BlendEquation.
data BlendingFactor
Zero :: BlendingFactor
One :: BlendingFactor
SrcColor :: BlendingFactor
OneMinusSrcColor :: BlendingFactor
DstColor :: BlendingFactor
OneMinusDstColor :: BlendingFactor
SrcAlpha :: BlendingFactor
OneMinusSrcAlpha :: BlendingFactor
DstAlpha :: BlendingFactor
OneMinusDstAlpha :: BlendingFactor
ConstantColor :: BlendingFactor
OneMinusConstantColor :: BlendingFactor
ConstantAlpha :: BlendingFactor
OneMinusConstantAlpha :: BlendingFactor
SrcAlphaSaturate :: BlendingFactor
usesConstantColor :: BlendingFactor -> Bool
-- | A bitwise logical operation that will be used to combine colors that
-- has an integral internal representation.
data LogicOp
Clear :: LogicOp
And :: LogicOp
AndReverse :: LogicOp
Copy :: LogicOp
AndInverted :: LogicOp
Noop :: LogicOp
Xor :: LogicOp
Or :: LogicOp
Nor :: LogicOp
Equiv :: LogicOp
Invert :: LogicOp
OrReverse :: LogicOp
CopyInverted :: LogicOp
OrInverted :: LogicOp
Nand :: LogicOp
Set :: LogicOp
-- | Denotes the operation that will be performed on the target's stencil
-- value
data StencilOp
OpZero :: StencilOp
OpKeep :: StencilOp
OpReplace :: StencilOp
OpIncr :: StencilOp
OpIncrWrap :: StencilOp
OpDecr :: StencilOp
OpDecrWrap :: StencilOp
OpInvert :: StencilOp
-- | Fill a color image with a constant color value
clearImageColor :: forall c os. ColorRenderable c => Image (Format c) -> Color c (ColorElement c) -> Render os ()
-- | Fill a depth image with a constant depth value (in the range [0,1])
clearImageDepth :: DepthRenderable d => Image (Format d) -> Float -> Render os ()
-- | Fill a depth image with a constant stencil value
clearImageStencil :: StencilRenderable s => Image (Format s) -> Int -> Render os ()
-- | Fill a combined depth stencil image with a constant depth value (in
-- the range [0,1]) and a constant stencil value
clearImageDepthStencil :: Image (Format DepthStencil) -> Float -> Int -> Render os ()
inWin :: Window os1 c ds -> IO () -> Render os2 ()
-- | Fill the window's back buffer with a constant color value
clearWindowColor :: forall os c ds. ContextColorFormat c => Window os c ds -> Color c Float -> Render os ()
-- | Fill the window's back depth buffer with a constant depth value (in
-- the range [0,1])
clearWindowDepth :: DepthRenderable ds => Window os c ds -> Float -> Render os ()
-- | Fill the window's back stencil buffer with a constant stencil value
clearWindowStencil :: StencilRenderable ds => Window os c ds -> Int -> Render os ()
-- | Fill the window's back depth and stencil buffers with a constant depth
-- value (in the range [0,1]) and a constant stencil value
clearWindowDepthStencil :: Window os c DepthStencil -> Float -> Int -> Render os ()
maybeThrow :: Monad m => ExceptT e m (Maybe e) -> ExceptT e m ()
glTrue :: Num n => n
getGlBlendEquation :: BlendEquation -> GLenum
getGlBlendFunc :: BlendingFactor -> GLenum
getGlLogicOp :: LogicOp -> GLenum
getGlStencilOp :: StencilOp -> GLenum
instance GHC.Base.Monad (Graphics.GPipe.Internal.FrameBuffer.DrawColors os s)
instance GHC.Base.Applicative (Graphics.GPipe.Internal.FrameBuffer.DrawColors os s)
instance GHC.Base.Functor (Graphics.GPipe.Internal.FrameBuffer.DrawColors os s)
-- | This module defines all functions and types for drawing into a context
-- window or texture from a Shader.
module Graphics.GPipe.FrameBuffer
-- | Draw color values from a FragmentStream into the window.
drawWindowColor :: forall os s c ds. ContextColorFormat c => (s -> (Window os c ds, ContextColorOption c)) -> FragmentStream (FragColor c) -> Shader os s ()
-- | Perform a depth test for each fragment from a FragmentStream in
-- the window. This doesn't draw any color values and only affects the
-- depth buffer.
drawWindowDepth :: forall os s c ds. DepthRenderable ds => (s -> (Window os c ds, DepthOption)) -> FragmentStream FragDepth -> Shader os s ()
-- | Perform a depth test for each fragment from a FragmentStream
-- and write a color value from each fragment that passes the test into
-- the window.
drawWindowColorDepth :: forall os s c ds. (ContextColorFormat c, DepthRenderable ds) => (s -> (Window os c ds, ContextColorOption c, DepthOption)) -> FragmentStream (FragColor c, FragDepth) -> Shader os s ()
-- | Perform a stencil test for each fragment from a FragmentStream
-- in the window. This doesn't draw any color values and only affects the
-- stencil buffer.
drawWindowStencil :: forall os s c ds. StencilRenderable ds => (s -> (Window os c ds, StencilOptions)) -> FragmentStream () -> Shader os s ()
-- | Perform a stencil test for each fragment from a FragmentStream
-- and write a color value from each fragment that passes the test into
-- the window.
drawWindowColorStencil :: forall os s c ds. (ContextColorFormat c, StencilRenderable ds) => (s -> (Window os c ds, ContextColorOption c, StencilOptions)) -> FragmentStream (FragColor c) -> Shader os s ()
-- | Perform a stencil test and depth test (in that order) for each
-- fragment from a FragmentStream in the window. This doesnt draw
-- any color values and only affects the depth and stencil buffer.
drawWindowDepthStencil :: forall os s c ds. (DepthRenderable ds, StencilRenderable ds) => (s -> (Window os c ds, DepthStencilOption)) -> FragmentStream FragDepth -> Shader os s ()
-- | Perform a stencil test and depth test (in that order) for each
-- fragment from a FragmentStream and write a color value from
-- each fragment that passes the tests into the window.
drawWindowColorDepthStencil :: forall os s c ds. (ContextColorFormat c, DepthRenderable ds, StencilRenderable ds) => (s -> (Window os c ds, ContextColorOption c, DepthStencilOption)) -> FragmentStream (FragColor c, FragDepth) -> Shader os s ()
-- | Draw all fragments in a FragmentStream using the provided
-- function that passes each fragment value into a DrawColors
-- monad. The first argument is a function that retrieves a
-- Blending setting from the shader environment, which will be
-- used for all drawColor actions in the DrawColors monad
-- where UseBlending is True. (OpenGl 3.3 unfortunately
-- doesn't support having different blending settings for different color
-- targets.)
draw :: forall a os f s. (s -> Blending) -> FragmentStream a -> (a -> DrawColors os s ()) -> Shader os s ()
-- | Like draw, but performs a depth test on each fragment first.
-- The DrawColors monad is then only run for fragments where the
-- depth test passes.
drawDepth :: forall a os f s d. DepthRenderable d => (s -> (Blending, Image (Format d), DepthOption)) -> FragmentStream (a, FragDepth) -> (a -> DrawColors os s ()) -> Shader os s ()
-- | Like draw, but performs a stencil test on each fragment first.
-- The DrawColors monad is then only run for fragments where the
-- stencil test passes.
drawStencil :: forall a os f s st. StencilRenderable st => (s -> (Blending, Image (Format st), StencilOptions)) -> FragmentStream a -> (a -> DrawColors os s ()) -> Shader os s ()
-- | Like draw, but performs a stencil test and a depth test (in
-- that order) on each fragment first. The DrawColors monad is
-- then only run for fragments where the stencil and depth test passes.
drawDepthStencil :: forall a os f s d st. (DepthRenderable d, StencilRenderable st) => (s -> (Blending, Image (Format d), Image (Format st), DepthStencilOption)) -> FragmentStream (a, FragDepth) -> (a -> DrawColors os s ()) -> Shader os s ()
-- | Draw color values into a color renderable texture image.
drawColor :: forall c s os. ColorRenderable c => (s -> (Image (Format c), ColorMask c, UseBlending)) -> FragColor c -> DrawColors os s ()
-- | A monad in which individual color images can be drawn.
data DrawColors os s a
-- | A texture image is a reference to a 2D array of pixels in a texture.
-- Some textures contain one Image per level of detail while some
-- contain several.
data Image f
-- | Compare two images that doesn't necessarily has same type
imageEquals :: Image a -> Image b -> Bool
-- | Retrieve the 2D size an image
imageSize :: Image f -> V2 Int
getTexture1DImage :: Texture1D os f -> Level -> Render os (Image f)
getTexture1DArrayImage :: Texture1DArray os f -> Level -> Int -> Render os (Image f)
getTexture2DImage :: Texture2D os f -> Level -> Render os (Image f)
getTexture2DArrayImage :: Texture2DArray os f -> Level -> Int -> Render os (Image f)
getTexture3DImage :: Texture3D os f -> Level -> Int -> Render os (Image f)
getTextureCubeImage :: TextureCube os f -> Level -> CubeSide -> Render os (Image f)
getLayeredTextureImage :: Texture3D os f -> MaxLevels -> Render os (Image f)
-- | Fill the window's back buffer with a constant color value
clearWindowColor :: forall os c ds. ContextColorFormat c => Window os c ds -> Color c Float -> Render os ()
-- | Fill the window's back depth buffer with a constant depth value (in
-- the range [0,1])
clearWindowDepth :: DepthRenderable ds => Window os c ds -> Float -> Render os ()
-- | Fill the window's back stencil buffer with a constant stencil value
clearWindowStencil :: StencilRenderable ds => Window os c ds -> Int -> Render os ()
-- | Fill the window's back depth and stencil buffers with a constant depth
-- value (in the range [0,1]) and a constant stencil value
clearWindowDepthStencil :: Window os c DepthStencil -> Float -> Int -> Render os ()
-- | Fill a color image with a constant color value
clearImageColor :: forall c os. ColorRenderable c => Image (Format c) -> Color c (ColorElement c) -> Render os ()
-- | Fill a depth image with a constant depth value (in the range [0,1])
clearImageDepth :: DepthRenderable d => Image (Format d) -> Float -> Render os ()
-- | Fill a depth image with a constant stencil value
clearImageStencil :: StencilRenderable s => Image (Format s) -> Int -> Render os ()
-- | Fill a combined depth stencil image with a constant depth value (in
-- the range [0,1]) and a constant stencil value
clearImageDepthStencil :: Image (Format DepthStencil) -> Float -> Int -> Render os ()
type FragColor c = Color c (S F (ColorElement c))
data ContextColorOption f
ContextColorOption :: Blending -> ColorMask f -> ContextColorOption f
-- | True for each color component that should be written to the
-- target.
type ColorMask f = Color f Bool
-- | Indicates whether this color draw should use the Blending
-- setting given to the draw action. If this is False, the
-- fragment's color value will simply replace the target value.
type UseBlending = Bool
-- | Denotes how each fragment's color value should be blended with the
-- target value.
data Blending
-- | The fragment's color will simply replace the target value.
NoBlending :: Blending
-- | The fragment's color will be blended using an equation and a set of
-- factors for the RGB components, and a separate equation and set of
-- factors for the Alpha component (if present), and a
-- ConstantColor that may be referenced from the
-- BlendingFactors. The ConstantColor may be
-- undefined if none of the BlendingFactors needs it. This
-- kind of blending will only be made on colors with a Float
-- representation (e.g. RGB8 or RGB32F, but not
-- RGB8I), integer colors will simply replace the target value.
BlendRgbAlpha :: (BlendEquation, BlendEquation) -> (BlendingFactors, BlendingFactors) -> ConstantColor -> Blending
-- | A logical operation that will be done on the bits of the fragment
-- color and the target color. This kind of blending is only done on
-- colors that has a integral internal representation (e.g.
-- RGB8 or RGB8I, but not RGB32F; note the
-- difference with BlendRgbAlpha restriction). For targets with
-- an internal floating point representation, the fragment value will
-- simply replace the target value.
LogicOp :: LogicOp -> Blending
type ConstantColor = V4 Float
-- | A set of blending factors used for the source (fragment) and the
-- destination (target).
data BlendingFactors
BlendingFactors :: BlendingFactor -> BlendingFactor -> BlendingFactors
[blendFactorSrc] :: BlendingFactors -> BlendingFactor
[blendFactorDst] :: BlendingFactors -> BlendingFactor
-- | The equation used to combine the source (fragment) and the destination
-- (target) after they have been multiplied with their respective
-- BlendingFactors.
data BlendEquation
FuncAdd :: BlendEquation
FuncSubtract :: BlendEquation
FuncReverseSubtract :: BlendEquation
Min :: BlendEquation
Max :: BlendEquation
-- | A factor that the source (fragment) or the destination (target) will
-- be multiplied with before combined with the other in the
-- BlendEquation.
data BlendingFactor
Zero :: BlendingFactor
One :: BlendingFactor
SrcColor :: BlendingFactor
OneMinusSrcColor :: BlendingFactor
DstColor :: BlendingFactor
OneMinusDstColor :: BlendingFactor
SrcAlpha :: BlendingFactor
OneMinusSrcAlpha :: BlendingFactor
DstAlpha :: BlendingFactor
OneMinusDstAlpha :: BlendingFactor
ConstantColor :: BlendingFactor
OneMinusConstantColor :: BlendingFactor
ConstantAlpha :: BlendingFactor
OneMinusConstantAlpha :: BlendingFactor
SrcAlphaSaturate :: BlendingFactor
-- | A bitwise logical operation that will be used to combine colors that
-- has an integral internal representation.
data LogicOp
Clear :: LogicOp
And :: LogicOp
AndReverse :: LogicOp
Copy :: LogicOp
AndInverted :: LogicOp
Noop :: LogicOp
Xor :: LogicOp
Or :: LogicOp
Nor :: LogicOp
Equiv :: LogicOp
Invert :: LogicOp
OrReverse :: LogicOp
CopyInverted :: LogicOp
OrInverted :: LogicOp
Nand :: LogicOp
Set :: LogicOp
type FragDepth = FFloat
data DepthOption
DepthOption :: DepthFunction -> DepthMask -> DepthOption
-- | True if the depth component should be written to the target.
type DepthMask = Bool
-- | The function used to compare the fragment's depth and the depth
-- buffers depth with. E.g. Less means "where fragment's depth
-- is less than the buffers current depth".
type DepthFunction = ComparisonFunction
type StencilOptions = FrontBack StencilOption
data StencilOption
StencilOption :: ComparisonFunction -> Int -> StencilOp -> StencilOp -> Word -> Word -> StencilOption
[stencilTest] :: StencilOption -> ComparisonFunction
[stencilReference] :: StencilOption -> Int
[opWhenStencilFail] :: StencilOption -> StencilOp
[opWhenStencilPass] :: StencilOption -> StencilOp
[stencilReadBitMask] :: StencilOption -> Word
[stencilWriteBitMask] :: StencilOption -> Word
data DepthStencilOption
DepthStencilOption :: StencilOptions -> DepthOption -> FrontBack StencilOp -> DepthStencilOption
[dsStencilOptions] :: DepthStencilOption -> StencilOptions
[dsDepthOption] :: DepthStencilOption -> DepthOption
[opWhenStencilPassButDepthFail] :: DepthStencilOption -> FrontBack StencilOp
data FrontBack a
FrontBack :: a -> a -> FrontBack a
[front] :: FrontBack a -> a
[back] :: FrontBack a -> a
-- | Denotes the operation that will be performed on the target's stencil
-- value
data StencilOp
OpZero :: StencilOp
OpKeep :: StencilOp
OpReplace :: StencilOp
OpIncr :: StencilOp
OpIncrWrap :: StencilOp
OpDecr :: StencilOp
OpDecrWrap :: StencilOp
OpInvert :: StencilOp
-- | A PrimitiveStream can be rasterized, i.e. chopped up in pixel
-- sized fragments, each of which contains an interpolated value of the
-- primitives vertices, producing a FragmentStream.
module Graphics.GPipe.FragmentStream
-- | A FragmentStream a is a stream of fragments of type
-- a. You may append FragmentStreams using the
-- Monoid instance, and you can operate a stream's values using
-- the Functor instance (this will result in a shader running on
-- the GPU).
data FragmentStream a
-- | This class constraints which vertex types can be turned into fragment
-- values, and what type those values have.
class FragmentInput a where {
-- | The type the vertex value will be turned into once it becomes a
-- fragment value.
type family FragmentFormat a;
}
-- | An arrow action that turns a value from it's vertex representation to
-- it's fragment representation. Use toFragment from the GPipe
-- provided instances to operate in this arrow. Also note that this arrow
-- needs to be able to return a value lazily, so ensure you use
--
-- proc ~pattern -> do ....
toFragment :: FragmentInput a => ToFragment a (FragmentFormat a)
-- | The arrow type for toFragment.
data ToFragment a b
-- | A float value that is not interpolated (like integers), and all
-- fragments will instead get the value of the primitive's last vertex
newtype FlatVFloat
Flat :: VFloat -> FlatVFloat
-- | A float value that doesn't get divided by the interpolated position's
-- w-component during interpolation.
newtype NoPerspectiveVFloat
NoPerspective :: VFloat -> NoPerspectiveVFloat
-- | Rasterize a stream of primitives into fragments, using a Side,
-- PolygonMode, Viewport and DepthRange from the
-- shader environment. Primitives will be transformed from canonical view
-- space, i.e. [(-1,-1,-1),(1,1,1)], to the 2D space defined by the
-- ViewPort parameter and the depth range defined by the
-- DepthRange parameter. PolygonMode controls whether to
-- fill in the primitives or whether to show a wireframe or points only.
rasterize :: forall p a s os f. FragmentInput a => (s -> (Side, PolygonMode, ViewPort, DepthRange)) -> PrimitiveStream p (VPos, a) -> Shader os s (FragmentStream (FragmentFormat a))
type VPos = V4 VFloat
-- | Defines which side to rasterize. Non triangle primitives only has a
-- front side.
data Side
Front :: Side
Back :: Side
FrontAndBack :: Side
-- | Defines whether to fill the polygon or to show points or wireframes.
data PolygonMode
PolygonFill :: PolygonMode
PolygonLine :: Float -> PolygonMode
PolygonPoint :: PolygonMode
-- | The viewport in pixel coordinates (where (0,0) is the lower left
-- corner) in to which the canonical view volume [(-1,-1,-1),(1,1,1)] is
-- transformed and clipped/scissored.
data ViewPort
ViewPort :: V2 Int -> V2 Int -> ViewPort
[viewPortLowerLeft] :: ViewPort -> V2 Int
[viewPortSize] :: ViewPort -> V2 Int
-- | The fragment depth range to map the canonical view volume's
-- z-coordinate to. Depth values are clamped to [0,1], so DepthRange
-- 0 1 gives maximum depth resolution.
data DepthRange
DepthRange :: Float -> Float -> DepthRange
[minDepth] :: DepthRange -> Float
[maxDepth] :: DepthRange -> Float
-- | Filter out fragments from the stream where the predicate in the first
-- argument evaluates to true, and discard all other fragments.
filterFragments :: (a -> FBool) -> FragmentStream a -> FragmentStream a
-- | Like fmap, but where various auto generated information from
-- the rasterization is provided for each vertex.
withRasterizedInfo :: (a -> RasterizedInfo -> b) -> FragmentStream a -> FragmentStream b
data RasterizedInfo
RasterizedInfo :: V4 FFloat -> FBool -> V2 FFloat -> RasterizedInfo
[rasterizedFragCoord] :: RasterizedInfo -> V4 FFloat
[rasterizedFrontFacing] :: RasterizedInfo -> FBool
[rasterizedPointCoord] :: RasterizedInfo -> V2 FFloat
module Graphics.GPipe.Linear
($*) :: Representable f => Covector r (Rep f) -> f r -> r
infixr 0 $*
-- | Linear functionals from elements of an (infinite) free module to a
-- scalar
newtype Covector r a
Covector :: ((a -> r) -> r) -> Covector r a
[runCovector] :: Covector r a -> (a -> r) -> r
counitalRep :: (Representable f, Coalgebra r (Rep f)) => f r -> r
comultRep :: (Representable f, Coalgebra r (Rep f)) => f r -> f (f r)
unitalRep :: (Representable f, Algebra r (Rep f)) => r -> f r
multRep :: (Representable f, Algebra r (Rep f)) => f (f r) -> f r
-- | An associative unital algebra over a ring
class Num r => Algebra r m
mult :: Algebra r m => (m -> m -> r) -> m -> r
unital :: Algebra r m => r -> m -> r
-- | A coassociative counital coalgebra over a ring
class Num r => Coalgebra r m
comult :: Coalgebra r m => (m -> r) -> m -> m -> r
counital :: Coalgebra r m => (m -> r) -> r
-- | Build an inverse orthographic perspective matrix from 6 clipping
-- planes
inverseOrtho :: Fractional a => a -> a -> a -> a -> a -> a -> M44 a
-- | Build an orthographic perspective matrix from 6 clipping planes. This
-- matrix takes the region delimited by these planes and maps it to
-- normalized device coordinates between [-1,1]
--
-- This call is designed to mimic the parameters to the OpenGL
-- glOrtho call, so it has a slightly strange convention:
-- Notably: the near and far planes are negated.
--
-- Consequently:
--
--
-- ortho l r b t n f !* V4 l b (-n) 1 = V4 (-1) (-1) (-1) 1
-- ortho l r b t n f !* V4 r t (-f) 1 = V4 1 1 1 1
--
--
-- Examples:
--
--
-- >>> ortho 1 2 3 4 5 6 !* V4 1 3 (-5) 1
-- V4 (-1.0) (-1.0) (-1.0) 1.0
--
--
--
-- >>> ortho 1 2 3 4 5 6 !* V4 2 4 (-6) 1
-- V4 1.0 1.0 1.0 1.0
--
ortho :: Fractional a => a -> a -> a -> a -> a -> a -> M44 a
inverseInfinitePerspective :: Floating a => a -> a -> a -> M44 a
-- | Build a matrix for a symmetric perspective-view frustum with a far
-- plane at infinite
infinitePerspective :: Floating a => a -> a -> a -> M44 a
inverseFrustum :: Floating a => a -> a -> a -> a -> a -> a -> M44 a
-- | Build a perspective matrix per the classic glFrustum
-- arguments.
frustum :: Floating a => a -> a -> a -> a -> a -> a -> M44 a
-- | Build an inverse perspective matrix
inversePerspective :: Floating a => a -> a -> a -> a -> M44 a
-- | Build a matrix for a symmetric perspective-view frustum
perspective :: Floating a => a -> a -> a -> a -> M44 a
-- | Compute the determinant of a matrix using LU decomposition, using the
-- vector's Finite instance to provide an index.
luDetFinite :: forall a m (n :: Nat). (Num a, Fractional a, Functor m, Finite m, n ~ Size m, KnownNat n, Num (m a)) => m (m a) -> a
-- | Compute the determinant of a matrix using LU decomposition.
luDet :: (Num a, Fractional a, Foldable m, Traversable m, Applicative m, Additive m, Trace m, Ixed (m a), Ixed (m (m a)), i ~ Index (m a), i ~ Index (m (m a)), Eq i, Integral i, a ~ IxValue (m a), m a ~ IxValue (m (m a)), Num (m a)) => m (m a) -> a
-- | Invert a matrix with LU decomposition, using the vector's
-- Finite instance to provide an index.
luInvFinite :: forall a m (n :: Nat). (Num a, Fractional a, Functor m, Finite m, n ~ Size m, KnownNat n, Num (m a)) => m (m a) -> m (m a)
-- | Invert a matrix with LU decomposition.
luInv :: (Num a, Fractional a, Foldable m, Traversable m, Applicative m, Additive m, Distributive m, Ixed (m a), Ixed (m (m a)), i ~ Index (m a), i ~ Index (m (m a)), Eq i, Integral i, a ~ IxValue (m a), m a ~ IxValue (m (m a)), Num (m a)) => m (m a) -> m (m a)
-- | Solve a linear system with LU decomposition, using the vector's
-- Finite instance to provide an index.
luSolveFinite :: forall a m (n :: Nat). (Num a, Fractional a, Functor m, Finite m, n ~ Size m, KnownNat n, Num (m a)) => m (m a) -> m a -> m a
-- | Solve a linear system with LU decomposition.
luSolve :: (Num a, Fractional a, Foldable m, Traversable m, Applicative m, Additive m, Ixed (m a), Ixed (m (m a)), i ~ Index (m a), i ~ Index (m (m a)), Eq i, Integral i, a ~ IxValue (m a), m a ~ IxValue (m (m a)), Num (m a)) => m (m a) -> m a -> m a
-- | Solve a linear system with an upper-triangular matrix of coefficients
-- with backwards substitution, using the vector's Finite instance
-- to provide an index.
backwardSubFinite :: forall a m (n :: Nat). (Num a, Fractional a, Foldable m, n ~ Size m, KnownNat n, Additive m, Finite m) => m (m a) -> m a -> m a
-- | Solve a linear system with an upper-triangular matrix of coefficients
-- with backwards substitution.
backwardSub :: (Num a, Fractional a, Foldable m, Additive m, Ixed (m a), Ixed (m (m a)), i ~ Index (m a), i ~ Index (m (m a)), Eq i, Ord i, Integral i, a ~ IxValue (m a), m a ~ IxValue (m (m a))) => m (m a) -> m a -> m a
-- | Solve a linear system with a lower-triangular matrix of coefficients
-- with forwards substitution, using the vector's Finite instance
-- to provide an index.
forwardSubFinite :: forall a m (n :: Nat). (Num a, Fractional a, Foldable m, n ~ Size m, KnownNat n, Additive m, Finite m) => m (m a) -> m a -> m a
-- | Solve a linear system with a lower-triangular matrix of coefficients
-- with forwards substitution.
forwardSub :: (Num a, Fractional a, Foldable m, Additive m, Ixed (m a), Ixed (m (m a)), i ~ Index (m a), i ~ Index (m (m a)), Eq i, Ord i, Integral i, a ~ IxValue (m a), m a ~ IxValue (m (m a))) => m (m a) -> m a -> m a
-- | Compute the (L, U) decomposition of a square matrix using Crout's
-- algorithm, using the vector's Finite instance to provide an
-- index.
luFinite :: forall a m (n :: Nat). (Num a, Fractional a, Functor m, Finite m, n ~ Size m, KnownNat n, Num (m a)) => m (m a) -> (m (m a), m (m a))
-- | Compute the (L, U) decomposition of a square matrix using Crout's
-- algorithm. The Index of the vectors must be Integral.
lu :: (Num a, Fractional a, Foldable m, Traversable m, Applicative m, Additive m, Ixed (m a), Ixed (m (m a)), i ~ Index (m a), i ~ Index (m (m a)), Eq i, Integral i, a ~ IxValue (m a), m a ~ IxValue (m (m a)), Num (m a)) => m (m a) -> (m (m a), m (m a))
-- | 4x4 matrix inverse.
inv44 :: Fractional a => M44 a -> M44 a
-- | transpose is just an alias for distribute
--
--
-- transpose (V3 (V2 1 2) (V2 3 4) (V2 5 6))
--
--
-- V2 (V3 1 3 5) (V3 2 4 6)
transpose :: (Distributive g, Functor f) => f (g a) -> g (f a)
-- | 3x3 matrix inverse.
--
--
-- >>> inv33 $ V3 (V3 1 2 4) (V3 4 2 2) (V3 1 1 1)
-- V3 (V3 0.0 0.5 (-1.0)) (V3 (-0.5) (-0.75) 3.5) (V3 0.5 0.25 (-1.5))
--
inv33 :: Fractional a => M33 a -> M33 a
-- | 2x2 matrix inverse.
--
--
-- >>> inv22 $ V2 (V2 1 2) (V2 3 4)
-- V2 (V2 (-2.0) 1.0) (V2 1.5 (-0.5))
--
inv22 :: Fractional a => M22 a -> M22 a
-- | 4x4 matrix determinant.
det44 :: Num a => M44 a -> a
-- | 3x3 matrix determinant.
--
--
-- >>> det33 (V3 (V3 a b c) (V3 d e f) (V3 g h i))
-- a * (e * i - f * h) - d * (b * i - c * h) + g * (b * f - c * e)
--
det33 :: Num a => M33 a -> a
-- | 2x2 matrix determinant.
--
--
-- >>> det22 (V2 (V2 a b) (V2 c d))
-- a * d - b * c
--
det22 :: Num a => M22 a -> a
-- | Extract a 4x4 matrix from a matrix of higher dimensions by dropping
-- excess rows and columns.
_m44 :: forall (t :: Type -> Type) (v :: Type -> Type) a. (Representable t, R4 t, R4 v) => Lens' (t (v a)) (M44 a)
-- | Extract a 4x3 matrix from a matrix of higher dimensions by dropping
-- excess rows and columns.
_m43 :: forall (t :: Type -> Type) (v :: Type -> Type) a. (Representable t, R4 t, R3 v) => Lens' (t (v a)) (M43 a)
-- | Extract a 4x2 matrix from a matrix of higher dimensions by dropping
-- excess rows and columns.
_m42 :: forall (t :: Type -> Type) (v :: Type -> Type) a. (Representable t, R4 t, R2 v) => Lens' (t (v a)) (M42 a)
-- | Extract a 3x4 matrix from a matrix of higher dimensions by dropping
-- excess rows and columns.
_m34 :: forall (t :: Type -> Type) (v :: Type -> Type) a. (Representable t, R3 t, R4 v) => Lens' (t (v a)) (M34 a)
-- | Extract a 3x3 matrix from a matrix of higher dimensions by dropping
-- excess rows and columns.
_m33 :: forall (t :: Type -> Type) (v :: Type -> Type) a. (Representable t, R3 t, R3 v) => Lens' (t (v a)) (M33 a)
-- | Extract a 3x2 matrix from a matrix of higher dimensions by dropping
-- excess rows and columns.
_m32 :: forall (t :: Type -> Type) (v :: Type -> Type) a. (Representable t, R3 t, R2 v) => Lens' (t (v a)) (M32 a)
-- | Extract a 2x4 matrix from a matrix of higher dimensions by dropping
-- excess rows and columns.
_m24 :: forall (t :: Type -> Type) (v :: Type -> Type) a. (Representable t, R2 t, R4 v) => Lens' (t (v a)) (M24 a)
-- | Extract a 2x3 matrix from a matrix of higher dimensions by dropping
-- excess rows and columns.
_m23 :: forall (t :: Type -> Type) (v :: Type -> Type) a. (Representable t, R2 t, R3 v) => Lens' (t (v a)) (M23 a)
-- | Extract a 2x2 matrix from a matrix of higher dimensions by dropping
-- excess rows and columns.
_m22 :: forall (t :: Type -> Type) (v :: Type -> Type) a. (Representable t, R2 t, R2 v) => Lens' (t (v a)) (M22 a)
-- | Extract the translation vector (first three entries of the last
-- column) from a 3x4 or 4x4 matrix.
translation :: forall (t :: Type -> Type) (v :: Type -> Type) a. (Representable t, R3 t, R4 v) => Lens' (t (v a)) (V3 a)
-- | The identity matrix for any dimension vector.
--
--
-- >>> identity :: M44 Int
-- V4 (V4 1 0 0 0) (V4 0 1 0 0) (V4 0 0 1 0) (V4 0 0 0 1)
--
-- >>> identity :: V3 (V3 Int)
-- V3 (V3 1 0 0) (V3 0 1 0) (V3 0 0 1)
--
identity :: (Num a, Traversable t, Applicative t) => t (t a)
-- | Convert a 3x3 matrix to a 4x4 matrix extending it with 0's in the new
-- row and column.
m33_to_m44 :: Num a => M33 a -> M44 a
-- | Convert from a 4x3 matrix to a 4x4 matrix, extending it with the [
-- 0 0 0 1 ] column vector
m43_to_m44 :: Num a => M43 a -> M44 a
-- | Build a transformation matrix from a rotation expressed as a
-- Quaternion and a translation vector.
mkTransformation :: Num a => Quaternion a -> V3 a -> M44 a
-- | Build a transformation matrix from a rotation matrix and a translation
-- vector.
mkTransformationMat :: Num a => M33 a -> V3 a -> M44 a
-- | Build a rotation matrix from a unit Quaternion.
fromQuaternion :: Num a => Quaternion a -> M33 a
-- | Hermitian conjugate or conjugate transpose
--
--
-- >>> adjoint (V2 (V2 (1 :+ 2) (3 :+ 4)) (V2 (5 :+ 6) (7 :+ 8)))
-- V2 (V2 (1.0 :+ (-2.0)) (5.0 :+ (-6.0))) (V2 (3.0 :+ (-4.0)) (7.0 :+ (-8.0)))
--
adjoint :: (Functor m, Distributive n, Conjugate a) => m (n a) -> n (m a)
-- | Matrix-scalar division
(!!/) :: (Functor m, Functor r, Fractional a) => m (r a) -> a -> m (r a)
infixl 7 !!/
-- | Matrix-scalar product
--
--
-- >>> V2 (V2 1 2) (V2 3 4) !!* 5
-- V2 (V2 5 10) (V2 15 20)
--
(!!*) :: (Functor m, Functor r, Num a) => m (r a) -> a -> m (r a)
infixl 7 !!*
-- | Scalar-matrix product
--
--
-- >>> 5 *!! V2 (V2 1 2) (V2 3 4)
-- V2 (V2 5 10) (V2 15 20)
--
(*!!) :: (Functor m, Functor r, Num a) => a -> m (r a) -> m (r a)
infixl 7 *!!
-- | Row vector * matrix
--
--
-- >>> V2 1 2 *! V2 (V3 3 4 5) (V3 6 7 8)
-- V3 15 18 21
--
(*!) :: (Num a, Foldable t, Additive f, Additive t) => t a -> t (f a) -> f a
infixl 7 *!
-- | Matrix * column vector
--
--
-- >>> V2 (V3 1 2 3) (V3 4 5 6) !* V3 7 8 9
-- V2 50 122
--
(!*) :: (Functor m, Foldable r, Additive r, Num a) => m (r a) -> r a -> m a
infixl 7 !*
-- | Entry-wise matrix subtraction.
--
--
-- >>> V2 (V3 1 2 3) (V3 4 5 6) !-! V2 (V3 7 8 9) (V3 1 2 3)
-- V2 (V3 (-6) (-6) (-6)) (V3 3 3 3)
--
(!-!) :: (Additive m, Additive n, Num a) => m (n a) -> m (n a) -> m (n a)
infixl 6 !-!
-- | Entry-wise matrix addition.
--
--
-- >>> V2 (V3 1 2 3) (V3 4 5 6) !+! V2 (V3 7 8 9) (V3 1 2 3)
-- V2 (V3 8 10 12) (V3 5 7 9)
--
(!+!) :: (Additive m, Additive n, Num a) => m (n a) -> m (n a) -> m (n a)
infixl 6 !+!
-- | Matrix product. This can compute any combination of sparse and dense
-- multiplication.
--
--
-- >>> V2 (V3 1 2 3) (V3 4 5 6) !*! V3 (V2 1 2) (V2 3 4) (V2 4 5)
-- V2 (V2 19 25) (V2 43 58)
--
--
--
-- >>> V2 (fromList [(1,2)]) (fromList [(2,3)]) !*! fromList [(1,V3 0 0 1), (2, V3 0 0 5)]
-- V2 (V3 0 0 2) (V3 0 0 15)
--
(!*!) :: (Functor m, Foldable t, Additive t, Additive n, Num a) => m (t a) -> t (n a) -> m (n a)
infixl 7 !*!
-- | This is a generalization of inside to work over any
-- corepresentable Functor.
--
--
-- column :: Representable f => Lens s t a b -> Lens (f s) (f t) (f a) (f b)
--
--
-- In practice it is used to access a column of a matrix.
--
--
-- >>> V2 (V3 1 2 3) (V3 4 5 6) ^._x
-- V3 1 2 3
--
--
--
-- >>> V2 (V3 1 2 3) (V3 4 5 6) ^.column _x
-- V2 1 4
--
column :: forall (f :: Type -> Type) a b s t. Representable f => LensLike (Context a b) s t a b -> Lens (f s) (f t) (f a) (f b)
-- | A 2x2 matrix with row-major representation
type M22 a = V2 V2 a
-- | A 2x3 matrix with row-major representation
type M23 a = V2 V3 a
-- | A 2x4 matrix with row-major representation
type M24 a = V2 V4 a
-- | A 3x2 matrix with row-major representation
type M32 a = V3 V2 a
-- | A 3x3 matrix with row-major representation
type M33 a = V3 V3 a
-- | A 3x4 matrix with row-major representation
type M34 a = V3 V4 a
-- | A 4x2 matrix with row-major representation
type M42 a = V4 V2 a
-- | A 4x3 matrix with row-major representation
type M43 a = V4 V3 a
-- | A 4x4 matrix with row-major representation
type M44 a = V4 V4 a
-- | Compute the Frobenius norm of a matrix.
frobenius :: (Num a, Foldable f, Additive f, Additive g, Distributive g, Trace g) => f (g a) -> a
class Functor m => Trace (m :: Type -> Type)
-- | Compute the trace of a matrix
--
--
-- >>> trace (V2 (V2 a b) (V2 c d))
-- a + d
--
trace :: (Trace m, Num a) => m (m a) -> a
-- | Compute the diagonal of a matrix
--
--
-- >>> diagonal (V2 (V2 a b) (V2 c d))
-- V2 a d
--
diagonal :: Trace m => m (m a) -> m a
-- | axisAngle axis theta builds a Quaternion
-- representing a rotation of theta radians about axis.
axisAngle :: (Epsilon a, Floating a) => V3 a -> a -> Quaternion a
-- | Apply a rotation to a vector.
rotate :: (Conjugate a, RealFloat a) => Quaternion a -> V3 a -> V3 a
-- | Spherical linear interpolation between two quaternions.
slerp :: RealFloat a => Quaternion a -> Quaternion a -> a -> Quaternion a
-- | atanh with a specified branch cut.
atanhq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a
-- | acosh with a specified branch cut.
acoshq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a
-- | asinh with a specified branch cut.
asinhq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a
-- | atan with a specified branch cut.
atanq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a
-- | acos with a specified branch cut.
acosq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a
-- | asin with a specified branch cut.
asinq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a
-- | raise a Quaternion to a scalar power
pow :: RealFloat a => Quaternion a -> a -> Quaternion a
-- | norm of the imaginary component
absi :: Floating a => Quaternion a -> a
ek :: forall (t :: Type -> Type). Hamiltonian t => E t
ej :: forall (t :: Type -> Type). Hamiltonian t => E t
ei :: forall (t :: Type -> Type). Complicated t => E t
ee :: forall (t :: Type -> Type). Complicated t => E t
-- | Quaternions
data Quaternion a
Quaternion :: !a -> {-# UNPACK #-} !V3 a -> Quaternion a
-- | A vector space that includes the basis elements _e and
-- _i
class Complicated (t :: Type -> Type)
_e :: Complicated t => Lens' (t a) a
_i :: Complicated t => Lens' (t a) a
-- | A vector space that includes the basis elements _e, _i,
-- _j and _k
class Complicated t => Hamiltonian (t :: Type -> Type)
_j :: Hamiltonian t => Lens' (t a) a
_k :: Hamiltonian t => Lens' (t a) a
_ijk :: Hamiltonian t => Lens' (t a) (V3 a)
-- | A 0-dimensional vector
--
--
-- >>> pure 1 :: V0 Int
-- V0
--
--
--
-- >>> V0 + V0
-- V0
--
data V0 a
V0 :: V0 a
-- | Convert 4-dimensional projective coordinates to a 3-dimensional point.
-- This operation may be denoted, euclidean [x:y:z:w] = (x/w, y/w,
-- z/w) where the projective, homogenous, coordinate
-- [x:y:z:w] is one of many associated with a single point
-- (x/w, y/w, z/w).
normalizePoint :: Fractional a => V4 a -> V3 a
-- | Convert a 3-dimensional affine point into a 4-dimensional homogeneous
-- vector, i.e. sets the w coordinate to 1.
point :: Num a => V3 a -> V4 a
-- | Convert a 3-dimensional affine vector into a 4-dimensional homogeneous
-- vector, i.e. sets the w coordinate to 0.
vector :: Num a => V3 a -> V4 a
ew :: forall (t :: Type -> Type). R4 t => E t
_wzyx :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_wzxy :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_wyzx :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_wyxz :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_wxzy :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_wxyz :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_zwyx :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_zwxy :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_zywx :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_zyxw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_zxwy :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_zxyw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_ywzx :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_ywxz :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_yzwx :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_yzxw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_yxwz :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_yxzw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_xwzy :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_xwyz :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_xzwy :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_xzyw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_xywz :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V4 a)
_wzy :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_wzx :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_wyz :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_wyx :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_wxz :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_wxy :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_zwy :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_zwx :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_zyw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_zxw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_ywz :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_ywx :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_yzw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_yxw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_xwz :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_xwy :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_xzw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_xyw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V3 a)
_wz :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V2 a)
_wy :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V2 a)
_wx :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V2 a)
_zw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V2 a)
_yw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V2 a)
_xw :: forall (t :: Type -> Type) a. R4 t => Lens' (t a) (V2 a)
-- | A 4-dimensional vector.
data V4 a
V4 :: !a -> !a -> !a -> !a -> V4 a
-- | A space that distinguishes orthogonal basis vectors _x,
-- _y, _z, _w. (It may have more.)
class R3 t => R4 (t :: Type -> Type)
-- |
-- >>> V4 1 2 3 4 ^._w
-- 4
--
_w :: R4 t => Lens' (t a) a
_xyzw :: R4 t => Lens' (t a) (V4 a)
-- | scalar triple product
triple :: Num a => V3 a -> V3 a -> V3 a -> a
-- | cross product
cross :: Num a => V3 a -> V3 a -> V3 a
ez :: forall (t :: Type -> Type). R3 t => E t
_zyx :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V3 a)
_zxy :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V3 a)
_yzx :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V3 a)
_yxz :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V3 a)
_xzy :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V3 a)
_zy :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V2 a)
_zx :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V2 a)
_yz :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V2 a)
_xz :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V2 a)
-- | A 3-dimensional vector
data V3 a
V3 :: !a -> !a -> !a -> V3 a
-- | A space that distinguishes 3 orthogonal basis vectors: _x,
-- _y, and _z. (It may have more)
class R2 t => R3 (t :: Type -> Type)
-- |
-- >>> V3 1 2 3 ^. _z
-- 3
--
_z :: R3 t => Lens' (t a) a
_xyz :: R3 t => Lens' (t a) (V3 a)
-- | The Z-component of the cross product of two vectors in the XY-plane.
--
--
-- >>> crossZ (V2 1 0) (V2 0 1)
-- 1
--
crossZ :: Num a => V2 a -> V2 a -> a
unangle :: (Floating a, Ord a) => V2 a -> a
angle :: Floating a => a -> V2 a
-- | the counter-clockwise perpendicular vector
--
--
-- >>> perp $ V2 10 20
-- V2 (-20) 10
--
perp :: Num a => V2 a -> V2 a
ey :: forall (t :: Type -> Type). R2 t => E t
-- |
-- >>> V2 1 2 ^. _yx
-- V2 2 1
--
_yx :: forall (t :: Type -> Type) a. R2 t => Lens' (t a) (V2 a)
-- | A 2-dimensional vector
--
--
-- >>> pure 1 :: V2 Int
-- V2 1 1
--
--
--
-- >>> V2 1 2 + V2 3 4
-- V2 4 6
--
--
--
-- >>> V2 1 2 * V2 3 4
-- V2 3 8
--
--
--
-- >>> sum (V2 1 2)
-- 3
--
data V2 a
V2 :: !a -> !a -> V2 a
-- | A space that distinguishes 2 orthogonal basis vectors _x and
-- _y, but may have more.
class R1 t => R2 (t :: Type -> Type)
-- |
-- >>> V2 1 2 ^._y
-- 2
--
--
--
-- >>> V2 1 2 & _y .~ 3
-- V2 1 3
--
_y :: R2 t => Lens' (t a) a
_xy :: R2 t => Lens' (t a) (V2 a)
ex :: forall (t :: Type -> Type). R1 t => E t
-- | A 1-dimensional vector
--
--
-- >>> pure 1 :: V1 Int
-- V1 1
--
--
--
-- >>> V1 2 + V1 3
-- V1 5
--
--
--
-- >>> V1 2 * V1 3
-- V1 6
--
--
--
-- >>> sum (V1 2)
-- 2
--
newtype V1 a
V1 :: a -> V1 a
-- | A space that has at least 1 basis vector _x.
class R1 (t :: Type -> Type)
-- |
-- >>> V1 2 ^._x
-- 2
--
--
--
-- >>> V1 2 & _x .~ 3
-- V1 3
--
_x :: R1 t => Lens' (t a) a
-- | project u v computes the projection of v onto
-- u.
project :: (Metric v, Fractional a) => v a -> v a -> v a
-- | Normalize a Metric functor to have unit norm. This
-- function does not change the functor if its norm is 0 or 1.
normalize :: (Floating a, Metric f, Epsilon a) => f a -> f a
-- | Free and sparse inner product/metric spaces.
class Additive f => Metric (f :: Type -> Type)
-- | Compute the inner product of two vectors or (equivalently) convert a
-- vector f a into a covector f a -> a.
--
--
-- >>> V2 1 2 `dot` V2 3 4
-- 11
--
dot :: (Metric f, Num a) => f a -> f a -> a
-- | Compute the squared norm. The name quadrance arises from Norman J.
-- Wildberger's rational trigonometry.
quadrance :: (Metric f, Num a) => f a -> a
-- | Compute the quadrance of the difference
qd :: (Metric f, Num a) => f a -> f a -> a
-- | Compute the distance between two vectors in a metric space
distance :: (Metric f, Floating a) => f a -> f a -> a
-- | Compute the norm of a vector in a metric space
norm :: (Metric f, Floating a) => f a -> a
-- | Convert a non-zero vector to unit vector.
signorm :: (Metric f, Floating a) => f a -> f a
-- | Outer (tensor) product of two vectors
outer :: (Functor f, Functor g, Num a) => f a -> g a -> f (g a)
-- | Create a unit vector.
--
--
-- >>> unit _x :: V2 Int
-- V2 1 0
--
unit :: (Additive t, Num a) => ASetter' (t a) a -> t a
-- | Produce a diagonal (scale) matrix from a vector.
--
--
-- >>> scaled (V2 2 3)
-- V2 (V2 2 0) (V2 0 3)
--
scaled :: (Traversable t, Num a) => t a -> t (t a)
-- | Produce a default basis for a vector space from which the argument is
-- drawn.
basisFor :: (Traversable t, Num a) => t b -> [t a]
-- | Produce a default basis for a vector space. If the dimensionality of
-- the vector space is not statically known, see basisFor.
basis :: (Additive t, Traversable t, Num a) => [t a]
-- | Compute division by a scalar on the right.
(^/) :: (Functor f, Fractional a) => f a -> a -> f a
infixl 7 ^/
-- | Compute the right scalar product
--
--
-- >>> V2 3 4 ^* 2
-- V2 6 8
--
(^*) :: (Functor f, Num a) => f a -> a -> f a
infixl 7 ^*
-- | Compute the left scalar product
--
--
-- >>> 2 *^ V2 3 4
-- V2 6 8
--
(*^) :: (Functor f, Num a) => a -> f a -> f a
infixl 7 *^
-- | Sum over multiple vectors
--
--
-- >>> sumV [V2 1 1, V2 3 4]
-- V2 4 5
--
sumV :: (Foldable f, Additive v, Num a) => f (v a) -> v a
-- | Compute the negation of a vector
--
--
-- >>> negated (V2 2 4)
-- V2 (-2) (-4)
--
negated :: (Functor f, Num a) => f a -> f a
-- | Basis element
newtype E (t :: Type -> Type)
E :: (forall x. () => Lens' (t x) x) -> E (t :: Type -> Type)
[el] :: E (t :: Type -> Type) -> forall x. () => Lens' (t x) x
-- | A vector is an additive group with additional structure.
class Functor f => Additive (f :: Type -> Type)
-- | The zero vector
zero :: (Additive f, Num a) => f a
-- | Compute the sum of two vectors
--
--
-- >>> V2 1 2 ^+^ V2 3 4
-- V2 4 6
--
(^+^) :: (Additive f, Num a) => f a -> f a -> f a
-- | Compute the difference between two vectors
--
--
-- >>> V2 4 5 ^-^ V2 3 1
-- V2 1 4
--
(^-^) :: (Additive f, Num a) => f a -> f a -> f a
-- | Linearly interpolate between two vectors.
lerp :: (Additive f, Num a) => a -> f a -> f a -> f a
-- | Apply a function to merge the 'non-zero' components of two vectors,
-- unioning the rest of the values.
--
--
-- - For a dense vector this is equivalent to liftA2.
-- - For a sparse vector this is equivalent to unionWith.
--
liftU2 :: Additive f => (a -> a -> a) -> f a -> f a -> f a
-- | Apply a function to the components of two vectors.
--
--
-- - For a dense vector this is equivalent to liftA2.
-- - For a sparse vector this is equivalent to
-- intersectionWith.
--
liftI2 :: Additive f => (a -> b -> c) -> f a -> f b -> f c
infixl 6 ^-^
infixl 6 ^+^
-- | Provides a fairly subjective test to see if a quantity is near zero.
--
--
-- >>> nearZero (1e-11 :: Double)
-- False
--
--
--
-- >>> nearZero (1e-17 :: Double)
-- True
--
--
--
-- >>> nearZero (1e-5 :: Float)
-- False
--
--
--
-- >>> nearZero (1e-7 :: Float)
-- True
--
class Num a => Epsilon a
-- | Determine if a quantity is near zero.
nearZero :: Epsilon a => a -> Bool
-- | An involutive ring
class Num a => Conjugate a
-- | Conjugate a value. This defaults to the trivial involution.
--
--
-- >>> conjugate (1 :+ 2)
-- 1.0 :+ (-2.0)
--
--
--
-- >>> conjugate 1
-- 1
--
conjugate :: Conjugate a => a -> a
-- | Requires and provides a default definition such that
--
--
-- conjugate = id
--
class Conjugate a => TrivialConjugate a
-- | Deserialize a linear type.
getLinear :: (Binary a, Applicative t, Traversable t) => Get (t a)
-- | Serialize a linear type.
putLinear :: (Binary a, Foldable t) => t a -> Put
-- | Orphan boolean instances for linear types. These are placed in a
-- separate module so you can choose to not import them (in that case, do
-- not import the Graphics.GPipe conveniance module but take all
-- sub modules instead, leaving this one out).
module Graphics.GPipe.Orphans
-- | PrimitiveArrays (aka VAOs in OpenGl) are the main input to compiled
-- shaders. A primitive array is created from one or more zipped vertex
-- arrays. A primitive array may also be instanced, using one or more
-- zipped vertex arrays as instance arrays. And lastly, an index array
-- may also be used to pick vertices for the primitive array.
--
-- Any possible combination of interleaved or non-interleaved vertex
-- buffers may be used, for example:
--
-- Buffer a = {(A,B),(A,B),(A,B)...} Buffer b
-- = {(X,Y,Z),(X,Y,Z),(X,Y,Z),...}
--
--
-- do
-- aArr <- newVertexArray a
-- bArr <- newVertexArray b
-- let primArr = toPrimitiveArray TriangleList (zipVertices ((a,b) y -> (a,b,y)) aArr (fmap ((_,y,_) -> y) bArr))
--
--
--
-- will create a primitive array primArr with this layout:
-- {(A,B,Y),(A,B,Y),(A,B,Y)...}
module Graphics.GPipe.PrimitiveArray
-- | A vertex array is the basic building block for a primitive array. It
-- is created from the contents of a Buffer, but unlike a
-- Buffer, it may be truncated, zipped with other vertex arrays,
-- and even morphed into arrays of a different type with the provided
-- Functor instance. A VertexArray t a has elements of
-- type a, and t indicates whether the vertex array may
-- be used as instances or not.
data VertexArray t a
-- | A phantom type to indicate that a VertexArray may only be used
-- for instances (in toPrimitiveArrayInstanced and
-- toPrimitiveArrayIndexedInstanced).
data Instances
-- | Create a VertexArray from a Buffer. The vertex array
-- will have the same number of elements as the buffer, use
-- takeVertices and dropVertices to make it smaller.
newVertexArray :: Buffer os a -> Render os (VertexArray t a)
-- | Retrieve the number of elements in a VertexArray.
vertexArrayLength :: VertexArray t a -> Int
-- | Zip two VertexArrays using the function given as first
-- argument. If either of the argument VertexArrays are restriced
-- to Instances only, then so will the resulting array be, as
-- depicted by the Combine type family.
zipVertices :: (a -> b -> c) -> VertexArray t a -> VertexArray t' b -> VertexArray (Combine t t') c
type family Combine t t'
-- | takeVertices n a creates a shorter vertex array by taking the
-- n first elements of the array a.
takeVertices :: Int -> VertexArray t a -> VertexArray t a
-- | dropVertices n a creates a shorter vertex array by dropping
-- the n first elements of the array a. The argument
-- array a must not be constrained to only Instances.
dropVertices :: Int -> VertexArray () a -> VertexArray t a
-- | replicateEach n a will create a longer vertex array, only to
-- be used for instances, by replicating each element of the array
-- a n times. E.g. replicateEach 3 {ABCD...}
-- will yield {AAABBBCCCDDD...}. This is particulary useful
-- before zipping the array with another that has a different replication
-- rate.
replicateEach :: Int -> VertexArray t a -> VertexArray Instances a
-- | An index array is like a vertex array, but contains only integer
-- indices. These indices must come from a tightly packed Buffer,
-- hence the lack of a Functor instance and no conversion from
-- VertexArrays.
data IndexArray
-- | Create an IndexArray from a Buffer of unsigned integers
-- (as constrained by the closed IndexFormat type family
-- instances). The index array will have the same number of elements as
-- the buffer, use takeIndices and dropIndices to make it
-- smaller. The Maybe a argument is used to optionally denote a
-- primitive restart index.
newIndexArray :: forall os f b a. (BufferFormat b, Integral a, IndexFormat b ~ a) => Buffer os b -> Maybe a -> Render os IndexArray
type family IndexFormat a
-- | Numer of indices in an IndexArray.
indexArrayLength :: IndexArray -> Int
-- | takeIndices n a creates a shorter index array by taking the
-- n first indices of the array a.
takeIndices :: Int -> IndexArray -> IndexArray
-- | dropIndices n a creates a shorter index array by dropping the
-- n first indices of the array a.
dropIndices :: Int -> IndexArray -> IndexArray
-- | An array of primitives
data PrimitiveArray p a
class PrimitiveTopology p where {
data family Geometry p a;
}
toGLtopology :: PrimitiveTopology p => p -> GLuint
toPrimitiveSize :: PrimitiveTopology p => p -> Int
toGeometryShaderOutputTopology :: PrimitiveTopology p => p -> GLuint
toLayoutIn :: PrimitiveTopology p => p -> Text
toLayoutOut :: PrimitiveTopology p => p -> Text
data Points
PointList :: Points
data Lines
LineLoop :: Lines
LineStrip :: Lines
LineList :: Lines
data LinesWithAdjacency
LineListAdjacency :: LinesWithAdjacency
LineStripAdjacency :: LinesWithAdjacency
data Triangles
TriangleList :: Triangles
TriangleStrip :: Triangles
data TrianglesWithAdjacency
TriangleListAdjacency :: TrianglesWithAdjacency
TriangleStripAdjacency :: TrianglesWithAdjacency
toPrimitiveArray :: PrimitiveTopology p => p -> VertexArray () a -> PrimitiveArray p a
toPrimitiveArrayIndexed :: PrimitiveTopology p => p -> IndexArray -> VertexArray () a -> PrimitiveArray p a
toPrimitiveArrayInstanced :: PrimitiveTopology p => p -> (a -> b -> c) -> VertexArray () a -> VertexArray t b -> PrimitiveArray p c
toPrimitiveArrayIndexedInstanced :: PrimitiveTopology p => p -> IndexArray -> (a -> b -> c) -> VertexArray () a -> VertexArray t b -> PrimitiveArray p c
-- | Split up a B4 a into two B2 as.
toB22 :: forall a. (Storable a, BufferFormat (B2 a)) => B4 a -> (B2 a, B2 a)
-- | Discard the last component of a B4 a to get a
-- B3 a.
toB3 :: forall a. (Storable a, BufferFormat (B3 a)) => B4 a -> B3 a
-- | Split up a B3 a into a B2 a and a
-- B1 a.
toB21 :: forall a. (Storable a, BufferFormat (B a)) => B3 a -> (B2 a, B a)
-- | Split up a B3 a into a B1 a and a
-- B2 a.
toB12 :: forall a. (Storable a, BufferFormat (B a)) => B3 a -> (B a, B2 a)
-- | Split up a B2 a into two B1 as.
toB11 :: forall a. (Storable a, BufferFormat (B a)) => B2 a -> (B a, B a)
-- | A PrimitiveArray can be turned into a PrimitiveStream in
-- a Shader, in order to operate on the vertices of it and
-- ultimately rasterize it into a FragmentStream.
module Graphics.GPipe.PrimitiveStream
-- | A PrimitiveStream t a is a stream of primitives of
-- type t where the vertices are values of type a. You
-- can operate a stream's vertex values using the Functor instance
-- (this will result in a shader running on the GPU). You may also append
-- PrimitiveStreams using the Monoid instance, but if
-- possible append the origin PrimitiveArrays instead, as this
-- will create more optimized draw calls.
data PrimitiveStream t a
-- | This class constraints which buffer types can be turned into vertex
-- values, and what type those values have.
class VertexInput a where {
-- | The type the buffer value will be turned into once it becomes a vertex
-- value.
type family VertexFormat a;
}
-- | An arrow action that turns a value from it's buffer representation to
-- it's vertex representation. Use toVertex from the GPipe
-- provided instances to operate in this arrow. Also note that this arrow
-- needs to be able to return a value lazily, so ensure you use
--
-- proc ~pattern -> do ....
toVertex :: VertexInput a => ToVertex a (VertexFormat a)
-- | The arrow type for toVertex.
data ToVertex a b
-- | Create a primitive stream from a primitive array provided from the
-- shader environment. TODO No way to constraint b a bit more?
toPrimitiveStream :: forall os f s a p. (PrimitiveTopology p, VertexInput a) => (s -> PrimitiveArray p a) -> Shader os s (PrimitiveStream p (VertexFormat a))
toPrimitiveStream' :: forall os f s a b p. (PrimitiveTopology p, VertexInput a) => Maybe (s -> Buffer os b) -> (s -> PrimitiveArray p a) -> Shader os s (PrimitiveStream p (VertexFormat a))
-- | Like fmap, but where the vertex and instance IDs are provided
-- as arguments as well.
withInputIndices :: (a -> InputIndices -> b) -> PrimitiveStream p a -> PrimitiveStream p b
data InputIndices
InputIndices :: VInt -> VInt -> InputIndices
[inputVertexID] :: InputIndices -> VInt
[inputInstanceID] :: InputIndices -> VInt
-- | Like fmap, but where each point's size is provided as arguments
-- as well, and a new point size is set for each point in addition to the
-- new vertex value.
--
-- When a PrimitiveStream of Points is created, all points
-- will have the default size of 1.
withPointSize :: (a -> PointSize -> (b, PointSize)) -> PrimitiveStream Points a -> PrimitiveStream Points b
type PointSize = VFloat
-- | A sampler is a value from which filtered color samples may be taken
-- inside a shader. A sampler is created from a texture and some sampling
-- parameters. There also exist Shadow samplers that doesnt return
-- a sampled color value, but instead compare a reference value to the
-- texture value.
module Graphics.GPipe.Sampler
data Sampler1D f
data Sampler1DArray f
data Sampler2D f
data Sampler2DArray f
data Sampler3D f
data SamplerCube f
-- | Used instead of Format for shadow samplers. These samplers have
-- specialized sampler values, see sample1DShadow and friends.
data Shadow
newSampler1D :: forall os s c. ColorSampleable c => (s -> (Texture1D os (Format c), SamplerFilter c, (EdgeMode, BorderColor c))) -> Shader os s (Sampler1D (Format c))
newSampler1DArray :: forall os s c. ColorSampleable c => (s -> (Texture1DArray os (Format c), SamplerFilter c, (EdgeMode, BorderColor c))) -> Shader os s (Sampler1DArray (Format c))
newSampler2D :: forall os s c. ColorSampleable c => (s -> (Texture2D os (Format c), SamplerFilter c, (EdgeMode2, BorderColor c))) -> Shader os s (Sampler2D (Format c))
newSampler2DArray :: forall os s c. ColorSampleable c => (s -> (Texture2DArray os (Format c), SamplerFilter c, (EdgeMode2, BorderColor c))) -> Shader os s (Sampler2DArray (Format c))
newSampler3D :: forall os s c. ColorRenderable c => (s -> (Texture3D os (Format c), SamplerFilter c, (EdgeMode3, BorderColor c))) -> Shader os s (Sampler3D (Format c))
newSamplerCube :: forall os s c. ColorSampleable c => (s -> (TextureCube os (Format c), SamplerFilter c)) -> Shader os s (SamplerCube (Format c))
newSampler1DShadow :: forall os s d. DepthRenderable d => (s -> (Texture1D os (Format d), SamplerFilter d, (EdgeMode, BorderColor d), ComparisonFunction)) -> Shader os s (Sampler1D Shadow)
newSampler1DArrayShadow :: forall os s d. DepthRenderable d => (s -> (Texture1DArray os (Format d), SamplerFilter d, (EdgeMode, BorderColor d), ComparisonFunction)) -> Shader os s (Sampler1DArray Shadow)
newSampler2DShadow :: forall os s d. DepthRenderable d => (s -> (Texture2D os d, SamplerFilter (Format d), (EdgeMode2, BorderColor d), ComparisonFunction)) -> Shader os s (Sampler2D Shadow)
newSampler2DArrayShadow :: forall os s d. DepthRenderable d => (s -> (Texture2DArray os (Format d), SamplerFilter d, (EdgeMode2, BorderColor d), ComparisonFunction)) -> Shader os s (Sampler2DArray Shadow)
newSamplerCubeShadow :: forall os s d. DepthRenderable d => (s -> (TextureCube os (Format d), SamplerFilter d, ComparisonFunction)) -> Shader os s (SamplerCube Shadow)
data Filter
Nearest :: Filter
Linear :: Filter
data EdgeMode
Repeat :: EdgeMode
Mirror :: EdgeMode
ClampToEdge :: EdgeMode
ClampToBorder :: EdgeMode
type EdgeMode2 = V2 EdgeMode
type EdgeMode3 = V3 EdgeMode
type BorderColor c = Color c (ColorElement c)
type Anisotropy = Maybe Float
type MinFilter = Filter
type MagFilter = Filter
type LodFilter = Filter
-- | A GADT for sample filters, where SamplerFilter cannot be used
-- for integer textures.
data SamplerFilter c
[SamplerFilter] :: ColorElement c ~ Float => MagFilter -> MinFilter -> LodFilter -> Anisotropy -> SamplerFilter c
[SamplerNearest] :: SamplerFilter c
data ComparisonFunction
Never :: ComparisonFunction
Less :: ComparisonFunction
Equal :: ComparisonFunction
Lequal :: ComparisonFunction
Greater :: ComparisonFunction
Notequal :: ComparisonFunction
Gequal :: ComparisonFunction
Always :: ComparisonFunction
sampler1DSize :: Sampler1D f -> S x Level -> S x Int
sampler1DArraySize :: Sampler1DArray f -> S x Level -> V2 (S x Int)
sampler2DSize :: Sampler2D f -> S x Level -> V2 (S x Int)
sampler2DArraySize :: Sampler2DArray f -> S x Level -> V3 (S x Int)
sampler3DSize :: Sampler3D f -> S x Level -> V3 (S x Int)
samplerCubeSize :: SamplerCube f -> S x Level -> S x Int
sample1D :: forall c x. ColorSampleable c => Sampler1D (Format c) -> SampleLod1 x -> SampleProj x -> SampleOffset1 x -> S x Float -> ColorSample x c
sample1DArray :: forall c x. ColorSampleable c => Sampler1DArray (Format c) -> SampleLod1 x -> SampleOffset1 x -> V2 (S x Float) -> ColorSample x c
sample2D :: forall c x. ColorSampleable c => Sampler2D (Format c) -> SampleLod2 x -> SampleProj x -> SampleOffset2 x -> V2 (S x Float) -> ColorSample x c
sample2DArray :: forall c x. ColorSampleable c => Sampler2DArray (Format c) -> SampleLod2 x -> SampleOffset2 x -> V3 (S x Float) -> ColorSample x c
sample3D :: forall c x. ColorSampleable c => Sampler3D (Format c) -> SampleLod3 x -> SampleProj x -> SampleOffset3 x -> V3 (S x Float) -> ColorSample x c
sampleCube :: forall c x. ColorSampleable c => SamplerCube (Format c) -> SampleLod3 x -> V3 (S x Float) -> ColorSample x c
sample1DShadow :: forall x. Sampler1D Shadow -> SampleLod1 x -> SampleProj x -> SampleOffset1 x -> ReferenceValue x -> S x Float -> S x Float
sample1DArrayShadow :: forall x. Sampler1DArray Shadow -> SampleLod1 x -> SampleOffset1 x -> ReferenceValue x -> V2 (S x Float) -> S x Float
sample2DShadow :: forall x. Sampler2D Shadow -> SampleLod2 x -> SampleProj x -> SampleOffset2 x -> ReferenceValue x -> V2 (S x Float) -> S x Float
sample2DArrayShadow :: forall x. Sampler2DArray Shadow -> SampleLod2' x -> SampleOffset2 x -> ReferenceValue x -> V3 (S x Float) -> S x Float
sampleCubeShadow :: forall x. SamplerCube Shadow -> SampleLod3' x -> ReferenceValue x -> V3 (S x Float) -> S x Float
texelFetch1D :: forall c x. ColorSampleable c => Sampler1D (Format c) -> SampleOffset1 x -> S x Level -> S x Int -> ColorSample x c
texelFetch1DArray :: forall c x. ColorSampleable c => Sampler1DArray (Format c) -> SampleOffset1 x -> S x Level -> V2 (S x Int) -> ColorSample x c
texelFetch2D :: forall c x. ColorSampleable c => Sampler2D (Format c) -> SampleOffset2 x -> S x Level -> V2 (S x Int) -> ColorSample x c
texelFetch2DArray :: forall c x. ColorSampleable c => Sampler2DArray (Format c) -> SampleOffset2 x -> S x Level -> V3 (S x Int) -> ColorSample x c
texelFetch3D :: forall c x. ColorSampleable c => Sampler3D (Format c) -> SampleOffset3 x -> S x Level -> V3 (S x Int) -> ColorSample x c
-- | A GADT to specify where the level of detail and/or partial derivates
-- should be taken from. Some values of this GADT are restricted to only
-- FragmentStreams.
data SampleLod vx x
[SampleAuto] :: SampleLod v F
[SampleBias] :: FFloat -> SampleLod vx F
[SampleLod] :: S x Float -> SampleLod vx x
[SampleGrad] :: vx -> vx -> SampleLod vx x
type SampleLod1 x = SampleLod (S x Float) x
type SampleLod2 x = SampleLod (V2 (S x Float)) x
type SampleLod3 x = SampleLod (V3 (S x Float)) x
-- | For some reason, OpenGl doesnt allow explicit lod to be specified for
-- some sampler types, hence this extra GADT.
data SampleLod' vx x
[SampleAuto'] :: SampleLod' v F
[SampleBias'] :: FFloat -> SampleLod' vx F
[SampleGrad'] :: vx -> vx -> SampleLod' vx x
type SampleLod2' x = SampleLod' (V2 (S x Float)) x
type SampleLod3' x = SampleLod' (V3 (S x Float)) x
fromLod' :: SampleLod' v x -> SampleLod v x
type SampleProj x = Maybe (S x Float)
type SampleOffset1 x = Maybe Int
type SampleOffset2 x = Maybe (V2 Int)
type SampleOffset3 x = Maybe (V3 Int)
type ReferenceValue x = S x Float
-- | The type of a color sample made by a texture t
type ColorSample x f = Color f (S x (ColorElement f))
-- | A Shader is a monad in which PrimitiveStreams and
-- FragmentStreams live, together with samplers and uniform
-- values. Any computations made on the streams and values in the
-- Shader monad will be performed on the GPU. A Shader
-- needs to be compiled before it can be used. In order to make it work
-- over different environments after it has been compiled, it closes over
-- an environment value just like a Reader monad, with the
-- distinction that there is no ask action, since we cannot make
-- the actual monad operation depend on the environment.
--
-- A Shader is an instance of Alternative and
-- MonadPlus which makes it possible to express choice with
-- functions like guard. The left most alternative will always
-- be the resulting monad.
module Graphics.GPipe.Shader
-- | The monad in which all GPU computations are done. 'Shader os s a'
-- lives in an object space os and a context with format
-- f, closing over an environent of type s.
data Shader os s a
-- | Compiles a shader into a CompiledShader. This action will
-- usually take a second or more, so put it during a loading sequence or
-- something.
--
-- May throw a GPipeException if the graphics driver doesn't
-- support something in this shader (e.g. too many interpolated floats
-- sent between a vertex and a fragment shader)
compileShader :: (ContextHandler ctx, MonadIO m, MonadException m) => Shader os s () -> ContextT ctx os m (CompiledShader os s)
-- | A compiled shader is just a function that takes an environment and
-- returns a Render action It could have been called
-- CompiledDrawcall or Renderer because it is the same
-- thing.
type CompiledShader os s = s -> Render os ()
-- | A monad in which shaders are run.
data Render os a
-- | Run a Render monad, that may have the effect of windows or
-- textures being drawn to.
--
-- May throw a GPipeException if a combination of draw images
-- (FBO) used by this render call is unsupported by the graphics driver
render :: (ContextHandler ctx, MonadIO m, MonadException m) => Render os () -> ContextT ctx os m ()
-- | Like guard, but dependent on the Shaders environment
-- value. Since this will be evaluated at shader run time, as opposed to
-- shader compile time for guard, using this to do recursion
-- will make compileShader diverge. You can break that divergence
-- by combining it with a normal guard and a maximum loop count.
guard' :: (s -> Bool) -> Shader os s ()
-- | Map the environment to a different environment and run a Shader in
-- that sub environment, returning it's result.
mapShader :: (s -> s') -> Shader os s' a -> Shader os s a
-- | Conditionally run the effects of a shader when a Maybe value is
-- Just something.
maybeShader :: (s -> Maybe s') -> Shader os s' () -> Shader os s ()
-- | Select one of two Shader actions based on whether an
-- Either value is Left or Right.
chooseShader :: (s -> Either s' s'') -> Shader os s' a -> Shader os s'' a -> Shader os s a
-- | Discard all effects of a Shader action (i.e., dont draw
-- anything) and just return the resulting value.
silenceShader :: Shader os s a -> Shader os s a
-- | A texture is a spatially arranged map of pixels that resides on the
-- GPU. A texture can be a 1D, 2D or 3D image, or an array of several
-- same sized 1D or 2D images, or a cube map with six square images. A
-- texture may also have several levels of detail, in decreasing size.
--
-- A texture has a strongly typed format and immutable size and number of
-- levels, but its content is mutable. A texture lives in an object space
-- and may be shared between contexts.
--
-- The main purpose for a texture is to be sampled in a Shader,
-- by turning it into a sampler object (See Sampler1D and
-- friends). A texture may also be used as a render target into which
-- FragmentStreams are drawn, thus generating the texture on the
-- GPU. To that end, a texture may not only be written from the host
-- (i.e. the normal Haskell world) but also read back.
module Graphics.GPipe.Texture
data Texture1D os a
data Texture1DArray os a
data Texture2D os a
data Texture2DArray os a
data Texture3D os a
data TextureCube os a
data CubeSide
CubePosX :: CubeSide
CubeNegX :: CubeSide
CubePosY :: CubeSide
CubeNegY :: CubeSide
CubePosZ :: CubeSide
CubeNegZ :: CubeSide
newTexture1D :: forall ctx w os f c m. (ContextHandler ctx, ColorSampleable c, MonadIO m) => Format c -> Size1 -> MaxLevels -> ContextT ctx os m (Texture1D os (Format c))
newTexture1DArray :: forall ctx w os f c m. (ContextHandler ctx, ColorSampleable c, MonadIO m) => Format c -> Size2 -> MaxLevels -> ContextT ctx os m (Texture1DArray os (Format c))
newTexture2D :: forall ctx w os f c m. (ContextHandler ctx, TextureFormat c, MonadIO m) => Format c -> Size2 -> MaxLevels -> ContextT ctx os m (Texture2D os (Format c))
newTexture2DArray :: forall ctx w os f c m. (ContextHandler ctx, ColorSampleable c, MonadIO m) => Format c -> Size3 -> MaxLevels -> ContextT ctx os m (Texture2DArray os (Format c))
newTexture3D :: forall ctx w os f c m. (ContextHandler ctx, ColorRenderable c, MonadIO m) => Format c -> Size3 -> MaxLevels -> ContextT ctx os m (Texture3D os (Format c))
newTextureCube :: forall ctx w os f c m. (ContextHandler ctx, ColorSampleable c, MonadIO m) => Format c -> Size1 -> MaxLevels -> ContextT ctx os m (TextureCube os (Format c))
texture1DLevels :: Texture1D os f -> Int
texture1DArrayLevels :: Texture1DArray os f -> Int
texture2DLevels :: Texture2D os f -> Int
texture2DArrayLevels :: Texture2DArray os f -> Int
texture3DLevels :: Texture3D os f -> Int
textureCubeLevels :: TextureCube os f -> Int
texture1DSizes :: Texture1D os f -> [Size1]
texture1DArraySizes :: Texture1DArray os f -> [Size2]
texture2DSizes :: Texture2D os f -> [Size2]
texture2DArraySizes :: Texture2DArray os f -> [Size3]
texture3DSizes :: Texture3D os f -> [Size3]
textureCubeSizes :: TextureCube os f -> [Size1]
writeTexture1D :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture1D os (Format c) -> Level -> StartPos1 -> Size1 -> [h] -> ContextT ctx os m ()
writeTexture1DArray :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture1DArray os (Format c) -> Level -> StartPos2 -> Size2 -> [h] -> ContextT ctx os m ()
writeTexture2D :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture2D os (Format c) -> Level -> StartPos2 -> Size2 -> [h] -> ContextT ctx os m ()
writeTexture2DArray :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture2DArray os (Format c) -> Level -> StartPos3 -> Size3 -> [h] -> ContextT ctx os m ()
writeTexture3D :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture3D os (Format c) -> Level -> StartPos3 -> Size3 -> [h] -> ContextT ctx os m ()
writeTextureCube :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => TextureCube os (Format c) -> Level -> CubeSide -> StartPos2 -> Size2 -> [h] -> ContextT ctx os m ()
writeTexture1DFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture1D os (Format c) -> Level -> StartPos1 -> Size1 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
writeTexture1DArrayFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture1DArray os (Format c) -> Level -> StartPos2 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
writeTexture2DFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture2D os (Format c) -> Level -> StartPos2 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
writeTexture2DArrayFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture2DArray os (Format c) -> Level -> StartPos3 -> Size3 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
writeTexture3DFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture3D os (Format c) -> Level -> StartPos3 -> Size3 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
writeTextureCubeFromBuffer :: forall ctx b c h w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => TextureCube os (Format c) -> Level -> CubeSide -> StartPos2 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
generateTexture1DMipmap :: (ContextHandler ctx, MonadIO m) => Texture1D os f -> ContextT ctx os m ()
generateTexture1DArrayMipmap :: (ContextHandler ctx, MonadIO m) => Texture1DArray os f -> ContextT ctx os m ()
generateTexture2DMipmap :: (ContextHandler ctx, MonadIO m) => Texture2D os f -> ContextT ctx os m ()
generateTexture2DArrayMipmap :: (ContextHandler ctx, MonadIO m) => Texture2DArray os f -> ContextT ctx os m ()
generateTexture3DMipmap :: (ContextHandler ctx, MonadIO m) => Texture3D os f -> ContextT ctx os m ()
generateTextureCubeMipmap :: (ContextHandler ctx, MonadIO m) => TextureCube os f -> ContextT ctx os m ()
readTexture1D :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture1D os (Format c) -> Level -> StartPos1 -> Size1 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTexture1DArray :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture1DArray os (Format c) -> Level -> StartPos2 -> Size1 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTexture2D :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture2D os (Format c) -> Level -> StartPos2 -> Size2 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTexture2DArray :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture2DArray os (Format c) -> Level -> StartPos3 -> Size2 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTexture3D :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => Texture3D os (Format c) -> Level -> StartPos3 -> Size2 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTextureCube :: forall ctx a b c h w os f m. (ContextHandler ctx, MonadAsyncException m, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) h ~ b, h ~ HostFormat b) => TextureCube os (Format c) -> Level -> CubeSide -> StartPos2 -> Size2 -> (a -> h -> ContextT ctx os m a) -> a -> ContextT ctx os m a
readTexture1DToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture1D os (Format c) -> Level -> StartPos1 -> Size1 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
readTexture1DArrayToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture1DArray os (Format c) -> Level -> StartPos2 -> Size1 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
readTexture2DToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture2D os (Format c) -> Level -> StartPos2 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
readTexture2DArrayToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture2DArray os (Format c) -> Level -> StartPos3 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
readTexture3DToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => Texture3D os (Format c) -> Level -> StartPos3 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
readTextureCubeToBuffer :: forall ctx b c w os f m. (ContextHandler ctx, MonadIO m, BufferFormat b, ColorSampleable c, BufferColor (Color c (ColorElement c)) (HostFormat b) ~ b) => TextureCube os (Format c) -> Level -> CubeSide -> StartPos2 -> Size2 -> Buffer os b -> BufferStartPos -> ContextT ctx os m ()
type MaxLevels = Int
type Level = Int
type Size1 = Int
type Size2 = V2 Int
type Size3 = V3 Int
type StartPos1 = Int
type StartPos2 = V2 Int
type StartPos3 = V3 Int
module Graphics.GPipe.TransformFeedback
drawNothing :: forall p a s c ds os f. (PrimitiveTopology p, VertexInput a, GeometryExplosive (VertexFormat a)) => Window os c ds -> (s -> Buffer os a) -> Int -> GeometryStream (GGenerativeGeometry p (VertexFormat a)) -> Shader os s ()
-- | Uniform values are constants that you can combine with all vertices or
-- fragments of a PrimitiveStream or FragmentStream.
-- They are loaded from a Buffer and OpenGl uniform blocks are
-- used under the hood.
module Graphics.GPipe.Uniform
-- | This class constraints which buffer types can be loaded as uniforms,
-- and what type those values have.
class BufferFormat a => UniformInput a where {
-- | The type the buffer value will be turned into once it becomes a vertex
-- or fragment value (the x parameter is either V or
-- F).
type family UniformFormat a x;
}
-- | An arrow action that turns a value from it's buffer representation to
-- it's vertex or fragment representation. Use toUniform from the
-- GPipe provided instances to operate in this arrow. Also note that this
-- arrow needs to be able to return a value lazily, so ensure you use
--
-- proc ~pattern -> do ....
toUniform :: UniformInput a => ToUniform x a (UniformFormat a x)
-- | The arrow type for toUniform.
data ToUniform x a b
-- | Load a uniform value from a Buffer into a Shader. The
-- argument function is used to retrieve the buffer and the index into
-- this buffer from the shader environment. UBO are obviously used here
-- and there is no way to use "classic" uniform.
getUniform :: forall os s b x. UniformInput b => (s -> (Buffer os (Uniform b), Int)) -> Shader os s (UniformFormat b x)
-- | Any buffer value that is going to be used as a uniform needs to be
-- wrapped in this newtype. This will cause is to be aligned properly for
-- uniform usage. It can still be used as input for vertex arrays, but
-- due to the uniform alignment it will probably be padded quite heavily
-- and thus wasteful.
newtype Uniform a
Uniform :: a -> Uniform a
-- | A typesafe API based on the conceptual model of OpenGl, but without
-- the imperative state machine. GPipe aims to be as close to raw OpenGl
-- performance as possible, without compromising type safety or
-- functional style. Includes an embedded domain specific language for
-- GLSL shaders which provides type safety even when crossing into that
-- domain. Uses the OpenGl 3.3 core profile under the hood.
--
-- To learn GPipe, start with the readme at the source
-- repository. You could also go directly to a working example
-- or the tutorials: Part 1, Part 2, Part 3, Part
-- 4, Part 5.
--
-- This module reexports relevant GPipe modules and the external
-- Linear and Data.Boolean modules.
module Graphics.GPipe