Optional invariant
on gl_FragCoord
and gl_PointCoord
#3520
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3518
As mentioned in #3518, from the ESSL 3.00 specification the variance of
gl_FragCoord
andgl_PointCoord
is mentioned:The same language is in the ESSL 1.00 specification.
There is no resolution, but option 2 is implied by existing ESSL 1.00 tests, e.g.:
WebGL/conformance-suites/2.0.0/conformance/glsl/misc/shaders-with-invariance.html
Line 289 in bd18b05
However ESSL 3.00 also states:
So we have a choice to either:
gl_FragCoord
andgl_PointCoord
onlyinvariant
ongl_FragCoord
andgl_PointCoord
(this appears to be the current behavior under ANGLE but doesn't appear to be tested explicitly)This PR chooses the first option to slightly improve compatibility between ESSL 1.00 and ESSL 3.00 if there's no strong reason to prefer one over the other. The tests in this PR currently expect ESSL 3.00 to match ESSL 1.00 behavior for
invariant gl_FragCoord
andinvariant gl_PointCoord
, which loosen the "only allow invariant declarations on outputs" rule for those two built-ins. I'd happy to update this PR to use the second option instead if that's preferred though.