Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/LambdaCube/Compiler/CoreToIR.hs:(528,24)-(530,61): Non-exhaustive patterns in case #7

Open
pippijn opened this issue Mar 25, 2021 · 2 comments

Comments

@pippijn
Copy link

pippijn commented Mar 25, 2021

Reproducing test case (paste in editor.html to see the error):

makeFrame (time :: Float)
          (texture :: Texture)
          (prims :: PrimitiveStream Triangle (Vec 4 Float, Vec 3 Float, Vec 3 Float))
    = imageFrame ((emptyColorImage (V4 0 0 0.4 1)))
  `overlay`
      prims
    & mapPrimitives (\(p,n,uvw) -> (p, V2 uvw%x (1 - uvw%y) ))
    & mapPrimitives (\(x) -> x)
    & rasterizePrimitives (TriangleCtx CullBack PolygonFill NoOffset LastVertex) ((Smooth))
    & mapFragments (\((uv)) -> ((texture2D (Sampler PointFilter MirroredRepeat texture) uv)))
    & accumulateWith ((ColorOp NoBlending (V4 True True True True)))

main = renderFrame $
   makeFrame (Uniform "time")
             (Texture2DSlot "diffuseTexture")
             (fetch "objects" (Attribute "position", Attribute "normal", Attribute "uvw"))

The relevant part is mapPrimitives (\(x) -> x). I'm sure this code is wrong, but the error message isn't helping me understand why.

@csabahruska
Copy link
Member

The graphics pipeline codegen is too rigid. It expects one or zero mapPrimitives operator.

@pippijn
Copy link
Author

pippijn commented Mar 25, 2021

Ok, so any function composition should be done within that operator's argument. Thanks! I'll leave the issue open because I think the compiler should either tell the user about this or transform the input to function composition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants