From 7dd4c572fcfff44d179ec6dcd541f727babb51e6 Mon Sep 17 00:00:00 2001 From: Csaba Hruska Date: Mon, 21 Dec 2015 13:32:56 +0100 Subject: more info in errors --- Backend/GL/Backend.hs | 2 +- Backend/GL/Input.hs | 9 +++++---- lambdacube-gl-ir.cabal | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Backend/GL/Backend.hs b/Backend/GL/Backend.hs index 4780966..d3abfad 100644 --- a/Backend/GL/Backend.hs +++ b/Backend/GL/Backend.hs @@ -233,7 +233,7 @@ compileProgram uniTrie p = do lcStreams = fmap ty (toTrie $ programStreams p) check a m = and $ map go $ T.toList m where go (k,b) = case T.lookup k a of - Nothing -> True + Nothing -> False Just x -> x == b unless (check lcUniforms uniformsType) $ do putStrLn $ "expected: " ++ show lcUniforms diff --git a/Backend/GL/Input.hs b/Backend/GL/Input.hs index 2b7c3d3..e1d06b7 100644 --- a/Backend/GL/Input.hs +++ b/Backend/GL/Input.hs @@ -85,7 +85,7 @@ addObject input slotName prim indices attribs uniformNames = do ] let slotIdx = case slotName `T.lookup` slotMap input of - Nothing -> error "internal error (slot index)" + Nothing -> error $ "internal error (slot index): " ++ show slotName Just i -> i seed = objSeed input order <- newIORef 0 @@ -194,13 +194,13 @@ createObjectCommands texUnitMap topUnis obj prg = objUniCmds ++ objStreamCmds ++ where uniCmds = [GLSetUniform i u | (n,i) <- uniMap, let u = T.lookupWithDefault (topUni n) n objUnis] uniMap = T.toList $ inputUniforms prg - topUni n = T.lookupWithDefault (error "internal error (createObjectCommands)!") n topUnis + topUni n = T.lookupWithDefault (error $ "internal error (createObjectCommands): " ++ show n) n topUnis objUnis = objUniSetup obj texUnis = S.toList $ inputTextureUniforms prg texCmds = [ GLBindTexture (inputTypeToTextureTarget $ uniInputType u) texUnit u | n <- texUnis , let u = T.lookupWithDefault (topUni n) n objUnis - , let texUnit = T.lookupWithDefault (error "internal error (createObjectCommands - Texture Unit)") n texUnitMap + , let texUnit = T.lookupWithDefault (error $ "internal error (createObjectCommands - Texture Unit): " ++ show n) n texUnitMap ] uniInputType (GLUniform ty _) = ty @@ -243,7 +243,8 @@ createObjectCommands texUnitMap topUnis obj prg = objUniCmds ++ objStreamCmds ++ constAttr -> GLSetVertexAttrib i constAttr nullSetter :: ByteString -> String -> a -> IO () -nullSetter n t _ = return () -- Prelude.putStrLn $ "WARNING: unknown uniform: " ++ SB.unpack n ++ " :: " ++ t +--nullSetter n t _ = return () -- Prelude.putStrLn $ "WARNING: unknown uniform: " ++ SB.unpack n ++ " :: " ++ t +nullSetter n t _ = Prelude.putStrLn $ "WARNING: unknown uniform: " ++ SB.unpack n ++ " :: " ++ t uniformBool :: ByteString -> Trie InputSetter -> SetterFun Bool uniformV2B :: ByteString -> Trie InputSetter -> SetterFun V2B diff --git a/lambdacube-gl-ir.cabal b/lambdacube-gl-ir.cabal index 0d2600a..53144ce 100644 --- a/lambdacube-gl-ir.cabal +++ b/lambdacube-gl-ir.cabal @@ -62,7 +62,7 @@ library GLFW-b >= 1.4.7, vect >= 0.4.7, pretty-show >=1.6 && <1.7, - lambdacube-compiler + lambdacube-ir hs-source-dirs: . default-language: Haskell2010 -- cgit v1.2.3