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
Gustav Sterbrant edited this page Oct 14, 2024
·
2 revisions
Declaration
To declare a variable with GPULang you can take several routes.
Declare a variable with an explicit type, uninitialized:
varcolor : f32x4;
Declare a variable with an inferred type:
constcolor=f32x4(r,g,b,a);
Declare a variable with an explicit type, initialized through conversion
constcolor : f32x4= 1.0f;
GPULang doesn't offer lazy type inference. The type must be known on the same statement where the variable is declared.
Conversion
GPULang offers a few conversion methods for ease of use. By default, implicit conversion is enabled but can be disabled with the disallowImplicitConversion flag passed to the compiler. Explicit conversions are encouraged, since all conversions generate potentially unnecessary code.