From fa9acbf78f91a639c0e76c1757564a6446445f39 Mon Sep 17 00:00:00 2001 From: Kosyrev Serge <_deepfire@feelingofgreen.ru> Date: Sat, 15 Sep 2018 16:24:52 +0300 Subject: CoreToIr: add some top-level type signatures --- src/LambdaCube/Compiler/CoreToIR.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/LambdaCube/Compiler/CoreToIR.hs b/src/LambdaCube/Compiler/CoreToIR.hs index 8972d6b9..6646d345 100644 --- a/src/LambdaCube/Compiler/CoreToIR.hs +++ b/src/LambdaCube/Compiler/CoreToIR.hs @@ -21,6 +21,7 @@ import Data.List import qualified Data.Map as Map import qualified Data.Set as Set import qualified Data.Vector as Vector +import GHC.Stack import Control.Arrow hiding ((<+>)) import Control.Monad.Writer import Control.Monad.State @@ -77,6 +78,11 @@ addLEq l x = modL l $ \sv -> maybe (let i = length sv in i `seq` (i, Map.insert --------------------------------------------------------- +addTarget + :: Backend + -> ExpTV + -> [IR.TargetItem] + -> CG ([IR.Command], [IR.Command]) addTarget backend a tl = do rt <- addL targetLens $ IR.RenderTarget $ Vector.fromList tl second (IR.SetRenderTarget rt:) <$> getCommands backend a @@ -201,6 +207,7 @@ type SamplerBinding = (IR.UniformName,IR.ImageRef) frameBufferType (A2 "FrameBuffer" _ ty) = ty frameBufferType x = error $ "illegal target type: " ++ ppShow x +getSemantics :: ExpTV -> [IR.ImageSemantic] getSemantics = compSemantics . frameBufferType . tyOf getFragFilter (A2 "map" (EtaPrim2 "filterFragment" p) x) = (Just p, x) @@ -428,6 +435,7 @@ compFetchPrimitive x = case x of A0 "TriangleAdjacency" -> IR.TrianglesAdjacency x -> error $ "compFetchPrimitive " ++ ppShow x +compValue :: HasCallStack => ExpTV -> IR.Value compValue x = case x of EFloat a -> IR.VFloat $ realToFrac a EInt a -> IR.VInt $ fromIntegral a @@ -495,6 +503,14 @@ compPV x = case x of --------------------------------------------------------------- GLSL generation +genGLSLs + :: Backend + -> Maybe ExpTV + -> ExpTV + -> (Maybe ExpTV, ExpTV) + -> (Maybe ExpTV, ExpTV) + -> Maybe ExpTV + -> ([[Char]], Uniforms, Doc, Doc) genGLSLs backend rp -- program point size (ETuple ints) -- interpolations -- cgit v1.2.3