summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO6
-rw-r--r--lambdacube-compiler.cabal8
-rw-r--r--src/LambdaCube/Compiler/CoreToIR.hs18
3 files changed, 25 insertions, 7 deletions
diff --git a/TODO b/TODO
index ceab6100..a6f44b1f 100644
--- a/TODO
+++ b/TODO
@@ -101,10 +101,13 @@ next:
101- support recursive local definitions 101- support recursive local definitions
102- mutual recursion (inference & reduction) 102- mutual recursion (inference & reduction)
103 103
104- backend: setup texture sampler configuration
105 done - haskell (opengl 3.3): sampler object
106 - purescript (webgl)
107done - backend: include compiler version in the generated pipeline as a string info field
104- editor: user texture support (maybe from external source) 108- editor: user texture support (maybe from external source)
105- editor: highlight errors in editor 109- editor: highlight errors in editor
106- editor: editor socket reconnection 110- editor: editor socket reconnection
107- backend: include compiler version in the generated pipeline as a string info field
108- backend: generate let in shaders 111- backend: generate let in shaders
109- backend: array support 112- backend: array support
110- backend: GLSL codegen doesn't support Vector and tuple patterns (not compiler frontend related): 113- backend: GLSL codegen doesn't support Vector and tuple patterns (not compiler frontend related):
@@ -112,7 +115,6 @@ next:
112 fragment02vectorpattern 115 fragment02vectorpattern
113 fragment05uniform 116 fragment05uniform
114- backend: basic pipeline optimization (let-floating) 117- backend: basic pipeline optimization (let-floating)
115- backend: setup texture sampler configuration
116- backend: setup viewport for render target size (purescript) 118- backend: setup viewport for render target size (purescript)
117- documentation: getting started: hello world on various platforms +Csaba 119- documentation: getting started: hello world on various platforms +Csaba
118- minimal quake videos 120- minimal quake videos
diff --git a/lambdacube-compiler.cabal b/lambdacube-compiler.cabal
index 58ab87d0..a4a9999d 100644
--- a/lambdacube-compiler.cabal
+++ b/lambdacube-compiler.cabal
@@ -2,7 +2,7 @@
2-- documentation, see http://haskell.org/cabal/users-guide/ 2-- documentation, see http://haskell.org/cabal/users-guide/
3 3
4name: lambdacube-compiler 4name: lambdacube-compiler
5version: 0.4.0.0 5version: 0.5.0.0
6homepage: http://lambdacube3d.com 6homepage: http://lambdacube3d.com
7synopsis: LambdaCube 3D is a DSL to program GPUs 7synopsis: LambdaCube 3D is a DSL to program GPUs
8description: LambdaCube 3D is a domain specific language and library that makes it 8description: LambdaCube 3D is a domain specific language and library that makes it
@@ -82,7 +82,7 @@ library
82 indentation >= 0.2 && <0.3, 82 indentation >= 0.2 && <0.3,
83 pretty-compact >=1.0 && <1.1, 83 pretty-compact >=1.0 && <1.1,
84 text >= 1.2 && <1.3, 84 text >= 1.2 && <1.3,
85 lambdacube-ir == 0.2.*, 85 lambdacube-ir == 0.3.*,
86 vector >= 0.11 && <0.12 86 vector >= 0.11 && <0.12
87 87
88 hs-source-dirs: src 88 hs-source-dirs: src
@@ -136,7 +136,7 @@ executable lambdacube-compiler-test-suite
136 pretty-compact >=1.0 && <1.1, 136 pretty-compact >=1.0 && <1.1,
137 text >= 1.2 && <1.3, 137 text >= 1.2 && <1.3,
138 time >= 1.5 && <1.6, 138 time >= 1.5 && <1.6,
139 lambdacube-ir == 0.2.*, 139 lambdacube-ir == 0.3.*,
140 vector >= 0.11 && <0.12 140 vector >= 0.11 && <0.12
141 141
142 if flag(profiling) 142 if flag(profiling)
@@ -188,7 +188,7 @@ executable lambdacube-compiler-coverage-test-suite
188 directory, 188 directory,
189 exceptions >= 0.8 && <0.9, 189 exceptions >= 0.8 && <0.9,
190 filepath, 190 filepath,
191 lambdacube-ir == 0.2.*, 191 lambdacube-ir == 0.3.*,
192 mtl >=2.2 && <2.3, 192 mtl >=2.2 && <2.3,
193 monad-control >= 1.0 && <1.1, 193 monad-control >= 1.0 && <1.1,
194 optparse-applicative == 0.12.*, 194 optparse-applicative == 0.12.*,
diff --git a/src/LambdaCube/Compiler/CoreToIR.hs b/src/LambdaCube/Compiler/CoreToIR.hs
index 04ce6ed1..4d1a38af 100644
--- a/src/LambdaCube/Compiler/CoreToIR.hs
+++ b/src/LambdaCube/Compiler/CoreToIR.hs
@@ -40,13 +40,27 @@ import LambdaCube.Compiler.Pretty hiding (parens)
40import qualified LambdaCube.Compiler.Infer as I 40import qualified LambdaCube.Compiler.Infer as I
41import LambdaCube.Compiler.Infer (SName, Lit(..), Visibility(..)) 41import LambdaCube.Compiler.Infer (SName, Lit(..), Visibility(..))
42 42
43import Data.Version
44import Paths_lambdacube_compiler (version)
45
43-------------------------------------------------------------------------- 46--------------------------------------------------------------------------
44 47
45type CG = State IR.Pipeline 48type CG = State IR.Pipeline
46 49
47pattern TFrameBuffer a b <- A2 "FrameBuffer" a b 50pattern TFrameBuffer a b <- A2 "FrameBuffer" a b
48 51
49emptyPipeline b = IR.Pipeline b mempty mempty mempty mempty mempty mempty mempty 52emptyPipeline b = IR.Pipeline
53 { IR.info = mempty
54 , IR.backend = b
55 , IR.textures = mempty
56 , IR.samplers = mempty
57 , IR.targets = mempty
58 , IR.programs = mempty
59 , IR.slots = mempty
60 , IR.streams = mempty
61 , IR.commands = mempty
62 }
63
50update i x xs = xs Vector.// [(i,x)] 64update i x xs = xs Vector.// [(i,x)]
51 65
52newTexture :: Int -> Int -> IR.ImageSemantic -> CG IR.TextureName 66newTexture :: Int -> Int -> IR.ImageSemantic -> CG IR.TextureName
@@ -98,6 +112,8 @@ compilePipeline :: IR.Backend -> I.ExpType -> IR.Pipeline
98compilePipeline b e = flip execState (emptyPipeline b) $ do 112compilePipeline b e = flip execState (emptyPipeline b) $ do
99 (subCmds,cmds) <- getCommands $ toExp e 113 (subCmds,cmds) <- getCommands $ toExp e
100 modify (\s -> s {IR.commands = Vector.fromList subCmds <> Vector.fromList cmds}) 114 modify (\s -> s {IR.commands = Vector.fromList subCmds <> Vector.fromList cmds})
115 -- add compiler version to pipeline info
116 modify (\s -> s {IR.info = "generated by lambdcube-compiler " ++ showVersion version})
101 117
102mergeSlot a b = a 118mergeSlot a b = a
103 { IR.slotUniforms = IR.slotUniforms a <> IR.slotUniforms b 119 { IR.slotUniforms = IR.slotUniforms a <> IR.slotUniforms b