When a variable is used with the out keyword in a function argument then it seems to trigger an if statement right below the function call even though the if statement should never execute.
This fragment shader turns the screen WHITE
#version 450
layout(location = 0) out vec4 out_color;
void empty_function(out vec3 color) {}
void main() {
vec3 color = vec3(0, 0, 0);
empty_function(color); // When commenting out this line the if statement does not execute and the screen turns BLACK
if (false) {color = vec3(1,1,1);}
out_color = vec4(color, 1);
}
When involving another variable and taking the maximum of the two (In this case the screen would turn WHITE if the if statement executed) the issue seems to disappear.
When a variable is used with the
out
keyword in a function argument then it seems to trigger an if statement right below the function call even though the if statement should never execute.This fragment shader turns the screen WHITE
When involving another variable and taking the maximum of the two (In this case the screen would turn WHITE if the if statement executed) the issue seems to disappear.
This fragment shader turns the screen BLACK
Info
Hardware: Intel Iris Xe Graphics API: Vulkan 1.3.283