From b13702e457d79f79831f8e852edd89a6abf28d81 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Thu, 30 May 2019 04:38:01 -0400 Subject: More TypeTag machinery. --- src/LambdaCube/GL/Input/Type.hs | 22 ++++++++++++++++++++++ src/LambdaCube/GL/Type.hs | 6 +++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/LambdaCube/GL/Input/Type.hs b/src/LambdaCube/GL/Input/Type.hs index eaadce5..5afe5af 100644 --- a/src/LambdaCube/GL/Input/Type.hs +++ b/src/LambdaCube/GL/Input/Type.hs @@ -525,3 +525,25 @@ glABI TypeM44F = IsGLMatrix GLPrimFloat withTypes :: p (a::k) -> q (b::k) -> f a b -> f a b withTypes _ _ x = x +class TypeTaggable c where typeTag :: t c -> TypeTag c +instance TypeTaggable (GLVector 1 Word32) where typeTag _ = TypeWord +instance TypeTaggable (GLVector 2 Word32) where typeTag _ = TypeV2U +instance TypeTaggable (GLVector 3 Word32) where typeTag _ = TypeV3U +instance TypeTaggable (GLVector 4 Word32) where typeTag _ = TypeV4U +instance TypeTaggable (GLVector 1 Int32) where typeTag _ = TypeInt +instance TypeTaggable (GLVector 2 Int32) where typeTag _ = TypeV2I +instance TypeTaggable (GLVector 3 Int32) where typeTag _ = TypeV3I +instance TypeTaggable (GLVector 4 Int32) where typeTag _ = TypeV4I +instance TypeTaggable (GLVector 1 Float) where typeTag _ = TypeFloat +instance TypeTaggable (GLVector 2 Float) where typeTag _ = TypeV2F +instance TypeTaggable (GLVector 3 Float) where typeTag _ = TypeV3F +instance TypeTaggable (GLVector 4 Float) where typeTag _ = TypeV4F +instance TypeTaggable (GLMatrix 2 2 Float) where typeTag _ = TypeM22F +instance TypeTaggable (GLMatrix 3 2 Float) where typeTag _ = TypeM23F +instance TypeTaggable (GLMatrix 4 2 Float) where typeTag _ = TypeM24F +instance TypeTaggable (GLMatrix 2 3 Float) where typeTag _ = TypeM32F +instance TypeTaggable (GLMatrix 3 3 Float) where typeTag _ = TypeM33F +instance TypeTaggable (GLMatrix 4 3 Float) where typeTag _ = TypeM34F +instance TypeTaggable (GLMatrix 2 4 Float) where typeTag _ = TypeM42F +instance TypeTaggable (GLMatrix 3 4 Float) where typeTag _ = TypeM43F +instance TypeTaggable (GLMatrix 4 4 Float) where typeTag _ = TypeM44F diff --git a/src/LambdaCube/GL/Type.hs b/src/LambdaCube/GL/Type.hs index 57f7df0..9069f37 100644 --- a/src/LambdaCube/GL/Type.hs +++ b/src/LambdaCube/GL/Type.hs @@ -140,10 +140,10 @@ data GLProgram = GLProgram { shaderObjects :: [GLuint] , programObject :: GLuint - , inputUniforms :: Map String GLint + , inputUniforms :: Map String GLint -- foreach: GLSetUniform , inputTextures :: Map String GLint -- all input textures (render texture + uniform texture) - , inputTextureUniforms :: Set String - , inputStreams :: Map String (GLuint,String) + , inputTextureUniforms :: Set String -- foreach: GLBindTexture + , inputStreams :: Map String (GLuint,String) -- foreach: GLSetVertexAttrib*Array } data GLTexture -- cgit v1.2.3