summaryrefslogtreecommitdiff
path: root/src/LambdaCube/Compiler/CoreToIR.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/LambdaCube/Compiler/CoreToIR.hs')
-rw-r--r--src/LambdaCube/Compiler/CoreToIR.hs16
1 files changed, 7 insertions, 9 deletions
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