Hello forum,


I was implementing some point rendering, and I've noticed strange behavior in the frag shader.

The code is very basic, just get the vertex, render if alpha is 1, otherwise discard the fragment. The problem is with the IF statement, for whatever reason an IF statement causes the color output change between 0 and Color whenever the camera is moved. All values I input are proper, in fact, the Depth output shows that the points render properly. Also the assigned stay the same, they just change between 0 and whatever assigned color is.

The code:

Code :
// shadertype=glsl
#version 450
layout(early_fragment_tests) in;
 
in float	object_size;
in vec3		object_color;
in float	object_alpha;
in float	object_depth;
 
layout(location = 0) out vec4 stage2ColorMap;
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void main() {	
	float fragmentAlpha = clamp(object_alpha, 0.0, 1.0);
 
	if (fragmentAlpha == 1.0) {
			stage2ColorMap = vec4(object_color, 1.0);
	} else {
		discard;
	}
}

Camera at position 1:



Camera at position 2:



Depth buffer output (notice how everything is shown as rendered):




Without the IF statement the color outputs just fine.

I could not find any info on the possible source of the issue. Is this a bug?