summaryrefslogtreecommitdiff
path: root/src/LambdaCube/GL
diff options
context:
space:
mode:
Diffstat (limited to 'src/LambdaCube/GL')
-rw-r--r--src/LambdaCube/GL/Input.hs8
-rw-r--r--src/LambdaCube/GL/Util.hs2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/LambdaCube/GL/Input.hs b/src/LambdaCube/GL/Input.hs
index 9ceb35f..0471a57 100644
--- a/src/LambdaCube/GL/Input.hs
+++ b/src/LambdaCube/GL/Input.hs
@@ -78,15 +78,15 @@ addObject :: GLStorage -> String -> Primitive -> Maybe (IndexStream Buffer) -> M
78addObject input slotName prim indices attribs uniformNames = do 78addObject input slotName prim indices attribs uniformNames = do
79 let sch = schema input 79 let sch = schema input
80 forM_ uniformNames $ \n -> case Map.lookup n (uniforms sch) of 80 forM_ uniformNames $ \n -> case Map.lookup n (uniforms sch) of
81 Nothing -> throw $ userError $ "Unknown uniform: " ++ show n 81 Nothing -> fail $ "Unknown uniform: " ++ show n
82 _ -> return () 82 _ -> return ()
83 case Map.lookup slotName (objectArrays sch) of 83 case Map.lookup slotName (objectArrays sch) of
84 Nothing -> throw $ userError $ "Unknown slot: " ++ show slotName 84 Nothing -> fail $ "Unknown slot: " ++ show slotName
85 Just (ObjectArraySchema sPrim sAttrs) -> do 85 Just (ObjectArraySchema sPrim sAttrs) -> do
86 when (sPrim /= (primitiveToFetchPrimitive prim)) $ throw $ userError $ 86 when (sPrim /= (primitiveToFetchPrimitive prim)) $ fail $
87 "Primitive mismatch for slot (" ++ show slotName ++ ") expected " ++ show sPrim ++ " but got " ++ show prim 87 "Primitive mismatch for slot (" ++ show slotName ++ ") expected " ++ show sPrim ++ " but got " ++ show prim
88 let sType = fmap streamToStreamType attribs 88 let sType = fmap streamToStreamType attribs
89 when (sType /= sAttrs) $ throw $ userError $ unlines $ 89 when (sType /= sAttrs) $ fail $ unlines $
90 [ "Attribute stream mismatch for slot (" ++ show slotName ++ ") expected " 90 [ "Attribute stream mismatch for slot (" ++ show slotName ++ ") expected "
91 , show sAttrs 91 , show sAttrs
92 , " but got " 92 , " but got "
diff --git a/src/LambdaCube/GL/Util.hs b/src/LambdaCube/GL/Util.hs
index bbc4345..bba322b 100644
--- a/src/LambdaCube/GL/Util.hs
+++ b/src/LambdaCube/GL/Util.hs
@@ -341,7 +341,7 @@ streamToInputType s = case s of
341 | 0 <= i && i < V.length a && 341 | 0 <= i && i < V.length a &&
342 if elem t integralTypes then elem at integralArrTypes else True 342 if elem t integralTypes then elem at integralArrTypes else True
343 -> fromStreamType t 343 -> fromStreamType t
344 | otherwise -> throw $ userError "streamToInputType failed" 344 | otherwise -> error "streamToInputType failed"
345 where 345 where
346 at = arrType $! (a V.! i) 346 at = arrType $! (a V.! i)
347 integralTypes = [Attribute_Word, Attribute_V2U, Attribute_V3U, Attribute_V4U, Attribute_Int, Attribute_V2I, Attribute_V3I, Attribute_V4I] 347 integralTypes = [Attribute_Word, Attribute_V2U, Attribute_V3U, Attribute_V4U, Attribute_Int, Attribute_V2I, Attribute_V3I, Attribute_V4I]