Open greggman opened 5 years ago
This issue is related to this one https://github.com/KhronosGroup/OpenGL-API/issues/51 also filed recently.
This was discussed a while ago and the OpenGL ES working group agreed that it is undesirable behavior for fragments outside of the viewport to be rendered. We were going to tighten the spec language to say point and line fragments outside of the viewport must be discarded. I don't think that spec change was finalized. For safety you can use the scissor, but I suspect most implementations already discard those fragments outside the viewport.
For reference this was discussed internally here: https://www.khronos.org/members/login/bugzilla/show_bug.cgi?id=10698
To make progress with this issue we first need to write a CTS test (https://gitlab.khronos.org/Tracker/vk-gl-cts/issues/1961) that verifies no line or point fragments are rasterized outside of the viewport. When we are confident all affected implementations implement this, or can implement this, then we'll update the API spec to mandate it. Currently we're waiting on the CTS to be written.
AFAICTin the OpenGL 4.6 spec if the viewport is smaller than the window/framebuffer, a point drawn near the edge of the viewport who's point size bleeds outside the viewport is supposed to be rendered
The spec seems to make it clear in section 13.7 only vertices (the center of a point) are clipped by the viewport settings. The square drawn around that point happens during rasterization in 14.4.1
This old post
https://www.opengl.org/archives/resources/features/KilgardTechniques/oglpitfall/
Suggests it's not supposed to clip the square around the point but testing most current implementations do clip.
This is important because based on that old post if you want to make sure rendering only happens inside some sub rectangle you're required to enable the scissor test. Without knowing the correct behavior I have to resort to voodoo. Basically enable the scissor test because some many year old post says it might be required but in reality no one knows.
I don't really care which way it goes but it would be nice that it's consistent, that the spec says definitively that squares around points are or are not clipped to the viewport and that there is a CTS test for the correct behavior so that in teaching this material I can tell people why they do or do not need to enable the scissor test.
Also the same is true for lines. In the non-core profile lineWidth > 1 drawing at the edge of the viewport should bleed outside the viewport but in actual testing they're clipped. Here too it seems the spec needs to make this explicit and tests need to test.