Review of the alpha to coverage change for alpha tested surfaces:
- An alpha which is flat over the pixel (fwidth 0) and equal to the opacity
threshold got a coverage of 0.5, so e.g. opacity 1 on an opaque or DXT1
texture turned half see-through with multisampling. Without an alpha edge
in the pixel the plain test decides now: step(opacity, alpha).
- The shaders took the coverage path whenever they were built with
multisampling, also where alpha to coverage is off (the reflections pass)
or does nothing (the single-sampled model previews), and grew the cut-outs
there by about half a pixel. model_ubo gets an alpha_to_coverage flag, set
together with the GL state, and the shaders keep the plain alpha test
without it. The previews no longer turn alpha to coverage on. The flag
takes 4 of the 12 padding bytes after shadow_tone, so the std140 layout and
the size of the block stay the same.
- The shader validator never set iMultisampling, so it never compiled the
alpha to coverage branches. Its "features on" configuration uses the
default of 2 now, on desktop GL and GLES.
The sides of the trackbed (and grass, fences, foliage) are cut out of their
textures by the alpha test, which keeps or drops whole pixels, so their edges
stayed jagged at any multisampling level; only geometry edges got smoothed.
With multisampling on, the alpha tested materials of the opaque colour pass
now draw with GL_SAMPLE_ALPHA_TO_COVERAGE. Their shaders do the alpha test
with alpha_test_fail() of glsl_common and write as alpha the coverage of the
test edge: the alpha sharpened around the opacity threshold to go from 0 to 1
over about a pixel, so the edge keeps the place it had and gets the samples
it covers. The renderer turns alpha to coverage on per material, only for
shaders which use the helper and only in the opaque pass with a positive
opacity, so translucent, water, terrain and the other shaders are unchanged.
Without multisampling the shaders work as before.