diff options
Diffstat (limited to 'ddl/out/purescript/LambdaCube/PipelineSchema.purs')
-rw-r--r-- | ddl/out/purescript/LambdaCube/PipelineSchema.purs | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/ddl/out/purescript/LambdaCube/PipelineSchema.purs b/ddl/out/purescript/LambdaCube/PipelineSchema.purs new file mode 100644 index 0000000..2a40ce2 --- /dev/null +++ b/ddl/out/purescript/LambdaCube/PipelineSchema.purs | |||
@@ -0,0 +1,157 @@ | |||
1 | -- generated file, do not modify! | ||
2 | -- 2016-11-12T12:48:59.849829000000Z | ||
3 | |||
4 | module LambdaCube.PipelineSchema where | ||
5 | import Prelude | ||
6 | import Data.Generic | ||
7 | import Data.Either (Either(..)) | ||
8 | import Data.Maybe (Maybe(..)) | ||
9 | import Data.StrMap (StrMap(..)) | ||
10 | import Data.Map (Map(..)) | ||
11 | import Data.List (List(..)) | ||
12 | import LinearBase | ||
13 | |||
14 | import Data.Argonaut.Encode.Combinators ((~>), (:=)) | ||
15 | import Data.Argonaut.Decode.Combinators ((.?)) | ||
16 | import Data.Argonaut.Core (jsonEmptyObject) | ||
17 | import Data.Argonaut.Printer (printJson) | ||
18 | import Data.Argonaut.Encode (class EncodeJson, encodeJson) | ||
19 | import Data.Argonaut.Decode (class DecodeJson, decodeJson) | ||
20 | |||
21 | import LambdaCube.IR | ||
22 | |||
23 | data StreamType | ||
24 | = Attribute_Word | ||
25 | | Attribute_V2U | ||
26 | | Attribute_V3U | ||
27 | | Attribute_V4U | ||
28 | | Attribute_Int | ||
29 | | Attribute_V2I | ||
30 | | Attribute_V3I | ||
31 | | Attribute_V4I | ||
32 | | Attribute_Float | ||
33 | | Attribute_V2F | ||
34 | | Attribute_V3F | ||
35 | | Attribute_V4F | ||
36 | | Attribute_M22F | ||
37 | | Attribute_M23F | ||
38 | | Attribute_M24F | ||
39 | | Attribute_M32F | ||
40 | | Attribute_M33F | ||
41 | | Attribute_M34F | ||
42 | | Attribute_M42F | ||
43 | | Attribute_M43F | ||
44 | | Attribute_M44F | ||
45 | |||
46 | data ObjectArraySchema | ||
47 | = ObjectArraySchema | ||
48 | { primitive :: FetchPrimitive | ||
49 | , attributes :: StrMap StreamType | ||
50 | } | ||
51 | |||
52 | |||
53 | data PipelineSchema | ||
54 | = PipelineSchema | ||
55 | { objectArrays :: StrMap ObjectArraySchema | ||
56 | , uniforms :: StrMap InputType | ||
57 | } | ||
58 | |||
59 | |||
60 | |||
61 | |||
62 | instance encodeJsonStreamType :: EncodeJson StreamType where | ||
63 | encodeJson v = case v of | ||
64 | Attribute_Word -> "tag" := "Attribute_Word" ~> jsonEmptyObject | ||
65 | Attribute_V2U -> "tag" := "Attribute_V2U" ~> jsonEmptyObject | ||
66 | Attribute_V3U -> "tag" := "Attribute_V3U" ~> jsonEmptyObject | ||
67 | Attribute_V4U -> "tag" := "Attribute_V4U" ~> jsonEmptyObject | ||
68 | Attribute_Int -> "tag" := "Attribute_Int" ~> jsonEmptyObject | ||
69 | Attribute_V2I -> "tag" := "Attribute_V2I" ~> jsonEmptyObject | ||
70 | Attribute_V3I -> "tag" := "Attribute_V3I" ~> jsonEmptyObject | ||
71 | Attribute_V4I -> "tag" := "Attribute_V4I" ~> jsonEmptyObject | ||
72 | Attribute_Float -> "tag" := "Attribute_Float" ~> jsonEmptyObject | ||
73 | Attribute_V2F -> "tag" := "Attribute_V2F" ~> jsonEmptyObject | ||
74 | Attribute_V3F -> "tag" := "Attribute_V3F" ~> jsonEmptyObject | ||
75 | Attribute_V4F -> "tag" := "Attribute_V4F" ~> jsonEmptyObject | ||
76 | Attribute_M22F -> "tag" := "Attribute_M22F" ~> jsonEmptyObject | ||
77 | Attribute_M23F -> "tag" := "Attribute_M23F" ~> jsonEmptyObject | ||
78 | Attribute_M24F -> "tag" := "Attribute_M24F" ~> jsonEmptyObject | ||
79 | Attribute_M32F -> "tag" := "Attribute_M32F" ~> jsonEmptyObject | ||
80 | Attribute_M33F -> "tag" := "Attribute_M33F" ~> jsonEmptyObject | ||
81 | Attribute_M34F -> "tag" := "Attribute_M34F" ~> jsonEmptyObject | ||
82 | Attribute_M42F -> "tag" := "Attribute_M42F" ~> jsonEmptyObject | ||
83 | Attribute_M43F -> "tag" := "Attribute_M43F" ~> jsonEmptyObject | ||
84 | Attribute_M44F -> "tag" := "Attribute_M44F" ~> jsonEmptyObject | ||
85 | |||
86 | instance decodeJsonStreamType :: DecodeJson StreamType where | ||
87 | decodeJson json = do | ||
88 | obj <- decodeJson json | ||
89 | tag <- obj .? "tag" | ||
90 | case tag of | ||
91 | "Attribute_Word" -> pure Attribute_Word | ||
92 | "Attribute_V2U" -> pure Attribute_V2U | ||
93 | "Attribute_V3U" -> pure Attribute_V3U | ||
94 | "Attribute_V4U" -> pure Attribute_V4U | ||
95 | "Attribute_Int" -> pure Attribute_Int | ||
96 | "Attribute_V2I" -> pure Attribute_V2I | ||
97 | "Attribute_V3I" -> pure Attribute_V3I | ||
98 | "Attribute_V4I" -> pure Attribute_V4I | ||
99 | "Attribute_Float" -> pure Attribute_Float | ||
100 | "Attribute_V2F" -> pure Attribute_V2F | ||
101 | "Attribute_V3F" -> pure Attribute_V3F | ||
102 | "Attribute_V4F" -> pure Attribute_V4F | ||
103 | "Attribute_M22F" -> pure Attribute_M22F | ||
104 | "Attribute_M23F" -> pure Attribute_M23F | ||
105 | "Attribute_M24F" -> pure Attribute_M24F | ||
106 | "Attribute_M32F" -> pure Attribute_M32F | ||
107 | "Attribute_M33F" -> pure Attribute_M33F | ||
108 | "Attribute_M34F" -> pure Attribute_M34F | ||
109 | "Attribute_M42F" -> pure Attribute_M42F | ||
110 | "Attribute_M43F" -> pure Attribute_M43F | ||
111 | "Attribute_M44F" -> pure Attribute_M44F | ||
112 | _ -> Left ("decodeJsonStreamType - unknown tag: " <> tag) | ||
113 | |||
114 | instance encodeJsonObjectArraySchema :: EncodeJson ObjectArraySchema where | ||
115 | encodeJson v = case v of | ||
116 | ObjectArraySchema r -> | ||
117 | "tag" := "ObjectArraySchema" ~> | ||
118 | "primitive" := r.primitive ~> | ||
119 | "attributes" := r.attributes ~> | ||
120 | jsonEmptyObject | ||
121 | |||
122 | instance decodeJsonObjectArraySchema :: DecodeJson ObjectArraySchema where | ||
123 | decodeJson json = do | ||
124 | obj <- decodeJson json | ||
125 | tag <- obj .? "tag" | ||
126 | case tag of | ||
127 | "ObjectArraySchema" -> do | ||
128 | primitive <- obj .? "primitive" | ||
129 | attributes <- obj .? "attributes" | ||
130 | pure $ ObjectArraySchema | ||
131 | { primitive:primitive | ||
132 | , attributes:attributes | ||
133 | } | ||
134 | _ -> Left ("decodeJsonObjectArraySchema - unknown tag: " <> tag) | ||
135 | |||
136 | instance encodeJsonPipelineSchema :: EncodeJson PipelineSchema where | ||
137 | encodeJson v = case v of | ||
138 | PipelineSchema r -> | ||
139 | "tag" := "PipelineSchema" ~> | ||
140 | "objectArrays" := r.objectArrays ~> | ||
141 | "uniforms" := r.uniforms ~> | ||
142 | jsonEmptyObject | ||
143 | |||
144 | instance decodeJsonPipelineSchema :: DecodeJson PipelineSchema where | ||
145 | decodeJson json = do | ||
146 | obj <- decodeJson json | ||
147 | tag <- obj .? "tag" | ||
148 | case tag of | ||
149 | "PipelineSchema" -> do | ||
150 | objectArrays <- obj .? "objectArrays" | ||
151 | uniforms <- obj .? "uniforms" | ||
152 | pure $ PipelineSchema | ||
153 | { objectArrays:objectArrays | ||
154 | , uniforms:uniforms | ||
155 | } | ||
156 | _ -> Left ("decodeJsonPipelineSchema - unknown tag: " <> tag) | ||
157 | |||