Open xkisu opened 6 months ago
I just realized this does work correctly if I pass the signed decimal conversion equivalent to the fields (don't know why I didn't think to try that before), but I still feel like it should be possible to enter the unsigned values directly for an unsigned field - it feels like erroneous behaviour to have to use signed integers to set an unsigned field.
Thank you for reporting, consolidating in:
Which has been solved on latest branch
See there for more details, if you think something was missed about this and it's not the same issue, please comment here and it can be reopened
Thank you for reporting, consolidating in:
Which has been solved on latest branch
See there for more details, if you think something was missed about this and it's not the same issue, please comment here and it can be reopened
It looks like #89436 does fix it for uint parameters, but doesn't for uvec* parameter and the merged changes added a todo comment for them. Would be good to also fix it for uvec parameters otherwise they experience the same behaviour.
True forgot that detail, then this will be fixed by:
Tested versions
Reproducible in v4.2.1-stable
System information
Godot v4.2.1.stable - macOS 14.4.1 - Vulkan (Forward+) - integrated Apple M1 - Apple M1 (8 Threads)
Issue description
The editor is refusing to let me specify integers over the 32-bit signed max for unsigned shader vector parameters. When I try to specify one over the signed max (i.e. an ARGB hexidecimal color) the editor reverts it to the signed 32-bit max. The max of an unsigned 32-bit integer field should be 4294967295, but as you can see with the steps below it's capped at the signed 32-bit limit of 2147483647.
I'm not sure if this is a wider problem with Godot using the signed Vector4i type for
uvec4
shader types (which is a problem of it's own), or if this is just an issue with how the editor is interpreting the parameter limits.Steps to reproduce
uvec2
,uvec3
, oruvec4
parameter (example using my shader):uniform uvec4 a_span; // [spanX, y, color0, color1]
varying vec4 v_rampColor;
mediump vec4 unpack_color_int(uint color) { // Format is ARGB uint r = (color >> 16u) & 0xffu; uint g = (color >> 8u) & 0xffu; uint b = (color >> 0u) & 0xffu; uint a = (color >> 24u) & 0xffu;
}
void vertex() { v_rampColor = unpack_color_int((VERTEX_ID & 1) == 0 ? a_span.z : a_span.w); }
void fragment() { COLOR = v_rampColor; }