Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POINT clipping in implementation don't match the spec #57

Open
greggman opened this issue Aug 9, 2019 · 2 comments
Open

POINT clipping in implementation don't match the spec #57

greggman opened this issue Aug 9, 2019 · 2 comments
Assignees

Comments

@greggman
Copy link

greggman commented Aug 9, 2019

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.

@pdaniell-nv
Copy link

This issue is related to this one #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

@pdaniell-nv
Copy link

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.

@pdaniell-nv pdaniell-nv added this to the Needs Action/PR milestone Jan 7, 2020
@pdaniell-nv pdaniell-nv self-assigned this Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants