summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCsaba Hruska <csaba.hruska@gmail.com>2016-05-09 01:13:26 +0200
committerCsaba Hruska <csaba.hruska@gmail.com>2016-05-09 01:13:26 +0200
commit7742955288fd71d93a8c6a4743be50ae95b59274 (patch)
tree8b5ce438c75eec844e012709ef03066e4f9c6e24
parent159fdbcbdb8fa14f6e0577fa339fc7d22a6e50ce (diff)
hacky workaround to support optimising drivers
-rw-r--r--src/LambdaCube/GL/Backend.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/LambdaCube/GL/Backend.hs b/src/LambdaCube/GL/Backend.hs
index f14d105..37b38c0 100644
--- a/src/LambdaCube/GL/Backend.hs
+++ b/src/LambdaCube/GL/Backend.hs
@@ -249,6 +249,7 @@ compileProgram p = do
249 texUnis = [n | (n,_) <- inTextures, Map.member n (programUniforms p)] 249 texUnis = [n | (n,_) <- inTextures, Map.member n (programUniforms p)]
250 let prgInTextures = Map.keys inTextureNames 250 let prgInTextures = Map.keys inTextureNames
251 uniInTextures = map fst inTextures 251 uniInTextures = map fst inTextures
252 {-
252 unless (S.fromList prgInTextures == S.fromList uniInTextures) $ fail $ unlines 253 unless (S.fromList prgInTextures == S.fromList uniInTextures) $ fail $ unlines
253 [ "shader program uniform texture input mismatch!" 254 [ "shader program uniform texture input mismatch!"
254 , "expected: " ++ show prgInTextures 255 , "expected: " ++ show prgInTextures
@@ -260,6 +261,7 @@ compileProgram p = do
260 , "fragment shader:" 261 , "fragment shader:"
261 , fragmentShader p 262 , fragmentShader p
262 ] 263 ]
264 -}
263 --putStrLn $ "uniTrie: " ++ show (Map.keys uniTrie) 265 --putStrLn $ "uniTrie: " ++ show (Map.keys uniTrie)
264 --putStrLn $ "inUniNames: " ++ show inUniNames 266 --putStrLn $ "inUniNames: " ++ show inUniNames
265 --putStrLn $ "inUniforms: " ++ show inUniforms 267 --putStrLn $ "inUniforms: " ++ show inUniforms
@@ -788,7 +790,7 @@ compileCommand texUnitMap samplers textures targets programs cmd = case cmd of
788 SetSamplerUniform n tu -> do 790 SetSamplerUniform n tu -> do
789 p <- currentProgram <$> get 791 p <- currentProgram <$> get
790 case Map.lookup n (inputTextures $ programs ! p) of 792 case Map.lookup n (inputTextures $ programs ! p) of
791 Nothing -> fail $ "internal error (SetSamplerUniform)! - " ++ show cmd 793 Nothing -> return (GLSetProgram (programObject $ programs ! p) {-HACK!!! we have to emit something-}) -- TODO: some drivers does heavy cross stage (vertex/fragment) dead code elimination; fail $ "internal error (SetSamplerUniform)! - " ++ show cmd
792 Just i -> case Map.lookup n texUnitMap of 794 Just i -> case Map.lookup n texUnitMap of
793 Nothing -> fail $ "internal error (SetSamplerUniform - IORef)! - " ++ show cmd 795 Nothing -> fail $ "internal error (SetSamplerUniform - IORef)! - " ++ show cmd
794 Just r -> return $ GLSetSamplerUniform i (fromIntegral tu) r 796 Just r -> return $ GLSetSamplerUniform i (fromIntegral tu) r