summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCsaba Hruska <csaba.hruska@gmail.com>2018-09-22 12:13:15 +0200
committerCsaba Hruska <csaba.hruska@gmail.com>2018-09-22 12:13:15 +0200
commit3acea61ec05c54671e6e2b1254b35130a8b502c8 (patch)
tree48f7feb209a362114539dda40cb3799afe0a0f85
parent65749d86dcc41b7de09d96834411031064bccff6 (diff)
support pipelines without color output
-rw-r--r--lambdacube-compiler.cabal2
-rw-r--r--src/LambdaCube/Compiler/CoreToIR.hs16
-rw-r--r--testdata/uniformparam02.out2
3 files changed, 9 insertions, 11 deletions
diff --git a/lambdacube-compiler.cabal b/lambdacube-compiler.cabal
index 6d47d950..8edcd5d6 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.6.1.0 5version: 0.6.2.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
diff --git a/src/LambdaCube/Compiler/CoreToIR.hs b/src/LambdaCube/Compiler/CoreToIR.hs
index feb1d6e2..357702f5 100644
--- a/src/LambdaCube/Compiler/CoreToIR.hs
+++ b/src/LambdaCube/Compiler/CoreToIR.hs
@@ -39,6 +39,7 @@ import qualified LambdaCube.Compiler.Core as I
39import LambdaCube.Compiler.Infer (neutType', makeCaseFunPars') 39import LambdaCube.Compiler.Infer (neutType', makeCaseFunPars')
40 40
41import Debug.Trace 41import Debug.Trace
42import Text.Printf
42 43
43import Data.Version 44import Data.Version
44import Paths_lambdacube_compiler (version) 45import Paths_lambdacube_compiler (version)
@@ -112,20 +113,17 @@ getCommands backend e = case e of
112 113
113 pUniforms' = snd <$> Map.filter ((\case UTexture2D{} -> False; _ -> True) . fst) pUniforms 114 pUniforms' = snd <$> Map.filter ((\case UTexture2D{} -> False; _ -> True) . fst) pUniforms
114 115
115 imageSemantics = getSemantics e 116 imageSemantics = getSemantics e
116 imageTypes = getImageInputTypes e 117 imageTypes = getImageInputTypes e
117 outImageType 118 outputValues = case imageTypes of
118 = case imageTypes of 119 [] -> error "Component-free pipelines are not supported."
119 [] -> error "Component-free pipelines are not supported." 120 xs -> take 1 [IR.Parameter "f0" ty | (IR.Color, ty) <- zip imageSemantics xs] -- TODO: support multiple output
120 [x] -> x
121 xs -> flip fromMaybe (lookup IR.Color $ zip imageSemantics xs) $
122 error "Multiple outputs, but no Color buffer?"
123 121
124 prg = IR.Program 122 prg = IR.Program
125 { IR.programUniforms = pUniforms' 123 { IR.programUniforms = pUniforms'
126 , IR.programStreams = Map.fromList $ zip vertexInput $ map (uncurry IR.Parameter) input 124 , IR.programStreams = Map.fromList $ zip vertexInput $ map (uncurry IR.Parameter) input
127 , IR.programInTextures = snd <$> Map.filter ((\case UUniform{} -> False; _ -> True) . fst) pUniforms 125 , IR.programInTextures = snd <$> Map.filter ((\case UUniform{} -> False; _ -> True) . fst) pUniforms
128 , IR.programOutput = pure $ IR.Parameter "f0" outImageType 126 , IR.programOutput = Vector.fromList outputValues
129 , IR.vertexShader = show vertSrc 127 , IR.vertexShader = show vertSrc
130 , IR.geometryShader = mempty -- TODO 128 , IR.geometryShader = mempty -- TODO
131 , IR.fragmentShader = show fragSrc 129 , IR.fragmentShader = show fragSrc
diff --git a/testdata/uniformparam02.out b/testdata/uniformparam02.out
index 65c6f23c..dc824ba3 100644
--- a/testdata/uniformparam02.out
+++ b/testdata/uniformparam02.out
@@ -18,7 +18,7 @@ Pipeline
18 fromList 18 fromList
19 [ ( "vi1" , Parameter { name = "position4" , ty = V4F } ) ] 19 [ ( "vi1" , Parameter { name = "position4" , ty = V4F } ) ]
20 , programInTextures = fromList [] 20 , programInTextures = fromList []
21 , programOutput = [ Parameter { name = "f0" , ty = V4F } ] 21 , programOutput = []
22 , vertexShader = 22 , vertexShader =
23 """ 23 """
24 #version 330 core 24 #version 330 core