You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to be able to pass a struct to the shader, (so that I can use the same struct in a vertex attrib array and automatically do the required glVertexAttribPointer and glEnableVertexAttribArray).
Marking the parameter type with the StructAttribute, produces a compiler error within the automatically-build quotation: FS3155: A quotation may not involve an assignment to or taking the address of a captured local variable.
Helpful users on the F# Slack suggested a workaround involving getter functions for the struct, but then FShade loses the parameters entirely.
Hey, I know the problem and sadly i don't really have a workaround for that. Did you try sonething like let v = v in the first line of your shader? Just a guess but maybe inside the builder or outside this could help.
My "reasoning" here is that local variable structs seem to be okay and this would make the input a local variable
I wanted to be able to pass a struct to the shader, (so that I can use the same struct in a vertex attrib array and automatically do the required glVertexAttribPointer and glEnableVertexAttribArray).
Marking the parameter type with the
StructAttribute
, produces a compiler error within the automatically-build quotation:FS3155: A quotation may not involve an assignment to or taking the address of a captured local variable.
Helpful users on the F# Slack suggested a workaround involving getter functions for the struct, but then FShade loses the parameters entirely.
An example of what I've tried is in a branch at https://github.com/marklam/FShade/tree/struct-params
The attempts and failing tests are shown in this commit marklam@7c2a421
Is there any advice on how to get a struct to work as a parameter?
The text was updated successfully, but these errors were encountered: