Open Bug 1803715 Opened 2 years ago Updated 1 year ago

No-op draw calls for POINTS if gl_PointSize is not written

Categories

(Core :: Graphics: CanvasWebGL, defect, P2)

defect

Tracking

()

People

(Reporter: jgilbert, Assigned: jgilbert)

References

Details

Attachments

(1 file)

Tracking the spec change here:
https://github.com/KhronosGroup/WebGL/pull/3370

This is allowed, because right now the WebGL spec defers to the GLES spec, which says:

The OpenGL ES and OpenGL GLSL ES specifications define that if the built-in vertex shader output
variable <code>gl_PointSize</code> is not written to, then its value is undefined in later shader
stages. As a consequence, in these specifications, it is undefined whether the draw has an effect.

However, like I commented in that PR:

I think my remaining nit here is that "undefined for later stages" means that the vertex shader is still run, but the values output are undefined. While indeed this usually isn't observable, if we draw with transform feedback, we should see writes into transform feedback, or at least an increment of the "used TF verts" counter. The draw still happens, it's just that it's valid to treat all verts as if they are at Infinity. We can safely skip rasterization, but TF happens before clipping, I believe!

I think there is no way to emulate this GLES-compliant behavior except by literally restarting transform feedback to guarantee that we fake that the verts were drawn and received output from transform feedback.

Now, I believe this is possible to do, but I'd rather not add this fragile complexity to our implementations for such a narrow usecase. I would rather deviate from the allowed GLES behavior, and like this spec change proposes, actually-skip (but still check for errors for) draw calls with POINTS without gl_PointSize.

I would rather be safe and technically very very narrowly inconsistent with GLES here.
And we can change our mind in a subsequent patch.

Also don't advance transform-feedback counter if error'd in FakeAttrib0.

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:jgilbert, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.

Flags: needinfo?(lsalzman)
Flags: needinfo?(jgilbert)
Flags: needinfo?(lsalzman)
See Also: → CVE-2024-6600
Flags: needinfo?(jgilbert)
Priority: P1 → P2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: