mojira.dev
MC-299823

Minecraft shaders cause C7050 warnings

0(20) : warning C7050: "color_layers[1]" might be used before being initialized
0(20) : warning C7050: "color_layers[2]" might be used before being initialized
0(20) : warning C7050: "color_layers[3]" might be used before being initialized
0(20) : warning C7050: "color_layers[4]" might be used before being initialized
0(20) : warning C7050: "color_layers[5]" might be used before being initialized
0(21) : warning C7050: "depth_layers[1]" might be used before being initialized
0(21) : warning C7050: "depth_layers[2]" might be used before being initialized
0(21) : warning C7050: "depth_layers[3]" might be used before being initialized
0(21) : warning C7050: "depth_layers[4]" might be used before being initialized
0(21) : warning C7050: "depth_layers[5]" might be used before being initialized

Adding this fixes the bug (see attached resource pack)

for (int i = 0; i < NUM_LAYERS; ++i) {
    color_layers[i] = vec4(0.0);
    depth_layers[i] = 1.0;
}

PS : I think that even if the fix I give works, Mojang should find a solution to not fill the variables with useless values.

Environment

GTX 1070

Attachments

Comments 1

Can confirm.

13th Gen Intel(R) Core(TM) i5-13400F

NVIDIA GeForce RTX 3060 Ti

Lolo

HÃ¥kan Wallin

Confirmed

Platform

Low

Rendering

1.21.8, 25w31a

25w33a

Retrieved