Skip to content

varying of type int, uint, bool and vector types are disallowed even if declared flat #64798

Description

@lyuma

Godot version

4.0.alpha

System information

Windows 10

Issue description

Godot should allow any primitive data type other than sampler2D to be passed as varying.

shaders do not allow interpolating non-floating point values. For this reason, non-float varyings are required to be flat. We could do this automatically, or we could display an error message and ask the user to add flat.

See also: #45918 , but allow for all of vertex, fragment and light.

I am in favor of automatically assuming flat if not a floating point type.

Steps to reproduce

  1. Create a new MeshInstance3D
  2. Create a new StandardMaterial3D and convert to shader material.
  3. Declare varying flat int instance_id;
  4. Set instance_id = INSTANCE_ID; in vertex()
  5. it shows error "Invalid type for varying, only 'float', ..."

Minimal reproduction project

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions