summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-05-11 19:48:56 -0400
committerJoe Crayne <joe@jerkface.net>2019-05-14 14:40:22 -0400
commitfbb307078eb95cada21ba8dc2475c67220c4f636 (patch)
tree8ccd63ae77587c2b1958af136bd88b9819557981
parent81e94ce3ccc56d2e9aae5be8a1471c5bed0f60fd (diff)
WIP: count built-in.sigs
-rw-r--r--src/LambdaCube/Compiler/CoreToIR.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/LambdaCube/Compiler/CoreToIR.hs b/src/LambdaCube/Compiler/CoreToIR.hs
index 7f4f9561..1cfa77e0 100644
--- a/src/LambdaCube/Compiler/CoreToIR.hs
+++ b/src/LambdaCube/Compiler/CoreToIR.hs
@@ -176,7 +176,7 @@ getCommands backend e = case e of
176 176
177 (smpBindings, txtCmds) <- mconcat <$> traverse (uncurry getRenderTextureCommands) (Map.toList $ fst <$> pUniforms) 177 (smpBindings, txtCmds) <- mconcat <$> traverse (uncurry getRenderTextureCommands) (Map.toList $ fst <$> pUniforms)
178 178
179 let grokFetch slotName attrs = do 179 let grokFetch slotName input = do
180 i <- IR.RenderSlot <$> addL' slotLens slotName (flip mergeSlot) IR.Slot 180 i <- IR.RenderSlot <$> addL' slotLens slotName (flip mergeSlot) IR.Slot
181 { IR.slotName = slotName 181 { IR.slotName = slotName
182 , IR.slotUniforms = IR.programUniforms prg 182 , IR.slotUniforms = IR.programUniforms prg
@@ -186,7 +186,6 @@ getCommands backend e = case e of
186 } 186 }
187 return (i, input) 187 return (i, input)
188 where 188 where
189 input = compInputType'' attrs
190 mergeSlot a b = a 189 mergeSlot a b = a
191 { IR.slotUniforms = IR.slotUniforms a <> IR.slotUniforms b 190 { IR.slotUniforms = IR.slotUniforms a <> IR.slotUniforms b
192 , IR.slotStreams = IR.slotStreams a <> IR.slotStreams b 191 , IR.slotStreams = IR.slotStreams a <> IR.slotStreams b
@@ -194,9 +193,12 @@ getCommands backend e = case e of
194 } 193 }
195 194
196 (renderCommand,input) <- case input_ of 195 (renderCommand,input) <- case input_ of
197 A2 "fetch" (EString slotName) attrs -> grokFetch slotName attrs 196 A2 "fetch" (EString slotName) attrs -> grokFetch slotName (compInputType'' attrs)
198 A1 "zipCount" (A2 "fetch" (EString slotName) attrs) -> do 197 A1 "zipCount" (A2 "fetch" (EString slotName) attrs) -> do
199 (rc,inp) <- grokFetch slotName attrs 198 (rc,inp) <- grokFetch slotName (compInputType'' attrs)
199 return (rc,inp)
200 A1 "count" _ -> do
201 (rc,inp) <- grokFetch "(internal)count" []
200 return (rc,inp) 202 return (rc,inp)
201 A1 "fetchArrays" (unzip . compAttributeValue -> (tys, values)) -> do 203 A1 "fetchArrays" (unzip . compAttributeValue -> (tys, values)) -> do
202 i <- IR.RenderStream <$> addL streamLens IR.StreamData 204 i <- IR.RenderStream <$> addL streamLens IR.StreamData
@@ -311,6 +313,7 @@ getVertexShader :: ExpTV -> ((Maybe ExpTV, Ty), ExpTV, Bool)
311getVertexShader xx@(A2 "map" (EtaPrim2 "mapPrimitive" f@(etaReds -> Just (_, o))) x) = 313getVertexShader xx@(A2 "map" (EtaPrim2 "mapPrimitive" f@(etaReds -> Just (_, o))) x) =
312 let hasCount = case x of 314 let hasCount = case x of
313 A1 "zipCount" _ -> True 315 A1 "zipCount" _ -> True
316 A1 "count" _ -> True
314 _ -> False 317 _ -> False
315 in ((Just f, tyOf o), x, hasCount) 318 in ((Just f, tyOf o), x, hasCount)
316--getVertexShader (A2 "map" (EtaPrim2 "mapPrimitive" f) x) = error $ "gff: " ++ show (case f of ExpTV x _ _ -> x) --ppShow (mapVal unFunc' f) 319--getVertexShader (A2 "map" (EtaPrim2 "mapPrimitive" f) x) = error $ "gff: " ++ show (case f of ExpTV x _ _ -> x) --ppShow (mapVal unFunc' f)