We chose 8 renderbuffer because it seems to be commonly supported
on mobile gpu and is more than 6 which is needed for generating
cubemaps. 4 was the minimum guaranteed by ES3.0.
The main changes here are:
- TargetBufferFlags is now a uint32_t instead of uint8_t
- The number of render buffer supported by filament and supported by
the hardware can now be different. Applications/users now must
query this value if more than 4 is needed.
- added a backend query (used gl terminology)
This is a redo of a previous attempt. There was an issue in the GL
backend that caused MRT to fail on some devices.
We chose 8 renderbuffer because it seems to be commonly supported
on mobile gpu and is more than 6 which is needed for generating
cubemaps. 4 was the minimum guaranteed by ES3.0.
The main changes here are:
- TargetBufferFlags is now a uint32_t instead of uint8_t
- The number of render buffer supported by filament and supported by
the hardware can now be different. Applications/users now must
query this value if more than 4 is needed.
- added a backend query (used gl terminology)
This implementation is an order of magnitude more efficient, running
in about 6ms on Pixel 4.
We're using the ring binning technique described in "Life of a Bokeh",
SIGGRAPH 2018.
vertex shader interpolants are interpolated at pixel centers by the GPU,
but we were doing our own "pixel-center" adjustment, so we ended-up with
"vertex_uv" at a pixel corner instead of center.
with this change, the vertex shader always compute vertex_uv in
fractional texels and the conversion to texture coordinates is done
in the fxaa code.
The half-pixel adjustment is removed.
This leads to sharper looking images because in addition to shifting
everything by 0.5 pixels, this was essentially applying a box-filter
to the whole picture -- kind of like taking 1 mip level down.
* Fix FXAA computations in mediump
UV coordinates computed in highp should be passed to the FXAA function
in highp as well. This change also fixes a potential division by 0 which
was causing dir1 to have components set to inifinity, thus breaking the
texture sampling calls below. We fix this with an early exit when a
potential division by 0 is detected. The original code contained a bias
to try to avoid this problem but that bias was not always enough. It
was frequent in mediump to cancel out the bias.
* Update shaders/src/fxaa.fs
Co-Authored-By: romainguy <romainguy@curious-creature.com>