unlike for refraction, the reflection buffer is distinct from "the"
color buffer, this allows an optimization (compared to ssr) when we
generate the mipmap chain -- we can allocate the mipmaped texture
and render the SSR pass directly into its level 0. This achieved
use the framegraph's forward resource feature.
With this change, shaders are compiled at program creation, programs
are linked at the start of the next render pass and queries are
deferred until first use.
This should improve overall performance on some drivers.
This reduces the size of OpenGLProgram from 64 to 32 bytes and
improves the code that sets new samplers.
The main simplification is that we're not trying to "pack" the
texture units used in the program. For e.g. we could be using
units 0,3,4, where before it would be 0,1,2.
This allows us to do less tracking.
Another optimization is that we're discarding entirely a SamplerGroup
if the program doesn't use any of its samplers. This helps remove
a test in updateSampler which in turn remove somem tracking data.
Instead of recomputing the Frustum from its 8 vertices, we compute it
from the projection matrix directly. This ensures this works with any
projection matrix. Building a Frustum object from 8 vertices required
these vertices to be given in a certain order which wasn't correct if
the projection was flipped for instance.
Removed the API to construct a Frustum from vertices.
fixes b/225975881
move its content to DriverEnums.h, we do this because it is used
in libfilabridge, which has an unspoken rule that it only includes
DriverEnums.h.
filabridge also only has a header dependency, so it can't call any
method, not even operator<<.
Also cleanups and simplifications.
The main simplification is that we don't need an actual map to retrieve
the global offset of a sampler, it can be easily calculated as:
global_offset = offset_of_the_block + local_offset
Instead of passing the level and layer explicitly to gaussianBlurPass,
we rely on the information already contained in the handle. i.e. we
honor the "subresource" part of the handle (if it has one).
In other words, it's now possible to pass a subresource (e.g. a layer)
to generateGaussianMipmap or gaussianBlurPass and things should work as
expected.
The problem here would happen when forwarding a subresource (i.e.
replacing an existing resource by a subresource) and the existing
resource had been written to. In this situation, the subresource's
parent needs to depend on the subresource (i.e. as if it was written to
by it). This would normally happen during write() but in this situation,
the write had already happened.
the dependency graph would be incorrectly severed in the situation where
a subresource was written to and later its parent was read from.
In this situation, the parent node is in fact a new version of the
original parent node, so we need a "read" dependency of the orginal to
the copy (otherwise the orginal node is not a dependent of anyone
and gets culled).