summaryrefslogtreecommitdiff
path: root/ddl/out/LambdaCube.PipelineSchema.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ddl/out/LambdaCube.PipelineSchema.hs')
-rw-r--r--ddl/out/LambdaCube.PipelineSchema.hs153
1 files changed, 153 insertions, 0 deletions
diff --git a/ddl/out/LambdaCube.PipelineSchema.hs b/ddl/out/LambdaCube.PipelineSchema.hs
new file mode 100644
index 0000000..c319967
--- /dev/null
+++ b/ddl/out/LambdaCube.PipelineSchema.hs
@@ -0,0 +1,153 @@
1-- generated file, do not modify!
2-- 2016-01-28T13:15:31.196716Z
3
4{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
5module LambdaCube.PipelineSchema where
6
7import Data.Int
8import Data.Word
9import Data.Map
10import Data.Vector (Vector(..))
11import LambdaCube.Linear
12
13import Data.Text
14import Data.Aeson hiding (Value,Bool)
15import Data.Aeson.Types hiding (Value,Bool)
16import Control.Monad
17
18import LambdaCube.IR
19
20data StreamType
21 = Attribute_Word
22 | Attribute_V2U
23 | Attribute_V3U
24 | Attribute_V4U
25 | Attribute_Int
26 | Attribute_V2I
27 | Attribute_V3I
28 | Attribute_V4I
29 | Attribute_Float
30 | Attribute_V2F
31 | Attribute_V3F
32 | Attribute_V4F
33 | Attribute_M22F
34 | Attribute_M23F
35 | Attribute_M24F
36 | Attribute_M32F
37 | Attribute_M33F
38 | Attribute_M34F
39 | Attribute_M42F
40 | Attribute_M43F
41 | Attribute_M44F
42 deriving (Show, Eq, Ord)
43
44data ObjectArraySchema
45 = ObjectArraySchema
46 { primitive :: FetchPrimitive
47 , attributes :: Map String StreamType
48 }
49
50 deriving (Show, Eq, Ord)
51
52data PipelineSchema
53 = PipelineSchema
54 { objectArrays :: Map String ObjectArraySchema
55 , uniforms :: Map String InputType
56 }
57
58 deriving (Show, Eq, Ord)
59
60
61instance ToJSON StreamType where
62 toJSON v = case v of
63 Attribute_Word -> object [ "tag" .= ("Attribute_Word" :: Text)]
64 Attribute_V2U -> object [ "tag" .= ("Attribute_V2U" :: Text)]
65 Attribute_V3U -> object [ "tag" .= ("Attribute_V3U" :: Text)]
66 Attribute_V4U -> object [ "tag" .= ("Attribute_V4U" :: Text)]
67 Attribute_Int -> object [ "tag" .= ("Attribute_Int" :: Text)]
68 Attribute_V2I -> object [ "tag" .= ("Attribute_V2I" :: Text)]
69 Attribute_V3I -> object [ "tag" .= ("Attribute_V3I" :: Text)]
70 Attribute_V4I -> object [ "tag" .= ("Attribute_V4I" :: Text)]
71 Attribute_Float -> object [ "tag" .= ("Attribute_Float" :: Text)]
72 Attribute_V2F -> object [ "tag" .= ("Attribute_V2F" :: Text)]
73 Attribute_V3F -> object [ "tag" .= ("Attribute_V3F" :: Text)]
74 Attribute_V4F -> object [ "tag" .= ("Attribute_V4F" :: Text)]
75 Attribute_M22F -> object [ "tag" .= ("Attribute_M22F" :: Text)]
76 Attribute_M23F -> object [ "tag" .= ("Attribute_M23F" :: Text)]
77 Attribute_M24F -> object [ "tag" .= ("Attribute_M24F" :: Text)]
78 Attribute_M32F -> object [ "tag" .= ("Attribute_M32F" :: Text)]
79 Attribute_M33F -> object [ "tag" .= ("Attribute_M33F" :: Text)]
80 Attribute_M34F -> object [ "tag" .= ("Attribute_M34F" :: Text)]
81 Attribute_M42F -> object [ "tag" .= ("Attribute_M42F" :: Text)]
82 Attribute_M43F -> object [ "tag" .= ("Attribute_M43F" :: Text)]
83 Attribute_M44F -> object [ "tag" .= ("Attribute_M44F" :: Text)]
84
85instance FromJSON StreamType where
86 parseJSON (Object obj) = do
87 tag <- obj .: "tag"
88 case tag :: Text of
89 "Attribute_Word" -> pure Attribute_Word
90 "Attribute_V2U" -> pure Attribute_V2U
91 "Attribute_V3U" -> pure Attribute_V3U
92 "Attribute_V4U" -> pure Attribute_V4U
93 "Attribute_Int" -> pure Attribute_Int
94 "Attribute_V2I" -> pure Attribute_V2I
95 "Attribute_V3I" -> pure Attribute_V3I
96 "Attribute_V4I" -> pure Attribute_V4I
97 "Attribute_Float" -> pure Attribute_Float
98 "Attribute_V2F" -> pure Attribute_V2F
99 "Attribute_V3F" -> pure Attribute_V3F
100 "Attribute_V4F" -> pure Attribute_V4F
101 "Attribute_M22F" -> pure Attribute_M22F
102 "Attribute_M23F" -> pure Attribute_M23F
103 "Attribute_M24F" -> pure Attribute_M24F
104 "Attribute_M32F" -> pure Attribute_M32F
105 "Attribute_M33F" -> pure Attribute_M33F
106 "Attribute_M34F" -> pure Attribute_M34F
107 "Attribute_M42F" -> pure Attribute_M42F
108 "Attribute_M43F" -> pure Attribute_M43F
109 "Attribute_M44F" -> pure Attribute_M44F
110 parseJSON _ = mzero
111
112instance ToJSON ObjectArraySchema where
113 toJSON v = case v of
114 ObjectArraySchema{..} -> object
115 [ "tag" .= ("ObjectArraySchema" :: Text)
116 , "primitive" .= primitive
117 , "attributes" .= attributes
118 ]
119
120instance FromJSON ObjectArraySchema where
121 parseJSON (Object obj) = do
122 tag <- obj .: "tag"
123 case tag :: Text of
124 "ObjectArraySchema" -> do
125 primitive <- obj .: "primitive"
126 attributes <- obj .: "attributes"
127 pure $ ObjectArraySchema
128 { primitive = primitive
129 , attributes = attributes
130 }
131 parseJSON _ = mzero
132
133instance ToJSON PipelineSchema where
134 toJSON v = case v of
135 PipelineSchema{..} -> object
136 [ "tag" .= ("PipelineSchema" :: Text)
137 , "objectArrays" .= objectArrays
138 , "uniforms" .= uniforms
139 ]
140
141instance FromJSON PipelineSchema where
142 parseJSON (Object obj) = do
143 tag <- obj .: "tag"
144 case tag :: Text of
145 "PipelineSchema" -> do
146 objectArrays <- obj .: "objectArrays"
147 uniforms <- obj .: "uniforms"
148 pure $ PipelineSchema
149 { objectArrays = objectArrays
150 , uniforms = uniforms
151 }
152 parseJSON _ = mzero
153