Go to file
Mike Klein 5640397c48 fix dst/arg aliasing issues
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>
2019-06-13 16:53:29 +00:00
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bench Interpreter: Vectorized interpreter 2019-06-13 15:50:55 +00:00
bin Add bin/try-clients to trigger client tryjobs 2019-06-11 16:55:53 +00:00
dm Make color initialization version of createBackendTexture public 2019-06-04 20:12:22 +00:00
docker Include wasm debugger in continuous build part 2 2019-04-01 19:51:43 +00:00
docs/examples PDF example 2019-05-28 17:21:59 +00:00
example Use SkTextEncoding enum instead of macros. 2019-05-07 20:54:16 +00:00
experimental Revert "Revert "try resolver pattern"" 2019-06-12 14:46:56 +00:00
fuzz Make fuzzing use embedded test font 2019-06-03 16:29:21 +00:00
gm Revert "Revert "try resolver pattern"" 2019-06-12 14:46:56 +00:00
gn Interpreter: Vectorized interpreter 2019-06-13 15:50:55 +00:00
include Revert "Add Ganesh support for RGBA_16161616 and RG_half" 2019-06-13 16:49:31 +00:00
infra Add tip on patching to G3 bot 2019-06-12 19:01:36 +00:00
modules [skottie] Use metrics for Shaper vertical alignment 2019-06-13 13:04:53 +00:00
platform_tools rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
resources expand unit tests, fix extract 2019-06-12 18:58:56 +00:00
samplecode Baseline for empty text 2019-06-11 21:49:49 +00:00
site fix up relative links and spacing 2019-06-11 14:29:38 +00:00
specs [img-decode] Start on proposed new spec 2019-05-06 17:39:19 +00:00
src fix dst/arg aliasing issues 2019-06-13 16:53:29 +00:00
tests fix dst/arg aliasing issues 2019-06-13 16:53:29 +00:00
third_party third-party.gni: Search includes using -I. 2019-06-11 19:04:29 +00:00
tools expand unit tests, fix extract 2019-06-12 18:58:56 +00:00
.clang-format restore .clang-format 2019-03-21 15:52:32 +00:00
.clang-tidy add google-build-namespaces to clang-tidy checks 2018-12-12 16:33:59 +00:00
.gitignore clean up some .gitignores 2019-05-15 19:55:45 +00:00
.gn Basic standalone GN configs. 2016-07-21 12:25:45 -07:00
AUTHORS third-party.gni: Search includes using -I. 2019-06-11 19:04:29 +00:00
BUILD.gn Revert "Revert "try resolver pattern"" 2019-06-12 14:46:56 +00:00
codereview.settings Make uploading to Gerrit the default for Skia 2016-11-09 19:07:56 +00:00
CONTRIBUTING Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
CQ_COMMITTERS Moved committer list to chrome-infra-auth and deleted it from the repo 2015-09-02 13:37:54 -07:00
DEPS Roll third_party/externals/angle2 2589cdcc88ec..85fef1bc62f8 (6 commits) 2019-06-13 06:02:33 +00:00
go.mod [infra] Pin infra code using Go modules 2019-05-06 17:53:19 +00:00
go.sum [infra] Pin infra code using Go modules 2019-05-06 17:53:19 +00:00
LICENSE BUG=skia:5602 2016-09-02 11:19:34 -07:00
OWNERS add OWNERS file 2017-12-01 19:50:19 +00:00
PRESUBMIT.py add mtklein to api approvals 2019-04-02 15:16:56 +00:00
public.bzl expose xform to google3 2019-06-11 21:21:38 +00:00
README Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
README.chromium Update README.chromium. 2015-06-11 13:19:24 -07:00
whitespace.txt Whitespace test 2019-05-18 13:05:29 +00:00

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.

See full details, and build instructions, at https://skia.org.