5640397c48
Any time we implement a Program::Instruction with multiple low-level operations, we risk overwriting any arguments that alias the destination. This is why the _I32 tests are failing, mad_unorm8 where d == x. We want (x*y+x)/256+z, but end up calculating (x*y+x*y)/256+z when x == d. We could fix this by never allowing any arguments to alias any destinations, but most instructions don't have this problem, and doing that blindly would bloat the register count significantly. We could fix this by knowing which Ops may be prone to aliasing in any backend, but I find that somewhat error prone and also a little abstraction- level-violatey. I would have thought, for instance, that the mad_f32 Op might be vulnerable here, but it's actually not... in any situation where there is aliasing, we actually lower it to a single vfmadd instruction, never mul-then-add. This sort of aliasing issue is going to keep coming back up again and again, especially with 2-argument architectures like SSE. Luckily it's trivially easy to fix by reserving a single tmp register to use as the result of all but the final instructions. The interpreter is safe because all its switch cases are single r(d) = ... statements. The right hand sides are evaluated before anything is written back to a destination register slot. Had it been written a little differently, it could have easily had this same aliasing issue. Change-Id: I996392ef6af48268238ecae4a97d3bf3b4fba002 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220600 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@google.com> |
||
---|---|---|
animations | ||
bench | ||
bin | ||
dm | ||
docker | ||
docs/examples | ||
example | ||
experimental | ||
fuzz | ||
gm | ||
gn | ||
include | ||
infra | ||
modules | ||
platform_tools | ||
resources | ||
samplecode | ||
site | ||
specs | ||
src | ||
tests | ||
third_party | ||
tools | ||
.clang-format | ||
.clang-tidy | ||
.gitignore | ||
.gn | ||
AUTHORS | ||
BUILD.gn | ||
codereview.settings | ||
CONTRIBUTING | ||
CQ_COMMITTERS | ||
DEPS | ||
go.mod | ||
go.sum | ||
LICENSE | ||
OWNERS | ||
PRESUBMIT.py | ||
public.bzl | ||
README | ||
README.chromium | ||
whitespace.txt |
Skia is a complete 2D graphic library for drawing Text, Geometries, and Images. See full details, and build instructions, at https://skia.org.