summaryrefslogtreecommitdiff
path: root/src/LambdaCube/GL/Type.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/LambdaCube/GL/Type.hs')
-rw-r--r--src/LambdaCube/GL/Type.hs47
1 files changed, 3 insertions, 44 deletions
diff --git a/src/LambdaCube/GL/Type.hs b/src/LambdaCube/GL/Type.hs
index 8f4bdd7..376fdf1 100644
--- a/src/LambdaCube/GL/Type.hs
+++ b/src/LambdaCube/GL/Type.hs
@@ -14,8 +14,9 @@ import Data.ByteString
14 14
15import Graphics.GL.Core33 15import Graphics.GL.Core33
16 16
17import Linear 17import LambdaCube.Linear
18import IR 18import LambdaCube.IR
19import LambdaCube.PipelineSchema
19 20
20type GLUniformName = ByteString 21type GLUniformName = ByteString
21 22
@@ -66,21 +67,6 @@ data ArrayDesc
66 - independent from pipeline 67 - independent from pipeline
67 - per object features: enable/disable visibility, set render ordering 68 - per object features: enable/disable visibility, set render ordering
68-} 69-}
69
70data ObjectArraySchema
71 = ObjectArraySchema
72 { primitive :: FetchPrimitive
73 , attributes :: Map String StreamType
74 }
75 deriving Show
76
77data PipelineSchema
78 = PipelineSchema
79 { objectArrays :: Map String ObjectArraySchema
80 , uniforms :: Map String InputType
81 }
82 deriving Show
83
84data GLUniform = forall a. Storable a => GLUniform !InputType !(IORef a) 70data GLUniform = forall a. Storable a => GLUniform !InputType !(IORef a)
85 71
86instance Show GLUniform where 72instance Show GLUniform where
@@ -322,33 +308,6 @@ sizeOfArrayType ArrHalf = 2
322data Array -- array type, element count (NOT byte size!), setter 308data Array -- array type, element count (NOT byte size!), setter
323 = Array ArrayType Int BufferSetter 309 = Array ArrayType Int BufferSetter
324 310
325-- dev hint: this should be InputType
326-- we restrict StreamType using type class
327-- subset of InputType, describes a stream type (in GPU side)
328data StreamType
329 = Attribute_Word
330 | Attribute_V2U
331 | Attribute_V3U
332 | Attribute_V4U
333 | Attribute_Int
334 | Attribute_V2I
335 | Attribute_V3I
336 | Attribute_V4I
337 | Attribute_Float
338 | Attribute_V2F
339 | Attribute_V3F
340 | Attribute_V4F
341 | Attribute_M22F
342 | Attribute_M23F
343 | Attribute_M24F
344 | Attribute_M32F
345 | Attribute_M33F
346 | Attribute_M34F
347 | Attribute_M42F
348 | Attribute_M43F
349 | Attribute_M44F
350 deriving (Show,Eq,Ord)
351
352toStreamType :: InputType -> Maybe StreamType 311toStreamType :: InputType -> Maybe StreamType
353toStreamType Word = Just Attribute_Word 312toStreamType Word = Just Attribute_Word
354toStreamType V2U = Just Attribute_V2U 313toStreamType V2U = Just Attribute_V2U