Go to file
Mike Klein 5b11a58c62 skvm::Builder friendliness improvements
It would be nice if we could use infix operators, and it would also be
nice if we could use literals instead of so many splats.

To make infix operators possible, we need to have each I32 / F32 struct
track its origin Builder, so that we know where to build the
corresponding operation when we encounter an infix operator.  E.g.

    struct F32 {
       Val      id      = NA;
       Builder* builder = ...;
    };

    ...

    static inline F32 operator*(F32 x, F32 y) {
        SkASSERT(x.builder == y.builder);
        return x.builder->mul(x,y);
    }

OK, that's great!  But then once we start churning out overrides to work
with literals, things get quite verbose, and it becomes easy to lose
track of which methods can take literals and which can't.  It'd be nice
to have some sort of way to automatically handle literals.

For that we notice that the F32 struct has 4 dead bytes anyway between
the Val and the Builder*... perfect space for a literal.

   struct F32 {
       Val      id      = NA;
       float    imm     = 0.0f;
       Builder* builder = nulltpr;
   };

Now we can operate under the convention that when builder == nullptr,
the F32 represents the value in `imm`, and when builder is set it is
the result of the instruction at `id`.

Then inside skvm::Builder, we'll look for F32's that are in that sort
of Builder-less imm state and resolve them to splats.  That's what id()
does, returning that `id` val.  I've renamed the field in the struct to
make sure I caught all the old uses of `.id`.

From there we make I32 and F32 much more locked down types, with three
public constructors: NA/false, immediates, and instruction values.

There's lots and lots and lots and lots and lots left to do both
removing splat()s and especially converting to infix.  I just tried
to get enough in here that proves it works.

luminance() has weird extra parens to preserve the order of evaluation,
but I don't see any reason not to drop them in a follow up.

Change-Id: If6889ec9ba1ecc23edb15361ccb2b2309be7a6b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279907
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-03-28 12:42:04 +00:00
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bench onProgram for SkGaussianColorFilter, plus gm and bench 2020-03-27 20:41:20 +00:00
bin [infra] Fix bin/try 2020-01-14 12:05:56 +00:00
build/fuchsia Add command line argument to specify the rendertests file. 2020-03-05 17:51:12 +00:00
build_overrides Add Dawn on Windows job. 2020-02-28 17:48:37 +00:00
dm Make skia_use_xps option work on Windows 2020-03-24 17:09:33 +00:00
docker Revert "fiddle - Don't make warnings into errors." 2020-02-07 21:39:38 +00:00
docs/examples Fix matrix scoping issue in sample 2020-03-23 13:44:53 +00:00
example Revert "Revert "switch to new filltype for SkPath"" 2019-11-26 17:43:14 +00:00
experimental Add experimental support for svg text tag. 2020-03-27 13:56:49 +00:00
fuzz Revert "Revert "Revert "Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots"""" 2020-03-20 17:11:58 +00:00
gm onProgram for SkGaussianColorFilter, plus gm and bench 2020-03-27 20:41:20 +00:00
gn Fix gcc 9 warnings. 2020-03-27 23:00:54 +00:00
include Rename SkColorTypeComponentFlags to SkColorChannelFlags. 2020-03-27 21:48:41 +00:00
infra Rename GrGpuTessellationPathRenderer to GrTessellationPathRenderer 2020-03-27 17:37:23 +00:00
modules Remove deprecated functions 2020-03-27 17:13:58 +00:00
platform_tools Reland "GrGLMakeNativeInterface_{iOS,mac,win}: clean up" 2020-01-08 16:55:43 +00:00
resources move ducky images into images 2020-03-25 12:19:56 +00:00
samplecode [skottie] Cleanup: relocate Animator base class out of SkSG 2020-03-26 20:50:10 +00:00
site Remove deprecated functions 2020-03-27 17:13:58 +00:00
specs [img-decode] Start on proposed new spec 2019-05-06 17:39:19 +00:00
src skvm::Builder friendliness improvements 2020-03-28 12:42:04 +00:00
tests Fix gcc 9 warnings. 2020-03-27 23:00:54 +00:00
third_party Roll skia/third_party/skcms cbf3b9df1ae1..bd0abcd0646a (1 commits) 2020-03-24 18:03:33 +00:00
tools Rename GrGpuTessellationPathRenderer to GrTessellationPathRenderer 2020-03-27 17:37:23 +00:00
.clang-format Disable BinPackParameters in .clang-format 2020-03-27 14:32:40 +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 Optimize SkSL xor where one argument is constant 2019-12-20 14:50:46 +00:00
BUILD.gn Add experimental support for svg text tag. 2020-03-27 13:56:49 +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/swiftshader 02e15b249b12..3ca41df3d3ba (10 commits) 2020-03-27 19:14:58 +00:00
go.mod Update Go Deps 2020-03-28 05:35:36 +00:00
go.sum Update Go Deps 2020-03-28 05:35:36 +00:00
LICENSE LICENSE file: clean up 2019-11-22 21:59:03 +00:00
OWNERS add OWNERS file 2017-12-01 19:50:19 +00:00
PRESUBMIT.py [Tree Status] Update all references in Skia repo to tree-status 2020-03-02 18:43:49 +00:00
public.bzl [skottie] Cleanup: split animators into separate CUs 2020-03-17 15:48:17 +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
RELEASE_NOTES.txt remove localmatrix parameter from Blend and Lerp compose shaders 2020-03-25 17:56:26 +00:00
whitespace.txt Whitespace change to re-trigger Mac/iOS tests 2020-02-23 20:55:01 +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.