krauthaufen/FShade

Record parameters not properly handled (null smuggled in)

Closed this issue · 1 comments

for code


[<ReflectedDefinition>]
module Gah = 
    let bla (v : Vertex) = v.pos

let effectTest() =

    let vert (v : Vertex) =
        vertex {
            return {
                pos = Bla.hugo (uniform.Trafo * Gah.bla v) 
                tc = v.tc
                vi = 0
            }
        }``

the following bad code is generated:
``void main()
{
    fs_Bla = Bla;
    gl_Position = Program_Bla_hugo((Program_Gah_bla(null) * Trafo));
    fs_TexCoord = TexCoord;
..``

example here: https://github.com/schimi2/FShade/tree/brokenStructParameters

thanks.

2 workarounds:

  • when using explicit constructions it works but not for implicitly lifted inputs.
    vertex { let a = { pos = v.pos; tc = v.tc; vi = v.vi } return { pos = Bla.hugo (uniform.Trafo * Test.blub a) tc = v.tc vi = 0 } }
  • use explicit arguments