KhronosGroup / KhronosGroup/WebGL

POINTS clipping not working correctly on several drivers

Open
#2,888 7 comments 0 reactions 1 assignee Claimed by @kdashg View on GitHub
Dominant language
HTML
Stars
2.9k
Forks
703
Avg merge
2d 9h
Merged PRs (30d)
4

Description

If I understand the spec correctly `POINTS` are not clipped in the vertex shader. From the spec section 2.13

> If the primitive under consideration is a point, then clipping discards it if it lies outside the near or far clip plane; **otherwise it is passed unchanged.**

There's a kind of conformance test for this here

https://www.khronos.org/registry/webgl/sdk/tests/conformance/rendering/clipping-wide-points.html?webglVersion=1&quiet=0&quick=1

But it only tests if the center of the point is slightly off the right and top sides.

I wrote a test to try all four sides and to move the center as far as possible off each side. It should be possible to set the center of the point basically the max point size from `gl.getParameter(ALIASED_POINT_SIZE_RANGE)[1]` divided by 2 - 0.6 or so (-0.50000001?) off of any side. The spec says

> Point rasterization produces a fragment for each framebuffer pixel whose center lies inside a square centered at the point’s (xw, yw), with side length equal to the point size

Here's the test

https://jsfiddle.net/greggman/beqptu8r/

It fails on my iPhone6+, My Pixel 2 XL, My 2014 MBP NVIDIA GeForce GT 750M
It passes on My 2014 MBP Intel Iris Pro, and on a Windows HD Graphics 630, and Windows NVidia 1060

It's possible my math is wrong but it doesn't seem wrong at a glance.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.