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
shader_type spatial;
varyingfloat foo;
void function2(infloat f) {
}
void function1() {
// This is okfloat bar = foo;
function2(bar);
// This is not ok (bug)// error: Varying 'foo' must be assigned in the vertex or fragment function first.
function2(foo);
}
void vertex()
{
foo =1.0;
}
void fragment()
{
function1();
// This is ok
function2(foo);
}
foo is a varying and is assigned in the vertex function.
In fragment, calling function2(foo); is ok as expected.
However, in function1 calling function2(foo); is mistakenly marked as an error.
Instead, assigning foo to bar first then giving bar as the parameter is ok.
As a fix, you can place vertex() function above the function1, and it will work. I'm not sure whether it is a bug or just misunderstanding of the limitations of the new varying system.
Godot version
4.0 Beta9
System information
Issue description
See this example:
foo
is a varying and is assigned in thevertex
function.In
fragment
, callingfunction2(foo);
is ok as expected.However, in
function1
callingfunction2(foo);
is mistakenly marked as an error.Instead, assigning
foo
tobar
first then givingbar
as the parameter is ok.Steps to reproduce
Minimal reproduction project
varying_error.zip
The text was updated successfully, but these errors were encountered: