diff options
Diffstat (limited to 'src/LambdaCube/GL/Input.hs')
-rw-r--r-- | src/LambdaCube/GL/Input.hs | 164 |
1 files changed, 81 insertions, 83 deletions
diff --git a/src/LambdaCube/GL/Input.hs b/src/LambdaCube/GL/Input.hs index aabf0e6..88b2654 100644 --- a/src/LambdaCube/GL/Input.hs +++ b/src/LambdaCube/GL/Input.hs | |||
@@ -5,9 +5,8 @@ import Control.Exception | |||
5 | import Control.Monad | 5 | import Control.Monad |
6 | import Data.ByteString.Char8 (ByteString,pack) | 6 | import Data.ByteString.Char8 (ByteString,pack) |
7 | import Data.IORef | 7 | import Data.IORef |
8 | import Data.Map (Map) | ||
8 | import Data.IntMap (IntMap) | 9 | import Data.IntMap (IntMap) |
9 | import Data.Trie (Trie) | ||
10 | import Data.Trie.Convenience as T | ||
11 | import Data.Vector (Vector,(//),(!)) | 10 | import Data.Vector (Vector,(//),(!)) |
12 | import Data.Word | 11 | import Data.Word |
13 | import Foreign | 12 | import Foreign |
@@ -15,7 +14,6 @@ import qualified Data.ByteString.Char8 as SB | |||
15 | import qualified Data.IntMap as IM | 14 | import qualified Data.IntMap as IM |
16 | import qualified Data.Set as S | 15 | import qualified Data.Set as S |
17 | import qualified Data.Map as Map | 16 | import qualified Data.Map as Map |
18 | import qualified Data.Trie as T | ||
19 | import qualified Data.Vector as V | 17 | import qualified Data.Vector as V |
20 | import qualified Data.Vector.Algorithms.Intro as I | 18 | import qualified Data.Vector.Algorithms.Intro as I |
21 | 19 | ||
@@ -29,9 +27,9 @@ import LambdaCube.GL.Util | |||
29 | import qualified IR as IR | 27 | import qualified IR as IR |
30 | 28 | ||
31 | schemaFromPipeline :: IR.Pipeline -> PipelineSchema | 29 | schemaFromPipeline :: IR.Pipeline -> PipelineSchema |
32 | schemaFromPipeline a = PipelineSchema (T.fromList sl) (foldl T.unionL T.empty ul) | 30 | schemaFromPipeline a = PipelineSchema (Map.fromList sl) (foldl Map.union Map.empty ul) |
33 | where | 31 | where |
34 | (sl,ul) = unzip [( (pack sName,SlotSchema sPrimitive (fmap cvt (toTrie sStreams))) | 32 | (sl,ul) = unzip [( (pack sName,ObjectArraySchema sPrimitive (fmap cvt (toTrie sStreams))) |
35 | , toTrie sUniforms | 33 | , toTrie sUniforms |
36 | ) | 34 | ) |
37 | | IR.Slot sName sStreams sUniforms sPrimitive _ <- V.toList $ IR.slots a | 35 | | IR.Slot sName sStreams sUniforms sPrimitive _ <- V.toList $ IR.slots a |
@@ -40,19 +38,19 @@ schemaFromPipeline a = PipelineSchema (T.fromList sl) (foldl T.unionL T.empty ul | |||
40 | Just v -> v | 38 | Just v -> v |
41 | Nothing -> error "internal error (schemaFromPipeline)" | 39 | Nothing -> error "internal error (schemaFromPipeline)" |
42 | 40 | ||
43 | mkUniform :: [(ByteString,InputType)] -> IO (Trie InputSetter, Trie GLUniform) | 41 | mkUniform :: [(ByteString,InputType)] -> IO (Map ByteString InputSetter, Map ByteString GLUniform) |
44 | mkUniform l = do | 42 | mkUniform l = do |
45 | unisAndSetters <- forM l $ \(n,t) -> do | 43 | unisAndSetters <- forM l $ \(n,t) -> do |
46 | (uni, setter) <- mkUniformSetter t | 44 | (uni, setter) <- mkUniformSetter t |
47 | return ((n,uni),(n,setter)) | 45 | return ((n,uni),(n,setter)) |
48 | let (unis,setters) = unzip unisAndSetters | 46 | let (unis,setters) = unzip unisAndSetters |
49 | return (T.fromList setters, T.fromList unis) | 47 | return (Map.fromList setters, Map.fromList unis) |
50 | 48 | ||
51 | allocStorage :: PipelineSchema -> IO GLStorage | 49 | allocStorage :: PipelineSchema -> IO GLStorage |
52 | allocStorage sch = do | 50 | allocStorage sch = do |
53 | let sm = T.fromList $ zip (T.keys $ T.slots sch) [0..] | 51 | let sm = Map.fromList $ zip (Map.keys $ objectArrays sch) [0..] |
54 | len = T.size sm | 52 | len = Map.size sm |
55 | (setters,unis) <- mkUniform $ T.toList $ uniforms sch | 53 | (setters,unis) <- mkUniform $ Map.toList $ uniforms sch |
56 | seed <- newIORef 0 | 54 | seed <- newIORef 0 |
57 | slotV <- V.replicateM len $ newIORef (GLSlot IM.empty V.empty Ordered) | 55 | slotV <- V.replicateM len $ newIORef (GLSlot IM.empty V.empty Ordered) |
58 | size <- newIORef (0,0) | 56 | size <- newIORef (0,0) |
@@ -72,15 +70,15 @@ disposeStorage :: GLStorage -> IO () | |||
72 | disposeStorage = error "not implemented: disposeStorage" | 70 | disposeStorage = error "not implemented: disposeStorage" |
73 | 71 | ||
74 | -- object | 72 | -- object |
75 | addObject :: GLStorage -> ByteString -> Primitive -> Maybe (IndexStream Buffer) -> Trie (Stream Buffer) -> [ByteString] -> IO Object | 73 | addObject :: GLStorage -> ByteString -> Primitive -> Maybe (IndexStream Buffer) -> Map ByteString (Stream Buffer) -> [ByteString] -> IO Object |
76 | addObject input slotName prim indices attribs uniformNames = do | 74 | addObject input slotName prim indices attribs uniformNames = do |
77 | let sch = schema input | 75 | let sch = schema input |
78 | forM_ uniformNames $ \n -> case T.lookup n (uniforms sch) of | 76 | forM_ uniformNames $ \n -> case Map.lookup n (uniforms sch) of |
79 | Nothing -> throw $ userError $ "Unknown uniform: " ++ show n | 77 | Nothing -> throw $ userError $ "Unknown uniform: " ++ show n |
80 | _ -> return () | 78 | _ -> return () |
81 | case T.lookup slotName (T.slots sch) of | 79 | case Map.lookup slotName (objectArrays sch) of |
82 | Nothing -> throw $ userError $ "Unknown slot: " ++ show slotName | 80 | Nothing -> throw $ userError $ "Unknown slot: " ++ show slotName |
83 | Just (SlotSchema sPrim sAttrs) -> do | 81 | Just (ObjectArraySchema sPrim sAttrs) -> do |
84 | when (sPrim /= (primitiveToFetchPrimitive prim)) $ throw $ userError $ | 82 | when (sPrim /= (primitiveToFetchPrimitive prim)) $ throw $ userError $ |
85 | "Primitive mismatch for slot (" ++ show slotName ++ ") expected " ++ show sPrim ++ " but got " ++ show prim | 83 | "Primitive mismatch for slot (" ++ show slotName ++ ") expected " ++ show sPrim ++ " but got " ++ show prim |
86 | let sType = fmap streamToStreamType attribs | 84 | let sType = fmap streamToStreamType attribs |
@@ -91,7 +89,7 @@ addObject input slotName prim indices attribs uniformNames = do | |||
91 | , show sType | 89 | , show sType |
92 | ] | 90 | ] |
93 | 91 | ||
94 | let slotIdx = case slotName `T.lookup` slotMap input of | 92 | let slotIdx = case slotName `Map.lookup` slotMap input of |
95 | Nothing -> error $ "internal error (slot index): " ++ show slotName | 93 | Nothing -> error $ "internal error (slot index): " ++ show slotName |
96 | Just i -> i | 94 | Just i -> i |
97 | seed = objSeed input | 95 | seed = objSeed input |
@@ -99,7 +97,7 @@ addObject input slotName prim indices attribs uniformNames = do | |||
99 | enabled <- newIORef True | 97 | enabled <- newIORef True |
100 | index <- readIORef seed | 98 | index <- readIORef seed |
101 | modifyIORef seed (1+) | 99 | modifyIORef seed (1+) |
102 | (setters,unis) <- mkUniform [(n,t) | n <- uniformNames, let Just t = T.lookup n (uniforms sch)] | 100 | (setters,unis) <- mkUniform [(n,t) | n <- uniformNames, let Just t = Map.lookup n (uniforms sch)] |
103 | cmdsRef <- newIORef (V.singleton V.empty) | 101 | cmdsRef <- newIORef (V.singleton V.empty) |
104 | let obj = Object | 102 | let obj = Object |
105 | { objSlot = slotIdx | 103 | { objSlot = slotIdx |
@@ -151,7 +149,7 @@ setObjectOrder p obj i = do | |||
151 | writeIORef (objOrder obj) i | 149 | writeIORef (objOrder obj) i |
152 | modifyIORef (slotVector p ! objSlot obj) $ \(GLSlot objs sorted _) -> GLSlot objs sorted Reorder | 150 | modifyIORef (slotVector p ! objSlot obj) $ \(GLSlot objs sorted _) -> GLSlot objs sorted Reorder |
153 | 151 | ||
154 | objectUniformSetter :: Object -> Trie InputSetter | 152 | objectUniformSetter :: Object -> Map ByteString InputSetter |
155 | objectUniformSetter = objUniSetter | 153 | objectUniformSetter = objUniSetter |
156 | 154 | ||
157 | setScreenSize :: GLStorage -> Word -> Word -> IO () | 155 | setScreenSize :: GLStorage -> Word -> Word -> IO () |
@@ -179,7 +177,7 @@ sortSlotObjects p = V.forM_ (slotVector p) $ \slotRef -> do | |||
179 | return (ord,obj) | 177 | return (ord,obj) |
180 | doSort objs | 178 | doSort objs |
181 | 179 | ||
182 | createObjectCommands :: Trie (IORef GLint) -> Trie GLUniform -> Object -> GLProgram -> [GLObjectCommand] | 180 | createObjectCommands :: Map ByteString (IORef GLint) -> Map ByteString GLUniform -> Object -> GLProgram -> [GLObjectCommand] |
183 | createObjectCommands texUnitMap topUnis obj prg = objUniCmds ++ objStreamCmds ++ [objDrawCmd] | 181 | createObjectCommands texUnitMap topUnis obj prg = objUniCmds ++ objStreamCmds ++ [objDrawCmd] |
184 | where | 182 | where |
185 | -- object draw command | 183 | -- object draw command |
@@ -193,26 +191,26 @@ createObjectCommands texUnitMap topUnis obj prg = objUniCmds ++ objStreamCmds ++ | |||
193 | where | 191 | where |
194 | objAttrs = objAttributes obj | 192 | objAttrs = objAttributes obj |
195 | prim = primitiveToGLType $ objPrimitive obj | 193 | prim = primitiveToGLType $ objPrimitive obj |
196 | count = head [c | Stream _ _ _ _ c <- T.elems objAttrs] | 194 | count = head [c | Stream _ _ _ _ c <- Map.elems objAttrs] |
197 | 195 | ||
198 | -- object uniform commands | 196 | -- object uniform commands |
199 | -- texture slot setup commands | 197 | -- texture slot setup commands |
200 | objUniCmds = uniCmds ++ texCmds | 198 | objUniCmds = uniCmds ++ texCmds |
201 | where | 199 | where |
202 | uniCmds = [GLSetUniform i u | (n,i) <- uniMap, let u = T.lookupWithDefault (topUni n) n objUnis] | 200 | uniCmds = [GLSetUniform i u | (n,i) <- uniMap, let u = Map.findWithDefault (topUni n) n objUnis] |
203 | uniMap = T.toList $ inputUniforms prg | 201 | uniMap = Map.toList $ inputUniforms prg |
204 | topUni n = T.lookupWithDefault (error $ "internal error (createObjectCommands): " ++ show n) n topUnis | 202 | topUni n = Map.findWithDefault (error $ "internal error (createObjectCommands): " ++ show n) n topUnis |
205 | objUnis = objUniSetup obj | 203 | objUnis = objUniSetup obj |
206 | texUnis = S.toList $ inputTextureUniforms prg | 204 | texUnis = S.toList $ inputTextureUniforms prg |
207 | texCmds = [ GLBindTexture (inputTypeToTextureTarget $ uniInputType u) texUnit u | 205 | texCmds = [ GLBindTexture (inputTypeToTextureTarget $ uniInputType u) texUnit u |
208 | | n <- texUnis | 206 | | n <- texUnis |
209 | , let u = T.lookupWithDefault (topUni n) n objUnis | 207 | , let u = Map.findWithDefault (topUni n) n objUnis |
210 | , let texUnit = T.lookupWithDefault (error $ "internal error (createObjectCommands - Texture Unit): " ++ show n) n texUnitMap | 208 | , let texUnit = Map.findWithDefault (error $ "internal error (createObjectCommands - Texture Unit): " ++ show n) n texUnitMap |
211 | ] | 209 | ] |
212 | uniInputType (GLUniform ty _) = ty | 210 | uniInputType (GLUniform ty _) = ty |
213 | 211 | ||
214 | -- object attribute stream commands | 212 | -- object attribute stream commands |
215 | objStreamCmds = [attrCmd i s | (i,name) <- T.elems attrMap, let Just s = T.lookup name objAttrs] | 213 | objStreamCmds = [attrCmd i s | (i,name) <- Map.elems attrMap, let Just s = Map.lookup name objAttrs] |
216 | where | 214 | where |
217 | attrMap = inputStreams prg | 215 | attrMap = inputStreams prg |
218 | objAttrs = objAttributes obj | 216 | objAttrs = objAttributes obj |
@@ -253,138 +251,138 @@ nullSetter :: ByteString -> String -> a -> IO () | |||
253 | --nullSetter n t _ = return () -- Prelude.putStrLn $ "WARNING: unknown uniform: " ++ SB.unpack n ++ " :: " ++ t | 251 | --nullSetter n t _ = return () -- Prelude.putStrLn $ "WARNING: unknown uniform: " ++ SB.unpack n ++ " :: " ++ t |
254 | nullSetter n t _ = Prelude.putStrLn $ "WARNING: unknown uniform: " ++ SB.unpack n ++ " :: " ++ t | 252 | nullSetter n t _ = Prelude.putStrLn $ "WARNING: unknown uniform: " ++ SB.unpack n ++ " :: " ++ t |
255 | 253 | ||
256 | uniformBool :: ByteString -> Trie InputSetter -> SetterFun Bool | 254 | uniformBool :: ByteString -> Map ByteString InputSetter -> SetterFun Bool |
257 | uniformV2B :: ByteString -> Trie InputSetter -> SetterFun V2B | 255 | uniformV2B :: ByteString -> Map ByteString InputSetter -> SetterFun V2B |
258 | uniformV3B :: ByteString -> Trie InputSetter -> SetterFun V3B | 256 | uniformV3B :: ByteString -> Map ByteString InputSetter -> SetterFun V3B |
259 | uniformV4B :: ByteString -> Trie InputSetter -> SetterFun V4B | 257 | uniformV4B :: ByteString -> Map ByteString InputSetter -> SetterFun V4B |
260 | 258 | ||
261 | uniformWord :: ByteString -> Trie InputSetter -> SetterFun Word32 | 259 | uniformWord :: ByteString -> Map ByteString InputSetter -> SetterFun Word32 |
262 | uniformV2U :: ByteString -> Trie InputSetter -> SetterFun V2U | 260 | uniformV2U :: ByteString -> Map ByteString InputSetter -> SetterFun V2U |
263 | uniformV3U :: ByteString -> Trie InputSetter -> SetterFun V3U | 261 | uniformV3U :: ByteString -> Map ByteString InputSetter -> SetterFun V3U |
264 | uniformV4U :: ByteString -> Trie InputSetter -> SetterFun V4U | 262 | uniformV4U :: ByteString -> Map ByteString InputSetter -> SetterFun V4U |
265 | 263 | ||
266 | uniformInt :: ByteString -> Trie InputSetter -> SetterFun Int32 | 264 | uniformInt :: ByteString -> Map ByteString InputSetter -> SetterFun Int32 |
267 | uniformV2I :: ByteString -> Trie InputSetter -> SetterFun V2I | 265 | uniformV2I :: ByteString -> Map ByteString InputSetter -> SetterFun V2I |
268 | uniformV3I :: ByteString -> Trie InputSetter -> SetterFun V3I | 266 | uniformV3I :: ByteString -> Map ByteString InputSetter -> SetterFun V3I |
269 | uniformV4I :: ByteString -> Trie InputSetter -> SetterFun V4I | 267 | uniformV4I :: ByteString -> Map ByteString InputSetter -> SetterFun V4I |
270 | 268 | ||
271 | uniformFloat :: ByteString -> Trie InputSetter -> SetterFun Float | 269 | uniformFloat :: ByteString -> Map ByteString InputSetter -> SetterFun Float |
272 | uniformV2F :: ByteString -> Trie InputSetter -> SetterFun V2F | 270 | uniformV2F :: ByteString -> Map ByteString InputSetter -> SetterFun V2F |
273 | uniformV3F :: ByteString -> Trie InputSetter -> SetterFun V3F | 271 | uniformV3F :: ByteString -> Map ByteString InputSetter -> SetterFun V3F |
274 | uniformV4F :: ByteString -> Trie InputSetter -> SetterFun V4F | 272 | uniformV4F :: ByteString -> Map ByteString InputSetter -> SetterFun V4F |
275 | 273 | ||
276 | uniformM22F :: ByteString -> Trie InputSetter -> SetterFun M22F | 274 | uniformM22F :: ByteString -> Map ByteString InputSetter -> SetterFun M22F |
277 | uniformM23F :: ByteString -> Trie InputSetter -> SetterFun M23F | 275 | uniformM23F :: ByteString -> Map ByteString InputSetter -> SetterFun M23F |
278 | uniformM24F :: ByteString -> Trie InputSetter -> SetterFun M24F | 276 | uniformM24F :: ByteString -> Map ByteString InputSetter -> SetterFun M24F |
279 | uniformM32F :: ByteString -> Trie InputSetter -> SetterFun M32F | 277 | uniformM32F :: ByteString -> Map ByteString InputSetter -> SetterFun M32F |
280 | uniformM33F :: ByteString -> Trie InputSetter -> SetterFun M33F | 278 | uniformM33F :: ByteString -> Map ByteString InputSetter -> SetterFun M33F |
281 | uniformM34F :: ByteString -> Trie InputSetter -> SetterFun M34F | 279 | uniformM34F :: ByteString -> Map ByteString InputSetter -> SetterFun M34F |
282 | uniformM42F :: ByteString -> Trie InputSetter -> SetterFun M42F | 280 | uniformM42F :: ByteString -> Map ByteString InputSetter -> SetterFun M42F |
283 | uniformM43F :: ByteString -> Trie InputSetter -> SetterFun M43F | 281 | uniformM43F :: ByteString -> Map ByteString InputSetter -> SetterFun M43F |
284 | uniformM44F :: ByteString -> Trie InputSetter -> SetterFun M44F | 282 | uniformM44F :: ByteString -> Map ByteString InputSetter -> SetterFun M44F |
285 | 283 | ||
286 | uniformFTexture2D :: ByteString -> Trie InputSetter -> SetterFun TextureData | 284 | uniformFTexture2D :: ByteString -> Map ByteString InputSetter -> SetterFun TextureData |
287 | 285 | ||
288 | uniformBool n is = case T.lookup n is of | 286 | uniformBool n is = case Map.lookup n is of |
289 | Just (SBool fun) -> fun | 287 | Just (SBool fun) -> fun |
290 | _ -> nullSetter n "Bool" | 288 | _ -> nullSetter n "Bool" |
291 | 289 | ||
292 | uniformV2B n is = case T.lookup n is of | 290 | uniformV2B n is = case Map.lookup n is of |
293 | Just (SV2B fun) -> fun | 291 | Just (SV2B fun) -> fun |
294 | _ -> nullSetter n "V2B" | 292 | _ -> nullSetter n "V2B" |
295 | 293 | ||
296 | uniformV3B n is = case T.lookup n is of | 294 | uniformV3B n is = case Map.lookup n is of |
297 | Just (SV3B fun) -> fun | 295 | Just (SV3B fun) -> fun |
298 | _ -> nullSetter n "V3B" | 296 | _ -> nullSetter n "V3B" |
299 | 297 | ||
300 | uniformV4B n is = case T.lookup n is of | 298 | uniformV4B n is = case Map.lookup n is of |
301 | Just (SV4B fun) -> fun | 299 | Just (SV4B fun) -> fun |
302 | _ -> nullSetter n "V4B" | 300 | _ -> nullSetter n "V4B" |
303 | 301 | ||
304 | uniformWord n is = case T.lookup n is of | 302 | uniformWord n is = case Map.lookup n is of |
305 | Just (SWord fun) -> fun | 303 | Just (SWord fun) -> fun |
306 | _ -> nullSetter n "Word" | 304 | _ -> nullSetter n "Word" |
307 | 305 | ||
308 | uniformV2U n is = case T.lookup n is of | 306 | uniformV2U n is = case Map.lookup n is of |
309 | Just (SV2U fun) -> fun | 307 | Just (SV2U fun) -> fun |
310 | _ -> nullSetter n "V2U" | 308 | _ -> nullSetter n "V2U" |
311 | 309 | ||
312 | uniformV3U n is = case T.lookup n is of | 310 | uniformV3U n is = case Map.lookup n is of |
313 | Just (SV3U fun) -> fun | 311 | Just (SV3U fun) -> fun |
314 | _ -> nullSetter n "V3U" | 312 | _ -> nullSetter n "V3U" |
315 | 313 | ||
316 | uniformV4U n is = case T.lookup n is of | 314 | uniformV4U n is = case Map.lookup n is of |
317 | Just (SV4U fun) -> fun | 315 | Just (SV4U fun) -> fun |
318 | _ -> nullSetter n "V4U" | 316 | _ -> nullSetter n "V4U" |
319 | 317 | ||
320 | uniformInt n is = case T.lookup n is of | 318 | uniformInt n is = case Map.lookup n is of |
321 | Just (SInt fun) -> fun | 319 | Just (SInt fun) -> fun |
322 | _ -> nullSetter n "Int" | 320 | _ -> nullSetter n "Int" |
323 | 321 | ||
324 | uniformV2I n is = case T.lookup n is of | 322 | uniformV2I n is = case Map.lookup n is of |
325 | Just (SV2I fun) -> fun | 323 | Just (SV2I fun) -> fun |
326 | _ -> nullSetter n "V2I" | 324 | _ -> nullSetter n "V2I" |
327 | 325 | ||
328 | uniformV3I n is = case T.lookup n is of | 326 | uniformV3I n is = case Map.lookup n is of |
329 | Just (SV3I fun) -> fun | 327 | Just (SV3I fun) -> fun |
330 | _ -> nullSetter n "V3I" | 328 | _ -> nullSetter n "V3I" |
331 | 329 | ||
332 | uniformV4I n is = case T.lookup n is of | 330 | uniformV4I n is = case Map.lookup n is of |
333 | Just (SV4I fun) -> fun | 331 | Just (SV4I fun) -> fun |
334 | _ -> nullSetter n "V4I" | 332 | _ -> nullSetter n "V4I" |
335 | 333 | ||
336 | uniformFloat n is = case T.lookup n is of | 334 | uniformFloat n is = case Map.lookup n is of |
337 | Just (SFloat fun) -> fun | 335 | Just (SFloat fun) -> fun |
338 | _ -> nullSetter n "Float" | 336 | _ -> nullSetter n "Float" |
339 | 337 | ||
340 | uniformV2F n is = case T.lookup n is of | 338 | uniformV2F n is = case Map.lookup n is of |
341 | Just (SV2F fun) -> fun | 339 | Just (SV2F fun) -> fun |
342 | _ -> nullSetter n "V2F" | 340 | _ -> nullSetter n "V2F" |
343 | 341 | ||
344 | uniformV3F n is = case T.lookup n is of | 342 | uniformV3F n is = case Map.lookup n is of |
345 | Just (SV3F fun) -> fun | 343 | Just (SV3F fun) -> fun |
346 | _ -> nullSetter n "V3F" | 344 | _ -> nullSetter n "V3F" |
347 | 345 | ||
348 | uniformV4F n is = case T.lookup n is of | 346 | uniformV4F n is = case Map.lookup n is of |
349 | Just (SV4F fun) -> fun | 347 | Just (SV4F fun) -> fun |
350 | _ -> nullSetter n "V4F" | 348 | _ -> nullSetter n "V4F" |
351 | 349 | ||
352 | uniformM22F n is = case T.lookup n is of | 350 | uniformM22F n is = case Map.lookup n is of |
353 | Just (SM22F fun) -> fun | 351 | Just (SM22F fun) -> fun |
354 | _ -> nullSetter n "M22F" | 352 | _ -> nullSetter n "M22F" |
355 | 353 | ||
356 | uniformM23F n is = case T.lookup n is of | 354 | uniformM23F n is = case Map.lookup n is of |
357 | Just (SM23F fun) -> fun | 355 | Just (SM23F fun) -> fun |
358 | _ -> nullSetter n "M23F" | 356 | _ -> nullSetter n "M23F" |
359 | 357 | ||
360 | uniformM24F n is = case T.lookup n is of | 358 | uniformM24F n is = case Map.lookup n is of |
361 | Just (SM24F fun) -> fun | 359 | Just (SM24F fun) -> fun |
362 | _ -> nullSetter n "M24F" | 360 | _ -> nullSetter n "M24F" |
363 | 361 | ||
364 | uniformM32F n is = case T.lookup n is of | 362 | uniformM32F n is = case Map.lookup n is of |
365 | Just (SM32F fun) -> fun | 363 | Just (SM32F fun) -> fun |
366 | _ -> nullSetter n "M32F" | 364 | _ -> nullSetter n "M32F" |
367 | 365 | ||
368 | uniformM33F n is = case T.lookup n is of | 366 | uniformM33F n is = case Map.lookup n is of |
369 | Just (SM33F fun) -> fun | 367 | Just (SM33F fun) -> fun |
370 | _ -> nullSetter n "M33F" | 368 | _ -> nullSetter n "M33F" |
371 | 369 | ||
372 | uniformM34F n is = case T.lookup n is of | 370 | uniformM34F n is = case Map.lookup n is of |
373 | Just (SM34F fun) -> fun | 371 | Just (SM34F fun) -> fun |
374 | _ -> nullSetter n "M34F" | 372 | _ -> nullSetter n "M34F" |
375 | 373 | ||
376 | uniformM42F n is = case T.lookup n is of | 374 | uniformM42F n is = case Map.lookup n is of |
377 | Just (SM42F fun) -> fun | 375 | Just (SM42F fun) -> fun |
378 | _ -> nullSetter n "M42F" | 376 | _ -> nullSetter n "M42F" |
379 | 377 | ||
380 | uniformM43F n is = case T.lookup n is of | 378 | uniformM43F n is = case Map.lookup n is of |
381 | Just (SM43F fun) -> fun | 379 | Just (SM43F fun) -> fun |
382 | _ -> nullSetter n "M43F" | 380 | _ -> nullSetter n "M43F" |
383 | 381 | ||
384 | uniformM44F n is = case T.lookup n is of | 382 | uniformM44F n is = case Map.lookup n is of |
385 | Just (SM44F fun) -> fun | 383 | Just (SM44F fun) -> fun |
386 | _ -> nullSetter n "M44F" | 384 | _ -> nullSetter n "M44F" |
387 | 385 | ||
388 | uniformFTexture2D n is = case T.lookup n is of | 386 | uniformFTexture2D n is = case Map.lookup n is of |
389 | Just (SFTexture2D fun) -> fun | 387 | Just (SFTexture2D fun) -> fun |
390 | _ -> nullSetter n "FTexture2D" | 388 | _ -> nullSetter n "FTexture2D" |