Simplify uniform padding in Metal (Ganesh).
Previously, we would pad Metal uniforms to the nearest 16-byte size if
they contained a float3, float4, or matrix type. This does not appear
to be necessary (all tests pass without this level of padding).
Since Metal is C++ based, it does have *some* struct padding, based on
the basic type in the structure with the highest bit-width. Rather
than track this amount, we just assume that it is 8 and round up
Metal uniform blocks to the nearest 8-byte size. This will ~never be
larger than our previous padding, since a typical Skia shader will
generally always include a float2 uniform or larger (e.g. RTFlip is
a float2), and will probably be tighter than before since most shaders
include a color (float3/float4) or matrix uniform.
Change-Id: Ic8dd49f33cb81a24a6415e9ba6e91c9f6faeb1b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/556216
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
3 files changed