General description
When using any of the uniforms imported by the minecraft:globals include file inside the particle core shader, the variables are populated with the intended values some of the time, but with seemingly arbitrary values at other times. In testing, the effect seemed to depend on whether or not the block selection outline was currently visible. I have not tested whether this issue applies to other shaders aside from the particle core shader.
Steps to reproduce the issue
Apply the attached resource pack that transforms particles of a specific color to print out their received uniforms on screen.
Display the particles by putting this command inside an always active repeating command block:
execute as @p at @s anchored eyes run particle entity_effect{color:[0.00392156862745098, 0.00784313725490196, 0.011764705882352941, 1.0]} ^ ^ ^10Now the shader is displaying the received uniform values to the screen.
Look away from any block or press F1, while observing the displayed values.
Expected result
The uniform values stay largely unchanged and show behavior matching their names. For example, ScreenSize should remain as a constant pair of positive integers that matches the actual window size in pixels.
Actual result
The uniforms change to completely arbitrary values that depend on what is placed in the environment. For example, ScreenSize may assume fractional or even negative values that have no relation to the real window size.
Why this counts as a bug
While core shaders as a whole are not a supported feature, it is clear that the intention behind the uniforms inside minecraft:globals is for them to be available everywhere and never reference arbitrary memory sections. With the developers currently asking for technical feedback on the new rendering changes, it makes sense to use the bug tracker to report related issues.
Environment
Tested on:
NVIDIA GeForce GTX 1050
AMD Radeon(TM) RX Vega 10 Graphics
During my tests in (mainly) 1.21.11, I noticed that everything works fine as long as there are no entities visible on the screen. However, when there is at least one entity currently being rendered, the bug description matches my observations. (it works depending on the block-outline being visible, which seems odd)
Maybe this helps narrowing down possible causes.