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

Cannot pass tessellation levels from TCS to TES #19

Open
madorjan opened this issue Feb 2, 2021 · 0 comments
Open

Cannot pass tessellation levels from TCS to TES #19

madorjan opened this issue Feb 2, 2021 · 0 comments

Comments

@madorjan
Copy link

madorjan commented Feb 2, 2021

In order to visualize the derived tessellation level using vertex colors I wanted to pass an outer tessellation level from the control shader to the evaluation shader.

Unfortunately the shader code produced by FShade isn't correct.

let heightTess (t : Triangle<Vertex>) =
        tessellation {
            //TCS part
            let outer01 = tessScreenSpaceSphere t.P0.pos t.P1.pos t.P0.tc t.P1.tc
            let outer12 = tessScreenSpaceSphere t.P1.pos t.P2.pos t.P1.tc t.P2.tc
            let outer20 = tessScreenSpaceSphere t.P2.pos t.P0.pos t.P2.tc t.P0.tc

            let inner = (outer01 + outer12 + outer20) / 3.0

            let! coord = tessellateTriangle inner (outer12, outer20, outer01)

            //TES part
            let p = coord.X * t.P0.pos + coord.Y * t.P1.pos + coord.Z * t.P2.pos
            let tc = coord.X * t.P0.tc + coord.Y * t.P1.tc + coord.Z * t.P2.tc
            let c = coord.X * t.P0.c + coord.Y * t.P1.c + coord.Z * t.P2.c

            let h0 = heightMap.Sample(tc).X

            let p0 = V3d(p.X,p.Y,h0)

            return {
                pos = uniform.ModelViewProjTrafo * V4d(p0, 1.0)
                wp = uniform.ModelTrafo * V4d(p0, 1.0)
                n = V3d.OOI
                tc = tc
                c = c
                level = outer01
            }
        }

This correctly produces patch out float te_outer01; for the outer01 attribute in the control shader.
Instead of patch in float te_outer01; just in float te_outer01; is produced for the evaluation shader.

I think this leads to the following error message when compiling the shader code:

[GL] shader compiler returned errors: "Tessellation evaluation info
----------------------------
0(141) : error C7544: OpenGL requires tessellation evaluation inputs to be arrays
"
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

1 participant