diff options
author | Csaba Hruska <csaba.hruska@gmail.com> | 2015-09-09 14:40:48 +0200 |
---|---|---|
committer | Csaba Hruska <csaba.hruska@gmail.com> | 2015-09-09 14:40:48 +0200 |
commit | ee3343a56fc02b6bd2eec93b4c839f08f7ef9a25 (patch) | |
tree | 44b91e9d04866bdf2730661c09c95f4957440ef3 | |
parent | 62b0743a9613eae4355eb9d4890373351366a9b5 (diff) |
remove tuples from IR type
-rw-r--r-- | Definitions.hs | 43 | ||||
-rw-r--r-- | Language.hs | 3 |
2 files changed, 33 insertions, 13 deletions
diff --git a/Definitions.hs b/Definitions.hs index 233e695..0423123 100644 --- a/Definitions.hs +++ b/Definitions.hs | |||
@@ -251,10 +251,15 @@ ir = execWriter $ do | |||
251 | data_ "Blending" $ do | 251 | data_ "Blending" $ do |
252 | enum_ "NoBlending" | 252 | enum_ "NoBlending" |
253 | const_ "BlendLogicOp" ["LogicOperation"] | 253 | const_ "BlendLogicOp" ["LogicOperation"] |
254 | const_ "Blend" [ Tuple ["BlendEquation", "BlendEquation"] | 254 | constR_ "Blend" |
255 | , Tuple [Tuple ["BlendingFactor","BlendingFactor"],Tuple ["BlendingFactor","BlendingFactor"]] | 255 | [ "colorEqSrc" #:: "BlendEquation" |
256 | , v4f | 256 | , "alphaEqSrc" #:: "BlendEquation" |
257 | ] | 257 | , "colorFSrc" #:: "BlendingFactor" |
258 | , "colorFDst" #:: "BlendingFactor" | ||
259 | , "alphaFSrc" #:: "BlendingFactor" | ||
260 | , "alphaFDst" #:: "BlendingFactor" | ||
261 | , "color" #:: v4f | ||
262 | ] | ||
258 | 263 | ||
259 | data_ "RasterContext" $ do | 264 | data_ "RasterContext" $ do |
260 | const_ "PointCtx" ["PointSize", Float, "PointSpriteCoordOrigin"] | 265 | const_ "PointCtx" ["PointSize", Float, "PointSpriteCoordOrigin"] |
@@ -315,6 +320,12 @@ ir = execWriter $ do | |||
315 | enum_ "Stencil" | 320 | enum_ "Stencil" |
316 | enum_ "Color" | 321 | enum_ "Color" |
317 | 322 | ||
323 | data_ "ClearImage" $ do | ||
324 | constR_ "ClearImage" | ||
325 | [ "imageSemantic" #:: "ImageSemantic" | ||
326 | , "clearValue" #:: "Value" | ||
327 | ] | ||
328 | |||
318 | data_ "Command" $ do | 329 | data_ "Command" $ do |
319 | const_ "SetRasterContext" ["RasterContext"] | 330 | const_ "SetRasterContext" ["RasterContext"] |
320 | const_ "SetAccumulationContext" ["AccumulationContext"] | 331 | const_ "SetAccumulationContext" ["AccumulationContext"] |
@@ -325,7 +336,7 @@ ir = execWriter $ do | |||
325 | const_ "SetSampler" ["TextureUnit", Maybe "SamplerName"] -- binds sampler to the specified texture unit | 336 | const_ "SetSampler" ["TextureUnit", Maybe "SamplerName"] -- binds sampler to the specified texture unit |
326 | const_ "RenderSlot" ["SlotName"] | 337 | const_ "RenderSlot" ["SlotName"] |
327 | const_ "RenderStream" ["StreamName"] | 338 | const_ "RenderStream" ["StreamName"] |
328 | const_ "ClearRenderTarget" [Array (Tuple ["ImageSemantic","Value"])] | 339 | const_ "ClearRenderTarget" [Array "ClearImage"] |
329 | const_ "GenerateMipMap" ["TextureUnit"] | 340 | const_ "GenerateMipMap" ["TextureUnit"] |
330 | const_ "SaveImage" ["FrameBufferComponent", "ImageRef"] -- from framebuffer component to texture (image) | 341 | const_ "SaveImage" ["FrameBufferComponent", "ImageRef"] -- from framebuffer component to texture (image) |
331 | const_ "LoadImage" ["ImageRef", "FrameBufferComponent"] -- from texture (image) to framebuffer component | 342 | const_ "LoadImage" ["ImageRef", "FrameBufferComponent"] -- from texture (image) to framebuffer component |
@@ -354,12 +365,18 @@ ir = execWriter $ do | |||
354 | , "samplerCompareFunc" #:: Maybe "ComparisonFunction" | 365 | , "samplerCompareFunc" #:: Maybe "ComparisonFunction" |
355 | ] | 366 | ] |
356 | 367 | ||
368 | data_ "Parameter" $ do | ||
369 | constR_ "Parameter" | ||
370 | [ "name" #:: String | ||
371 | , "ty" #:: "InputType" | ||
372 | ] | ||
373 | |||
357 | data_ "Program" $ do -- AST, input | 374 | data_ "Program" $ do -- AST, input |
358 | constR_ "Program" | 375 | constR_ "Program" |
359 | [ "programUniforms" #:: Map "UniformName" "InputType" -- uniform input (value based uniforms only / no textures) | 376 | [ "programUniforms" #:: Map "UniformName" "InputType" -- uniform input (value based uniforms only / no textures) |
360 | , "programStreams" #:: Map "UniformName" (Tuple [String,"InputType"]) -- vertex shader input attribute name -> (slot attribute name, attribute type) | 377 | , "programStreams" #:: Map "UniformName" "Parameter" -- vertex shader input attribute name -> (slot attribute name, attribute type) |
361 | , "programInTextures" #:: Map "UniformName" "InputType" -- all textures (uniform textures and render textures) referenced by the program | 378 | , "programInTextures" #:: Map "UniformName" "InputType" -- all textures (uniform textures and render textures) referenced by the program |
362 | , "programOutput" #:: Array (Tuple [String,"InputType"]) | 379 | , "programOutput" #:: Array "Parameter" |
363 | , "vertexShader" #:: String | 380 | , "vertexShader" #:: String |
364 | , "geometryShader" #:: Maybe String | 381 | , "geometryShader" #:: Maybe String |
365 | , "fragmentShader" #:: String | 382 | , "fragmentShader" #:: String |
@@ -382,9 +399,15 @@ ir = execWriter $ do | |||
382 | , "streamPrograms" #:: Array "ProgramName" | 399 | , "streamPrograms" #:: Array "ProgramName" |
383 | ] | 400 | ] |
384 | 401 | ||
402 | data_ "TargetItem" $ do | ||
403 | constR_ "TargetItem" | ||
404 | [ "targetSemantic" #:: "ImageSemantic" | ||
405 | , "targetRef" #:: Maybe "ImageRef" | ||
406 | ] | ||
407 | |||
385 | data_ "RenderTarget" $ do | 408 | data_ "RenderTarget" $ do |
386 | constR_ "RenderTarget" | 409 | constR_ "RenderTarget" |
387 | [ "renderTargets" #:: Array (Tuple ["ImageSemantic",Maybe "ImageRef"]) -- render texture or default framebuffer (semantic, render texture for the program output) | 410 | [ "renderTargets" #:: Array "TargetItem" -- render texture or default framebuffer (semantic, render texture for the program output) |
388 | ] | 411 | ] |
389 | 412 | ||
390 | data_ "Backend" $ do | 413 | data_ "Backend" $ do |
diff --git a/Language.hs b/Language.hs index ae38916..1950c6e 100644 --- a/Language.hs +++ b/Language.hs | |||
@@ -49,7 +49,6 @@ data Type | |||
49 | -- higher order types | 49 | -- higher order types |
50 | | Array Type | 50 | | Array Type |
51 | | List Type | 51 | | List Type |
52 | | Tuple [Type] | ||
53 | | Maybe Type | 52 | | Maybe Type |
54 | | Map Type Type | 53 | | Map Type Type |
55 | -- user defined | 54 | -- user defined |
@@ -97,7 +96,6 @@ psType = \case | |||
97 | 96 | ||
98 | Array t -> "Array " ++ parens (hsType t) | 97 | Array t -> "Array " ++ parens (hsType t) |
99 | List t -> "List " ++ parens (hsType t) | 98 | List t -> "List " ++ parens (hsType t) |
100 | Tuple l -> "(" ++ intercalate "," (map hsType l) ++ ")" | ||
101 | Maybe t -> "Maybe " ++ parens (hsType t) | 99 | Maybe t -> "Maybe " ++ parens (hsType t) |
102 | Map String v -> "StrMap " ++ parens (hsType v) | 100 | Map String v -> "StrMap " ++ parens (hsType v) |
103 | Map k v -> "Map " ++ parens (hsType k) ++ " " ++ parens (hsType v) | 101 | Map k v -> "Map " ++ parens (hsType k) ++ " " ++ parens (hsType v) |
@@ -141,7 +139,6 @@ hsType = \case | |||
141 | 139 | ||
142 | Array t -> "[" ++ hsType t ++ "]" | 140 | Array t -> "[" ++ hsType t ++ "]" |
143 | List t -> "[" ++ hsType t ++ "]" | 141 | List t -> "[" ++ hsType t ++ "]" |
144 | Tuple l -> "(" ++ intercalate "," (map hsType l) ++ ")" | ||
145 | Maybe t -> "Maybe " ++ parens (hsType t) | 142 | Maybe t -> "Maybe " ++ parens (hsType t) |
146 | Map k v -> "Map " ++ parens (hsType k) ++ " " ++ parens (hsType v) | 143 | Map k v -> "Map " ++ parens (hsType k) ++ " " ++ parens (hsType v) |
147 | -- user defined | 144 | -- user defined |