diff options
Diffstat (limited to 'src/LambdaCube/GL/Backend.hs')
-rw-r--r-- | src/LambdaCube/GL/Backend.hs | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/src/LambdaCube/GL/Backend.hs b/src/LambdaCube/GL/Backend.hs index 7c2c3fb..29acbb8 100644 --- a/src/LambdaCube/GL/Backend.hs +++ b/src/LambdaCube/GL/Backend.hs | |||
@@ -759,13 +759,11 @@ data CGState | |||
759 | = CGState | 759 | = CGState |
760 | { currentProgram :: ProgramName | 760 | { currentProgram :: ProgramName |
761 | , textureBinding :: IntMap GLTexture | 761 | , textureBinding :: IntMap GLTexture |
762 | , samplerUniforms :: Map UniformName TextureUnit | ||
763 | } | 762 | } |
764 | 763 | ||
765 | initCGState = CGState | 764 | initCGState = CGState |
766 | { currentProgram = error "CGState: empty currentProgram" | 765 | { currentProgram = error "CGState: empty currentProgram" |
767 | , textureBinding = IM.empty | 766 | , textureBinding = IM.empty |
768 | , samplerUniforms = mempty | ||
769 | } | 767 | } |
770 | 768 | ||
771 | type CG a = State CGState a | 769 | type CG a = State CGState a |
@@ -779,7 +777,6 @@ compileCommand texUnitMap samplers textures targets programs cmd = case cmd of | |||
779 | modify (\s -> s {currentProgram = p}) | 777 | modify (\s -> s {currentProgram = p}) |
780 | return $ GLSetProgram $ programObject $ programs ! p | 778 | return $ GLSetProgram $ programObject $ programs ! p |
781 | SetSamplerUniform n tu -> do | 779 | SetSamplerUniform n tu -> do |
782 | modify (\s@CGState{..} -> s {samplerUniforms = Map.insert n tu samplerUniforms}) | ||
783 | p <- currentProgram <$> get | 780 | p <- currentProgram <$> get |
784 | case Map.lookup n (inputTextures $ programs ! p) of | 781 | case Map.lookup n (inputTextures $ programs ! p) of |
785 | Nothing -> fail $ "internal error (SetSamplerUniform)! - " ++ show cmd | 782 | Nothing -> fail $ "internal error (SetSamplerUniform)! - " ++ show cmd |
@@ -792,7 +789,6 @@ compileCommand texUnitMap samplers textures targets programs cmd = case cmd of | |||
792 | return $ GLSetTexture (GL_TEXTURE0 + fromIntegral tu) (glTextureTarget tex) (glTextureObject tex) | 789 | return $ GLSetTexture (GL_TEXTURE0 + fromIntegral tu) (glTextureTarget tex) (glTextureObject tex) |
793 | SetSampler tu s -> return $ GLSetSampler (GL_TEXTURE0 + fromIntegral tu) (maybe 0 (glSamplerObject . (samplers !)) s) | 790 | SetSampler tu s -> return $ GLSetSampler (GL_TEXTURE0 + fromIntegral tu) (maybe 0 (glSamplerObject . (samplers !)) s) |
794 | RenderSlot slot -> do | 791 | RenderSlot slot -> do |
795 | smpUnis <- samplerUniforms <$> get | ||
796 | p <- currentProgram <$> get | 792 | p <- currentProgram <$> get |
797 | return $ GLRenderSlot slot p | 793 | return $ GLRenderSlot slot p |
798 | RenderStream stream -> do | 794 | RenderStream stream -> do |