We were using a specialization constant to size an array inside an
UBO interface block, which caused the crash in the Vulkan driver.
However, this specialization constant was only used to workaround a
Chrome bug on WebGL. Additionally, specialized array size inside blocks
are not fully supported in spirv.
This workaround simply replaces the specialization constant by a
constant on Vulkan.
Fix#6444
At least some adreno compilers don't like returning an element of a
UBO array that is a structure in the vertex shader.
To work this around we have to copy the each of the structure fields.
Fixes#6355
All shadow maps need a 1-px border for different reasons.
The directional shadow needs a "not in shadow" border because it uses
the intersection of receivers and casters in light-space.
Other shadow types need a border because of bilinear access at the
edges. Until now, the spot/point shadow border was handled with the
sampler's CLAMP.
Instead, now, we always generate a border and in one case we fill it
with "not in shadow" (by not rendering into it), in the other cases we
render the 2px larger shadowmap so we get completely correct bilinear
filter.
Additionally, for PCF, DPCF and PCSS we use a large filter kernel which
accesses data outside the texture, until now this was handled with CLAMP,
but that failed (2 of the edges were not handled in the same way) when
the shadowmap was smaller than the texture.
We fix this by clamping manually the texture coordinates.
The real motivation for these changes is to allow the use of a
shadow Atlas later.
The viewport is now entirely handled by ShadowMap, that is, we're no
longer setting a viewport in the renderpass, instead the ShadowMap
uses a post projection transform to achieve the same effect.
This will become useful when store shadow maps in an Atlas.
point light shadows are not sampled just like spotlight shadows, the
only difference is that we're calculating the face first to access the
corresponding shadowmap data (including the light transform).
- the layer is now stored in the shadow ubo
- we now have one shadow ubo per face
- ShadowMap holds UBO index even for cascades
- move some shadow "view" uniforms into the shadow UBO
* Recompute bounding boxes with morph targets
* Reduce the number of heap allocation while recomputing bounding boxes
Co-authored-by: Romain Guy <romainguy@curious-creature.com>
This 2D allocator only supports power-of-two, square allocations. It
uses a quadtree to store the allocated regions.
The quadtree implementation currently has a fixed depth (templated).
The allocator does a best-fit match, but currently doesn't implement a
free method.